DXGL r774 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r773‎ | r774 | r775 >
Date:06:06, 14 December 2017
Author:admin
Status:new
Tags:
Comment:
Add custom primary scaling to DXGL Config.
Modified paths:
  • /cfgmgr/cfgmgr.c (modified) (history)
  • /dxgl-example.ini (modified) (history)
  • /dxglcfg/dxglcfg.cpp (modified) (history)
  • /dxglcfg/dxglcfg.rc (modified) (history)

Diff [purge]

Index: cfgmgr/cfgmgr.c
@@ -666,6 +666,8 @@
667667 defaultmask.postsizey = 1.0f;
668668 defaultmask.DisplayMultiplierX = 1.0f;
669669 defaultmask.DisplayMultiplierY = 1.0f;
 670+ defaultmask.primaryscalex = 1.0f;
 671+ defaultmask.primaryscaley = 1.0f;
670672 WriteDWORD(hKey,cfg->scaler,cfgmask->scaler,_T("ScalingMode"));
671673 WriteDWORD(hKey, cfg->fullmode, cfgmask->fullmode, _T("FullscreenWindowMode"));
672674 WriteBool(hKey,cfg->colormode,cfgmask->colormode,_T("ChangeColorDepth"));
@@ -811,6 +813,8 @@
812814 cfg->CustomRefresh = 60;
813815 cfg->DisplayMultiplierX = 1.0f;
814816 cfg->DisplayMultiplierY = 1.0f;
 817+ cfg->primaryscalex = 1.0f;
 818+ cfg->primaryscaley = 1.0f;
815819 cfg->BltThreshold = 127;
816820 if (!cfg->Windows8Detected)
817821 {
Index: dxgl-example.ini
@@ -226,7 +226,7 @@
227227 AdjustPrimaryResolution = 0
228228
229229 ; PrimaryScaleX - Floating point
230 -; (future) Sets the scaling amount in the X dimension for custom primary
 230+; Sets the scaling amount in the X dimension for custom primary
231231 ; buffer scaling.
232232 ; If zero, negative, or an invalid value, will be interpreted as 1.0
233233 ; Default is 1.0
@@ -233,7 +233,7 @@
234234 PrimaryScaleX = 1.0
235235
236236 ; PrimaryScaleY - Floating point
237 -; (future) Sets the scaling amount in the Y dimension for custom primary
 237+; Sets the scaling amount in the Y dimension for custom primary
238238 ; buffer scaling.
239239 ; If zero, negative, or an invalid value, will be interpreted as 1.0
240240 ; Default is 1.0
Index: dxglcfg/dxglcfg.cpp
@@ -1571,7 +1571,53 @@
15721572 cfg->primaryscale = GetCombo(hWnd, IDC_PRIMARYSCALE, &cfgmask->primaryscale);
15731573 EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
15741574 *dirty = TRUE;
 1575+ if (cfg->primaryscale == 12)
 1576+ {
 1577+ EnableWindow(GetDlgItem(hWnd, IDC_CUSTOMSCALELABEL), TRUE);
 1578+ EnableWindow(GetDlgItem(hWnd, IDC_CUSTOMSCALELABELX), TRUE);
 1579+ EnableWindow(GetDlgItem(hWnd, IDC_CUSTOMSCALEX), TRUE);
 1580+ EnableWindow(GetDlgItem(hWnd, IDC_CUSTOMSCALELABELY), TRUE);
 1581+ EnableWindow(GetDlgItem(hWnd, IDC_CUSTOMSCALEY), TRUE);
 1582+ }
 1583+ else
 1584+ {
 1585+ EnableWindow(GetDlgItem(hWnd, IDC_CUSTOMSCALELABEL), FALSE);
 1586+ EnableWindow(GetDlgItem(hWnd, IDC_CUSTOMSCALELABELX), FALSE);
 1587+ EnableWindow(GetDlgItem(hWnd, IDC_CUSTOMSCALEX), FALSE);
 1588+ EnableWindow(GetDlgItem(hWnd, IDC_CUSTOMSCALELABELY), FALSE);
 1589+ EnableWindow(GetDlgItem(hWnd, IDC_CUSTOMSCALEY), FALSE);
 1590+ }
15751591 break;
 1592+ case IDC_CUSTOMSCALEX:
 1593+ if (HIWORD(wParam) == EN_CHANGE)
 1594+ {
 1595+ if (!EditInterlock)
 1596+ {
 1597+ cfg->primaryscalex = GetFloat(hWnd, IDC_CUSTOMSCALEX, &cfgmask->primaryscalex);
 1598+ EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
 1599+ *dirty = TRUE;
 1600+ }
 1601+ }
 1602+ if (HIWORD(wParam) == EN_KILLFOCUS)
 1603+ {
 1604+ SetFloat3place(hWnd, IDC_CUSTOMSCALEX, cfg->primaryscalex, cfgmask->primaryscalex);
 1605+ }
 1606+ break;
 1607+ case IDC_CUSTOMSCALEY:
 1608+ if (HIWORD(wParam) == EN_CHANGE)
 1609+ {
 1610+ if (!EditInterlock)
 1611+ {
 1612+ cfg->primaryscaley = GetFloat(hWnd, IDC_CUSTOMSCALEY, &cfgmask->primaryscaley);
 1613+ EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
 1614+ *dirty = TRUE;
 1615+ }
 1616+ }
 1617+ if (HIWORD(wParam) == EN_KILLFOCUS)
 1618+ {
 1619+ SetFloat3place(hWnd, IDC_CUSTOMSCALEY, cfg->primaryscaley, cfgmask->primaryscaley);
 1620+ }
 1621+ break;
15761622 case IDC_SHADER:
15771623 if (HIWORD(wParam) == EN_CHANGE)
15781624 {
@@ -2328,6 +2374,25 @@
23292375 _tcscpy(buffer, _T("Custom scale"));
23302376 SendDlgItemMessage(hTabs[1], IDC_PRIMARYSCALE, CB_ADDSTRING, 0, (LPARAM)buffer);
23312377 SendDlgItemMessage(hTabs[1], IDC_PRIMARYSCALE, CB_SETCURSEL, cfg->primaryscale, 0);
 2378+ // Primary scaling size
 2379+ if (cfg->primaryscale == 12)
 2380+ {
 2381+ EnableWindow(GetDlgItem(hTabs[1],IDC_CUSTOMSCALELABEL), TRUE);
 2382+ EnableWindow(GetDlgItem(hTabs[1],IDC_CUSTOMSCALELABELX), TRUE);
 2383+ EnableWindow(GetDlgItem(hTabs[1],IDC_CUSTOMSCALEX), TRUE);
 2384+ EnableWindow(GetDlgItem(hTabs[1],IDC_CUSTOMSCALELABELY), TRUE);
 2385+ EnableWindow(GetDlgItem(hTabs[1],IDC_CUSTOMSCALEY), TRUE);
 2386+ }
 2387+ else
 2388+ {
 2389+ EnableWindow(GetDlgItem(hTabs[1], IDC_CUSTOMSCALELABEL), FALSE);
 2390+ EnableWindow(GetDlgItem(hTabs[1], IDC_CUSTOMSCALELABELX), FALSE);
 2391+ EnableWindow(GetDlgItem(hTabs[1], IDC_CUSTOMSCALEX), FALSE);
 2392+ EnableWindow(GetDlgItem(hTabs[1], IDC_CUSTOMSCALELABELY), FALSE);
 2393+ EnableWindow(GetDlgItem(hTabs[1], IDC_CUSTOMSCALEY), FALSE);
 2394+ }
 2395+ SetFloat3place(hTabs[1], IDC_CUSTOMSCALEX, cfg->primaryscalex, cfgmask->primaryscalex);
 2396+ SetFloat3place(hTabs[1], IDC_CUSTOMSCALEY, cfg->primaryscaley, cfgmask->primaryscaley);
23322397 // scaling filter
23332398 _tcscpy(buffer,_T("Nearest"));
23342399 SendDlgItemMessage(hTabs[0], IDC_SCALE, CB_ADDSTRING, 0, (LPARAM)buffer);
@@ -2984,6 +3049,24 @@
29853050 SetPostScaleCombo(hTabs[1], IDC_POSTSCALESIZE, cfg->postsizex, cfg->postsizey,
29863051 cfgmask->postsizex , cfgmask->postsizey, tristate);
29873052 SetCombo(hTabs[1], IDC_PRIMARYSCALE, cfg->primaryscale, cfgmask->primaryscale, tristate);
 3053+ if (cfg->primaryscale == 12)
 3054+ {
 3055+ EnableWindow(GetDlgItem(hTabs[1], IDC_CUSTOMSCALELABEL), TRUE);
 3056+ EnableWindow(GetDlgItem(hTabs[1], IDC_CUSTOMSCALELABELX), TRUE);
 3057+ EnableWindow(GetDlgItem(hTabs[1], IDC_CUSTOMSCALEX), TRUE);
 3058+ EnableWindow(GetDlgItem(hTabs[1], IDC_CUSTOMSCALELABELY), TRUE);
 3059+ EnableWindow(GetDlgItem(hTabs[1], IDC_CUSTOMSCALEY), TRUE);
 3060+ }
 3061+ else
 3062+ {
 3063+ EnableWindow(GetDlgItem(hTabs[1], IDC_CUSTOMSCALELABEL), FALSE);
 3064+ EnableWindow(GetDlgItem(hTabs[1], IDC_CUSTOMSCALELABELX), FALSE);
 3065+ EnableWindow(GetDlgItem(hTabs[1], IDC_CUSTOMSCALEX), FALSE);
 3066+ EnableWindow(GetDlgItem(hTabs[1], IDC_CUSTOMSCALELABELY), FALSE);
 3067+ EnableWindow(GetDlgItem(hTabs[1], IDC_CUSTOMSCALEY), FALSE);
 3068+ }
 3069+ SetFloat3place(hTabs[1], IDC_CUSTOMSCALEX, cfg->primaryscalex, cfgmask->primaryscalex);
 3070+ SetFloat3place(hTabs[1], IDC_CUSTOMSCALEY, cfg->primaryscaley, cfgmask->primaryscaley);
29883071 SetText(hTabs[1], IDC_SHADER, cfg->shaderfile, cfgmask->shaderfile, tristate);
29893072 SetCombo(hTabs[1], IDC_BLTFILTER, cfg->BltScale, cfgmask->BltScale, tristate);
29903073 SetCombo(hTabs[2], IDC_TEXFILTER, cfg->texfilter, cfgmask->texfilter, tristate);
Index: dxglcfg/dxglcfg.rc
@@ -206,7 +206,7 @@
207207 COMBOBOX IDC_POSTSCALE, 7, 17, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
208208 LTEXT "Postprocess input multiplier", IDC_STATIC, 114, 7, 90, 9, SS_LEFT, WS_EX_LEFT
209209 COMBOBOX IDC_POSTSCALESIZE, 114, 17, 102, 30, CBS_DROPDOWN | CBS_HASSTRINGS, WS_EX_LEFT
210 - AUTOCHECKBOX "Use post-processing shader", IDC_USESHADER, 7, 33, 103, 8, 0, WS_EX_LEFT
 210+ AUTOCHECKBOX "Use post-processing shader", IDC_USESHADER, 7, 33, 103, 8, WS_DISABLED, WS_EX_LEFT
211211 COMBOBOX IDC_SHADER, 7, 43, 247, 92, WS_DISABLED | CBS_DROPDOWN | CBS_HASSTRINGS, WS_EX_LEFT
212212 PUSHBUTTON "...", IDC_BROWSESHADER, 256, 42, 20, 14, WS_DISABLED, WS_EX_LEFT
213213 LTEXT "Primary buffer scaling", IDC_STATIC, 7, 58, 70, 8, SS_LEFT, WS_EX_LEFT