DXGL r769 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r768‎ | r769 | r770 >
Date:06:20, 6 December 2017
Author:admin
Status:new
Tags:
Comment:
Add default values for custom scaling.
Add variables for Blt scaling.
Modified paths:
  • /cfgmgr/ReadMe.txt (modified) (history)
  • /cfgmgr/cfgmgr.c (modified) (history)
  • /cfgmgr/cfgmgr.h (modified) (history)
  • /dxgl-example.ini (modified) (history)

Diff [purge]

Index: cfgmgr/ReadMe.txt
@@ -142,11 +142,30 @@
143143 INI Entry ScalingFilter
144144 INI Group scaling
145145 REG_DWORD HKCU\DXGL\Profiles\<app>\ScalingFilter
146 -Filter to use for stretched 2D blits and the final display scaling.
 146+Filter to use for display scaling.
147147 Valid settings:
148148 0 - Nearest-neighbor stretching
149149 1 - Bilinear interpolation
150150
 151+Member BltScale
 152+INI Entry BltScale
 153+INI Group scaling
 154+REG_DWORD HKCU\DXGL\Profiles\<app>\BltScale
 155+Filter to use for Blt scaling.
 156+Valid settings:
 157+0 - Nearest-neighbor stretching
 158+1 - Bilinear interpolation
 159+2 - Bilinear interpolation, sharp color key
 160+3 - Bilinear interpolation, soft color key
 161+
 162+Member BltThreshold
 163+INI Entry BltThreshold
 164+INI Group scaling
 165+REG_DWORD HKCU\DXGL\Profiles\<app>\BltThreshold
 166+Threshold point for sharp color key scaling.
 167+Default is 127.
 168+Valid settings are 0 to 254, 255 will be accepted but disable color keying.
 169+
151170 Member primaryscale
152171 INI Entry AdjustPrimaryResolution
153172 INI Group scaling
Index: cfgmgr/cfgmgr.c
@@ -540,6 +540,8 @@
541541 cfg->postsizey = ReadFloatWithObsolete(hKey, cfg->postsizey, &cfgmask->postsizey, _T("PostprocessScaleY"),
542542 1, _T("FirstScaleY"));
543543 cfg->scalingfilter = ReadDWORD(hKey,cfg->scalingfilter,&cfgmask->scalingfilter,_T("ScalingFilter"));
 544+ cfg->BltScale = ReadDWORD(hKey, cfg->BltScale, &cfgmask->BltScale, _T("BltScale"));
 545+ cfg->BltThreshold = ReadDWORD(hKey, cfg->BltThreshold, &cfgmask->BltThreshold, _T("BltThreshold"));
544546 cfg->texfilter = ReadDWORD(hKey,cfg->texfilter,&cfgmask->texfilter,_T("TextureFilter"));
545547 cfg->anisotropic = ReadDWORD(hKey,cfg->anisotropic,&cfgmask->anisotropic,_T("AnisotropicFiltering"));
546548 cfg->msaa = ReadDWORD(hKey,cfg->msaa,&cfgmask->msaa,_T("Antialiasing"));
@@ -660,6 +662,8 @@
661663 defaultmask.aspect = 1.0f;
662664 defaultmask.postsizex = 1.0f;
663665 defaultmask.postsizey = 1.0f;
 666+ defaultmask.DisplayMultiplierX = 1.0f;
 667+ defaultmask.DisplayMultiplierY = 1.0f;
664668 WriteDWORD(hKey,cfg->scaler,cfgmask->scaler,_T("ScalingMode"));
665669 WriteDWORD(hKey, cfg->fullmode, cfgmask->fullmode, _T("FullscreenWindowMode"));
666670 WriteBool(hKey,cfg->colormode,cfgmask->colormode,_T("ChangeColorDepth"));
@@ -670,6 +674,8 @@
671675 WriteFloatDeleteObsolete(hKey, cfg->postsizey, cfgmask->postsizey, _T("PostprocessScaleY"),
672676 1, _T("FirstScaleY"));
673677 WriteDWORD(hKey,cfg->scalingfilter,cfgmask->scalingfilter,_T("ScalingFilter"));
 678+ WriteDWORD(hKey, cfg->BltScale, cfgmask->BltScale, _T("BltScale"));
 679+ WriteDWORD(hKey, cfg->BltThreshold, cfgmask->BltThreshold, _T("BltThreshold"));
674680 WriteDWORD(hKey,cfg->texfilter,cfgmask->texfilter,_T("TextureFilter"));
675681 WriteDWORD(hKey,cfg->anisotropic,cfgmask->anisotropic,_T("AnisotropicFiltering"));
676682 WriteDWORD(hKey,cfg->msaa,cfgmask->msaa,_T("Antialiasing"));
@@ -796,6 +802,12 @@
797803 ZeroMemory(cfg, sizeof(DXGLCFG));
798804 cfg->DPIScale = 1;
799805 cfg->AddModes = 1;
 806+ cfg->CustomResolutionX = 640;
 807+ cfg->CustomResolutionY = 480;
 808+ cfg->CustomRefresh = 60;
 809+ cfg->DisplayMultiplierX = 1.0f;
 810+ cfg->DisplayMultiplierY = 1.0f;
 811+ cfg->BltThreshold = 127;
800812 if (!cfg->Windows8Detected)
801813 {
802814 OSVERSIONINFO osver;
@@ -896,6 +908,8 @@
897909 if (!stricmp(section, "scaling"))
898910 {
899911 if (!stricmp(name, "ScalingFilter")) cfg->scalingfilter = INIIntValue(value);
 912+ if (!stricmp(name, "BltScale")) cfg->BltScale = INIIntValue(value);
 913+ if (!stricmp(name, "BltThreshold")) cfg->BltThreshold = INIIntValue(value);
900914 if (!stricmp(name, "AdjustPrimaryResolution")) cfg->primaryscale = INIIntValue(value);
901915 if (!stricmp(name, "PrimaryScaleX")) cfg->primaryscalex = INIFloatValue(value);
902916 if (!stricmp(name, "PrimaryScaleY")) cfg->primaryscaley = INIFloatValue(value);
Index: cfgmgr/cfgmgr.h
@@ -42,6 +42,8 @@
4343 float DisplayMultiplierY;
4444 // [scaling]
4545 DWORD scalingfilter;
 46+ DWORD BltScale;
 47+ DWORD BltThreshold;
4648 DWORD primaryscale;
4749 float primaryscalex;
4850 float primaryscaley;
Index: dxgl-example.ini
@@ -187,6 +187,23 @@
188188 ; 1 - Bilinear interpolation
189189 ScalingFilter = 0
190190
 191+; BltScale - Integer
 192+; Selects the filter to be used to scale Blt operations.
 193+; Default is 0
 194+; The following values are valid:
 195+; 0 - Nearest-neighbor stretching
 196+; 1 - Bilinear interpolation
 197+; 2 - Bilinear interpolation, sharp color key
 198+; 3 - Bilinear interpolation, soft color key
 199+BltScale = 0
 200+
 201+; BltThreshold - Integer
 202+; Sets the threshold point for sharp color key scaling.
 203+; 0 will trim the most, 254 will trim the least, and 255 will completely
 204+; disable color keying.
 205+; Default is 127
 206+BltThreshold = 127
 207+
191208 ; AdjustPrimaryResolution - Integer
192209 ; Determines whether or not to resize the buffers used to hold the primary
193210 ; buffers if scaling is enabled. Enabling this may cause graphical glitches