1
+ /*
2
+ * Copyright (C) 2024 Musa Haji
3
+ * Copyright (C) 2024 Carlos Lopez
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+
7
+ #define ImTextureID ImU64
8
+
9
+ #define DEBUG_LEVEL_0
10
+ #define DEBUG_SLIDERS_OFF
11
+
12
+ #include < deps/imgui/imgui.h>
13
+
14
+ #include < embed/0x24182048.h> // Color Grading - main menu & prologue
15
+ #include < embed/0x73E7A34D.h> // Color Grading - main menu & prologue - sharpening low
16
+ #include < embed/0xD7BC63A1.h> // Color Grading - level 1: Inkwater Marsh
17
+
18
+ // additional color grading shaders done in batch
19
+ #include < embed/0x063548F6.h>
20
+ #include < embed/0x0BE6093C.h>
21
+ #include < embed/0x0E0EE842.h>
22
+ #include < embed/0x1A46FADC.h>
23
+ #include < embed/0x1E8FDB7D.h>
24
+ #include < embed/0x211F3245.h>
25
+ #include < embed/0x28B10677.h>
26
+ #include < embed/0x2CEC407A.h>
27
+ #include < embed/0x34F7E01C.h>
28
+ #include < embed/0x350163E1.h>
29
+ #include < embed/0x37E6CB72.h>
30
+ #include < embed/0x3F118009.h>
31
+ #include < embed/0x3FDCF7AA.h>
32
+ #include < embed/0x48CDE62E.h>
33
+ #include < embed/0x4A3D4181.h>
34
+ #include < embed/0x596B9BD3.h>
35
+ #include < embed/0x5B0965E4.h>
36
+ #include < embed/0x5CDE4A30.h>
37
+ #include < embed/0x613B5403.h>
38
+ #include < embed/0x62C79AA3.h>
39
+ #include < embed/0x649A0B90.h>
40
+ #include < embed/0x7C14BB2C.h>
41
+ #include < embed/0x841FAF0A.h>
42
+ #include < embed/0x84C7D93E.h>
43
+ #include < embed/0x8A303253.h>
44
+ #include < embed/0x8B1DE268.h>
45
+ #include < embed/0x8D6097D1.h>
46
+ #include < embed/0x8D6C34A5.h>
47
+ #include < embed/0x8EC5798A.h>
48
+ #include < embed/0x9AC0DEEF.h>
49
+ #include < embed/0x9B5CC768.h>
50
+ #include < embed/0x9DA86DCE.h>
51
+ #include < embed/0xA6488EB2.h>
52
+ #include < embed/0xABD8D6B7.h>
53
+ #include < embed/0xB24C1A54.h>
54
+ #include < embed/0xB270CA5B.h>
55
+ #include < embed/0xC4128983.h>
56
+ #include < embed/0xD9B57ECB.h>
57
+ #include < embed/0xDB90C883.h>
58
+ #include < embed/0xDE975B11.h>
59
+ #include < embed/0xE3F6E54F.h>
60
+ #include < embed/0xF017475F.h>
61
+ #include < embed/0xF3917C63.h>
62
+ #include < embed/0xF7933F3F.h>
63
+ #include < embed/0xFCF0717A.h>
64
+
65
+ #include < embed/0x9D323EA3.h> // Inverse tonemap, garbage default hdr implementation
66
+ #include < embed/0xF9C2BDE1.h> // DICE, final bt2020 conversion, paper white, and pq encode
67
+
68
+ #include < include/reshade.hpp>
69
+ #include " ../../mods/shader.hpp"
70
+ #include " ../../utils/settings.hpp"
71
+ #include " ./shared.h"
72
+
73
+ namespace {
74
+
75
+ renodx::mods::shader::CustomShaders custom_shaders = {
76
+ CustomShaderEntry (0x24182048 ), // Color Grading - main menu & prologue
77
+ CustomShaderEntry (0x73E7A34D ), // Color Grading - main menu & prologue - sharpening low
78
+ CustomShaderEntry (0xD7BC63A1 ), // Color Grading - level 1
79
+
80
+ // additional color grading shaders done in batch
81
+ CustomShaderEntry (0x063548F6 ),
82
+ CustomShaderEntry (0x0BE6093C ),
83
+ CustomShaderEntry (0x0E0EE842 ),
84
+ CustomShaderEntry (0x1A46FADC ),
85
+ CustomShaderEntry (0x1E8FDB7D ),
86
+ CustomShaderEntry (0x211F3245 ),
87
+ CustomShaderEntry (0x28B10677 ),
88
+ CustomShaderEntry (0x2CEC407A ),
89
+ CustomShaderEntry (0x34F7E01C ),
90
+ CustomShaderEntry (0x350163E1 ),
91
+ CustomShaderEntry (0x37E6CB72 ),
92
+ CustomShaderEntry (0x3F118009 ),
93
+ CustomShaderEntry (0x3FDCF7AA ),
94
+ CustomShaderEntry (0x48CDE62E ),
95
+ CustomShaderEntry (0x4A3D4181 ),
96
+ CustomShaderEntry (0x596B9BD3 ),
97
+ CustomShaderEntry (0x5B0965E4 ),
98
+ CustomShaderEntry (0x5CDE4A30 ),
99
+ CustomShaderEntry (0x613B5403 ),
100
+ CustomShaderEntry (0x62C79AA3 ),
101
+ CustomShaderEntry (0x649A0B90 ),
102
+ CustomShaderEntry (0x7C14BB2C ),
103
+ CustomShaderEntry (0x841FAF0A ),
104
+ CustomShaderEntry (0x84C7D93E ),
105
+ CustomShaderEntry (0x8A303253 ),
106
+ CustomShaderEntry (0x8B1DE268 ),
107
+ CustomShaderEntry (0x8D6097D1 ),
108
+ CustomShaderEntry (0x8D6C34A5 ),
109
+ CustomShaderEntry (0x8EC5798A ),
110
+ CustomShaderEntry (0x9AC0DEEF ),
111
+ CustomShaderEntry (0x9B5CC768 ),
112
+ CustomShaderEntry (0x9DA86DCE ),
113
+ CustomShaderEntry (0xA6488EB2 ),
114
+ CustomShaderEntry (0xABD8D6B7 ),
115
+ CustomShaderEntry (0xB24C1A54 ),
116
+ CustomShaderEntry (0xB270CA5B ),
117
+ CustomShaderEntry (0xC4128983 ),
118
+ CustomShaderEntry (0xD9B57ECB ),
119
+ CustomShaderEntry (0xDB90C883 ),
120
+ CustomShaderEntry (0xDE975B11 ),
121
+ CustomShaderEntry (0xE3F6E54F ),
122
+ CustomShaderEntry (0xF017475F ),
123
+ CustomShaderEntry (0xF3917C63 ),
124
+ CustomShaderEntry (0xF7933F3F ),
125
+ CustomShaderEntry (0xFCF0717A ),
126
+
127
+ CustomShaderEntry (0x9D323EA3 ), // Inverse tonemap, garbage default hdr implementation
128
+ CustomShaderEntry (0xF9C2BDE1 ), // DICE, final bt2020 conversion, paper white, and pq encode
129
+ };
130
+
131
+ ShaderInjectData shader_injection;
132
+
133
+ renodx::utils::settings::Settings settings = {
134
+ new renodx::utils::settings::Setting{
135
+ .key = " toneMapType" ,
136
+ .binding = &shader_injection.toneMapType ,
137
+ .value_type = renodx::utils::settings::SettingValueType::INTEGER,
138
+ .default_value = 2 .f ,
139
+ .can_reset = false ,
140
+ .label = " Tone Mapper" ,
141
+ .section = " Tone Mapping" ,
142
+ .tooltip = " Sets the tone mapper type" ,
143
+ .labels = {" Vanilla (Fake HDR)" , " None" , " DICE" },
144
+ },
145
+ new renodx::utils::settings::Setting{
146
+ .key = " toneMapPeakNits" ,
147
+ .binding = &shader_injection.toneMapPeakNits ,
148
+ .default_value = 1000 .f ,
149
+ .can_reset = false ,
150
+ .label = " Peak Brightness" ,
151
+ .section = " Tone Mapping" ,
152
+ .tooltip = " Sets the value of peak white in nits" ,
153
+ .min = 48 .f ,
154
+ .max = 4000 .f ,
155
+ },
156
+ new renodx::utils::settings::Setting{
157
+ .key = " toneMapGameNits" ,
158
+ .binding = &shader_injection.toneMapGameNits ,
159
+ .default_value = 203 .f ,
160
+ .can_reset = false ,
161
+ .label = " Game Brightness" ,
162
+ .section = " Tone Mapping" ,
163
+ .tooltip = " Sets the value of 100%% white in nits" ,
164
+ .min = 48 .f ,
165
+ .max = 500 .f ,
166
+ },
167
+ new renodx::utils::settings::Setting{
168
+ .key = " toneMapHueCorrection" ,
169
+ .binding = &shader_injection.toneMapHueCorrection ,
170
+ .default_value = 50 .f ,
171
+ .can_reset = false ,
172
+ .label = " Hue Correction" ,
173
+ .section = " Tone Mapping" ,
174
+ .tooltip = " Emulates hue shifting from the vanilla tonemapper" ,
175
+ .max = 100 .f ,
176
+ .is_enabled = []() { return shader_injection.toneMapType != 0 ; },
177
+ .parse = [](float value) { return value * 0 .01f ; },
178
+ },
179
+ new renodx::utils::settings::Setting{
180
+ .key = " colorGradeStrength" ,
181
+ .binding = &shader_injection.colorGradeStrength ,
182
+ .default_value = 100 .f ,
183
+ .label = " Color Grade Strength" ,
184
+ .section = " Color Grading" ,
185
+ .max = 100 .f ,
186
+ .parse = [](float value) { return value * 0 .01f ; },
187
+ },
188
+ };
189
+
190
+ void OnPresetOff () {
191
+ renodx::utils::settings::UpdateSetting (" toneMapType" , 0 );
192
+ renodx::utils::settings::UpdateSetting (" toneMapPeakNits" , 1000 .f );
193
+ renodx::utils::settings::UpdateSetting (" toneMapGameNits" , 203 .f );
194
+ renodx::utils::settings::UpdateSetting (" toneMapGammaCorrection" , 1 .f );
195
+ renodx::utils::settings::UpdateSetting (" colorGradeExposure" , 1 .f );
196
+ renodx::utils::settings::UpdateSetting (" colorGradeHighlights" , 50 .f );
197
+ renodx::utils::settings::UpdateSetting (" colorGradeShadows" , 50 .f );
198
+ renodx::utils::settings::UpdateSetting (" colorGradeContrast" , 50 .f );
199
+ renodx::utils::settings::UpdateSetting (" colorGradeSaturation" , 50 .f );
200
+ renodx::utils::settings::UpdateSetting (" colorGradeStrength" , 100 .f );
201
+ }
202
+
203
+ } // namespace
204
+
205
+ // NOLINTBEGIN(readability-identifier-naming)
206
+
207
+ extern " C" __declspec(dllexport) const char * NAME = " RenoDX" ;
208
+ extern " C" __declspec(dllexport) const char * DESCRIPTION = " RenoDX for Ori and the Will of the Wisps" ;
209
+
210
+ // NOLINTEND(readability-identifier-naming)
211
+
212
+ BOOL APIENTRY DllMain (HMODULE h_module, DWORD fdw_reason, LPVOID lpv_reserved) {
213
+ switch (fdw_reason) {
214
+ case DLL_PROCESS_ATTACH:
215
+ renodx::mods::shader::force_pipeline_cloning = true ;
216
+ renodx::mods::shader::expected_constant_buffer_index = 11 ;
217
+
218
+ if (!reshade::register_addon (h_module)) return FALSE ;
219
+
220
+ break ;
221
+ case DLL_PROCESS_DETACH:
222
+ reshade::unregister_addon (h_module);
223
+ break ;
224
+ }
225
+
226
+ renodx::utils::settings::Use (fdw_reason, &settings, &OnPresetOff);
227
+
228
+ renodx::mods::shader::Use (fdw_reason, custom_shaders, &shader_injection);
229
+
230
+ return TRUE ;
231
+ }
0 commit comments