DXGL r772 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r771‎ | r772 | r773 >
Date:00:25, 8 December 2017
Author:admin
Status:new
Tags:
Comment:
Implement configuration of Blt filter, Low color rendering, and Enable dithering.
Modified paths:
  • /dxglcfg/dxglcfg.cpp (modified) (history)
  • /dxglcfg/dxglcfg.rc (modified) (history)
  • /dxglcfg/resource.h (modified) (history)

Diff [purge]

Index: dxglcfg/dxglcfg.cpp
@@ -1260,6 +1260,11 @@
12611261 *dirty = TRUE;
12621262 }
12631263 break;
 1264+ case IDC_BLTFILTER:
 1265+ cfg->BltScale = GetCombo(hWnd, IDC_BLTFILTER, &cfgmask->BltScale);
 1266+ EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
 1267+ *dirty = TRUE;
 1268+ break;
12641269 default:
12651270 break;
12661271 }
@@ -1299,6 +1304,16 @@
13001305 EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
13011306 *dirty = TRUE;
13021307 break;
 1308+ case IDC_LOWCOLORRENDER:
 1309+ cfg->LowColorRendering = GetCombo(hWnd, IDC_LOWCOLORRENDER, &cfgmask->LowColorRendering);
 1310+ EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
 1311+ *dirty = TRUE;
 1312+ break;
 1313+ case IDC_DITHERING:
 1314+ cfg->EnableDithering = GetCombo(hWnd, IDC_DITHERING, &cfgmask->EnableDithering);
 1315+ EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
 1316+ *dirty = TRUE;
 1317+ break;
13031318 default:
13041319 break;
13051320 }
@@ -1997,6 +2012,19 @@
19982013 _tcscpy(buffer,_T("Bilinear"));
19992014 SendDlgItemMessage(hTabs[0],IDC_SCALE,CB_ADDSTRING,1,(LPARAM)buffer);
20002015 SendDlgItemMessage(hTabs[0],IDC_SCALE,CB_SETCURSEL,cfg->scalingfilter,0);
 2016+ // Blt scaling filter
 2017+ _tcscpy(buffer, _T("Nearest"));
 2018+ SendDlgItemMessage(hTabs[1], IDC_BLTFILTER, CB_ADDSTRING, 0, (LPARAM)buffer);
 2019+ _tcscpy(buffer, _T("Bilinear"));
 2020+ SendDlgItemMessage(hTabs[1], IDC_BLTFILTER, CB_ADDSTRING, 1, (LPARAM)buffer);
 2021+ _tcscpy(buffer, _T("Bilinear, sharp colorkey"));
 2022+ SendDlgItemMessage(hTabs[1], IDC_BLTFILTER, CB_ADDSTRING, 2, (LPARAM)buffer);
 2023+ _tcscpy(buffer, _T("Bilinear, soft colorkey"));
 2024+ SendDlgItemMessage(hTabs[1], IDC_BLTFILTER, CB_ADDSTRING, 3, (LPARAM)buffer);
 2025+ SendDlgItemMessage(hTabs[1], IDC_BLTFILTER, CB_SETCURSEL, cfg->BltScale, 0);
 2026+ // Blt scaling threshold
 2027+ SendDlgItemMessage(hTabs[1], IDC_BLTTHRESHOLDSLIDER, TBM_SETRANGE, 0, 0xFE0000);
 2028+ SendDlgItemMessage(hTabs[1], IDC_BLTTHRESHOLDSLIDER, TBM_SETPOS, TRUE, cfg->BltThreshold);
20012029 // aspect
20022030 _tcscpy(buffer,_T("Default"));
20032031 SendDlgItemMessage(hTabs[0], IDC_ASPECT, CB_ADDSTRING, 0, (LPARAM)buffer);
@@ -2068,6 +2096,7 @@
20692097 SendDlgItemMessage(hTabs[2], IDC_ANISO, CB_SETCURSEL, cfg->anisotropic, 0);
20702098 }
20712099 // msaa
 2100+#ifdef _DEBUG
20722101 if(msaa_available)
20732102 {
20742103 _tcscpy(buffer,_T("Application default"));
@@ -2122,6 +2151,13 @@
21232152 EnableWindow(GetDlgItem(hTabs[2], IDC_MSAA), FALSE);
21242153 cfg->msaa = 0;
21252154 }
 2155+#else
 2156+ _tcscpy(buffer, _T("Not yet implemented"));
 2157+ SendDlgItemMessage(hTabs[2], IDC_MSAA, CB_ADDSTRING, 0, (LPARAM)buffer);
 2158+ SendDlgItemMessage(hTabs[2], IDC_MSAA, CB_SETCURSEL, 0, 0);
 2159+ EnableWindow(GetDlgItem(hTabs[2], IDC_MSAA), FALSE);
 2160+ cfg->msaa = 0;
 2161+#endif
21262162 // aspect3d
21272163 _tcscpy(buffer,_T("Stretch to display"));
21282164 SendDlgItemMessage(hTabs[2], IDC_ASPECT3D, CB_ADDSTRING, 0, (LPARAM)buffer);
@@ -2130,6 +2166,24 @@
21312167 _tcscpy(buffer,_T("Crop to display"));
21322168 SendDlgItemMessage(hTabs[2],IDC_ASPECT3D,CB_ADDSTRING,2,(LPARAM)buffer);
21332169 SendDlgItemMessage(hTabs[2],IDC_ASPECT3D,CB_SETCURSEL,cfg->aspect3d,0);
 2170+ // low color render
 2171+ _tcscpy(buffer, _T("Use surface color depth"));
 2172+ SendDlgItemMessage(hTabs[2], IDC_LOWCOLORRENDER, CB_ADDSTRING, 0, (LPARAM)buffer);
 2173+ _tcscpy(buffer, _T("Use 32-bpp color depth"));
 2174+ SendDlgItemMessage(hTabs[2], IDC_LOWCOLORRENDER, CB_ADDSTRING, 0, (LPARAM)buffer);
 2175+ SendDlgItemMessage(hTabs[2], IDC_LOWCOLORRENDER, CB_SETCURSEL, cfg->LowColorRendering, 0);
 2176+ // Enable dithering
 2177+ _tcscpy(buffer, _T("Application defined, low color"));
 2178+ SendDlgItemMessage(hTabs[2], IDC_DITHERING, CB_ADDSTRING, 0, (LPARAM)buffer);
 2179+ _tcscpy(buffer, _T("Disabled"));
 2180+ SendDlgItemMessage(hTabs[2], IDC_DITHERING, CB_ADDSTRING, 0, (LPARAM)buffer);
 2181+ _tcscpy(buffer, _T("Always enabled, low color"));
 2182+ SendDlgItemMessage(hTabs[2], IDC_DITHERING, CB_ADDSTRING, 0, (LPARAM)buffer);
 2183+ _tcscpy(buffer, _T("Application defined, all modes"));
 2184+ SendDlgItemMessage(hTabs[2], IDC_DITHERING, CB_ADDSTRING, 0, (LPARAM)buffer);
 2185+ _tcscpy(buffer, _T("Always enabled, low color"));
 2186+ SendDlgItemMessage(hTabs[2], IDC_DITHERING, CB_ADDSTRING, 0, (LPARAM)buffer);
 2187+ SendDlgItemMessage(hTabs[2], IDC_DITHERING, CB_SETCURSEL, cfg->EnableDithering, 0);
21342188 // sort modes
21352189 _tcscpy(buffer,_T("Use system order"));
21362190 SendDlgItemMessage(hTabs[0], IDC_SORTMODES, CB_ADDSTRING, 0, (LPARAM)buffer);
@@ -2486,13 +2540,19 @@
24872541 SendDlgItemMessage(hTabs[0], IDC_FULLMODE, CB_ADDSTRING, 0, (LPARAM)strdefault);
24882542 SendDlgItemMessage(hTabs[0], IDC_COLOR, BM_SETSTYLE, BS_AUTO3STATE, (LPARAM)TRUE);
24892543 SendDlgItemMessage(hTabs[0], IDC_SINGLEBUFFER, BM_SETSTYLE, BS_AUTO3STATE, (LPARAM)TRUE);
 2544+ // Effects tab
24902545 SendDlgItemMessage(hTabs[1], IDC_POSTSCALE, CB_ADDSTRING, 0, (LPARAM)strdefault);
24912546 SendDlgItemMessage(hTabs[1], IDC_POSTSCALESIZE, CB_ADDSTRING, 0, (LPARAM)strdefault);
24922547 SendDlgItemMessage(hTabs[1], IDC_PRIMARYSCALE, CB_ADDSTRING, 0, (LPARAM)strdefault);
 2548+ SendDlgItemMessage(hTabs[1], IDC_BLTFILTER, CB_ADDSTRING, 0, (LPARAM)strdefault);
 2549+ // 3D tab
24932550 SendDlgItemMessage(hTabs[2], IDC_TEXFILTER, CB_ADDSTRING, 0, (LPARAM)strdefault);
24942551 SendDlgItemMessage(hTabs[2], IDC_ANISO, CB_ADDSTRING, 0, (LPARAM)strdefault);
24952552 SendDlgItemMessage(hTabs[2], IDC_MSAA, CB_ADDSTRING, 0, (LPARAM)strdefault);
24962553 SendDlgItemMessage(hTabs[2], IDC_ASPECT3D, CB_ADDSTRING, 0, (LPARAM)strdefault);
 2554+ SendDlgItemMessage(hTabs[2], IDC_LOWCOLORRENDER, CB_ADDSTRING, 0, (LPARAM)strdefault);
 2555+ SendDlgItemMessage(hTabs[2], IDC_DITHERING, CB_ADDSTRING, 0, (LPARAM)strdefault);
 2556+ // Advanced tab
24972557 SendDlgItemMessage(hTabs[3],IDC_TEXTUREFORMAT,CB_ADDSTRING,0,(LPARAM)strdefault);
24982558 SendDlgItemMessage(hTabs[3],IDC_TEXUPLOAD,CB_ADDSTRING,0,(LPARAM)strdefault);
24992559 }
@@ -2520,6 +2580,7 @@
25212581 SendDlgItemMessage(hTabs[0], IDC_FULLMODE, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
25222582 SendDlgItemMessage(hTabs[0], IDC_COLOR, BM_SETSTYLE, BS_AUTOCHECKBOX, (LPARAM)TRUE);
25232583 SendDlgItemMessage(hTabs[0], IDC_SINGLEBUFFER, BM_SETSTYLE, BS_AUTOCHECKBOX, (LPARAM)TRUE);
 2584+ // Effects tab
25242585 SendDlgItemMessage(hTabs[1], IDC_POSTSCALE, CB_DELETESTRING,
25252586 SendDlgItemMessage(hTabs[1], IDC_POSTSCALE, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
25262587 SendDlgItemMessage(hTabs[1], IDC_POSTSCALESIZE, CB_DELETESTRING,
@@ -2526,6 +2587,9 @@
25272588 SendDlgItemMessage(hTabs[1], IDC_POSTSCALESIZE, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
25282589 SendDlgItemMessage(hTabs[1], IDC_PRIMARYSCALE, CB_DELETESTRING,
25292590 SendDlgItemMessage(hTabs[1], IDC_PRIMARYSCALE, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
 2591+ SendDlgItemMessage(hTabs[1], IDC_BLTFILTER, CB_DELETESTRING,
 2592+ SendDlgItemMessage(hTabs[1], IDC_BLTFILTER, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
 2593+ // 3D tab
25302594 SendDlgItemMessage(hTabs[2], IDC_TEXFILTER, CB_DELETESTRING,
25312595 SendDlgItemMessage(hTabs[2], IDC_TEXFILTER, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
25322596 SendDlgItemMessage(hTabs[2], IDC_ANISO, CB_DELETESTRING,
@@ -2534,6 +2598,11 @@
25352599 SendDlgItemMessage(hTabs[2], IDC_MSAA, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
25362600 SendDlgItemMessage(hTabs[2], IDC_ASPECT3D, CB_DELETESTRING,
25372601 SendDlgItemMessage(hTabs[2], IDC_ASPECT3D, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
 2602+ SendDlgItemMessage(hTabs[2], IDC_LOWCOLORRENDER, CB_DELETESTRING,
 2603+ SendDlgItemMessage(hTabs[2], IDC_LOWCOLORRENDER, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
 2604+ SendDlgItemMessage(hTabs[2], IDC_DITHERING, CB_DELETESTRING,
 2605+ SendDlgItemMessage(hTabs[2], IDC_DITHERING, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
 2606+ // Advanced tab
25382607 SendDlgItemMessage(hTabs[3],IDC_TEXTUREFORMAT,CB_DELETESTRING,
25392608 SendDlgItemMessage(hTabs[3],IDC_ASPECT3D,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
25402609 SendDlgItemMessage(hTabs[3],IDC_TEXUPLOAD,CB_DELETESTRING,
@@ -2552,7 +2621,6 @@
25532622 SetCombo(hTabs[0], IDC_FULLMODE, cfg->fullmode, cfgmask->fullmode, tristate);
25542623 SetCheck(hTabs[0], IDC_COLOR, cfg->colormode, cfgmask->colormode, tristate);
25552624 SetCheck(hTabs[0], IDC_SINGLEBUFFER, cfg->SingleBufferDevice, cfgmask->SingleBufferDevice, tristate);
2556 - SetCombo(hTabs[1], IDC_POSTSCALE, cfg->postfilter, cfgmask->postfilter, tristate);
25572625 if (cfg->scaler == 8)
25582626 {
25592627 EnableWindow(GetDlgItem(hTabs[0], IDC_FIXEDSCALELABEL), TRUE);
@@ -2583,14 +2651,18 @@
25842652 }
25852653 SetFloat3place(hTabs[0], IDC_FIXEDSCALEX, cfg->DisplayMultiplierX, cfgmask->DisplayMultiplierX);
25862654 SetFloat3place(hTabs[0], IDC_FIXEDSCALEY, cfg->DisplayMultiplierY, cfgmask->DisplayMultiplierY);
 2655+ SetCombo(hTabs[1], IDC_POSTSCALE, cfg->postfilter, cfgmask->postfilter, tristate);
25872656 SetPostScaleCombo(hTabs[1], IDC_POSTSCALESIZE, cfg->postsizex, cfg->postsizey,
25882657 cfgmask->postsizex , cfgmask->postsizey, tristate);
25892658 SetCombo(hTabs[1], IDC_PRIMARYSCALE, cfg->primaryscale, cfgmask->primaryscale, tristate);
25902659 SetText(hTabs[1], IDC_SHADER, cfg->shaderfile, cfgmask->shaderfile, tristate);
 2660+ SetCombo(hTabs[1], IDC_BLTFILTER, cfg->BltScale, cfgmask->BltScale, tristate);
25912661 SetCombo(hTabs[2], IDC_TEXFILTER, cfg->texfilter, cfgmask->texfilter, tristate);
25922662 SetCombo(hTabs[2], IDC_ANISO, cfg->anisotropic, cfgmask->anisotropic, tristate);
25932663 SetCombo(hTabs[2], IDC_MSAA, cfg->msaa, cfgmask->msaa, tristate);
25942664 SetCombo(hTabs[2], IDC_ASPECT3D, cfg->aspect3d, cfgmask->aspect3d, tristate);
 2665+ SetCombo(hTabs[2], IDC_LOWCOLORRENDER, cfg->LowColorRendering, cfgmask->LowColorRendering, tristate);
 2666+ SetCombo(hTabs[2], IDC_DITHERING, cfg->EnableDithering, cfgmask->EnableDithering, tristate);
25952667 SetCombo(hTabs[3],IDC_TEXTUREFORMAT,cfg->TextureFormat,cfgmask->TextureFormat,tristate);
25962668 SetCombo(hTabs[3],IDC_TEXUPLOAD,cfg->TexUpload,cfgmask->TexUpload,tristate);
25972669 RedrawWindow(GetDlgItem(hTabs[4], IDC_DEBUGLIST), NULL, NULL, RDW_INVALIDATE);
Index: dxglcfg/dxglcfg.rc
@@ -214,12 +214,13 @@
215215 LTEXT "Blt Scaling Filter", IDC_STATIC, 114, 58, 52, 8, SS_LEFT, WS_EX_LEFT
216216 COMBOBOX IDC_BLTFILTER, 114, 68, 102, 92, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
217217 LTEXT "Blt Color Key Threshold", 0, 114, 83, 76, 9, SS_LEFT, WS_EX_LEFT
218 - CONTROL "", IDC_BLTTHRESHOLD, TRACKBAR_CLASS, WS_TABSTOP | TBS_BOTH | TBS_NOTICKS, 114, 93, 102, 15, WS_EX_LEFT
219218 LTEXT "Custom scale", IDC_CUSTOMSCALELABEL, 7, 83, 44, 8, WS_DISABLED | SS_LEFT, WS_EX_LEFT
220219 LTEXT "X", IDC_CUSTOMSCALELABELX, 7, 97, 8, 8, WS_DISABLED | SS_LEFT, WS_EX_LEFT
221220 EDITTEXT IDC_CUSTOMSCALEX, 15, 94, 40, 14, WS_DISABLED | ES_AUTOHSCROLL, WS_EX_LEFT
222221 LTEXT "Y", IDC_CUSTOMSCALELABELY, 57, 97, 8, 8, WS_DISABLED | SS_LEFT, WS_EX_LEFT
223222 EDITTEXT IDC_CUSTOMSCALEY, 65, 94, 40, 14, WS_DISABLED | ES_AUTOHSCROLL, WS_EX_LEFT
 223+ 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
224225 }
225226
226227
Index: dxglcfg/resource.h
@@ -85,12 +85,13 @@
8686 #define IDC_BROWSESHADER 2105
8787 #define IDC_PRIMARYSCALE 2106
8888 #define IDC_BLTFILTER 2107
89 -#define IDC_BLTTHRESHOLD 2108
90 -#define IDC_CUSTOMSCALELABEL 2109
91 -#define IDC_CUSTOMSCALELABELX 2110
92 -#define IDC_CUSTOMSCALEX 2111
93 -#define IDC_CUSTOMSCALELABELY 2112
94 -#define IDC_CUSTOMSCALEY 2113
 89+#define IDC_CUSTOMSCALELABEL 2108
 90+#define IDC_CUSTOMSCALELABELX 2109
 91+#define IDC_CUSTOMSCALEX 2110
 92+#define IDC_CUSTOMSCALELABELY 2111
 93+#define IDC_CUSTOMSCALEY 2112
 94+#define IDC_BLTTHRESHOLDSLIDER 2113
 95+#define IDC_BLTTHRESHOLD 2114
9596
9697 // Controls - 3D Graphics Tab
9798 #define IDC_TEXFILTER 2201