DXGL r939 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r938‎ | r939 | r940 >
Date:00:03, 19 August 2019
Author:admin
Status:new
Tags:
Comment:
Make Limit D3D Texture Formats an integer, default 1 for <= DirectX5
Modified paths:
  • /cfgmgr/cfgmgr.c (modified) (history)
  • /cfgmgr/cfgmgr.h (modified) (history)
  • /dxgl-example.ini (modified) (history)
  • /dxglcfg/dxglcfg.cpp (modified) (history)
  • /dxglcfg/dxglcfg.rc (modified) (history)

Diff [purge]

Index: cfgmgr/cfgmgr.c
@@ -979,7 +979,7 @@
980980 cfg->WindowWidth = 640;
981981 cfg->WindowHeight = 480;
982982 cfg->HackPaletteDelay = 30;
983 - cfg->LimitTextureFormats = TRUE;
 983+ cfg->LimitTextureFormats = 1;
984984 if (!cfg->Windows8Detected)
985985 {
986986 OSVERSIONINFO osver;
@@ -1552,7 +1552,7 @@
15531553 INIWriteInt(file, "D3DAspect", cfg->aspect3d, mask->aspect3d, INISECTION_D3D);
15541554 INIWriteInt(file, "LowColorRendering", cfg->LowColorRendering, mask->LowColorRendering, INISECTION_D3D);
15551555 INIWriteInt(file, "EnableDithering", cfg->EnableDithering, mask->EnableDithering, INISECTION_D3D);
1556 - INIWriteBool(file, "LimitTextureFormats", cfg->LimitTextureFormats, mask->LimitTextureFormats, INISECTION_D3D);
 1556+ INIWriteInt(file, "LimitTextureFormats", cfg->LimitTextureFormats, mask->LimitTextureFormats, INISECTION_D3D);
15571557 // [advanced]
15581558 INIWriteInt(file, "TextureFormat", cfg->TextureFormat, mask->TextureFormat, INISECTION_ADVANCED);
15591559 INIWriteInt(file, "TexUpload", cfg->TexUpload, mask->TexUpload, INISECTION_ADVANCED);
Index: cfgmgr/cfgmgr.h
@@ -67,7 +67,7 @@
6868 DWORD aspect3d;
6969 DWORD LowColorRendering;
7070 DWORD EnableDithering;
71 - BOOL LimitTextureFormats;
 71+ DWORD LimitTextureFormats;
7272 // [advanced]
7373 DWORD vsync;
7474 DWORD TextureFormat;
Index: dxgl-example.ini
@@ -411,10 +411,15 @@
412412 ; Default is 0
413413 EnableDithering=0
414414
415 -; LimitTextureFormats - Boolean
 415+; LimitTextureFormats - Integer
416416 ; Limits the available texture formats returned by EnumTextureFormats to
417 -; avoid crashes in some games. Default is true.
418 -LimitTextureFormats=true
 417+; avoid crashes in some games.
 418+; The following values are valid:
 419+; 0 - Don't limit formats regardless of API version
 420+; 1 - Limit formats on API versions 2 and 1 (DirectX 5 and DirectX 3/2)
 421+; 2 - Limit formats on all API versions.
 422+; Default is 1
 423+LimitTextureFormats=1
419424
420425 [advanced]
421426 ; TextureFormat - Integer
Index: dxglcfg/dxglcfg.cpp
@@ -1982,7 +1982,7 @@
19831983 *dirty = TRUE;
19841984 break;
19851985 case IDC_LIMITTEXFORMATS:
1986 - cfg->LimitTextureFormats = GetCheck(hWnd, IDC_SINGLEBUFFER, &cfgmask->LimitTextureFormats);
 1986+ cfg->LimitTextureFormats = GetCombo(hWnd, IDC_LIMITTEXFORMATS, &cfgmask->LimitTextureFormats);
19871987 EnableWindow(GetDlgItem(hDialog, IDC_APPLY), TRUE);
19881988 *dirty = TRUE;
19891989 break;
@@ -2890,7 +2890,7 @@
28912891 SendDlgItemMessage(hTabs[2], IDC_ASPECT3D, CB_ADDSTRING, 0, (LPARAM)strdefault);
28922892 SendDlgItemMessage(hTabs[2], IDC_LOWCOLORRENDER, CB_ADDSTRING, 0, (LPARAM)strdefault);
28932893 SendDlgItemMessage(hTabs[2], IDC_DITHERING, CB_ADDSTRING, 0, (LPARAM)strdefault);
2894 - SendDlgItemMessage(hTabs[2], IDC_LIMITTEXFORMATS, BM_SETSTYLE, BS_AUTO3STATE, (LPARAM)TRUE);
 2894+ SendDlgItemMessage(hTabs[2], IDC_LIMITTEXFORMATS, CB_ADDSTRING, 0, (LPARAM)strdefault);
28952895 // Advanced tab
28962896 SendDlgItemMessage(hTabs[3], IDC_TEXTUREFORMAT, CB_ADDSTRING, 0, (LPARAM)strdefault);
28972897 SendDlgItemMessage(hTabs[3], IDC_TEXUPLOAD, CB_ADDSTRING, 0, (LPARAM)strdefault);
@@ -2949,7 +2949,8 @@
29502950 SendDlgItemMessage(hTabs[2], IDC_LOWCOLORRENDER, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
29512951 SendDlgItemMessage(hTabs[2], IDC_DITHERING, CB_DELETESTRING,
29522952 SendDlgItemMessage(hTabs[2], IDC_DITHERING, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
2953 - SendDlgItemMessage(hTabs[2], IDC_LIMITTEXFORMATS, BM_SETSTYLE, BS_AUTOCHECKBOX, TRUE);
 2953+ SendDlgItemMessage(hTabs[2], IDC_LIMITTEXFORMATS, CB_DELETESTRING,
 2954+ SendDlgItemMessage(hTabs[2], IDC_LIMITTEXFORMATS, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
29542955 // Advanced tab
29552956 SendDlgItemMessage(hTabs[3], IDC_TEXTUREFORMAT, CB_DELETESTRING,
29562957 SendDlgItemMessage(hTabs[3], IDC_TEXTUREFORMAT, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
@@ -3048,7 +3049,7 @@
30493050 SetCombo(hTabs[2], IDC_ASPECT3D, cfg->aspect3d, cfgmask->aspect3d, tristate);
30503051 SetCombo(hTabs[2], IDC_LOWCOLORRENDER, cfg->LowColorRendering, cfgmask->LowColorRendering, tristate);
30513052 SetCombo(hTabs[2], IDC_DITHERING, cfg->EnableDithering, cfgmask->EnableDithering, tristate);
3052 - SetCheck(hTabs[2], IDC_LIMITTEXFORMATS, cfg->LimitTextureFormats, cfgmask->LimitTextureFormats, tristate);
 3053+ SetCombo(hTabs[2], IDC_LIMITTEXFORMATS, cfg->LimitTextureFormats, cfgmask->LimitTextureFormats, tristate);
30533054 // Advanced tab
30543055 SetCombo(hTabs[3], IDC_TEXTUREFORMAT, cfg->TextureFormat, cfgmask->TextureFormat, tristate);
30553056 SetCombo(hTabs[3], IDC_TEXUPLOAD, cfg->TexUpload, cfgmask->TexUpload, tristate);
@@ -3616,9 +3617,14 @@
36173618 _tcscpy(buffer, _T("Always enabled, low color"));
36183619 SendDlgItemMessage(hTabs[2], IDC_DITHERING, CB_ADDSTRING, 0, (LPARAM)buffer);
36193620 SendDlgItemMessage(hTabs[2], IDC_DITHERING, CB_SETCURSEL, cfg->EnableDithering, 0);
3620 - if (cfg->LimitTextureFormats) SendDlgItemMessage(hTabs[2], IDC_LIMITTEXFORMATS, BM_SETCHECK, BST_CHECKED, 0);
3621 - else SendDlgItemMessage(hTabs[2], IDC_LIMITTEXFORMATS, BM_SETCHECK, BST_UNCHECKED, 0);
3622 -
 3621+ // Limit texture formats
 3622+ _tcscpy(buffer, _T("Disabled"));
 3623+ SendDlgItemMessage(hTabs[2], IDC_LIMITTEXFORMATS, CB_ADDSTRING, 0, (LPARAM)buffer);
 3624+ _tcscpy(buffer, _T("Enabled for DX5 and below"));
 3625+ SendDlgItemMessage(hTabs[2], IDC_LIMITTEXFORMATS, CB_ADDSTRING, 0, (LPARAM)buffer);
 3626+ _tcscpy(buffer, _T("Enabled always"));
 3627+ SendDlgItemMessage(hTabs[2], IDC_LIMITTEXFORMATS, CB_ADDSTRING, 0, (LPARAM)buffer);
 3628+ SendDlgItemMessage(hTabs[2], IDC_LIMITTEXFORMATS, CB_SETCURSEL, cfg->LimitTextureFormats, 0);
36233629 // sort modes
36243630 _tcscpy(buffer,_T("Use system order"));
36253631 SendDlgItemMessage(hTabs[0], IDC_SORTMODES, CB_ADDSTRING, 0, (LPARAM)buffer);
Index: dxglcfg/dxglcfg.rc
@@ -102,7 +102,8 @@
103103 COMBOBOX IDC_LOWCOLORRENDER, 7, 68, 102, 64, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
104104 LTEXT "Enable dithering", IDC_STATIC, 114, 58, 52, 9, SS_LEFT, WS_EX_LEFT
105105 COMBOBOX IDC_DITHERING, 114, 68, 102, 64, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
106 - AUTOCHECKBOX "Limit D3D Texture Formats", IDC_LIMITTEXFORMATS, 7, 86, 99, 8, 0, WS_EX_LEFT
 106+ LTEXT "Limit D3D Texture Formats", 0, 7, 83, 84, 9, SS_LEFT, WS_EX_LEFT
 107+ COMBOBOX IDC_LIMITTEXFORMATS, 7, 94, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
107108 }
108109
109110