DXGL r718 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r717‎ | r718 | r719 >
Date:06:46, 7 July 2017
Author:admin
Status:new
Tags:
Comment:
Create example .ini file.
Rename first scale filter and size to postprocess internally.
Modified paths:
  • /cfgmgr/ReadMe.txt (modified) (history)
  • /cfgmgr/cfgmgr.c (modified) (history)
  • /cfgmgr/cfgmgr.h (modified) (history)
  • /ddraw/glDirectDraw.cpp (modified) (history)
  • /ddraw/glDirectDrawSurface.cpp (modified) (history)
  • /ddraw/glRenderer.cpp (modified) (history)
  • /ddraw/glRenderer.h (modified) (history)
  • /ddraw/trace.c (modified) (history)
  • /dxgl-example.ini (added) (history)
  • /dxglcfg/dxglcfg.c (modified) (history)
  • /dxglcfg2/dxglcfg2.c (modified) (history)

Diff [purge]

Index: cfgmgr/ReadMe.txt
@@ -1,5 +1,8 @@
22 Struct DXGLCFG
 3+
34 Member scaler
 5+INI Entry ScalingMode
 6+INI Group display
47 REG_DWORD HKCU\DXGL\Profiles\<app>\ScalingMode
58 Determines the method of scaling full screen modes.
69 Valid settings:
@@ -13,6 +16,8 @@
1417 7 - Crop output to desktop, preserving aspect ratio
1518
1619 Member fullmode
 20+INI Entry FullscreenWindowMode
 21+INI Group display
1722 REG_DWORD HKCU\DXGL\Profiles\<app>\FullscreenWindowMode
1823 Determines how to handle fullscreen modes.
1924 Valid settings:
@@ -23,32 +28,63 @@
2429 4 - Use a borderless, non-resizable window, called windowed borderless in industry
2530
2631 Member colormode
 32+INI Entry ChangeColorDepth
 33+INI Group display
2734 REG_DWORD HKCU\DXGL\Profiles\<app>\ChangeColorDepth
2835 If nonzero, switches screen color depth if requested by the application.
2936 Recommended setting is off. DXGL handles color depth conversion internally.
3037
31 -Member firstscalefilter
32 -REG_DWORD HKCU\DXGL\Profiles\<app>\FirstScaleFilter
33 -Filter to use for the optional first pass display scaling.
 38+Member AllColorDepths
 39+REG_DWORD HKCU\DXGL\Profiles\<app>\AllColorDepths
 40+[DEPRECATED FOR DXGLCFG2]Enable all color depths, even if unsupported by the system
3441 Valid settings:
35 -0 - Nearest-neighbor stretching
36 -1 - Bilinear interpolation
 42+0 - Off
 43+1 - On
3744
38 -Member firstscalex
39 -REG_DWORD HKCU\DXGL\Profiles\<app>\FirstScaleX
40 -Amount to stretch the display in the X direction for the first pass.
41 -If either X or Y is set to 0 or less than 0.25, automatically choose
42 -2x, 2x1, or 1x2 scaling for certain low resolutions.
43 -Stored as a 32-bit float encoded as a DWORD.
 45+Member AddColorDepths
 46+REG_DWORD HKCU\DXGL\Profiles\<app>\AddColorDepths
 47+Adds color depths, even if unsupported by the system
 48+Bit-mapped variable
 49+Valid settings, OR'ed to combine settings:
 50+0 - None
 51+1 - Add 8-bit modes
 52+2 - Add 15-bit modes
 53+4 - Add 16-bit modes
 54+8 - Add 24-bit modes
 55+16 - Add 32-bit modes
4456
45 -Member firstscaley
46 -REG_DWORD HKCU\DXGL\Profiles\<app>\FirstScaley
47 -Amount to stretch the display in the Y direction for the first pass.
48 -If either X or Y is set to 0 or less than 0.25, automatically choose
49 -2x, 2x1, or 1x2 scaling for certain low resolutions.
50 -Stored as a 32-bit float encoded as a DWORD.
 57+Member ExtraModes
 58+REG_DWORD HKCU\DXGL\Profiles\<app>\ExtraModes
 59+[DEPRECATED FOR DXGLCFG2]Enable extra video modes, even if unsupported by the system
 60+Valid settings:
 61+0 - Off
 62+1 - On
5163
 64+member AddModes
 65+REG_DWORD HKCU\DXGL\Profiles\<app>\AddModes
 66+Adds additional video modes, even if unsupported by the system
 67+Bit-mapped variable
 68+Valid settings, OR'ed to combine settings:
 69+0 - None
 70+1 - Add common low-resolution modes
 71+2 - Add less common low-resolution modes
 72+4 - Add uncommon standard definition modes
 73+8 - Add high definition modes
 74+16 - Add QHD to UHD modes.
 75+32 - Add over-4K UHD modes. Check GPU specifications before enabling.
 76+64 - Add very uncommon resolutions of all dimensions.
 77+
 78+Member SortModes
 79+REG_DWORD HKCU\DXGL\Profiles\<app>\SortModes
 80+Sort display modes
 81+Valid settings:
 82+0 - As reported by system
 83+1 - Group by depth
 84+2 - Group by resolution
 85+
5286 Member scalingfilter
 87+INI Entry ScalingFilter
 88+INI Group scaling
5389 REG_DWORD HKCU\DXGL\Profiles\<app>\ScalingFilter
5490 Filter to use for stretched 2D blits and the final display scaling.
5591 Valid settings:
@@ -56,6 +92,8 @@
5793 1 - Bilinear interpolation
5894
5995 Member primaryscale
 96+INI Entry AdjustPrimaryResolution
 97+INI Group scaling
6098 REG_DWORD HKCU\DXGL\Profiles\<app>\AdjustPrimaryResolution
6199 Changes primary resolution to match desktop resolution.
62100 May cause glitches
@@ -62,6 +100,7 @@
63101 Valid settings:
64102 0 - Use native primary surface size. Most compatible.
65103 1 - Adjust primary surface size to match display.
 104+(future)
66105 2 - Adjust primary surface to nearest integer multiple of native.
67106 3 - Use exact 1.5x scale.
68107 4 - Use exact 2x scale.
@@ -70,19 +109,90 @@
71110 7 - Use exact 4x scale.
72111 8 - Use custom scale.
73112
 113+(future)
74114 Member primaryscalex
 115+INI Entry PrimaryScaleX
 116+INI Group scaling
75117 REG_DWORD HKCU\DXGL\Profiles\<app>\PrimaryScaleX
76118 Custom X scale for primary scaling.
77119 Stored as a 32-bit float encoded as a DWORD.
78120 If zero, negative, or an invalid value, set to 1.
79121
 122+(future)
80123 Member primaryscaley
 124+INI Entry PrimaryScaleY
 125+INI Group scaling
81126 REG_DWORD HKCU\DXGL\Profiles\<app>\PrimaryScaleY
82127 Custom X scale for primary scaling.
83128 Stored as a 32-bit float encoded as a DWORD.
84129 If zero, negative, or an invalid value, set to 1.
85130
 131+Member aspect
 132+INI Entry ScreenAspect
 133+INI Group scaling
 134+REG_DWORD HKCU\DXGL\Profiles\<app>\ScreenAspect
 135+Screen aspect ratio to simulate, if the scaler is 1 or 5.
 136+Stored as a 32-bit float encoded as a DWORD.
 137+If zero, negative, or an invalid value, use automatic ratio based on square pixels.
 138+Positive values indicate a specific screen aspect ratio.
 139+
 140+Member DPIScale
 141+INI Entry DPIScale
 142+INI Group scaling
 143+REG_DWORD HKCU\DXGL\Profiles\<app>\DPIScale
 144+Enable DPI scaling fix
 145+The program may be restarted if the Windows AppCompat method is enabled or
 146+disabled.
 147+Valid settings:
 148+0 - Disabled
 149+1 - Enabled
 150+2 - Use Windows AppCompat
 151+
 152+Member postfilter
 153+INI Entry PostprocessFilter
 154+INI Group postprocess
 155+REG_DWORD HKCU\DXGL\Profiles\<app>\PostprocessFilter
 156+Alternately reads from REG_DWORD HKCU\DXGL\Profiles\<app>\FirstScaleFilter
 157+Filter to use for the optional postprocess display scaling.
 158+Valid settings:
 159+0 - Nearest-neighbor stretching
 160+1 - Bilinear interpolation
 161+
 162+Member postsizex
 163+INI Entry PostprocessScaleX
 164+INI Group postprocess
 165+REG_DWORD HKCU\DXGL\Profiles\<app>\PostprocessScaleX
 166+Alternately reads from REG_DWORD HKCU\DXGL\Profiles\<app>\FirstScaleX
 167+Amount to stretch the display in the X direction for the postprocess pass.
 168+If either X or Y is set to 0 or less than 0.25, automatically choose
 169+2x, 2x1, or 1x2 scaling for certain low resolutions.
 170+Stored as a 32-bit float encoded as a DWORD.
 171+
 172+Member postsizey
 173+INI Entry PostprocessScaleY
 174+INI Group postprocess
 175+REG_DWORD HKCU\DXGL\Profiles\<app>\PostprocessScaleY
 176+Alternately reads from REG_DWORD HKCU\DXGL\Profiles\<app>\FirstScaleY
 177+Amount to stretch the display in the Y direction for the postprocess pass.
 178+If either X or Y is set to 0 or less than 0.25, automatically choose
 179+2x, 2x1, or 1x2 scaling for certain low resolutions.
 180+Stored as a 32-bit float encoded as a DWORD.
 181+
 182+Member EnableShader
 183+INI Entry EnableShader
 184+INI Group postprocess
 185+REG_DWORD HKCU\DXGL\Profiles\<app>\EnableShader
 186+If nonzero, enables post-process shaders.
 187+
 188+Member shaderfile
 189+INI Entry ShaderFile
 190+INI Group postprocess
 191+REG_SZ HKCU\DXGL\Profiles\<app>\ShaderFile
 192+Full path to file containing a post-process shader script.
 193+
86194 Member texfilter
 195+INI Entry TextureFilter
 196+INI Group d3d
87197 REG_DWORD HKCU\DXGL\Profiles\<app>\TextureFilter
88198 Filter for 3D textured polygons
89199 Valid settings:
@@ -95,6 +205,8 @@
96206 6 - GL_LINEAR_MIPMAP_LINEAR (Trilinear filtering)
97207
98208 Member anisotropic
 209+INI Entry AnisotropicFiltering
 210+INI Group d3d
99211 REG_DWORD HKCU\DXGL\Profiles\<app>\AnisotropicFiltering
100212 Anisotropic filter level, may decrese performance on slower GPUs.
101213 Valid settings:
@@ -103,6 +215,8 @@
104216 Larger numbers enable anisotropic filtering, maximum determined by GPU driver.
105217
106218 member msaa
 219+INI Entry Antialiasing
 220+INI Group d3d
107221 REG_DWORD HKCU\DXGL\Profiles\<app>\Antialiasing
108222 Level of Full Screen Antialiasing. May considerably decrease performance on
109223 slower GPUs.
@@ -115,7 +229,10 @@
116230 Example: 16 coverage, 8 color = 0x8010
117231
118232 Member aspect3d
119 -REG_DWORD HKCU\DXGL\Profiles\<app>\AdjustAspectRatio
 233+INI Entry D3DAspect
 234+INI Group d3d
 235+REG_DWORD HKCU\DXGL\Profiles\<app>\D3DAspect
 236+Altrenately reads from REG_DWORD HKCU\DXGL\Profiles\<app>\AdjustAspectRatio
120237 If the scaler is 1 or 4, adjust 3D projection to correct aspect ratio. Does
121238 not affect 2D blits or similar operations.
122239 Valid settings:
@@ -123,59 +240,9 @@
124241 1 - Expand viewable area. May have glitches on edge of screen.
125242 2 - Crop to viewable area. May cause graphics to get cut off.
126243
127 -Member EnableShader
128 -REG_DWORD HKCU\DXGL\Profiles\<app>\EnableShader
129 -If nonzero, enables post-process shaders.
130 -
131 -Member shaderfile
132 -REG_SZ HKCU\DXGL\Profiles\<app>\ShaderFile
133 -Full path to file containing a post-process shader script.
134 -
135 -Member SortModes
136 -REG_DWORD HKCU\DXGL\Profiles\<app>\SortModes
137 -Sort display modes
138 -Valid settings:
139 -0 - As reported by system
140 -1 - Group by depth
141 -2 - Group by resolution
142 -
143 -Member AllColorDepths
144 -REG_DWORD HKCU\DXGL\Profiles\<app>\AllColorDepths
145 -[DEPRECATED]Enable all color depths, even if unsupported by the system
146 -Valid settings:
147 -0 - Off
148 -1 - On
149 -
150 -Member AddColorDepths
151 -REG_DWORD HKCU\DXGL\Profiles\<app>\AddColorDepths
152 -Adds color depths, even if unsupported by the system
153 -Bit-mapped variable
154 -Valid settings, OR'ed to combine settings:
155 -0 - None
156 -1 - Add 8-bit modes
157 -2 - Add 15-bit modes
158 -4 - Add 16-bit modes
159 -8 - Add 24-bit modes
160 -16 - Add 32-bit modes
161 -
162 -Member ExtraModes
163 -REG_DWORD HKCU\DXGL\Profiles\<app>\ExtraModes
164 -[DEPRECATED]Enable extra video modes, even if unsupported by the system
165 -Valid settings:
166 -0 - Off
167 -1 - On
168 -
169 -member AddModes
170 -REG_DWORD HKCU\DXGL\Profiles\<app>\AddModes
171 -Adds additional video modes, even if unsupported by the system
172 -Bit-mapped variable
173 -Valid settings, OR'ed to combine settings:
174 -0 - None
175 -1 - Add common low-resolution modes
176 -2 - Add less common low-resolution modes
177 -4 - Add higher resolution modes
178 -
179244 Member vsync
 245+INI Entry VSync
 246+INI Group advanced
180247 REG_DWORD HKCU\DXGL\Profiles\<app>\VSync
181248 Vertical retrace control
182249 Valid settings:
@@ -182,6 +249,8 @@
183250 0 - Determined by application
184251
185252 Member TextureFormat
 253+INI Entry TextureFormat
 254+INI Group advanced
186255 REG_DWORD HKCU\DXGL\Profiles\<app>\TextureFormat
187256 Texture format
188257 Valid settings:
@@ -188,32 +257,18 @@
189258 0 - Automatic
190259
191260 Member TexUpload
 261+INI Entry TexUpload
 262+INI Group advanced
192263 REG_DWORD HKCU\DXGL\Profiles\<app>\TexUpload
193264 Method used to upload textures
194265 Valid settings:
195266 0 - Automatic
196 -1 - OpenGL Standard
197267
198 -Member DPIScale
199 -REG_DWORD HKCU\DXGL\Profiles\<app>\DPIScale
200 -Enable DPI scaling fix
201 -The program may be restarted if the Windows AppCompat method is enabled or
202 -disabled.
203 -Valid settings:
204 -0 - Disabled
205 -1 - Enabled
206 -2 - Use Windows AppCompat
207 -
208 -Member aspect
209 -REG_DWORD HKCU\DXGL\Profiles\<app>\ScreenAspect
210 -Screen aspect ratio to simulate, if the scaler is 1 or 5.
211 -Stored as a 32-bit float encoded as a DWORD.
212 -If zero, negative, or an invalid value, use automatic ratio based on square pixels.
213 -Positive values indicate a specific screen aspect ratio.
214 -
215268 Member Windows8Detected
 269+Not in INI file
216270 REG_DWORD HKCU\DXGL\Global\Windows8Detected
217271 Nonzero if Windows 8 (or later) is detected.
218272 If zero or undefined and Windows 8 (or later) is detected, AllColorDepths in
219273 Global key is set to 1 and Windows8Detected is also set to 1.
220 -If nonzero, AllColorDepths is not affected.
\ No newline at end of file
 274+If nonzero, AllColorDepths is not affected.
 275+
Index: cfgmgr/cfgmgr.c
@@ -31,6 +31,7 @@
3232 #include "../ddraw/resource.h"
3333 #include <tchar.h>
3434 #include <math.h>
 35+#include <stdarg.h>
3536
3637 TCHAR regkeyglobal[] = _T("Software\\DXGL\\Global");
3738 TCHAR regkeybase[] = _T("Software\\DXGL\\");
@@ -397,6 +398,42 @@
398399 }
399400 }
400401
 402+DWORD ReadDWORDWithObsolete(HKEY hKey, DWORD original, DWORD *mask, LPCTSTR value,
 403+ unsigned int obsolete_count, ...) // obsolete items are LPCTSTRs
 404+{
 405+ LPCTSTR obsolete;
 406+ va_list va;
 407+ int i;
 408+ DWORD dwOut;
 409+ DWORD sizeout = 4;
 410+ DWORD regdword = REG_DWORD;
 411+ LSTATUS error = RegQueryValueEx(hKey, value, NULL, &regdword, (LPBYTE)&dwOut, &sizeout);
 412+ if (error == ERROR_SUCCESS)
 413+ {
 414+ *mask = 1;
 415+ return dwOut;
 416+ }
 417+ else
 418+ {
 419+ va_start(va, obsolete_count);
 420+ for (i = 0; i < obsolete_count; i++)
 421+ {
 422+ regdword = REG_DWORD;
 423+ obsolete = va_arg(va, LPCTSTR);
 424+ error = RegQueryValueEx(hKey, obsolete, NULL, &regdword, (LPBYTE)&dwOut, &sizeout);
 425+ if (error == ERROR_SUCCESS)
 426+ {
 427+ *mask = 1;
 428+ va_end(va);
 429+ return dwOut;
 430+ }
 431+ }
 432+ *mask = 0;
 433+ va_end(va);
 434+ return original;
 435+ }
 436+}
 437+
401438 DWORD ReadDWORD(HKEY hKey, DWORD original, DWORD *mask, LPCTSTR value)
402439 {
403440 DWORD dwOut;
@@ -415,6 +452,42 @@
416453 }
417454 }
418455
 456+float ReadFloatWithObsolete(HKEY hKey, float original, float *mask, LPCTSTR value,
 457+ unsigned int obsolete_count, ...) // obsolete items are LPCTSTRs
 458+{
 459+ LPCTSTR obsolete;
 460+ va_list va;
 461+ int i;
 462+ float dwOut;
 463+ DWORD sizeout = 4;
 464+ DWORD regdword = REG_DWORD;
 465+ LSTATUS error = RegQueryValueEx(hKey, value, NULL, &regdword, (LPBYTE)&dwOut, &sizeout);
 466+ if (error == ERROR_SUCCESS)
 467+ {
 468+ *mask = 1.0f;
 469+ return dwOut;
 470+ }
 471+ else
 472+ {
 473+ va_start(va, obsolete_count);
 474+ for (i = 0; i < obsolete_count; i++)
 475+ {
 476+ regdword = REG_DWORD;
 477+ obsolete = va_arg(va, LPCTSTR);
 478+ error = RegQueryValueEx(hKey, obsolete, NULL, &regdword, (LPBYTE)&dwOut, &sizeout);
 479+ if (error == ERROR_SUCCESS)
 480+ {
 481+ *mask = 1.0f;
 482+ va_end(va);
 483+ return dwOut;
 484+ }
 485+ }
 486+ *mask = 0.0f;
 487+ va_end(va);
 488+ return original;
 489+ }
 490+}
 491+
419492 float ReadFloat(HKEY hKey, float original, float *mask, LPCTSTR value)
420493 {
421494 float dwOut;
@@ -458,9 +531,12 @@
459532 cfg->scaler = ReadDWORD(hKey, cfg->scaler, &cfgmask->scaler, _T("ScalingMode"));
460533 cfg->fullmode = ReadDWORD(hKey, cfg->fullmode, &cfgmask->fullmode, _T("FullscreenWindowMode"));
461534 cfg->colormode = ReadBool(hKey,cfg->colormode,&cfgmask->colormode,_T("ChangeColorDepth"));
462 - cfg->firstscalefilter = ReadDWORD(hKey, cfg->firstscalefilter, &cfgmask->firstscalefilter, _T("FirstScaleFilter"));
463 - cfg->firstscalex = ReadFloat(hKey, cfg->firstscalex, &cfgmask->firstscalex, _T("FirstScaleX"));
464 - cfg->firstscaley = ReadFloat(hKey, cfg->firstscaley, &cfgmask->firstscaley, _T("FirstScaleY"));
 535+ cfg->postfilter = ReadDWORDWithObsolete(hKey, cfg->postfilter, &cfgmask->postfilter, _T("PostprocessFilter"),
 536+ 1, _T("FirstScaleFilter"));
 537+ cfg->postsizex = ReadFloatWithObsolete(hKey, cfg->postsizex, &cfgmask->postsizex, _T("PostprocessScaleX"),
 538+ 1, _T("FirstScaleX"));
 539+ cfg->postsizey = ReadFloatWithObsolete(hKey, cfg->postsizey, &cfgmask->postsizey, _T("PostprocessScaleY"),
 540+ 1, _T("FirstScaleY"));
465541 cfg->scalingfilter = ReadDWORD(hKey,cfg->scalingfilter,&cfgmask->scalingfilter,_T("ScalingFilter"));
466542 cfg->texfilter = ReadDWORD(hKey,cfg->texfilter,&cfgmask->texfilter,_T("TextureFilter"));
467543 cfg->anisotropic = ReadDWORD(hKey,cfg->anisotropic,&cfgmask->anisotropic,_T("AnisotropicFiltering"));
@@ -507,6 +583,23 @@
508584 else RegDeleteValue(hKey,name);
509585 }
510586
 587+void WriteDWORDDeleteObsolete(HKEY hKey, DWORD value, DWORD mask, LPCTSTR name,
 588+ unsigned int obsolete_count, ...) // obsolete items are LPCTSTRs
 589+{
 590+ LPCTSTR obsolete;
 591+ va_list va;
 592+ int i;
 593+ va_start(va, obsolete_count);
 594+ for (i = 0; i < obsolete_count; i++)
 595+ {
 596+ obsolete = va_arg(va, LPCTSTR);
 597+ RegDeleteValue(hKey, obsolete);
 598+ }
 599+ va_end(va);
 600+ if (mask) RegSetValueEx(hKey, name, 0, REG_DWORD, (BYTE*)&value, 4);
 601+ else RegDeleteValue(hKey, name);
 602+}
 603+
511604 void WriteDWORD(HKEY hKey, DWORD value, DWORD mask, LPCTSTR name)
512605 {
513606 if(mask) RegSetValueEx(hKey,name,0,REG_DWORD,(BYTE*)&value,4);
@@ -517,6 +610,23 @@
518611 if(mask[0]) RegSetValueEx(hKey,name,0,REG_SZ,(BYTE*)path,(_tcslen(path)+1)*sizeof(TCHAR));
519612 else RegDeleteValue(hKey,name);
520613 }
 614+
 615+void WriteFloatDeleteObsolete(HKEY hKey, float value, float mask, LPCTSTR name,
 616+ unsigned int obsolete_count, ...) // obsolete items are LPCTSTRs
 617+{
 618+ LPCTSTR obsolete;
 619+ va_list va;
 620+ int i;
 621+ va_start(va, obsolete_count);
 622+ for (i = 0; i < obsolete_count; i++)
 623+ {
 624+ obsolete = va_arg(va, LPCTSTR);
 625+ RegDeleteValue(hKey, obsolete);
 626+ }
 627+ va_end(va);
 628+ if (fabsf(mask) > 0.5f) RegSetValueEx(hKey, name, 0, REG_DWORD, (BYTE*)&value, 4);
 629+ else RegDeleteValue(hKey, name);
 630+}
521631 void WriteFloat(HKEY hKey, float value, float mask, LPCTSTR name)
522632 {
523633 if (fabsf(mask) > 0.5f) RegSetValueEx(hKey, name, 0, REG_DWORD, (BYTE*)&value, 4);
@@ -530,14 +640,17 @@
531641 else cfgmask = &defaultmask;
532642 memset(&defaultmask,1,sizeof(DXGLCFG));
533643 defaultmask.aspect = 1.0f;
534 - defaultmask.firstscalex = 1.0f;
535 - defaultmask.firstscaley = 1.0f;
 644+ defaultmask.postsizex = 1.0f;
 645+ defaultmask.postsizey = 1.0f;
536646 WriteDWORD(hKey,cfg->scaler,cfgmask->scaler,_T("ScalingMode"));
537647 WriteDWORD(hKey, cfg->fullmode, cfgmask->fullmode, _T("FullscreenWindowMode"));
538648 WriteBool(hKey,cfg->colormode,cfgmask->colormode,_T("ChangeColorDepth"));
539 - WriteDWORD(hKey, cfg->firstscalefilter, cfgmask->firstscalefilter, _T("FirstScaleFilter"));
540 - WriteFloat(hKey, cfg->firstscalex, cfgmask->firstscalex, _T("FirstScaleX"));
541 - WriteFloat(hKey, cfg->firstscaley, cfgmask->firstscaley, _T("FirstScaleY"));
 649+ WriteDWORDDeleteObsolete(hKey, cfg->postfilter, cfgmask->postfilter, _T("PostprocessFilter"),
 650+ 1, _T("FirstScaleFilter"));
 651+ WriteFloatDeleteObsolete(hKey, cfg->postsizex, cfgmask->postsizex, _T("PostprocessScaleX"),
 652+ 1, _T("FirstScaleX"));
 653+ WriteFloatDeleteObsolete(hKey, cfg->postsizey, cfgmask->postsizey, _T("PostprocessScaleY"),
 654+ 1, _T("FirstScaleY"));
542655 WriteDWORD(hKey,cfg->scalingfilter,cfgmask->scalingfilter,_T("ScalingFilter"));
543656 WriteDWORD(hKey,cfg->texfilter,cfgmask->texfilter,_T("TextureFilter"));
544657 WriteDWORD(hKey,cfg->anisotropic,cfgmask->anisotropic,_T("AnisotropicFiltering"));
Index: cfgmgr/cfgmgr.h
@@ -28,9 +28,9 @@
2929 DWORD scaler;
3030 DWORD fullmode;
3131 BOOL colormode;
32 - DWORD firstscalefilter;
33 - float firstscalex;
34 - float firstscaley;
 32+ DWORD postfilter;
 33+ float postsizex;
 34+ float postsizey;
3535 DWORD scalingfilter;
3636 DWORD texfilter;
3737 DWORD anisotropic;
Index: ddraw/glDirectDraw.cpp
@@ -483,9 +483,9 @@
484484 ddmode.dwSize = sizeof(DDSURFACEDESC);
485485 ddmode.dwFlags = DDSD_HEIGHT | DDSD_WIDTH | DDSD_PITCH | DDSD_PIXELFORMAT | DDSD_REFRESHRATE;
486486 ddmode.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT);
487 - if (!_isnan(dxglcfg.firstscalex) && !_isnan(dxglcfg.firstscaley) &&
488 - (dxglcfg.firstscalex > 0.25f) && (dxglcfg.firstscaley > 0.25f) &&
489 - (dxglcfg.firstscalex != 1.0f) && (dxglcfg.firstscaley != 1.0f) &&
 487+ if (!_isnan(dxglcfg.postsizex) && !_isnan(dxglcfg.postsizey) &&
 488+ (dxglcfg.postsizex > 0.25f) && (dxglcfg.postsizey > 0.25f) &&
 489+ (dxglcfg.postsizex != 1.0f) && (dxglcfg.postsizey != 1.0f) &&
490490 ((dxglcfg.scaler == 0) || ((dxglcfg.scaler >= 4) && (dxglcfg.scaler <= 6))) &&
491491 (!dxglcfg.primaryscale))
492492 scalemodes = TRUE;
@@ -494,8 +494,8 @@
495495 {
496496 if (scalemodes)
497497 {
498 - mode.dmPelsWidth /= dxglcfg.firstscalex;
499 - mode.dmPelsHeight /= dxglcfg.firstscaley;
 498+ mode.dmPelsWidth /= dxglcfg.postsizex;
 499+ mode.dmPelsHeight /= dxglcfg.postsizey;
500500 }
501501 modes[modenum-1] = mode;
502502 if(modenum >= modemax)
@@ -514,8 +514,8 @@
515515 if(dxglcfg.AddColorDepths) AddExtraColorModes(&modes,&modenum); // FIXME: Add color depths by bitmask
516516 DiscardDuplicateModes(&modes,&modenum);
517517 if(dxglcfg.AddModes && (dxglcfg.scaler != 0)) AddExtraResolutions(&modes,&modenum); // FIXME: Add modes by bitmask
518 - if (dxglcfg.AddModes && (_isnan(dxglcfg.firstscalex) || _isnan(dxglcfg.firstscaley) ||
519 - (dxglcfg.firstscalex < 0.25f) || (dxglcfg.firstscaley < 0.25f)))
 518+ if (dxglcfg.AddModes && (_isnan(dxglcfg.postsizex) || _isnan(dxglcfg.postsizey) ||
 519+ (dxglcfg.postsizex < 0.25f) || (dxglcfg.postsizey < 0.25f)))
520520 AddDoubledResolutions(&modes, &modenum);
521521 modenum--;
522522 switch(dxglcfg.SortModes)
@@ -1785,8 +1785,8 @@
17861786 currmode.dmSize = sizeof(DEVMODE);
17871787 EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&currmode);
17881788 this->currmode.dmSize = 0;
1789 - if (_isnan(dxglcfg.firstscalex) || _isnan(dxglcfg.firstscaley) ||
1790 - (dxglcfg.firstscalex < 0.25f) || (dxglcfg.firstscaley < 0.25f))
 1789+ if (_isnan(dxglcfg.postsizex) || _isnan(dxglcfg.postsizey) ||
 1790+ (dxglcfg.postsizex < 0.25f) || (dxglcfg.postsizey < 0.25f))
17911791 {
17921792 if (dwWidth <= 400) xscale = 2.0f;
17931793 else xscale = 1.0f;
@@ -1795,8 +1795,8 @@
17961796 }
17971797 else
17981798 {
1799 - xscale = dxglcfg.firstscalex;
1800 - yscale = dxglcfg.firstscaley;
 1799+ xscale = dxglcfg.postsizex;
 1800+ yscale = dxglcfg.postsizey;
18011801 }
18021802 switch (dxglcfg.fullmode)
18031803 {
@@ -1810,8 +1810,8 @@
18111811 default:
18121812 newmode.dmSize = sizeof(DEVMODE);
18131813 newmode.dmDriverExtra = 0;
1814 - if (!dxglcfg.primaryscale || (_isnan(dxglcfg.firstscalex) || _isnan(dxglcfg.firstscaley) ||
1815 - (dxglcfg.firstscalex < 0.25f) || (dxglcfg.firstscaley < 0.25f)))
 1814+ if (!dxglcfg.primaryscale || (_isnan(dxglcfg.postsizex) || _isnan(dxglcfg.postsizey) ||
 1815+ (dxglcfg.postsizex < 0.25f) || (dxglcfg.postsizey < 0.25f)))
18161816 {
18171817 newmode.dmPelsWidth = dwWidth * xscale;
18181818 newmode.dmPelsHeight = dwHeight * yscale;
Index: ddraw/glDirectDrawSurface.cpp
@@ -92,8 +92,8 @@
9393 ddsd.dwHeight = sizes[3];
9494 if(dxglcfg.primaryscale)
9595 {
96 - if (_isnan(dxglcfg.firstscalex) || _isnan(dxglcfg.firstscaley) ||
97 - (dxglcfg.firstscalex < 0.25f) || (dxglcfg.firstscaley < 0.25f))
 96+ if (_isnan(dxglcfg.postsizex) || _isnan(dxglcfg.postsizey) ||
 97+ (dxglcfg.postsizex < 0.25f) || (dxglcfg.postsizey < 0.25f))
9898 {
9999 if (ddsd.dwWidth <= 400) xscale = 2.0f;
100100 else xscale = 1.0f;
@@ -102,8 +102,8 @@
103103 }
104104 else
105105 {
106 - xscale = dxglcfg.firstscalex;
107 - yscale = dxglcfg.firstscaley;
 106+ xscale = dxglcfg.postsizex;
 107+ yscale = dxglcfg.postsizey;
108108 }
109109 fakex = (DWORD)((float)sizes[0] / xscale);
110110 fakey = (DWORD)((float)sizes[1] / yscale);
@@ -1232,8 +1232,8 @@
12331233 ddsd.dwHeight = sizes[3];
12341234 if(dxglcfg.primaryscale)
12351235 {
1236 - if (_isnan(dxglcfg.firstscalex) || _isnan(dxglcfg.firstscaley) ||
1237 - (dxglcfg.firstscalex < 0.25f) || (dxglcfg.firstscaley < 0.25f))
 1236+ if (_isnan(dxglcfg.postsizex) || _isnan(dxglcfg.postsizey) ||
 1237+ (dxglcfg.postsizex < 0.25f) || (dxglcfg.postsizey < 0.25f))
12381238 {
12391239 if (ddsd.dwWidth <= 400) xscale = 2.0f;
12401240 else xscale = 1.0f;
@@ -1242,8 +1242,8 @@
12431243 }
12441244 else
12451245 {
1246 - xscale = dxglcfg.firstscalex;
1247 - yscale = dxglcfg.firstscaley;
 1246+ xscale = dxglcfg.postsizex;
 1247+ yscale = dxglcfg.postsizey;
12481248 }
12491249 fakex = (DWORD)((float)sizes[0] / xscale);
12501250 fakey = (DWORD)((float)sizes[1] / yscale);
@@ -1286,8 +1286,8 @@
12871287 ddsd.dwHeight = sizes[3];
12881288 if(dxglcfg.primaryscale)
12891289 {
1290 - if (_isnan(dxglcfg.firstscalex) || _isnan(dxglcfg.firstscaley) ||
1291 - (dxglcfg.firstscalex < 0.25f) || (dxglcfg.firstscaley < 0.25f))
 1290+ if (_isnan(dxglcfg.postsizex) || _isnan(dxglcfg.postsizey) ||
 1291+ (dxglcfg.postsizex < 0.25f) || (dxglcfg.postsizey < 0.25f))
12921292 {
12931293 if (ddsd.dwWidth <= 400) xscale = 2.0f;
12941294 else xscale = 1.0f;
@@ -1296,8 +1296,8 @@
12971297 }
12981298 else
12991299 {
1300 - xscale = dxglcfg.firstscalex;
1301 - yscale = dxglcfg.firstscaley;
 1300+ xscale = dxglcfg.postsizex;
 1301+ yscale = dxglcfg.postsizey;
13021302 }
13031303 fakex = (DWORD)((float)sizes[0] / xscale);
13041304 fakey = (DWORD)((float)sizes[1] / yscale);
Index: ddraw/glRenderer.cpp
@@ -2790,16 +2790,16 @@
27912791 //glRenderer__InitCommandBuffer(This, &This->cmd2, width * height * (NextMultipleOf8(bpp) / 8));
27922792 //BufferObject_Map(This->cmd1.vertices, GL_ARRAY_BUFFER, GL_WRITE_ONLY);
27932793 //BufferObject_Map(This->cmd1.indices, GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY);
2794 - if (_isnan(dxglcfg.firstscalex) || _isnan(dxglcfg.firstscaley) ||
2795 - (dxglcfg.firstscalex < 0.25f) || (dxglcfg.firstscaley < 0.25f))
 2794+ if (_isnan(dxglcfg.postsizex) || _isnan(dxglcfg.postsizey) ||
 2795+ (dxglcfg.postsizex < 0.25f) || (dxglcfg.postsizey < 0.25f))
27962796 {
2797 - This->firstscalex = 1.0f;
2798 - This->firstscaley = 1.0f;
 2797+ This->postsizex = 1.0f;
 2798+ This->postsizey = 1.0f;
27992799 }
28002800 else
28012801 {
2802 - This->firstscalex = dxglcfg.firstscalex;
2803 - This->firstscaley = dxglcfg.firstscaley;
 2802+ This->postsizex = dxglcfg.postsizex;
 2803+ This->postsizey = dxglcfg.postsizey;
28042804 }
28052805 TRACE_SYSINFO();
28062806 return TRUE;
@@ -3213,8 +3213,8 @@
32143214 GLfloat view[4];
32153215 DDSURFACEDESC2 ddsd;
32163216 DWORD x2, y2;
3217 - x2 = x * This->firstscalex;
3218 - y2 = y * This->firstscaley;
 3217+ x2 = x * This->postsizex;
 3218+ y2 = y * This->postsizey;
32193219 glUtil_SetActiveTexture(This->util,8);
32203220 if(!This->backbuffer)
32213221 {
@@ -3242,7 +3242,7 @@
32433243 glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
32443244 glUtil_SetTexture(This->util,8,*texture);
32453245 *texture = This->backbuffer;
3246 - if (!paletted && firstpass && (dxglcfg.firstscalefilter == 1))
 3246+ if (!paletted && firstpass && (dxglcfg.postfilter == 1))
32473247 glTexture__SetFilter(*texture, 8, GL_LINEAR, GL_LINEAR, This);
32483248 else glTexture__SetFilter(*texture, 8, GL_NEAREST, GL_NEAREST, This);
32493249 This->ext->glUniform4f(This->shaders->shaders[progtype].view,view[0],view[1],view[2],view[3]);
@@ -3342,18 +3342,18 @@
33433343 if(This->ddInterface->GetFullscreen())
33443344 {
33453345 This->ddInterface->GetSizes(sizes);
3346 - if (_isnan(dxglcfg.firstscalex) || _isnan(dxglcfg.firstscaley) ||
3347 - (dxglcfg.firstscalex < 0.25f) || (dxglcfg.firstscaley < 0.25f))
 3346+ if (_isnan(dxglcfg.postsizex) || _isnan(dxglcfg.postsizey) ||
 3347+ (dxglcfg.postsizex < 0.25f) || (dxglcfg.postsizey < 0.25f))
33483348 {
3349 - if (sizes[2] <= 400) This->firstscalex = 2.0f;
3350 - else This->firstscalex = 1.0f;
3351 - if (sizes[3] <= 300) This->firstscaley = 2.0f;
3352 - else This->firstscaley = 1.0f;
 3349+ if (sizes[2] <= 400) This->postsizex = 2.0f;
 3350+ else This->postsizex = 1.0f;
 3351+ if (sizes[3] <= 300) This->postsizey = 2.0f;
 3352+ else This->postsizey = 1.0f;
33533353 }
33543354 else
33553355 {
3356 - This->firstscalex = dxglcfg.firstscalex;
3357 - This->firstscaley = dxglcfg.firstscaley;
 3356+ This->postsizex = dxglcfg.postsizex;
 3357+ This->postsizey = dxglcfg.postsizey;
33583358 }
33593359 viewport[0] = viewport[1] = 0;
33603360 viewport[2] = sizes[4];
@@ -3394,7 +3394,7 @@
33953395 This->ext->glUniform1i(This->shaders->shaders[progtype].pal,9);
33963396 glUtil_SetTexture(This->util,8,texture);
33973397 glUtil_SetTexture(This->util,9,paltex);
3398 - if(dxglcfg.scalingfilter || (This->firstscalex != 1.0f) || (This->firstscaley != 1.0f))
 3398+ if(dxglcfg.scalingfilter || (This->postsizex != 1.0f) || (This->postsizey != 1.0f))
33993399 {
34003400 glRenderer__DrawBackbuffer(This,&texture,texture->bigwidth,texture->bigheight,progtype,TRUE,TRUE);
34013401 ShaderManager_SetShader(This->shaders,PROG_TEXTURE,NULL,0);
@@ -3405,7 +3405,7 @@
34063406 }
34073407 else
34083408 {
3409 - if ((This->firstscalex != 1.0f) || (This->firstscaley != 1.0f))
 3409+ if ((This->postsizex != 1.0f) || (This->postsizey != 1.0f))
34103410 {
34113411 progtype = PROG_TEXTURE;
34123412 ShaderManager_SetShader(This->shaders, PROG_TEXTURE, NULL, 0);
@@ -3732,18 +3732,18 @@
37333733 glRenderer__SetSwap(This,0);
37343734 glUtil_SetViewport(This->util, 0, 0, width, height);
37353735 }
3736 - if (_isnan(dxglcfg.firstscalex) || _isnan(dxglcfg.firstscaley) ||
3737 - (dxglcfg.firstscalex < 0.25f) || (dxglcfg.firstscaley < 0.25f))
 3736+ if (_isnan(dxglcfg.postsizex) || _isnan(dxglcfg.postsizey) ||
 3737+ (dxglcfg.postsizex < 0.25f) || (dxglcfg.postsizey < 0.25f))
37383738 {
3739 - if (width <= 400) This->firstscalex = 2.0f;
3740 - else This->firstscaley = 1.0f;
3741 - if (height <= 300) This->firstscaley = 2.0f;
3742 - else This->firstscaley = 1.0f;
 3739+ if (width <= 400) This->postsizex = 2.0f;
 3740+ else This->postsizex = 1.0f;
 3741+ if (height <= 300) This->postsizey = 2.0f;
 3742+ else This->postsizey = 1.0f;
37433743 }
37443744 else
37453745 {
3746 - This->firstscalex = dxglcfg.firstscalex;
3747 - This->firstscaley = dxglcfg.firstscaley;
 3746+ This->postsizex = dxglcfg.postsizex;
 3747+ This->postsizey = dxglcfg.postsizey;
37483748 }
37493749 SetEvent(This->busy);
37503750 }
Index: ddraw/glRenderer.h
@@ -159,7 +159,7 @@
160160 DWORD last_fvf;
161161 GLsizei fvf_stride;
162162 BOOL mode_3d;
163 - float firstscalex, firstscaley;
 163+ float postsizex, postsizey;
164164 } glRenderer;
165165
166166 HRESULT glRenderer_AddCommand(glRenderer *This, QueueCmd *cmd, BOOL inner, BOOL wait);
Index: ddraw/trace.c
@@ -1082,6 +1082,7 @@
10831083 }
10841084 WriteFile(outfile,");\r\n",4,&byteswritten,NULL);
10851085 trace_depth++;
 1086+ va_end(args);
10861087 LeaveCriticalSection(&trace_cs);
10871088 }
10881089 void trace_exit(const char *function, int argtype, void *arg)
Index: dxgl-example.ini
@@ -0,0 +1,377 @@
 2+; Example configuration for DXGL
 3+; Place in the same folder as a game or application and rename to dxgl.ini
 4+; in order to pre-set profile settings for the game or application.
 5+
 6+[system]
 7+; NoWriteRegistry - Boolean
 8+; If true, do not write a profile or settings to the user's registry.
 9+; Set to true if distributing the DXGL ddraw.dll with a game or application.
 10+; Default is false so ensure the following line is set to avoid writing to
 11+; the end user's registry.
 12+NoWriteRegistry = true
 13+
 14+[display]
 15+; ScalingMode - Integer
 16+; Determines the method DXGL will use to scale full screen modes.
 17+; Default is 0.
 18+; The following values are valid:
 19+; 0 - Change display mode to match requested mode.
 20+; 1 - Stretch output to desktop
 21+; 2 - Stretch output to desktop, preserving aspect ratio
 22+; 3 - Center output on desktop
 23+; 4 - Change display mode, stretch if matching mode not found
 24+; 5 - Change display mode, aspect corrected stretch if matching mode not found
 25+; 6 - Change display mode, center if matching mode not found
 26+; 7 - Crop output to desktop, preserving aspect ratio
 27+ScalingMode = 0
 28+
 29+; FullscreenWindowMode - Integer
 30+; Determines how DXGL will draw the window for fullscreen modes.
 31+; Some modes will override the scaling mode.
 32+; The following values are valid:
 33+; 0 - Use exclusive fullscreen
 34+; 1 - Use non-exclusive fullscreen, not quite borderless windowed mode
 35+; 2 - Use a non-resizable window
 36+; 3 - Use a resizable window, uses scaler mode, preferably 1, 2, 3, or 7
 37+; 4 - Use a borderless, non-resizable window, called windowed borderless in industry
 38+FullscreenWindowMode = 0
 39+
 40+; ChangeColorDepth - Boolean
 41+; If true, Windows will attempt to change the color depth of the screen.
 42+; This will prevent 8-bit color modes from working correctly in Windows 7
 43+; or earlier. In Windows 8 or later, a compatibility mode must be set to
 44+; make low color depths work, but in those operating systems 8-bit color
 45+; will work.
 46+; DXGL always performs color depth conversion for DirectDraw internally
 47+; via the OpenGL runtime regardless of the operating system's display mode.
 48+; Default is false and is recommended except in special circumstances.
 49+ChangeColorDepth = false
 50+
 51+; AllColorDepths - Boolean
 52+; Adds 8, 16, 24, and 32-bit color modes if they are not already
 53+; added to the list of display modes passed to the program.
 54+; (future)Equivalent to setting AddColorDepths to 29.
 55+; (future)Overridden by AddColorDepths.
 56+; Default is true if Windows 8 or higher is detected, false otherwise.
 57+AllColorDepths = true
 58+
 59+; AddColorDepths - Integer
 60+; (future) Adds additional color modes if they are not already
 61+; added to the list of display modes passed to the program.
 62+; This is a bit-mapped variable, add up the desired color depths from
 63+; the list of values below:
 64+; 1 - Add 8-bit modes
 65+; 2 - Add 15-bit modes
 66+; 4 - Add 16-bit modes
 67+; 8 - Add 24-bit modes
 68+; 16 - Add 32-bit modes
 69+; Default is 29 if Windows 8 or higher is detected, 0 otherwise.
 70+; Adding both 15 and 16 bit modes at the same time may cause
 71+; crashes or undefined behavior in some programs.
 72+AddColorDepths = 29
 73+
 74+; ExtraModes - Boolean
 75+; Adds additional video modes to the list of resolutions.
 76+; If a display scaling mode is not set and postprocess scaling
 77+; is set to automatic, it will add several low resolution pixel doubled
 78+; video modes.
 79+; Default is true.
 80+; (future)Equivalent to setting AddModes to 7. Overridden by AddModes.
 81+ExtraModes = true
 82+
 83+; AddModes - Integer
 84+; (future) Adds additional video modes to the list of resolutions.
 85+; This is a bitmapped variable, add up the desired mode lists from
 86+; the list of values below:
 87+; 0 - None
 88+; 1 - Add common low-resolution modes
 89+; 2 - Add less common low-resolution modes
 90+; 4 - Add uncommon standard definition modes
 91+; 8 - Add high definition modes
 92+; 16 - Add QHD to UHD modes.
 93+; 32 - Add over-4K UHD modes. Check GPU specifications before enabling.
 94+; 64 - Add very uncommon resolutions of all dimensions.
 95+; Default is 1.
 96+AddModes = 1
 97+
 98+; SortModes - Integer
 99+; Determines whether or not to sort display modes by either
 100+; resolution first or color depth first. This can make in-game
 101+; display mode menus display video modes in increasing order instead
 102+; of potentially in a random assortment.
 103+; The following values are valid:
 104+; 0 - Do not sort. Display modes detected by the system will be listed in
 105+; the order they appear. Display modes added by DXGL will be added at
 106+; the end.
 107+; 1 - Sort video modes, grouping by color depth.
 108+; 2 - Sort video modes, grouping by resolution.
 109+; Default is 0.
 110+SortModes = 0
 111+
 112+[scaling]
 113+; ScalingFilter - Integer
 114+; Selects the filter to be used to scale the output image
 115+; Default is 0
 116+; The following values are valid:
 117+; 0 - Nearest-neighbor stretching
 118+; 1 - Bilinear interpolation
 119+ScalingFilter = 0
 120+
 121+; AdjustPrimaryResolution - Integer
 122+; Determines whether or not to resize the buffers used to hold the primary
 123+; buffers if scaling is enabled. Enabling this may cause graphical glitches
 124+; and/or slowdown.
 125+; The following values are valid:
 126+; 0 - Use native primary surface size. Most compatible.
 127+; 1 - Adjust primary surface size to match display.
 128+; The following will be added in the future:
 129+; 2 - Adjust primary surface to nearest integer multiple of native.
 130+; 3 - Use exact 1.5x scale.
 131+; 4 - Use exact 2x scale.
 132+; 5 - Use exact 2.5x scale.
 133+; 6 - Use exact 3x scale.
 134+; 7 - Use exact 4x scale.
 135+; 8 - Use custom scale.
 136+; Default is 0.
 137+AdjustPrimaryResolution = 0
 138+
 139+; PrimaryScaleX - Floating point
 140+; (future) Sets the scaling amount in the X dimension for custom primary
 141+; buffer scaling.
 142+; If zero, negative, or an invalid value, will be interpreted as 1.0
 143+; Default is 1.0
 144+PrimaryScaleX = 1.0
 145+
 146+; PrimaryScaleY - Floating point
 147+; (future) Sets the scaling amount in the Y dimension for custom primary
 148+; buffer scaling.
 149+; If zero, negative, or an invalid value, will be interpreted as 1.0
 150+; Default is 1.0
 151+PrimaryScaleY = 1.0
 152+
 153+; ScreenAspect - Floating point or string
 154+; Sets the aspect ratio of the display output.
 155+; May be entered as a floating point number or as aspect ratio notation.
 156+; Examples would be 1.33333 or 4:3 for a "fullscreen" aspect ratio.
 157+; Or "Default" may be entered to use the default aspect for the selected mode.
 158+; If zero, negative, "Default" or an invalid value, the display will default
 159+; to a 1:1 PAR except on specific low-resolution modes which may use 2:1 or
 160+; 1:2 PAR.
 161+; Default is "Default"
 162+ScreenAspect = Default
 163+
 164+; DPIScale - Integer
 165+; Overrides Windows DPI scaling on high-DPI modes.
 166+; Has no effect on Windows XP or earlier, or if "Windows XP style DPI Scaling"
 167+; is enabled in Windows, or if the Desktop Window Manager is disabled.
 168+; Setting to 0 allows Windows to control high-DPI scaling, which may cause
 169+; glitches.
 170+; Setting to 1 causes DXGL to use the SetDPIAwareness API on Windows 8.1 or
 171+; higher to set the process as Per-Monitor High DPI Aware, or on Windows Vista
 172+; through 8.0 use the SetProcessDPIAware API to set the process as High DPI
 173+; Aware. If the GUI is initialized before ddraw.dll is loaded, this will have
 174+; no effect.
 175+; Setting to 2 will adjust the Windows Application Compatibility registry
 176+; values to disable Windows High DPI scaling. This may cause your application
 177+; or game to restart as the registry value is set. Use this mode only if
 178+; setting DPIScale to 1 has no effect.
 179+; Default is 1.
 180+DPIScale = 1
 181+
 182+[postprocess]
 183+; PostprocessFilter - Integer
 184+; Selects the filter to use for the postprocess pass.
 185+; (future)If a post processing shader is selected this will be clamped to 1
 186+; or overridden by the shader metadata.
 187+; This will be ignored if there is no
 188+; The following values are valid:
 189+; 0 - Nearest-neighbor stretching
 190+; 1 - Bilinear interpolation
 191+PostprocessFilter = 0
 192+
 193+; PostprocessScaleX - Floating point
 194+; Scaling in the X direction for the postprocess pass.
 195+; May be overridden by metadata in a postprocess shader.
 196+; If either X or Y are set to 0 or less than 0.25 DXGL will select a scaling
 197+; amount that doubles the width if it is 400 or fewer pixels wide, and doubles
 198+; the lines if the height is 300 or fewer lines.
 199+; Default is 0.0
 200+PostprocessScaleX = 0.0
 201+
 202+; PostprocessScaleY - Floating point
 203+; Scaling in the Y direction for the postprocess pass.
 204+; May be overridden by metadata in a postprocess shader.
 205+; If either X or Y are set to 0 or less than 0.25 DXGL will select a scaling
 206+; amount that doubles the width if it is 400 or fewer pixels wide, and doubles
 207+; the lines if the height is 300 or fewer lines.
 208+; Default is 0.0
 209+PostprocessScaleY = 0.0
 210+
 211+; EnableShader - Boolean
 212+; (future) If true, uses a custom shader to render the postprocess pass.
 213+; Default is false
 214+EnableShader = false
 215+
 216+; ShaderFile
 217+; (future)Path to a file containing either a GLSL fragment shader or a
 218+; to-be-determined metadata file containing a shader pipeline and certain
 219+; parameters.
 220+; The path can be relative (will search the Shaders subdirectory of the
 221+; install directory and the path where the ddraw.dll implementation has been
 222+; placed) or absolute.
 223+; Default is undefined.
 224+; ShaderFile = example.fs
 225+
 226+[d3d]
 227+; TextureFilter - Integer
 228+; Texture filtering method for Direct3D draw commands.
 229+; The following values are valid:
 230+; 0 - Use the setting in the Direct3D texture stage state
 231+; 1 - GL_NEAREST (Nearest-neighbor filtering)
 232+; 2 - GL_LINEAR (Bilinear filtering)
 233+; 3 - GL_NEAREST_MIPMAP_NEAREST (Nearest-neighbor with mipmap)
 234+; 4 - GL_NEAREST_MIPMAP_LINEAR (Nearest-neighbor with linear mipmap)
 235+; 5 - GL_LINEAR_MIPMAP_NEAREST (Bilinear with mipmap)
 236+; 6 - GL_LINEAR_MIPMAP_LINEAR (Trilinear filtering)
 237+; Default is 0
 238+TextureFilter = 0
 239+
 240+; AnisotropicFiltering - Integer
 241+; (future) Enabled anisotropic filtering to improve display quality
 242+; May cause slowdown on older, low-end graphics cards in some situations.
 243+; The following values are valid, though larger values may be dependent
 244+; on the capabilities of the graphics card:
 245+; 0 - Use the setting in the Direct3D texture stage state
 246+; 1 - Disables anisotropic filtering.
 247+; 2 - Sets anisotropic filtering to 2x.
 248+; 4 - Sets anisotropic filtering to 4x.
 249+; 8 - Sets anisotropic filtering to 8x.
 250+; 16 - Sets anisotropic filtering to 16x.
 251+AnisotropicFiltering = 0
 252+
 253+; Antialiasing - Hexadecimal integer
 254+; (future) Enables multisample antialiasing. May cause significant
 255+; slowdown, especially on slower graphics cards.
 256+; The following values are valid on all graphics cards:
 257+; 0x0 - Enables antialiasing if requested by the D3D device.
 258+; 0x1 - Disables antialiasing
 259+; For enabling antialiasing, run DXGLCFG to enumerate the available
 260+; antialiasing modes for your graphics card. Then retrieve the value
 261+; from the registry.
 262+; You may also use a number from 0x2 to 0xff to enable standard OpenGL
 263+; multisampling.
 264+; Add 0x10000 to the number to enable the specific antialiasing mode only
 265+; when the application requests it.
 266+; Default is 0x0
 267+Antialiasing = 0x0
 268+
 269+; D3DAspect - Integer
 270+; (future)Selects whether or not to adjust the aspect ratio for Direct3D
 271+; content. Also known as widescreen hack.
 272+; Only active if the display scaling is set to "Stretch to screen"
 273+; The following values are valid:
 274+; 0 - Stretches the output to the screen.
 275+; 1 - Expands the viewable area, i.e. hor+. There may be missing geometry
 276+; off-screen.
 277+; 2 - Crops the display to the viewable area. May cut off parts of the game
 278+; graphics.
 279+; Default is 0
 280+D3DAspect = 0
 281+
 282+[advanced]
 283+; VSync - Integer
 284+; Determines vertical retrace behavior.
 285+; This option is reserved for future expansion, and the only valid value is
 286+; currently 0.
 287+VSync = 0
 288+
 289+; TextureFormat - Integer
 290+; Determines the internal format to use for textures and DirectDraw
 291+; surfaces.
 292+; This option is reserved for future expansion, and the only valid value is
 293+; currently 0.
 294+TextureFormat = 0
 295+
 296+; TexUpload - Integer
 297+; Determines the method used to upload texture data to the graphics card.
 298+; This option is reserved for future expansion, and the only valid value is
 299+; currently 0.
 300+TexUpload = 0
 301+
 302+[debug]
 303+; DebugNoExtFramebuffer - Boolean
 304+; Disables use of the EXT_framebuffer_object OpenGL extension.
 305+; WARNING: If this is enabled and either ARB_framebuffer_object is
 306+; unavailable or DebugNoArbFramebuffer is enabled, then DXGL will fail
 307+; to initialize.
 308+; Default is false
 309+DebugNoExtFramebuffer = false
 310+
 311+; DebugNoArbFramebuffer - Boolean
 312+; Disables use of the ARB_framebuffer_object OpenGL extension.
 313+; WARNING: If this is enabled and either EXT_framebuffer_object is
 314+; unavailable or DebugNoExtFramebuffer is enabled, then DXGL will fail
 315+; to initialize.
 316+; Default is false
 317+DebugNoArbFramebuffer = false
 318+
 319+; DebugNoES2Compatibility - Boolean
 320+; Disables use of the ARB_ES2_compatibility OpenGL extension.
 321+; Currently this means that GL_RGB565 16-bit internal texture format
 322+; will not be used.
 323+; Default is false
 324+DebugNoES2Compatibility = false
 325+
 326+; DebugNoExtDirectStateAccess - Boolean
 327+; Disables use of the EXT_direct_state_access OpenGL extension.
 328+; This extension allows DXGL to more easily manipulate texture and other
 329+; objects. Disabling direct state access will revert to a more traditional
 330+; approach to manipulating OpenGL objects.
 331+; Default is false
 332+DebugNoExtDirectStateAccess = false
 333+
 334+; DebugNoArbDirectStateAccess - Boolean
 335+; Disables use of the ARB_direct_state_access OpenGL extension.
 336+; This extension allows DXGL to more easily manipulate texture and other
 337+; objects. Disabling direct state access will revert to a more traditional
 338+; approach to manipulating OpenGL objects.
 339+; Default is false
 340+DebugNoArbDirectStateAccess = false
 341+
 342+; DebugNoSamplerObjects - Boolean
 343+; Disables use of sampler objects. Disabling sampler objects may reduce
 344+; the performance and accuracy of Direct3D commands.
 345+; Default is false
 346+DebugNoSamplerObjects = false
 347+
 348+; DebugNoGpuShader4 - Boolean
 349+; Disables use of the EXT_gpu_shader4 OpenGL extension.
 350+; Disabling this extension may reduce the accuracy of DirectDraw drawing
 351+; commands. This has no effect on OpenGL 3.0 or later as this functionality
 352+; is in core.
 353+; In addition disabling GLSL 1.30 and EXT_gpu_shader4 will disable DirectDraw
 354+; ROP support.
 355+; Default is false.
 356+DebugNoGpuShader4 = false
 357+
 358+; DebugNoGLSL130 - Boolean
 359+; Disables use of GLSL 1.30 shaders. Enabling this parameter as well as
 360+; DebugNoGpuShader4 will disable integer processing of DirectDraw commands
 361+; as well as disabling DirectDraw ROP support.
 362+; Default is false
 363+DebugNoGLSL130 = false
 364+
 365+; DebugMaxGLVersionMajor - Integer
 366+; Determines the maximum OpenGL major version available to DXGL.
 367+; If the system has a lower OpenGL version that will take precedence.
 368+; If this value is 0 than DXGL will use the highest OpenGL version
 369+; available to the system and ignore DebugMaxGLVersionMinor.
 370+; Default is 0
 371+DebugMaxGLVersionMajor = 0
 372+
 373+; DebugMaxGLVersionMinor - Integer
 374+; Determines the maximum OpenGL minor version available to DXGL.
 375+; This will be ignored if the system OpenGL major version is less than
 376+; DebugMaxGLVersionMajor.
 377+; Default is 0
 378+DebugMaxGLVersionMinor = 0
Index: dxglcfg/dxglcfg.c
@@ -679,7 +679,7 @@
680680 SendDlgItemMessage(hWnd, IDC_PRESCALE, CB_ADDSTRING, 0, (LPARAM)buffer);
681681 _tcscpy(buffer, _T("Bilinear"));
682682 SendDlgItemMessage(hWnd, IDC_PRESCALE, CB_ADDSTRING, 1, (LPARAM)buffer);
683 - SendDlgItemMessage(hWnd, IDC_PRESCALE, CB_SETCURSEL, cfg->firstscalefilter, 0);
 683+ SendDlgItemMessage(hWnd, IDC_PRESCALE, CB_SETCURSEL, cfg->postfilter, 0);
684684 // first scaling sizes
685685 _tcscpy(buffer, _T("Auto"));
686686 SendDlgItemMessage(hWnd, IDC_PRESCALESIZE, CB_ADDSTRING, 0, (LPARAM)buffer);
@@ -693,8 +693,8 @@
694694 SendDlgItemMessage(hWnd, IDC_PRESCALESIZE, CB_ADDSTRING, 0, (LPARAM)buffer);
695695 _tcscpy(buffer, _T("4x"));
696696 SendDlgItemMessage(hWnd, IDC_PRESCALESIZE, CB_ADDSTRING, 0, (LPARAM)buffer);
697 - Set1stScaleCombo(hWnd, IDC_PRESCALESIZE, cfg->firstscalex, cfg->firstscaley,
698 - cfgmask->firstscalex, cfgmask->firstscaley, tristate);
 697+ Set1stScaleCombo(hWnd, IDC_PRESCALESIZE, cfg->postsizex, cfg->postsizey,
 698+ cfgmask->postsizex, cfgmask->postsizey, tristate);
699699 // final scaling filter
700700 _tcscpy(buffer,_T("Nearest"));
701701 SendDlgItemMessage(hWnd,IDC_SCALE,CB_ADDSTRING,0,(LPARAM)buffer);
@@ -1183,7 +1183,7 @@
11841184 // Read settings into controls
11851185 SetCombo(hWnd,IDC_VIDMODE,cfg->scaler,cfgmask->scaler,tristate);
11861186 SetCombo(hWnd,IDC_SORTMODES,cfg->SortModes,cfgmask->SortModes,tristate);
1187 - SetCombo(hWnd,IDC_PRESCALE,cfg->firstscalefilter,cfgmask->firstscalefilter,tristate);
 1187+ SetCombo(hWnd,IDC_PRESCALE,cfg->postfilter,cfgmask->postfilter,tristate);
11881188 SetCombo(hWnd,IDC_SCALE,cfg->scalingfilter,cfgmask->scalingfilter,tristate);
11891189 //SetCombo(hWnd,IDC_VSYNC,cfg->vsync,cfgmask->vsync,tristate);
11901190 SetCombo(hWnd,IDC_FULLMODE,cfg->fullmode,cfgmask->fullmode,tristate);
@@ -1198,8 +1198,8 @@
11991199 SetCombo(hWnd,IDC_TEXUPLOAD,cfg->TexUpload,cfgmask->TexUpload,tristate);
12001200 SetCheck(hWnd,IDC_EXTRAMODES,cfg->AddModes,cfgmask->AddModes,tristate);
12011201 SetCombo(hWnd, IDC_DPISCALE, cfg->DPIScale, cfgmask->DPIScale, tristate);
1202 - Set1stScaleCombo(hWnd, IDC_PRESCALESIZE, cfg->firstscalex, cfg->firstscaley,
1203 - cfgmask->firstscalex, cfgmask->firstscaley, tristate);
 1202+ Set1stScaleCombo(hWnd, IDC_PRESCALESIZE, cfg->postsizex, cfg->postsizey,
 1203+ cfgmask->postsizex, cfgmask->postsizey, tristate);
12041204 SetAspectCombo(hWnd, IDC_ASPECT, cfg->aspect, cfgmask->aspect, tristate);
12051205 }
12061206 break;
@@ -1214,7 +1214,7 @@
12151215 *dirty = TRUE;
12161216 break;
12171217 case IDC_PRESCALE:
1218 - cfg->firstscalefilter = GetCombo(hWnd,IDC_PRESCALE,&cfgmask->firstscalefilter);
 1218+ cfg->postfilter = GetCombo(hWnd,IDC_PRESCALE,&cfgmask->postfilter);
12191219 EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
12201220 *dirty = TRUE;
12211221 break;
@@ -1291,17 +1291,17 @@
12921292 case IDC_PRESCALESIZE:
12931293 if (HIWORD(wParam) == CBN_KILLFOCUS)
12941294 {
1295 - Get1stScaleCombo(hWnd, IDC_PRESCALESIZE, &cfg->firstscalex, &cfg->firstscaley,
1296 - &cfgmask->firstscalex, &cfgmask->firstscaley);
1297 - Set1stScaleCombo(hWnd, IDC_PRESCALESIZE, cfg->firstscalex, cfg->firstscaley,
1298 - cfgmask->firstscalex, cfgmask->firstscaley, tristate);
 1295+ Get1stScaleCombo(hWnd, IDC_PRESCALESIZE, &cfg->postsizex, &cfg->postsizey,
 1296+ &cfgmask->postsizex, &cfgmask->postsizey);
 1297+ Set1stScaleCombo(hWnd, IDC_PRESCALESIZE, cfg->postsizex, cfg->postsizey,
 1298+ cfgmask->postsizex, cfgmask->postsizey, tristate);
12991299 EnableWindow(GetDlgItem(hWnd, IDC_APPLY), TRUE);
13001300 *dirty = TRUE;
13011301 }
13021302 else if (HIWORD(wParam) == CBN_SELCHANGE)
13031303 {
1304 - Get1stScaleCombo(hWnd, IDC_PRESCALESIZE, &cfg->firstscalex, &cfg->firstscaley,
1305 - &cfgmask->firstscalex, &cfgmask->firstscaley);
 1304+ Get1stScaleCombo(hWnd, IDC_PRESCALESIZE, &cfg->postsizex, &cfg->postsizey,
 1305+ &cfgmask->postsizex, &cfgmask->postsizey);
13061306 EnableWindow(GetDlgItem(hWnd, IDC_APPLY), TRUE);
13071307 *dirty = TRUE;
13081308 }
Index: dxglcfg2/dxglcfg2.c
@@ -911,7 +911,7 @@
912912 SendDlgItemMessage(hTabs[0], IDC_PRESCALE, CB_ADDSTRING, 0, (LPARAM)buffer);
913913 _tcscpy(buffer, _T("Bilinear"));
914914 SendDlgItemMessage(hTabs[0], IDC_PRESCALE, CB_ADDSTRING, 1, (LPARAM)buffer);
915 - SendDlgItemMessage(hWnd, IDC_PRESCALE, CB_SETCURSEL, cfg->firstscalefilter, 0);
 915+ SendDlgItemMessage(hWnd, IDC_PRESCALE, CB_SETCURSEL, cfg->postfilter, 0);
916916 // first scaling sizes
917917 _tcscpy(buffer, _T("Auto"));
918918 SendDlgItemMessage(hTabs[0], IDC_PRESCALESIZE, CB_ADDSTRING, 0, (LPARAM)buffer);
@@ -925,8 +925,8 @@
926926 SendDlgItemMessage(hTabs[0], IDC_PRESCALESIZE, CB_ADDSTRING, 0, (LPARAM)buffer);
927927 _tcscpy(buffer, _T("4x"));
928928 SendDlgItemMessage(hTabs[0], IDC_PRESCALESIZE, CB_ADDSTRING, 0, (LPARAM)buffer);
929 - Set1stScaleCombo(hWnd, IDC_PRESCALESIZE, cfg->firstscalex, cfg->firstscaley,
930 - cfgmask->firstscalex, cfgmask->firstscaley, tristate);
 929+ Set1stScaleCombo(hWnd, IDC_PRESCALESIZE, cfg->postsizex, cfg->postsizey,
 930+ cfgmask->postsizex, cfgmask->postsizey, tristate);
931931 // final scaling filter
932932 _tcscpy(buffer,_T("Nearest"));
933933 SendDlgItemMessage(hTabs[0], IDC_SCALE, CB_ADDSTRING, 0, (LPARAM)buffer);