DXGL r837 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r836‎ | r837 | r838 >
Date:00:30, 30 July 2018
Author:admin
Status:new
Tags:
Comment:
Partially implement updated Hacks tab (settings are currently not visible until the item is selected).
Fix reading Hacks tab items when saved to a dxgl.ini file.
Modified paths:
  • /cfgmgr/ReadMe.txt (modified) (history)
  • /cfgmgr/cfgmgr.c (modified) (history)
  • /cfgmgr/cfgmgr.h (modified) (history)
  • /ddraw/glRenderer.cpp (modified) (history)
  • /dxgl-example.ini (modified) (history)
  • /dxglcfg/dxglcfg.cpp (modified) (history)
  • /dxglcfg/dxglcfg.rc (modified) (history)
  • /dxglcfg/resource.h (modified) (history)

Diff [purge]

Index: cfgmgr/ReadMe.txt
@@ -547,12 +547,35 @@
548548 REG_DWORD HKCU\DXGL\Profiles\<app>\HackCrop640480to640400
549549 Crops 640x480 display mode to 640x400.
550550
551 -Member HackAutoScale512448to640480
552 -INI Entry HackAutoScale512448to640480
 551+Member HackAutoExpandViewport
 552+INI Entry HackAutoExpandViewport
553553 INI Group hacks
554 -REG_DWORD HKCU\DXGL\Profiles\<app>\HackAutoScale512448to640480
555 -Expands a 512x448 image to 640x480 if the bordering pixels are black.
 554+REG_DWORD HKCU\DXGL\Profiles\<app>\HackAutoExpandViewport
 555+Applies a hack to expand the viewport if a bodering pixel matches a set value.
 556+Valid settings:
 557+0 - Hack is disabled.
 558+1 - Expands 512x448 to 640x480, or 256x224 to 320x240
 559+2 - Expands 512x480 to 640x480, or 256x240 to 320x240
556560
 561+Member HackAutoExpandViewportCompare
 562+INI Entry HackAutoExpandViewportCompare
 563+INI Group hacks
 564+REG_DWORD HKCU\DXGL\Profiles\<app>\HackAutoExpandViewportCompare
 565+Comparison method to detect blank pixels when HackAutoExpandViewport is active.
 566+Valid settings:
 567+0 - Activate when the pixel matches a set color
 568+1 - Activate when the pixel color is less than or equal to a set color
 569+2 - Activate when the pixel color is greater than or equal to a set color
 570+3 - Activate when the pixel value matches a set value (i.e. palette index)
 571+4 - Activate when the pixel value is less than or equal to a set value
 572+5 - Activate when the pixel value is greater than or equal to a set value
 573+
 574+Member HackAutoExpandViewportValue
 575+INI Entry HackAutoExpandViewportValue
 576+INI Group hacks
 577+REG_DWORD HKCU\DXGL\Profiles\<app>\HackAutoExpandViewportValue
 578+Value to use for detecting blank pixels when HackAutoExpandViewport is active.
 579+
557580 Member HackNoTVRefresh
558581 INI Entry HackNoTVRefresh
559582 INI Group hacks
Index: cfgmgr/cfgmgr.c
@@ -683,7 +683,10 @@
684684 cfg->DebugMaxGLVersionMajor = ReadDWORD(hKey, cfg->DebugMaxGLVersionMajor, &cfgmask->DebugMaxGLVersionMajor, _T("DebugMaxGLVersionMajor"));
685685 cfg->DebugMaxGLVersionMinor = ReadDWORD(hKey, cfg->DebugMaxGLVersionMinor, &cfgmask->DebugMaxGLVersionMinor, _T("DebugMaxGLVersionMinor"));
686686 cfg->HackCrop640480to640400 = ReadBool(hKey, cfg->HackCrop640480to640400, &cfgmask->HackCrop640480to640400, _T("HackCrop640480to640400"));
687 - cfg->HackAutoScale512448to640480 = ReadDWORD(hKey, cfg->HackAutoScale512448to640480, &cfgmask->HackAutoScale512448to640480, _T("HackAutoScale512448to640480"));
 687+ cfg->HackAutoExpandViewport = ReadDWORDWithObsolete(hKey, cfg->HackAutoExpandViewport, &cfgmask->HackAutoExpandViewport, _T("HackAutoExpandViewport"),
 688+ 1, _T("HackAutoScale512448to640480"));
 689+ cfg->HackAutoExpandViewportCompare = ReadDWORD(hKey, cfg->HackAutoExpandViewportCompare, &cfgmask->HackAutoExpandViewportCompare, _T("HackAutoExpandViewportCompare"));
 690+ cfg->HackAutoExpandViewportValue = ReadDWORD(hKey, cfg->HackAutoExpandViewportValue, &cfgmask->HackAutoExpandViewportValue, _T("HackAutoExpandViewportValue"));
688691 cfg->HackNoTVRefresh = ReadBool(hKey, cfg->HackNoTVRefresh, &cfgmask->HackNoTVRefresh, _T("HackNoTVRefresh"));
689692 cfg->HackSetCursor = ReadBool(hKey, cfg->HackSetCursor, &cfgmask->HackSetCursor, _T("HackSetCursor"));
690693 if(!global && dll)
@@ -846,7 +849,10 @@
847850 WriteDWORD(hKey, cfg->DebugMaxGLVersionMajor, cfgmask->DebugMaxGLVersionMajor, _T("DebugMaxGLVersionMajor"));
848851 WriteDWORD(hKey, cfg->DebugMaxGLVersionMinor, cfgmask->DebugMaxGLVersionMinor, _T("DebugMaxGLVersionMinor"));
849852 WriteBool(hKey, cfg->HackCrop640480to640400, cfgmask->HackCrop640480to640400, _T("HackCrop640480to640400"));
850 - WriteDWORD(hKey, cfg->HackAutoScale512448to640480, cfgmask->HackAutoScale512448to640480, _T("HackAutoScale512448to640480"));
 853+ WriteDWORDDeleteObsolete(hKey, cfg->HackAutoExpandViewport, cfgmask->HackAutoExpandViewport, _T("HackAutoExpandViewport"),
 854+ 1, _T("HackAutoScale512448to640480"));
 855+ WriteDWORD(hKey, cfg->HackAutoExpandViewportCompare, cfgmask->HackAutoExpandViewportCompare, _T("HackAutoExpandViewportCompare"));
 856+ WriteDWORD(hKey, cfg->HackAutoExpandViewportValue, cfgmask->HackAutoExpandViewportValue, _T("HackAutoExpandViewportValue"));
851857 WriteBool(hKey, cfg->HackNoTVRefresh, cfgmask->HackNoTVRefresh, _T("HackNoTVRefresh"));
852858 WriteBool(hKey, cfg->HackSetCursor, cfgmask->HackSetCursor, _T("HackSetCursor"));
853859 }
@@ -1141,10 +1147,13 @@
11421148 }
11431149 if (!_stricmp(section, "hacks"))
11441150 {
1145 - if (!_stricmp(section, "HackCrop640480to640400")) cfg->HackCrop640480to640400 = INIBoolValue(value);
1146 - if (!_stricmp(section, "HackAutoScale512448to640480")) cfg->HackAutoScale512448to640480 = INIIntBoolValue(value);
1147 - if (!_stricmp(section, "HackNoTVRefresh")) cfg->HackNoTVRefresh = INIBoolValue(value);
1148 - if (!_stricmp(section, "HackSetCursor")) cfg->HackSetCursor = INIBoolValue(value);
 1151+ if (!_stricmp(name, "HackCrop640480to640400")) cfg->HackCrop640480to640400 = INIBoolValue(value);
 1152+ if (!_stricmp(name, "HackAutoExpandViewport")) cfg->HackAutoExpandViewport = INIIntBoolValue(value);
 1153+ if (!_stricmp(name, "HackAutoScale512448to640480")) cfg->HackAutoExpandViewport = INIIntBoolValue(value);
 1154+ if (!_stricmp(name, "HackAutoExpandViewportCompare")) cfg->HackAutoExpandViewportCompare = INIIntValue(value);
 1155+ if (!_stricmp(name, "HackAutoExpandViewportValue")) cfg->HackAutoExpandViewportValue = INIHexValue(value);
 1156+ if (!_stricmp(name, "HackNoTVRefresh")) cfg->HackNoTVRefresh = INIBoolValue(value);
 1157+ if (!_stricmp(name, "HackSetCursor")) cfg->HackSetCursor = INIBoolValue(value);
11491158 }
11501159 return 1;
11511160 }
@@ -1548,7 +1557,9 @@
15491558 INIWriteBool(file, "DebugMaxGLVersionMinor", cfg->DebugMaxGLVersionMinor, mask->DebugMaxGLVersionMinor, INISECTION_DEBUG);
15501559 // [hacks]
15511560 INIWriteBool(file, "HackCrop640480to640400", cfg->HackCrop640480to640400, mask->HackCrop640480to640400, INISECTION_HACKS);
1552 - INIWriteInt(file, "HackAutoScale512448to640480", cfg->HackAutoScale512448to640480, mask->HackAutoScale512448to640480, INISECTION_HACKS);
 1561+ INIWriteInt(file, "HackAutoExpandViewport", cfg->HackAutoExpandViewport, mask->HackAutoExpandViewport, INISECTION_HACKS);
 1562+ INIWriteInt(file, "HackAutoExpandViewportCompare", cfg->HackAutoExpandViewportCompare, mask->HackAutoExpandViewportCompare, INISECTION_HACKS);
 1563+ INIWriteHex(file, "HackAutoExpandViewportValue", cfg->HackAutoExpandViewportValue, mask->HackAutoExpandViewportValue, INISECTION_HACKS);
15531564 INIWriteBool(file, "HackNoTVRefresh", cfg->HackNoTVRefresh, mask->HackNoTVRefresh, INISECTION_HACKS);
15541565 INIWriteBool(file, "HackSetCursor", cfg->HackSetCursor, mask->HackSetCursor, INISECTION_HACKS);
15551566 CloseHandle(file);
Index: cfgmgr/cfgmgr.h
@@ -98,7 +98,9 @@
9999 DWORD DebugMaxGLVersionMinor;
100100 // [hacks]
101101 BOOL HackCrop640480to640400;
102 - BOOL HackAutoScale512448to640480;
 102+ DWORD HackAutoExpandViewport;
 103+ DWORD HackAutoExpandViewportCompare;
 104+ DWORD HackAutoExpandViewportValue;
103105 BOOL HackNoTVRefresh;
104106 BOOL HackSetCursor;
105107 // internal
Index: ddraw/glRenderer.cpp
@@ -3677,7 +3677,7 @@
36783678 DWORD *ptr32;
36793679 WORD *ptr16;
36803680 BYTE *ptr8;
3681 - if (dxglcfg.HackAutoScale512448to640480)
 3681+ if (dxglcfg.HackAutoExpandViewport)
36823682 {
36833683 if ((primary->levels[0].ddsd.dwWidth == 640) && (primary->levels[0].ddsd.dwHeight == 480))
36843684 {
@@ -3853,7 +3853,7 @@
38543854 }
38553855 if (scale512448)
38563856 {
3857 - if (dxglcfg.HackAutoScale512448to640480 == 1)
 3857+ if (dxglcfg.HackAutoExpandViewport == 1)
38583858 {
38593859 This->bltvertices[0].s = This->bltvertices[2].s = 0.9f;
38603860 This->bltvertices[0].t = This->bltvertices[1].t = 0.966666667f;
@@ -3860,7 +3860,7 @@
38613861 This->bltvertices[1].s = This->bltvertices[3].s = 0.1f;
38623862 This->bltvertices[2].t = This->bltvertices[3].t = 0.0333333333f;
38633863 }
3864 - else if (dxglcfg.HackAutoScale512448to640480 == 2)
 3864+ else if (dxglcfg.HackAutoExpandViewport == 2)
38653865 {
38663866 This->bltvertices[0].s = This->bltvertices[2].s = 0.9f;
38673867 This->bltvertices[1].s = This->bltvertices[3].s = 0.1f;
Index: dxgl-example.ini
@@ -601,7 +601,7 @@
602602 ; Default is false
603603 HackCrop640480to640400=false
604604
605 -; HackAutoScale512448to640480 - Boolean
 605+; HackAutoExpandViewport - Boolean or integer
606606 ; Detects when the application is rendering a 512x448 image in 640x480 mode.
607607 ; This can take effect in 640x480 DR mode in ZSNES, or 640x480 mode in Zelda
608608 ; Classic. If it is detected that the game is drawing outside the 512x448
@@ -610,11 +610,36 @@
611611 ; when when it is detected the out-of-bounds area is clear, like going back
612612 ; in-game. This hack should only be enabled on games that render 512x448 with
613613 ; black bars in 640x480 mode.
614 -; If set to 1, this will scale in both X and Y directions. If set to 1, this
615 -; will scale only in the X direction.
 614+; This was previously known as HackAutoScale512448to640480.
 615+; The following values are valid:
 616+; 0 - Do not expand viewport
 617+; 1 - Expand 512x448 to 640x480 or 256x224 to 320x240
 618+; 2 - Expand 512x480 to 640x480 or 256x240 to 320x240
616619 ; Default is 0
617 -HackAutoScale512448to640480=0
 620+HackAutoExpandViewport=0
618621
 622+; HackAutoExpandViewportCompare - Integer
 623+; Selects the comparison methd to detect blank pixels outside the boundary
 624+; defined by HackAutoExpandViewport.
 625+; The following values are valid:
 626+; 0 - Activate when the pixel matches a set color
 627+; 1 - Activate when the pixel color is less than or equal to a set color
 628+; 2 - Activate when the pixel color is greater than or equal to a set color
 629+; 3 - Activate when the pixel value matches a set value (i.e. palette index)
 630+; 4 - Activate when the pixel value is less than or equal to a set value
 631+; 5 - Activate when the pixel value is greater than or equal to a set value
 632+; Default is 0
 633+HackAutoExpandViewportCompare=0
 634+
 635+; HackAutoExpandViewportValue - Hexadecimal integer
 636+; Value to use for comparison when detecting blank border pixels.
 637+; This value is dependent on the color depth of the primary surface, and
 638+; if using color comparison under 8-bit color uses the the 32-bit color of
 639+; the pixel's palette lookup, or in value comparison uses the palette index
 640+; of the pixel.
 641+; Default is 0x0
 642+HackAutoExpandViewportValue=0x0
 643+
619644 ; HackNoTVRefresh - Boolean
620645 ; Removes TV-compatible refresh rates that may be added by Windows 7 and
621646 ; above. If a rounded refresh rate is not available it will be added.
Index: dxglcfg/dxglcfg.cpp
@@ -70,6 +70,7 @@
7171 static BOOL ColorDepth_Dropdown = FALSE;
7272 HWND hDialog = NULL;
7373 static BOOL EditInterlock = FALSE;
 74+static DWORD hackstabitem = 0xFFFFFFFF;
7475
7576
7677 typedef struct
@@ -2237,7 +2238,7 @@
22382239 cfg->DebugBlendDestColorKey = value;
22392240 cfgmask->DebugBlendDestColorKey = mask;
22402241 break;
2241 - /*case 10:
 2242+ /*case 11:
22422243 cfg->DebugDisableErrors = value;
22432244 cfgmask->DebugDisableErrors = mask;
22442245 break;*/
@@ -2361,77 +2362,97 @@
23622363 return TRUE;
23632364 }
23642365
2365 -void ReadHacksItem(int item, BOOL *value, BOOL *mask)
 2366+void UpdateHacksControl(HWND hWnd, int DlgItem, int item)
23662367 {
 2368+ TCHAR buffer[64];
23672369 switch (item)
23682370 {
23692371 case 0:
2370 - *value = cfg->HackCrop640480to640400;
2371 - *mask = cfgmask->HackCrop640480to640400;
 2372+ SendDlgItemMessage(hWnd, DlgItem, CB_RESETCONTENT, 0, 0);
 2373+ _tcscpy(buffer, _T("Disabled"));
 2374+ SendDlgItemMessage(hWnd, DlgItem, CB_ADDSTRING, 0, (LPARAM)buffer);
 2375+ _tcscpy(buffer, _T("Enabled"));
 2376+ SendDlgItemMessage(hWnd, DlgItem, CB_ADDSTRING, 0, (LPARAM)buffer);
 2377+ if (tristate) SendDlgItemMessage(hWnd, DlgItem, CB_ADDSTRING, 0, (LPARAM)strdefault);
 2378+ SetCombo(hWnd, DlgItem, cfg->HackCrop640480to640400, cfgmask->HackCrop640480to640400, tristate);
23722379 break;
23732380 case 1:
2374 - *value = cfg->HackAutoScale512448to640480;
2375 - *mask = cfgmask->HackAutoScale512448to640480;
 2381+ SendDlgItemMessage(hWnd, DlgItem, CB_RESETCONTENT, 0, 0);
 2382+ _tcscpy(buffer, _T("Disabled"));
 2383+ SendDlgItemMessage(hWnd, DlgItem, CB_ADDSTRING, 0, (LPARAM)buffer);
 2384+ _tcscpy(buffer, _T("512x448 to 640x480"));
 2385+ SendDlgItemMessage(hWnd, DlgItem, CB_ADDSTRING, 0, (LPARAM)buffer);
 2386+ _tcscpy(buffer, _T("512x480 to 640x480"));
 2387+ SendDlgItemMessage(hWnd, DlgItem, CB_ADDSTRING, 0, (LPARAM)buffer);
 2388+ if (tristate) SendDlgItemMessage(hWnd, DlgItem, CB_ADDSTRING, 0, (LPARAM)strdefault);
 2389+ SetCombo(hWnd, DlgItem, cfg->HackAutoExpandViewport, cfgmask->HackAutoExpandViewport, tristate);
23762390 break;
23772391 case 2:
2378 - *value = cfg->HackNoTVRefresh;
2379 - *mask = cfgmask->HackNoTVRefresh;
 2392+ SendDlgItemMessage(hWnd, DlgItem, CB_RESETCONTENT, 0, 0);
 2393+ _tcscpy(buffer, _T("Match color"));
 2394+ SendDlgItemMessage(hWnd, DlgItem, CB_ADDSTRING, 0, (LPARAM)buffer);
 2395+ _tcscpy(buffer, _T("Color less than or equal"));
 2396+ SendDlgItemMessage(hWnd, DlgItem, CB_ADDSTRING, 0, (LPARAM)buffer);
 2397+ _tcscpy(buffer, _T("Color greater than or equal"));
 2398+ SendDlgItemMessage(hWnd, DlgItem, CB_ADDSTRING, 0, (LPARAM)buffer);
 2399+ _tcscpy(buffer, _T("Match palette entry"));
 2400+ SendDlgItemMessage(hWnd, DlgItem, CB_ADDSTRING, 0, (LPARAM)buffer);
 2401+ _tcscpy(buffer, _T("Palette less than or equal"));
 2402+ SendDlgItemMessage(hWnd, DlgItem, CB_ADDSTRING, 0, (LPARAM)buffer);
 2403+ _tcscpy(buffer, _T("Palette greater than or equal"));
 2404+ SendDlgItemMessage(hWnd, DlgItem, CB_ADDSTRING, 0, (LPARAM)buffer);
 2405+ if (tristate) SendDlgItemMessage(hWnd, DlgItem, CB_ADDSTRING, 0, (LPARAM)strdefault);
 2406+ SetCombo(hWnd, DlgItem, cfg->HackAutoExpandViewportCompare, cfgmask->HackAutoExpandViewportCompare, tristate);
23802407 break;
23812408 case 3:
2382 - *value = cfg->HackSetCursor;
2383 - *mask = cfgmask->HackSetCursor;
23842409 break;
2385 - default:
2386 - *value = FALSE;
2387 - *mask = FALSE;
 2410+ case 4:
 2411+ SendDlgItemMessage(hWnd, DlgItem, CB_RESETCONTENT, 0, 0);
 2412+ _tcscpy(buffer, _T("Disabled"));
 2413+ SendDlgItemMessage(hWnd, DlgItem, CB_ADDSTRING, 0, (LPARAM)buffer);
 2414+ _tcscpy(buffer, _T("Enabled"));
 2415+ SendDlgItemMessage(hWnd, DlgItem, CB_ADDSTRING, 0, (LPARAM)buffer);
 2416+ if (tristate) SendDlgItemMessage(hWnd, DlgItem, CB_ADDSTRING, 0, (LPARAM)strdefault);
 2417+ SetCombo(hWnd, DlgItem, cfg->HackNoTVRefresh, cfgmask->HackNoTVRefresh, tristate);
23882418 break;
2389 - }
2390 -}
2391 -
2392 -void WriteHacksItem(int item, BOOL value, BOOL mask)
2393 -{
2394 - switch (item)
2395 - {
2396 - case 0:
2397 - cfg->HackCrop640480to640400 = value;
2398 - cfgmask->HackCrop640480to640400 = mask;
 2419+ case 5:
 2420+ SendDlgItemMessage(hWnd, DlgItem, CB_RESETCONTENT, 0, 0);
 2421+ _tcscpy(buffer, _T("Disabled"));
 2422+ SendDlgItemMessage(hWnd, DlgItem, CB_ADDSTRING, 0, (LPARAM)buffer);
 2423+ _tcscpy(buffer, _T("Enabled"));
 2424+ SendDlgItemMessage(hWnd, DlgItem, CB_ADDSTRING, 0, (LPARAM)buffer);
 2425+ if (tristate) SendDlgItemMessage(hWnd, DlgItem, CB_ADDSTRING, 0, (LPARAM)strdefault);
 2426+ SetCombo(hWnd, DlgItem, cfg->HackSetCursor, cfgmask->HackSetCursor, tristate);
23992427 break;
2400 - case 1:
2401 - cfg->HackAutoScale512448to640480 = value;
2402 - cfgmask->HackAutoScale512448to640480 = mask;
2403 - break;
2404 - case 2:
2405 - cfg->HackNoTVRefresh = value;
2406 - cfgmask->HackNoTVRefresh = mask;
2407 - break;
2408 - case 3:
2409 - cfg->HackSetCursor = value;
2410 - cfgmask->HackSetCursor = mask;
2411 - break;
24122428 default:
24132429 break;
24142430 }
24152431 }
2416 -
24172432 LRESULT CALLBACK HacksTabCallback(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
24182433 {
24192434 TCHAR str[64];
2420 - RECT r;
 2435+ RECT r, r2;
 2436+ DWORD x;
24212437 DRAWITEMSTRUCT* drawitem;
24222438 COLORREF OldTextColor, OldBackColor;
2423 - BOOL hackvalue, hackmask;
2424 - DWORD item;
24252439 switch (Msg)
24262440 {
24272441 case WM_INITDIALOG:
24282442 if (_EnableThemeDialogTexture) _EnableThemeDialogTexture(hWnd, ETDT_ENABLETAB);
 2443+ SetParent(GetDlgItem(hWnd,IDC_HACKSDROPDOWN), GetDlgItem(hWnd,IDC_HACKSLIST));
 2444+ SetParent(GetDlgItem(hWnd, IDC_HACKSEDIT), GetDlgItem(hWnd, IDC_HACKSLIST));
 2445+ ShowWindow(GetDlgItem(GetDlgItem(hWnd, IDC_HACKSLIST), IDC_HACKSDROPDOWN), SW_HIDE);
 2446+ ShowWindow(GetDlgItem(GetDlgItem(hWnd, IDC_HACKSLIST), IDC_HACKSEDIT), SW_HIDE);
24292447 return TRUE;
24302448 case WM_MEASUREITEM:
24312449 switch (wParam)
24322450 {
24332451 case IDC_HACKSLIST:
2434 - ((LPMEASUREITEMSTRUCT)lParam)->itemHeight = GetSystemMetrics(SM_CYMENUCHECK);
2435 - ((LPMEASUREITEMSTRUCT)lParam)->itemWidth = GetSystemMetrics(SM_CXMENUCHECK);
 2452+ if(((LPMEASUREITEMSTRUCT)lParam)->itemID == 3)
 2453+ GetWindowRect(GetDlgItem(GetDlgItem(hWnd, IDC_HACKSLIST), IDC_HACKSEDIT), &r);
 2454+ else GetWindowRect(GetDlgItem(GetDlgItem(hWnd, IDC_HACKSLIST), IDC_HACKSDROPDOWN), &r);
 2455+ ((LPMEASUREITEMSTRUCT)lParam)->itemHeight = r.bottom - r.top;
 2456+ ((LPMEASUREITEMSTRUCT)lParam)->itemWidth = r.right - r.left;
24362457 break;
24372458 default:
24382459 break;
@@ -2440,40 +2461,70 @@
24412462 case WM_COMMAND:
24422463 switch (LOWORD(wParam))
24432464 {
 2465+ case IDC_HACKSDROPDOWN:
 2466+ switch (hackstabitem)
 2467+ {
 2468+ case 0:
 2469+ cfg->HackCrop640480to640400 = GetCombo(GetDlgItem(hWnd, IDC_HACKSLIST), IDC_HACKSDROPDOWN,
 2470+ (DWORD*)&cfgmask->HackCrop640480to640400);
 2471+ EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
 2472+ *dirty = TRUE;
 2473+ break;
 2474+ case 1:
 2475+ cfg->HackAutoExpandViewport = GetCombo(GetDlgItem(hWnd, IDC_HACKSLIST), IDC_HACKSDROPDOWN,
 2476+ &cfgmask->HackAutoExpandViewport);
 2477+ EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
 2478+ *dirty = TRUE;
 2479+ break;
 2480+ case 2:
 2481+ cfg->HackAutoExpandViewportCompare = GetCombo(GetDlgItem(hWnd, IDC_HACKSLIST), IDC_HACKSDROPDOWN,
 2482+ &cfgmask->HackAutoExpandViewportCompare);
 2483+ EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
 2484+ *dirty = TRUE;
 2485+ break;
 2486+ case 4:
 2487+ cfg->HackNoTVRefresh = GetCombo(GetDlgItem(hWnd, IDC_HACKSLIST), IDC_HACKSDROPDOWN,
 2488+ (DWORD*)&cfgmask->HackNoTVRefresh);
 2489+ EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
 2490+ *dirty = TRUE;
 2491+ modelistdirty = TRUE;
 2492+ break;
 2493+ case 5:
 2494+ cfg->HackSetCursor = GetCombo(GetDlgItem(hWnd, IDC_HACKSLIST), IDC_HACKSDROPDOWN,
 2495+ (DWORD*)&cfgmask->HackSetCursor);
 2496+ EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
 2497+ *dirty = TRUE;
 2498+ break;
 2499+ default:
 2500+ break;
 2501+ }
 2502+ break;
24442503 case IDC_HACKSLIST:
24452504 if ((HIWORD(wParam) == LBN_SELCHANGE) || (HIWORD(wParam) == LBN_DBLCLK))
24462505 {
2447 - item = SendDlgItemMessage(hWnd, IDC_HACKSLIST, LB_GETCURSEL, 0, 0);
2448 - ReadHacksItem(item, &hackvalue, &hackmask);
2449 - if (tristate)
 2506+ hackstabitem = SendDlgItemMessage(hWnd, IDC_HACKSLIST, LB_GETCURSEL, 0, 0);
 2507+ SendDlgItemMessage(hWnd, IDC_HACKSLIST, LB_GETITEMRECT, hackstabitem, (LPARAM)&r2);
 2508+ if (hackstabitem == 3)
24502509 {
2451 - if (hackvalue && hackmask)
2452 - {
2453 - hackvalue = FALSE;
2454 - hackmask = FALSE;
2455 - }
2456 - else if (!hackmask)
2457 - {
2458 - hackvalue = FALSE;
2459 - hackmask = TRUE;
2460 - }
2461 - else
2462 - {
2463 - hackvalue = TRUE;
2464 - hackmask = TRUE;
2465 - }
 2510+ GetWindowRect(GetDlgItem(GetDlgItem(hWnd, IDC_HACKSLIST), IDC_HACKSEDIT), &r);
 2511+ x = r.right - r.left;
 2512+ r2.left = r2.right - x;
 2513+ SetWindowPos(GetDlgItem(GetDlgItem(hWnd, IDC_HACKSLIST), IDC_HACKSEDIT),
 2514+ HWND_TOP, r2.left, r2.top, x, r2.bottom - r2.top, SWP_SHOWWINDOW);
 2515+ ShowWindow(GetDlgItem(GetDlgItem(hWnd, IDC_HACKSLIST), IDC_HACKSDROPDOWN), SW_HIDE);
 2516+ UpdateHacksControl(GetDlgItem(hWnd, IDC_HACKSLIST), IDC_HACKSEDIT, hackstabitem);
24662517 }
24672518 else
24682519 {
2469 - if (hackvalue)
2470 - hackvalue = FALSE;
2471 - else hackvalue = TRUE;
 2520+ GetWindowRect(GetDlgItem(GetDlgItem(hWnd, IDC_HACKSLIST), IDC_HACKSDROPDOWN), &r);
 2521+ x = r.right - r.left;
 2522+ r2.left = r2.right - x;
 2523+ SetWindowPos(GetDlgItem(GetDlgItem(hWnd, IDC_HACKSLIST), IDC_HACKSDROPDOWN),
 2524+ HWND_TOP, r2.left, r2.top, x, r2.bottom - r2.top, SWP_SHOWWINDOW);
 2525+ ShowWindow(GetDlgItem(GetDlgItem(hWnd, IDC_HACKSLIST), IDC_HACKSEDIT), SW_HIDE);
 2526+ UpdateHacksControl(GetDlgItem(hWnd, IDC_HACKSLIST), IDC_HACKSDROPDOWN, hackstabitem);
24722527 }
2473 - WriteHacksItem(item, hackvalue, hackmask);
24742528 RedrawWindow(GetDlgItem(hWnd, IDC_HACKSLIST), NULL, NULL, RDW_INVALIDATE);
2475 - EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
2476 - *dirty = TRUE;
2477 - if(item == 2) modelistdirty = TRUE;
24782529 }
24792530 break;
24802531 default:
@@ -2501,13 +2552,11 @@
25022553 memcpy(&r, &drawitem->rcItem, sizeof(RECT));
25032554 r.left = r.left + 2;
25042555 r.right = r.left + GetSystemMetrics(SM_CXMENUCHECK);
2505 - ReadHacksItem(drawitem->itemID, &hackvalue, &hackmask);
2506 - DrawCheck(drawitem->hDC, drawitem->itemState & ODS_SELECTED, hackvalue, FALSE, !hackmask, &r);
2507 - drawitem->rcItem.left += GetSystemMetrics(SM_CXSMICON) + 5;
 2556+ drawitem->rcItem.left += 1;
25082557 SendDlgItemMessage(hWnd, IDC_HACKSLIST, LB_GETTEXT, drawitem->itemID, (LPARAM)str);
25092558 DrawText(drawitem->hDC, str, _tcslen(str), &drawitem->rcItem,
25102559 DT_LEFT | DT_SINGLELINE | DT_VCENTER);
2511 - drawitem->rcItem.left -= GetSystemMetrics(SM_CXSMICON) + 5;
 2560+ drawitem->rcItem.left -= 1;
25122561 if (drawitem->itemState & ODS_FOCUS) DrawFocusRect(drawitem->hDC, &drawitem->rcItem);
25132562 SetTextColor(drawitem->hDC, OldTextColor);
25142563 SetBkColor(drawitem->hDC, OldBackColor);
@@ -3288,8 +3337,12 @@
32893338 // Hacks
32903339 _tcscpy(buffer, _T("Crop 640x480 to 640x400"));
32913340 SendDlgItemMessage(hTabs[5], IDC_HACKSLIST, LB_ADDSTRING, 0, (LPARAM)buffer);
3292 - _tcscpy(buffer, _T("Expand 512x448 to 640x480 when border is blank"));
 3341+ _tcscpy(buffer, _T("Automatically expand viewport"));
32933342 SendDlgItemMessage(hTabs[5], IDC_HACKSLIST, LB_ADDSTRING, 0, (LPARAM)buffer);
 3343+ _tcscpy(buffer, _T("Automatic expand comparison method"));
 3344+ SendDlgItemMessage(hTabs[5], IDC_HACKSLIST, LB_ADDSTRING, 0, (LPARAM)buffer);
 3345+ _tcscpy(buffer, _T("Automatic expand comparison value"));
 3346+ SendDlgItemMessage(hTabs[5], IDC_HACKSLIST, LB_ADDSTRING, 0, (LPARAM)buffer);
32943347 _tcscpy(buffer, _T("Remove TV-compatible refresh rates"));
32953348 SendDlgItemMessage(hTabs[5], IDC_HACKSLIST, LB_ADDSTRING, 0, (LPARAM)buffer);
32963349 _tcscpy(buffer, _T("SetCursor hide visibility"));
@@ -3795,6 +3848,7 @@
37963849 SetGLCombo(hTabs[4], IDC_GLVERSION, &cfg->DebugMaxGLVersionMajor, &cfg->DebugMaxGLVersionMinor,
37973850 &cfgmask->DebugMaxGLVersionMajor, &cfgmask->DebugMaxGLVersionMinor, tristate, hWnd);
37983851 // Hacks tab
 3852+ UpdateHacksControl(GetDlgItem(hTabs[5], IDC_HACKSLIST), IDC_HACKSDROPDOWN, hackstabitem);
37993853 RedrawWindow(GetDlgItem(hTabs[5], IDC_HACKSLIST), NULL, NULL, RDW_INVALIDATE);
38003854 }
38013855 break;
Index: dxglcfg/dxglcfg.rc
@@ -144,7 +144,7 @@
145145 FONT 8, "Ms Shell Dlg"
146146 {
147147 LTEXT "Changing these options may affect the functionality of DXGL and should only be done if necessary.", IDC_STATIC, 7, 5, 320, 9, SS_LEFT, WS_EX_LEFT
148 - LISTBOX IDC_DEBUGLIST, 7, 16, 269, 130, WS_TABSTOP | WS_VSCROLL | LBS_NOINTEGRALHEIGHT |
 148+ LISTBOX IDC_DEBUGLIST, 7, 16, 326, 130, WS_TABSTOP | WS_VSCROLL | LBS_NOINTEGRALHEIGHT |
149149 LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOTIFY, WS_EX_LEFT
150150 LTEXT "Maximum OpenGL Version", IDC_STATIC, 8, 153, 86, 9, SS_LEFT, WS_EX_LEFT
151151 COMBOBOX IDC_GLVERSION, 96, 151, 101, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
@@ -158,8 +158,10 @@
159159 FONT 8, "Ms Shell Dlg"
160160 {
161161 LTEXT "These options should be set only for specific programs; use with other programs may cause malfuncion.", IDC_STATIC, 7, 5, 332, 9, SS_LEFT, WS_EX_LEFT
162 - LISTBOX IDC_HACKSLIST, 7, 16, 269, 148, WS_TABSTOP | WS_VSCROLL | LBS_NOINTEGRALHEIGHT |
163 - LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOTIFY, WS_EX_LEFT
 162+ COMBOBOX IDC_HACKSDROPDOWN, 186, 17, 146, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
 163+ EDITTEXT IDC_HACKSEDIT, 186, 32, 146, 14, ES_AUTOHSCROLL, WS_EX_LEFT
 164+ LISTBOX IDC_HACKSLIST, 7, 16, 326, 148, WS_TABSTOP | WS_VSCROLL | LBS_NOINTEGRALHEIGHT |
 165+ LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS | LBS_NOTIFY, WS_EX_LEFT
164166 }
165167
166168
Index: dxglcfg/resource.h
@@ -127,6 +127,8 @@
128128
129129 // Controls - Hacks Tab
130130 #define IDC_HACKSLIST 2501
 131+#define IDC_HACKSDROPDOWN 2502
 132+#define IDC_HACKSEDIT 2503
131133
132134 // Controls - Graphics Tests Tab
133135 #define IDC_TESTLIST 2601