Skip to content

Commit 9891f88

Browse files
committed
v1.1.1
1 parent 62a4f12 commit 9891f88

File tree

6 files changed

+168
-17
lines changed

6 files changed

+168
-17
lines changed

deps/release/reshade

Submodule reshade updated 277 files

src/ReShade_advancedfx.vcxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,5 +125,11 @@
125125
<ItemGroup>
126126
<ClCompile Include="main.cpp" />
127127
</ItemGroup>
128+
<ItemGroup>
129+
<ClInclude Include="resource.h" />
130+
</ItemGroup>
131+
<ItemGroup>
132+
<ResourceCompile Include="Resource.rc" />
133+
</ItemGroup>
128134
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
129135
</Project>

src/Resource.aps

2.59 KB
Binary file not shown.

src/Resource.rc

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
// Microsoft Visual C++ generated resource script.
2+
//
3+
#include "resource.h"
4+
5+
#define APSTUDIO_READONLY_SYMBOLS
6+
/////////////////////////////////////////////////////////////////////////////
7+
//
8+
// Generated from the TEXTINCLUDE 2 resource.
9+
//
10+
#include "winres.h"
11+
12+
/////////////////////////////////////////////////////////////////////////////
13+
#undef APSTUDIO_READONLY_SYMBOLS
14+
15+
/////////////////////////////////////////////////////////////////////////////
16+
// Deutsch (Deutschland) resources
17+
18+
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
19+
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
20+
#pragma code_page(1252)
21+
22+
#ifdef APSTUDIO_INVOKED
23+
/////////////////////////////////////////////////////////////////////////////
24+
//
25+
// TEXTINCLUDE
26+
//
27+
28+
1 TEXTINCLUDE
29+
BEGIN
30+
"resource.h\0"
31+
END
32+
33+
2 TEXTINCLUDE
34+
BEGIN
35+
"#include ""winres.h""\r\n"
36+
"\0"
37+
END
38+
39+
3 TEXTINCLUDE
40+
BEGIN
41+
"\r\n"
42+
"\0"
43+
END
44+
45+
#endif // APSTUDIO_INVOKED
46+
47+
48+
/////////////////////////////////////////////////////////////////////////////
49+
//
50+
// Version
51+
//
52+
53+
VS_VERSION_INFO VERSIONINFO
54+
FILEVERSION 1,1,1,0
55+
PRODUCTVERSION 1,1,1,0
56+
FILEFLAGSMASK 0x3fL
57+
#ifdef _DEBUG
58+
FILEFLAGS 0x1L
59+
#else
60+
FILEFLAGS 0x0L
61+
#endif
62+
FILEOS 0x40004L
63+
FILETYPE 0x2L
64+
FILESUBTYPE 0x0L
65+
BEGIN
66+
BLOCK "StringFileInfo"
67+
BEGIN
68+
BLOCK "040004b0"
69+
BEGIN
70+
VALUE "CompanyName", "advancedfx.org"
71+
VALUE "FileDescription", "ReShade advancedfx addon"
72+
VALUE "FileVersion", "1.1.1.0"
73+
VALUE "InternalName", "ReShade_advancedfx.addon"
74+
VALUE "LegalCopyright", "Copyright (C) 2022"
75+
VALUE "OriginalFilename", "ReShade_advancedfx.addon"
76+
VALUE "ProductName", "ReShade_advancedfx"
77+
VALUE "ProductVersion", "1.1.1.0"
78+
END
79+
END
80+
BLOCK "VarFileInfo"
81+
BEGIN
82+
VALUE "Translation", 0x400, 1200
83+
END
84+
END
85+
86+
#endif // Deutsch (Deutschland) resources
87+
/////////////////////////////////////////////////////////////////////////////
88+
89+
90+
91+
#ifndef APSTUDIO_INVOKED
92+
/////////////////////////////////////////////////////////////////////////////
93+
//
94+
// Generated from the TEXTINCLUDE 3 resource.
95+
//
96+
97+
98+
/////////////////////////////////////////////////////////////////////////////
99+
#endif // not APSTUDIO_INVOKED
100+

src/main.cpp

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
#include <imgui.h>
44
#include <reshade.hpp>
55
#include <vector>
6+
#include <queue>
67

78
using namespace reshade::api;
89

910
struct __declspec(uuid("745350f4-bd58-479b-8ad0-81e872a9952b")) device_data
1011
{
1112
effect_runtime *main_runtime = nullptr;
1213

14+
bool block_effects = true;
15+
1316
bool _hasBackBuffer = false;
1417
resource_desc _back_buffer_desc;
1518
uint32_t _width;
@@ -19,6 +22,7 @@ struct __declspec(uuid("745350f4-bd58-479b-8ad0-81e872a9952b")) device_data
1922
resource _back_buffer_resolved = { 0 };
2023
resource_view _back_buffer_resolved_srv = { 0 };
2124
std::vector<resource_view> _back_buffer_targets;
25+
std::queue<effect_technique> _disabled_techniques;
2226

2327
resource depth_texture = { 0 };
2428
resource_view depth_texture_view = { 0 };
@@ -53,6 +57,22 @@ struct __declspec(uuid("745350f4-bd58-479b-8ad0-81e872a9952b")) device_data
5357
});
5458
}
5559

60+
void disable_techniques() {
61+
main_runtime->enumerate_techniques(nullptr, [this](effect_runtime* runtime, auto technique) {
62+
if (runtime->get_technique_state(technique)) {
63+
_disabled_techniques.push(technique);
64+
runtime->set_technique_state(technique, false);
65+
}
66+
});
67+
}
68+
69+
void reenable_techniques() {
70+
while (!_disabled_techniques.empty()) {
71+
main_runtime->set_technique_state(_disabled_techniques.front(), true);
72+
_disabled_techniques.pop();
73+
}
74+
}
75+
5676
void free_buffer_resources() {
5777
if (main_runtime == 0)
5878
return;
@@ -233,6 +253,11 @@ bool supply_depth(void* pDepthTextureResource) {
233253

234254
extern "C" bool __declspec(dllexport) AdvancedfxRenderEffects(void* pRenderTargetView, void * pDepthTextureResource) {
235255

256+
if (pRenderTargetView == 0) {
257+
// HLAE wants us to render no effects.
258+
return true;
259+
}
260+
236261
if (g_MainCommandList == 0)
237262
return false;
238263

@@ -242,12 +267,6 @@ extern "C" bool __declspec(dllexport) AdvancedfxRenderEffects(void* pRenderTarge
242267
if (dev_data.main_runtime == 0)
243268
return false;
244269

245-
if (pRenderTargetView == 0) {
246-
// HLAE wants us to render no effects.
247-
dev_data.main_runtime->render_effects(g_MainCommandList, resource_view{ 0 });
248-
return true;
249-
}
250-
251270
resource back_buffer_resource{ (uint64_t)pRenderTargetView };
252271

253272
if (!dev_data.ensure_buffers(back_buffer_resource))
@@ -274,12 +293,16 @@ extern "C" bool __declspec(dllexport) AdvancedfxRenderEffects(void* pRenderTarge
274293

275294
if (dev_data._back_buffer_resolved != 0)
276295
{
296+
dev_data.block_effects = false;
277297
dev_data.main_runtime->render_effects(g_MainCommandList, dev_data._back_buffer_targets[0], dev_data._back_buffer_targets[1]);
298+
dev_data.block_effects = true;
278299
}
279300
else
280301
{
281302
g_MainCommandList->barrier(back_buffer_resource, resource_usage::present, resource_usage::render_target);
303+
dev_data.block_effects = false;
282304
dev_data.main_runtime->render_effects(g_MainCommandList, dev_data._back_buffer_targets[0], dev_data._back_buffer_targets[1]);
305+
dev_data.block_effects = true;
283306
g_MainCommandList->barrier(back_buffer_resource, resource_usage::render_target, resource_usage::present);
284307
}
285308

@@ -336,19 +359,26 @@ static void on_destroy_effect_runtime(effect_runtime *runtime)
336359
}
337360
}
338361

339-
static void on_draw_settings(effect_runtime *runtime)
362+
static void on_begin_render_effects(effect_runtime* runtime, command_list* cmd_list, resource_view, resource_view)
340363
{
341-
device *const device = runtime->get_device();
342-
auto &dev_data = device->get_private_data<device_data>();
364+
if (g_MainCommandList == 0)
365+
return;
343366

344-
if (runtime != dev_data.main_runtime)
345-
{
346-
ImGui::TextUnformatted("This is not the main effect runtime.");
367+
device* const device = g_MainCommandList->get_device();
368+
auto& dev_data = device->get_private_data<device_data>();
369+
370+
if (dev_data.block_effects) dev_data.disable_techniques();
371+
}
372+
373+
static void on_finish_render_effects(effect_runtime* runtime, command_list* cmd_list, resource_view, resource_view)
374+
{
375+
if (g_MainCommandList == 0)
347376
return;
348-
}
349377

350-
ImGui::TextUnformatted("v1.1.0");
351-
ImGui::TextUnformatted("There are no settings currently.");
378+
device* const device = g_MainCommandList->get_device();
379+
auto& dev_data = device->get_private_data<device_data>();
380+
381+
if (dev_data.block_effects) dev_data.reenable_techniques();
352382
}
353383

354384
BOOL APIENTRY DllMain(HMODULE hModule, DWORD fdwReason, LPVOID)
@@ -364,7 +394,8 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD fdwReason, LPVOID)
364394
reshade::register_event<reshade::addon_event::destroy_command_list>(on_destroy_command_list);
365395
reshade::register_event<reshade::addon_event::init_effect_runtime>(on_init_effect_runtime);
366396
reshade::register_event<reshade::addon_event::destroy_effect_runtime>(on_destroy_effect_runtime);
367-
reshade::register_overlay(nullptr, on_draw_settings);
397+
reshade::register_event<reshade::addon_event::reshade_begin_effects>(on_begin_render_effects);
398+
reshade::register_event<reshade::addon_event::reshade_finish_effects>(on_finish_render_effects);
368399

369400
// Need to set texture binding again after reloading
370401
reshade::register_event<reshade::addon_event::reshade_reloaded_effects>(update_effect_runtime);

src/resource.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//{{NO_DEPENDENCIES}}
2+
// Microsoft Visual C++ generated include file.
3+
// Used by Resource.rc
4+
5+
// Nächste Standardwerte für neue Objekte
6+
//
7+
#ifdef APSTUDIO_INVOKED
8+
#ifndef APSTUDIO_READONLY_SYMBOLS
9+
#define _APS_NEXT_RESOURCE_VALUE 101
10+
#define _APS_NEXT_COMMAND_VALUE 40001
11+
#define _APS_NEXT_CONTROL_VALUE 1001
12+
#define _APS_NEXT_SYMED_VALUE 101
13+
#endif
14+
#endif

0 commit comments

Comments
 (0)