DXGL r775 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r774‎ | r775 | r776 >
Date:06:37, 14 December 2017
Author:admin
Status:new
Tags:
Comment:
Add Color key Blt threshold to DXGL Config.
Update copyright date of the DXGL Test integrated into DXGL Config.
Modified paths:
  • /dxglcfg/dxglcfg.cpp (modified) (history)
  • /dxglcfg/dxglcfg.rc (modified) (history)
  • /dxglcfg/dxgltest.cpp (modified) (history)

Diff [purge]

Index: dxglcfg/dxglcfg.cpp
@@ -549,6 +549,16 @@
550550 EditInterlock = FALSE;
551551 }
552552
 553+void SetInteger(HWND hWnd, int DlgItem, int value, int mask)
 554+{
 555+ TCHAR number[32];
 556+ if (mask) _itot(value, number, 10);
 557+ else number[0] = 0;
 558+ EditInterlock = TRUE;
 559+ SendDlgItemMessage(hWnd, DlgItem, WM_SETTEXT, 0, (LPARAM)number);
 560+ EditInterlock = FALSE;
 561+}
 562+
553563 void SetResolution(HWND hWnd, int DlgItem, const DXGLCFG *cfg, const DXGLCFG *cfgmask)
554564 {
555565 TCHAR output[104];
@@ -692,6 +702,30 @@
693703 }
694704 }
695705
 706+int GetInteger(HWND hWnd, int dlgitem, int *mask, int defaultnum)
 707+{
 708+ TCHAR buffer[32];
 709+ SendDlgItemMessage(hWnd, dlgitem, WM_GETTEXT, 32, (LPARAM)buffer);
 710+ if (buffer[0] == 0)
 711+ {
 712+ if (!current_app)
 713+ {
 714+ *mask = 1;
 715+ return defaultnum;
 716+ }
 717+ else
 718+ {
 719+ *mask = 0;
 720+ return defaultnum;
 721+ }
 722+ }
 723+ else
 724+ {
 725+ *mask = 1;
 726+ return _ttoi(buffer);
 727+ }
 728+}
 729+
696730 void ProcessResolutionString(LPTSTR input)
697731 {
698732 DWORD x, y, refresh;
@@ -1618,6 +1652,23 @@
16191653 SetFloat3place(hWnd, IDC_CUSTOMSCALEY, cfg->primaryscaley, cfgmask->primaryscaley);
16201654 }
16211655 break;
 1656+ case IDC_BLTTHRESHOLD:
 1657+ if (HIWORD(wParam) == EN_CHANGE)
 1658+ {
 1659+ if (!EditInterlock)
 1660+ {
 1661+ cfg->BltThreshold = GetInteger(hWnd, IDC_BLTTHRESHOLD, (int*)&cfgmask->BltThreshold, 127);
 1662+ if (cfg->BltThreshold > 255) cfg->BltThreshold = 255;
 1663+ SendDlgItemMessage(hWnd, IDC_BLTTHRESHOLDSLIDER, TBM_SETPOS, TRUE, cfg->BltThreshold);
 1664+ EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
 1665+ *dirty = TRUE;
 1666+ }
 1667+ }
 1668+ if (HIWORD(wParam) == EN_KILLFOCUS)
 1669+ {
 1670+ SetInteger(hWnd, IDC_BLTTHRESHOLD, cfg->BltThreshold, cfgmask->BltThreshold);
 1671+ }
 1672+ break;
16221673 case IDC_SHADER:
16231674 if (HIWORD(wParam) == EN_CHANGE)
16241675 {
@@ -1634,6 +1685,28 @@
16351686 default:
16361687 break;
16371688 }
 1689+ case WM_HSCROLL:
 1690+ switch (LOWORD(wParam))
 1691+ {
 1692+ case TB_ENDTRACK:
 1693+ case TB_THUMBTRACK:
 1694+ case TB_THUMBPOSITION:
 1695+ case TB_BOTTOM:
 1696+ case TB_TOP:
 1697+ case TB_LINEDOWN:
 1698+ case TB_LINEUP:
 1699+ case TB_PAGEDOWN:
 1700+ case TB_PAGEUP:
 1701+ cfgmask->BltThreshold = 1;
 1702+ cfg->BltThreshold = SendDlgItemMessage(hWnd, IDC_BLTTHRESHOLDSLIDER, TBM_GETPOS, 0, 0);
 1703+ SetInteger(hWnd, IDC_BLTTHRESHOLD, cfg->BltThreshold, cfgmask->BltThreshold);
 1704+ EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
 1705+ *dirty = TRUE;
 1706+ break;
 1707+ default:
 1708+ break;
 1709+ }
 1710+ break;
16381711 default:
16391712 return FALSE;
16401713 }
@@ -2412,6 +2485,8 @@
24132486 // Blt scaling threshold
24142487 SendDlgItemMessage(hTabs[1], IDC_BLTTHRESHOLDSLIDER, TBM_SETRANGE, 0, 0xFE0000);
24152488 SendDlgItemMessage(hTabs[1], IDC_BLTTHRESHOLDSLIDER, TBM_SETPOS, TRUE, cfg->BltThreshold);
 2489+ SendDlgItemMessage(hTabs[1], IDC_BLTTHRESHOLD, EM_SETLIMITTEXT, 3, 0);
 2490+ SetInteger(hTabs[1], IDC_BLTTHRESHOLD, cfg->BltThreshold, cfgmask->BltThreshold);
24162491 // aspect
24172492 _tcscpy(buffer,_T("Default"));
24182493 SendDlgItemMessage(hTabs[0], IDC_ASPECT, CB_ADDSTRING, 0, (LPARAM)buffer);
@@ -3045,6 +3120,7 @@
30463121 SetFloat3place(hTabs[0], IDC_FIXEDSCALEX, cfg->DisplayMultiplierX, cfgmask->DisplayMultiplierX);
30473122 SetFloat3place(hTabs[0], IDC_FIXEDSCALEY, cfg->DisplayMultiplierY, cfgmask->DisplayMultiplierY);
30483123 SetResolution(hTabs[0], IDC_CUSTOMMODE, cfg, cfgmask);
 3124+ // Effects tab
30493125 SetCombo(hTabs[1], IDC_POSTSCALE, cfg->postfilter, cfgmask->postfilter, tristate);
30503126 SetPostScaleCombo(hTabs[1], IDC_POSTSCALESIZE, cfg->postsizex, cfg->postsizey,
30513127 cfgmask->postsizex , cfgmask->postsizey, tristate);
@@ -3069,6 +3145,13 @@
30703146 SetFloat3place(hTabs[1], IDC_CUSTOMSCALEY, cfg->primaryscaley, cfgmask->primaryscaley);
30713147 SetText(hTabs[1], IDC_SHADER, cfg->shaderfile, cfgmask->shaderfile, tristate);
30723148 SetCombo(hTabs[1], IDC_BLTFILTER, cfg->BltScale, cfgmask->BltScale, tristate);
 3149+ SetInteger(hTabs[1], IDC_BLTTHRESHOLD, cfg->BltThreshold, cfgmask->BltThreshold);
 3150+ if (cfgmask->BltThreshold)
 3151+ {
 3152+ SendDlgItemMessage(hTabs[1], IDC_BLTTHRESHOLDSLIDER, TBM_SETPOS, TRUE, cfg->BltThreshold);
 3153+ }
 3154+ else SendDlgItemMessage(hTabs[1], IDC_BLTTHRESHOLDSLIDER, TBM_SETPOS, TRUE, 127);
 3155+ // 3D tab
30733156 SetCombo(hTabs[2], IDC_TEXFILTER, cfg->texfilter, cfgmask->texfilter, tristate);
30743157 SetCombo(hTabs[2], IDC_ANISO, cfg->anisotropic, cfgmask->anisotropic, tristate);
30753158 SetCombo(hTabs[2], IDC_MSAA, cfg->msaa, cfgmask->msaa, tristate);
@@ -3075,9 +3158,13 @@
30763159 SetCombo(hTabs[2], IDC_ASPECT3D, cfg->aspect3d, cfgmask->aspect3d, tristate);
30773160 SetCombo(hTabs[2], IDC_LOWCOLORRENDER, cfg->LowColorRendering, cfgmask->LowColorRendering, tristate);
30783161 SetCombo(hTabs[2], IDC_DITHERING, cfg->EnableDithering, cfgmask->EnableDithering, tristate);
 3162+ // Advanced tab
30793163 SetCombo(hTabs[3],IDC_TEXTUREFORMAT,cfg->TextureFormat,cfgmask->TextureFormat,tristate);
30803164 SetCombo(hTabs[3],IDC_TEXUPLOAD,cfg->TexUpload,cfgmask->TexUpload,tristate);
 3165+ // Debug tab
30813166 RedrawWindow(GetDlgItem(hTabs[4], IDC_DEBUGLIST), NULL, NULL, RDW_INVALIDATE);
 3167+ // Hacks tab
 3168+ RedrawWindow(GetDlgItem(hTabs[5], IDC_HACKSLIST), NULL, NULL, RDW_INVALIDATE);
30823169 }
30833170 break;
30843171 case IDC_ADD:
Index: dxglcfg/dxglcfg.rc
@@ -220,7 +220,7 @@
221221 LTEXT "Y", IDC_CUSTOMSCALELABELY, 57, 97, 8, 8, WS_DISABLED | SS_LEFT, WS_EX_LEFT
222222 EDITTEXT IDC_CUSTOMSCALEY, 65, 94, 40, 14, WS_DISABLED | ES_AUTOHSCROLL, WS_EX_LEFT
223223 CONTROL "", IDC_BLTTHRESHOLDSLIDER, TRACKBAR_CLASS, WS_TABSTOP | TBS_BOTH | TBS_NOTICKS, 114, 93, 79, 15, WS_EX_LEFT
224 - EDITTEXT IDC_BLTTHRESHOLD, 195, 94, 21, 14, ES_AUTOHSCROLL, WS_EX_LEFT
 224+ EDITTEXT IDC_BLTTHRESHOLD, 195, 94, 21, 14, ES_AUTOHSCROLL | ES_NUMBER, WS_EX_LEFT
225225 }
226226
227227
Index: dxglcfg/dxgltest.cpp
@@ -1,5 +1,5 @@
22 // DXGL
3 -// Copyright (C) 2011-2013 William Feely
 3+// Copyright (C) 2011-2017 William Feely
44
55 // This library is free software; you can redistribute it and/or
66 // modify it under the terms of the GNU Lesser General Public