DXGL r767 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r766‎ | r767 | r768 >
Date:07:03, 5 December 2017
Author:admin
Status:new
Tags:
Comment:
Rearrange display tab.
Add new scaling options to DXGL Config.
Tweak to fix cut off text on high DPI.
Modified paths:
  • /cfgmgr/cfgmgr.c (modified) (history)
  • /dxglcfg/dxglcfg.cpp (modified) (history)
  • /dxglcfg/dxglcfg.rc (modified) (history)
  • /dxglcfg/resource.h (modified) (history)

Diff [purge]

Index: cfgmgr/cfgmgr.c
@@ -579,7 +579,7 @@
580580 GetDirFromPath(path);
581581 error = RegQueryValueEx(hKey,_T("InstallPath"),NULL,&regsz,NULL,&sizeout);
582582 if(error == ERROR_FILE_NOT_FOUND)
583 - RegSetValueEx(hKey, _T("InstallPath"), 0, REG_MULTI_SZ,
 583+ RegSetValueEx(hKey, _T("InstallPath"), 0, REG_SZ,
584584 (LPBYTE)path, _tcslen(path) * sizeof(TCHAR));
585585 }
586586 }
Index: dxglcfg/dxglcfg.cpp
@@ -1791,7 +1791,13 @@
17921792 _tcscpy(buffer,_T("Center if mode not found"));
17931793 SendDlgItemMessage(hTabs[0], IDC_VIDMODE, CB_ADDSTRING, 6, (LPARAM)buffer);
17941794 _tcscpy(buffer,_T("Crop to screen"));
1795 - SendDlgItemMessage(hTabs[0],IDC_VIDMODE,CB_ADDSTRING,7,(LPARAM)buffer);
 1795+ SendDlgItemMessage(hTabs[0], IDC_VIDMODE, CB_ADDSTRING, 7, (LPARAM)buffer);
 1796+ _tcscpy(buffer, _T("Custom size multiplier"));
 1797+ SendDlgItemMessage(hTabs[0], IDC_VIDMODE, CB_ADDSTRING, 8, (LPARAM)buffer);
 1798+ _tcscpy(buffer, _T("Custom display mode"));
 1799+ SendDlgItemMessage(hTabs[0], IDC_VIDMODE, CB_ADDSTRING, 9, (LPARAM)buffer);
 1800+ _tcscpy(buffer, _T("Custom size, centered"));
 1801+ SendDlgItemMessage(hTabs[0], IDC_VIDMODE, CB_ADDSTRING, 10, (LPARAM)buffer);
17961802 SendDlgItemMessage(hTabs[0],IDC_VIDMODE,CB_SETCURSEL,cfg->scaler,0);
17971803 // fullscreen window mode
17981804 _tcscpy(buffer, _T("Exclusive fullscreen"));
@@ -1807,6 +1813,14 @@
18081814 _tcscpy(buffer, _T("Borderless window (scaled)"));
18091815 SendDlgItemMessage(hTabs[0], IDC_FULLMODE, CB_ADDSTRING, 5, (LPARAM)buffer);
18101816 SendDlgItemMessage(hTabs[0], IDC_FULLMODE, CB_SETCURSEL, cfg->fullmode, 0);
 1817+ // vsync mode
 1818+ _tcscpy(buffer, _T("Application default"));
 1819+ SendDlgItemMessage(hTabs[0], IDC_VSYNC, CB_ADDSTRING, 0, (LPARAM)buffer);
 1820+ _tcscpy(buffer, _T("Disabled"));
 1821+ SendDlgItemMessage(hTabs[0], IDC_VSYNC, CB_ADDSTRING, 1, (LPARAM)buffer);
 1822+ _tcscpy(buffer, _T("Enabled every flip or primary Blt"));
 1823+ SendDlgItemMessage(hTabs[0], IDC_VSYNC, CB_ADDSTRING, 2, (LPARAM)buffer);
 1824+ SendDlgItemMessage(hTabs[0], IDC_VSYNC, CB_SETCURSEL, cfg->vsync, 0);
18111825 // colormode
18121826 if (cfg->colormode) SendDlgItemMessage(hTabs[0], IDC_COLOR, BM_SETCHECK, BST_CHECKED, 0);
18131827 else SendDlgItemMessage(hTabs[0], IDC_COLOR, BM_SETCHECK, BST_UNCHECKED, 0);
@@ -1813,13 +1827,13 @@
18141828 // single buffer
18151829 if(cfg->SingleBufferDevice) SendDlgItemMessage(hTabs[0], IDC_SINGLEBUFFER, BM_SETCHECK, BST_CHECKED, 0);
18161830 else SendDlgItemMessage(hTabs[0], IDC_SINGLEBUFFER, BM_SETCHECK, BST_UNCHECKED, 0);
1817 - // first scaling filter
 1831+ // postprocess scaling filter
18181832 _tcscpy(buffer, _T("Nearest"));
18191833 SendDlgItemMessage(hTabs[1], IDC_POSTSCALE, CB_ADDSTRING, 0, (LPARAM)buffer);
18201834 _tcscpy(buffer, _T("Bilinear"));
18211835 SendDlgItemMessage(hTabs[1], IDC_POSTSCALE, CB_ADDSTRING, 1, (LPARAM)buffer);
18221836 SendDlgItemMessage(hTabs[1], IDC_POSTSCALE, CB_SETCURSEL, cfg->postfilter, 0);
1823 - // first scaling sizes
 1837+ // postprocess scaling sizes
18241838 _tcscpy(buffer, _T("Auto"));
18251839 SendDlgItemMessage(hTabs[1], IDC_POSTSCALESIZE, CB_ADDSTRING, 0, (LPARAM)buffer);
18261840 _tcscpy(buffer, _T("1x"));
Index: dxglcfg/dxglcfg.rc
@@ -56,28 +56,30 @@
5757 COMBOBOX IDC_VIDMODE, 7, 17, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
5858 LTEXT "Add color depths", IDC_STATIC, 114, 7, 54, 8, SS_LEFT, WS_EX_LEFT
5959 COMBOBOX IDC_COLORDEPTH, 114, 17, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_OWNERDRAWFIXED, WS_EX_LEFT
60 - LTEXT "Scaling method", IDC_STATIC, 7, 32, 50, 9, SS_LEFT, WS_EX_LEFT
61 - COMBOBOX IDC_SCALE, 7, 43, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
62 - LTEXT "Additional display modes", IDC_STATIC, 114, 32, 80, 8, SS_LEFT, WS_EX_LEFT
63 - COMBOBOX IDC_EXTRAMODES, 114, 43, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_OWNERDRAWFIXED, WS_EX_LEFT
64 - LTEXT "Screen aspect ratio", IDC_STATIC, 7, 58, 63, 8, SS_LEFT, WS_EX_LEFT
65 - COMBOBOX IDC_ASPECT, 7, 68, 102, 30, CBS_DROPDOWN | CBS_HASSTRINGS, WS_EX_LEFT
66 - LTEXT "Sort video modes", IDC_STATIC, 114, 58, 56, 8, SS_LEFT, WS_EX_LEFT
67 - COMBOBOX IDC_SORTMODES, 114, 68, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
68 - LTEXT "DPI scaling mode", IDC_STATIC, 7, 83, 56, 8, SS_LEFT, WS_EX_LEFT
69 - COMBOBOX IDC_DPISCALE, 7, 93, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
70 - LTEXT "Vertical sync", IDC_STATIC, 114, 83, 41, 8, SS_LEFT, WS_EX_LEFT
71 - COMBOBOX IDC_VSYNC, 114, 93, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
72 - LTEXT "Fullscreen window mode", IDC_STATIC, 7, 108, 79, 9, SS_LEFT, WS_EX_LEFT
73 - COMBOBOX IDC_FULLMODE, 7, 119, 101, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
74 - LTEXT "Fixed scaling", IDC_FIXEDSCALELABEL, 114, 108, 47, 9, WS_DISABLED | SS_LEFT, WS_EX_LEFT
75 - LTEXT "X", IDC_FIXEDSCALELABELX, 114, 122, 8, 9, WS_DISABLED | SS_LEFT, WS_EX_LEFT
76 - EDITTEXT IDC_FIXEDSCALEX, 122, 119, 24, 14, ES_AUTOHSCROLL, WS_EX_LEFT
77 - LTEXT "Y", IDC_FIXEDSCALELABELY, 151, 122, 8, 9, WS_DISABLED | SS_LEFT, WS_EX_LEFT
78 - EDITTEXT IDC_FIXEDSCALEY, 159, 119, 24, 14, ES_AUTOHSCROLL, WS_EX_LEFT
79 - AUTOCHECKBOX "Square", IDC_FIXEDSCALESQUARE, 188, 118, 29, 14, BS_PUSHLIKE, WS_EX_LEFT
80 - AUTOCHECKBOX "Change display color depth", IDC_COLOR, 7, 134, 100, 10, 0, WS_EX_LEFT
81 - AUTOCHECKBOX "Single buffered display", IDC_SINGLEBUFFER, 114, 135, 87, 8, 0, WS_EX_LEFT
 60+ LTEXT "Scaling method", IDC_STATIC, 221, 6, 50, 9, SS_LEFT, WS_EX_LEFT
 61+ COMBOBOX IDC_SCALE, 221, 17, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
 62+ LTEXT "Additional display modes", IDC_STATIC, 7, 32, 80, 8, SS_LEFT, WS_EX_LEFT
 63+ COMBOBOX IDC_EXTRAMODES, 7, 43, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_OWNERDRAWFIXED, WS_EX_LEFT
 64+ LTEXT "Screen aspect ratio", IDC_STATIC, 114, 33, 63, 8, SS_LEFT, WS_EX_LEFT
 65+ COMBOBOX IDC_ASPECT, 114, 43, 102, 30, CBS_DROPDOWN | CBS_HASSTRINGS, WS_EX_LEFT
 66+ LTEXT "Sort video modes", IDC_STATIC, 221, 33, 56, 8, SS_LEFT, WS_EX_LEFT
 67+ COMBOBOX IDC_SORTMODES, 221, 43, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
 68+ LTEXT "DPI scaling mode", IDC_STATIC, 7, 58, 56, 8, SS_LEFT, WS_EX_LEFT
 69+ COMBOBOX IDC_DPISCALE, 7, 68, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
 70+ LTEXT "Vertical sync", IDC_STATIC, 114, 58, 41, 8, SS_LEFT, WS_EX_LEFT
 71+ COMBOBOX IDC_VSYNC, 114, 68, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
 72+ LTEXT "Fullscreen window mode", IDC_STATIC, 221, 57, 79, 9, SS_LEFT, WS_EX_LEFT
 73+ COMBOBOX IDC_FULLMODE, 221, 68, 101, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
 74+ LTEXT "Fixed scaling", IDC_FIXEDSCALELABEL, 7, 83, 47, 9, WS_DISABLED | SS_LEFT, WS_EX_LEFT
 75+ LTEXT "X", IDC_FIXEDSCALELABELX, 7, 97, 8, 9, WS_DISABLED | SS_LEFT, WS_EX_LEFT
 76+ EDITTEXT IDC_FIXEDSCALEX, 15, 94, 40, 14, WS_DISABLED | ES_AUTOHSCROLL, WS_EX_LEFT
 77+ LTEXT "Y", IDC_FIXEDSCALELABELY, 57, 97, 8, 9, WS_DISABLED | SS_LEFT, WS_EX_LEFT
 78+ EDITTEXT IDC_FIXEDSCALEY, 65, 94, 40, 14, WS_DISABLED | ES_AUTOHSCROLL, WS_EX_LEFT
 79+ LTEXT "Custom resolution", 0, 114, 83, 58, 9, SS_LEFT, WS_EX_LEFT
 80+ EDITTEXT IDC_CUSTOMMODE, 114, 94, 71, 14, ES_AUTOHSCROLL, WS_EX_LEFT
 81+ PUSHBUTTON "Select", IDC_SETMODE, 187, 94, 29, 14, WS_DISABLED, WS_EX_LEFT
 82+ AUTOCHECKBOX "Change display color depth", IDC_COLOR, 7, 113, 100, 10, 0, WS_EX_LEFT
 83+ AUTOCHECKBOX "Single buffered display", IDC_SINGLEBUFFER, 114, 114, 87, 8, 0, WS_EX_LEFT
8284 }
8385
8486
@@ -173,7 +175,7 @@
174176 CONTROL "", IDC_SPINFRAME, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY, 261, 125, 12, 14
175177 LTEXT "Texture filter", IDC_FILTERLABEL, 186, 141, 40, 8, SS_LEFT
176178 COMBOBOX IDC_FILTER, 186, 150, 66, 19, WS_DISABLED | CBS_DROPDOWN | CBS_HASSTRINGS
177 - LTEXT "Antialiasing", IDC_FSAALABEL, 259, 141, 36, 8, SS_LEFT
 179+ LTEXT "Antialiasing", IDC_FSAALABEL, 259, 141, 38, 8, SS_LEFT
178180 COMBOBOX IDC_FSAA, 257, 150, 70, 19, WS_DISABLED | CBS_DROPDOWN | CBS_HASSTRINGS
179181 PUSHBUTTON "Run test", IDC_TEST, 277, 125, 56, 14, WS_DISABLED
180182 }
@@ -214,10 +216,10 @@
215217 LTEXT "Blt Color Key Threshold", 0, 114, 83, 76, 9, SS_LEFT, WS_EX_LEFT
216218 CONTROL "", IDC_BLTTHRESHOLD, TRACKBAR_CLASS, WS_TABSTOP | TBS_BOTH | TBS_NOTICKS, 114, 93, 102, 15, WS_EX_LEFT
217219 LTEXT "Custom scale", IDC_CUSTOMSCALELABEL, 7, 83, 44, 8, WS_DISABLED | SS_LEFT, WS_EX_LEFT
218 - LTEXT "X", IDC_CUSTOMSCALELABELX, 7, 96, 8, 8, WS_DISABLED | SS_LEFT, WS_EX_LEFT
219 - EDITTEXT IDC_CUSTOMSCALEX, 15, 93, 40, 14, WS_DISABLED | ES_AUTOHSCROLL, WS_EX_LEFT
220 - LTEXT "Y", IDC_CUSTOMSCALELABELY, 57, 96, 8, 8, WS_DISABLED | SS_LEFT, WS_EX_LEFT
221 - EDITTEXT IDC_CUSTOMSCALEY, 65, 93, 40, 14, WS_DISABLED | ES_AUTOHSCROLL, WS_EX_LEFT
 220+ LTEXT "X", IDC_CUSTOMSCALELABELX, 7, 97, 8, 8, WS_DISABLED | SS_LEFT, WS_EX_LEFT
 221+ EDITTEXT IDC_CUSTOMSCALEX, 15, 94, 40, 14, WS_DISABLED | ES_AUTOHSCROLL, WS_EX_LEFT
 222+ LTEXT "Y", IDC_CUSTOMSCALELABELY, 57, 97, 8, 8, WS_DISABLED | SS_LEFT, WS_EX_LEFT
 223+ EDITTEXT IDC_CUSTOMSCALEY, 65, 94, 40, 14, WS_DISABLED | ES_AUTOHSCROLL, WS_EX_LEFT
222224 }
223225
224226
@@ -451,6 +453,19 @@
452454
453455
454456
 457+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
 458+IDD_MODELIST DIALOG 0, 0, 186, 95
 459+STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU
 460+CAPTION "Set display resolution"
 461+FONT 8, "Ms Shell Dlg"
 462+{
 463+ LISTBOX IDC_MODELIST, 5, 5, 119, 85, WS_TABSTOP | WS_VSCROLL | LBS_NOINTEGRALHEIGHT | LBS_SORT | LBS_NOTIFY, WS_EX_LEFT
 464+ PUSHBUTTON "Cancel", IDCANCEL, 129, 24, 50, 14, 0, WS_EX_LEFT
 465+ DEFPUSHBUTTON "OK", IDOK, 129, 7, 50, 14, 0, WS_EX_LEFT
 466+}
 467+
 468+
 469+
455470 //
456471 // Icon resources
457472 //
Index: dxglcfg/resource.h
@@ -24,7 +24,7 @@
2525 #define IDD_LOADING 102
2626 #define IDD_TEXSHADER 103
2727 #define IDD_VERTEXSHADER 104
28 -#define IDD_DXGLTEST 199
 28+#define IDD_MODELIST 105
2929
3030 // Tabs
3131 #define IDD_DISPLAY 201
@@ -71,9 +71,10 @@
7272 #define IDC_FIXEDSCALEX 2012
7373 #define IDC_FIXEDSCALELABELY 2013
7474 #define IDC_FIXEDSCALEY 2014
75 -#define IDC_FIXEDSCALESQUARE 2015
76 -#define IDC_COLOR 2016
77 -#define IDC_SINGLEBUFFER 2017
 75+#define IDC_CUSTOMMODE 2015
 76+#define IDC_SETMODE 2016
 77+#define IDC_COLOR 2017
 78+#define IDC_SINGLEBUFFER 2018
7879
7980 // Controls - Effects Tab
8081 #define IDC_POSTSCALE 2101
@@ -242,3 +243,6 @@
243244 #define IDC_LIGHTATTEN2 3039
244245 #define IDC_LIGHTTHETA 3040
245246 #define IDC_LIGHTPHI 3041
 247+
 248+// Controls - Mode list dialog
 249+#define IDC_MODELIST 3101