DXGL r70 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r69‎ | r70 | r71 >
Date:17:45, 7 January 2012
Author:admin
Status:new
Tags:
Comment:
Add texture format checkbox to dxglcfg
Modified paths:
  • /cfgmgr/ReadMe.txt (modified) (history)
  • /cfgmgr/cfgmgr.cpp (modified) (history)
  • /cfgmgr/cfgmgr.h (modified) (history)
  • /ddraw/glDirectDrawSurface.cpp (modified) (history)
  • /dxglcfg/dxglcfg.cpp (modified) (history)
  • /dxglcfg/dxglcfg.rc (modified) (history)
  • /dxglcfg/resource.h (modified) (history)

Diff [purge]

Index: cfgmgr/ReadMe.txt
@@ -106,4 +106,11 @@
107107 Valid settings:
108108 0 - Determined by application
109109 1 - Off
110 -2 - On
\ No newline at end of file
 110+2 - On
 111+
 112+Member texformat
 113+REG_DWORD HKCU\DXGL\<app>\TexFormat
 114+Texture format
 115+Valid settings:
 116+0 - RGBA8
 117+1 - Optimized
\ No newline at end of file
Index: cfgmgr/cfgmgr.cpp
@@ -139,6 +139,7 @@
140140 cfg->AllColorDepths = ReadBool(hKey,cfg->AllColorDepths,cfgmask->AllColorDepths,_T("AllColorDepths"));
141141 cfg->ExtraModes = ReadBool(hKey,cfg->ExtraModes,cfgmask->ExtraModes,_T("ExtraModes"));
142142 cfg->vsync = ReadDWORD(hKey,cfg->vsync,cfgmask->vsync,_T("VSync"));
 143+ cfg->texformat = ReadBool(hKey,cfg->texformat,cfgmask->texformat,_T("TexFormat"));
143144 if(!global && dll)
144145 {
145146 LPTSTR paths;
@@ -213,6 +214,7 @@
214215 WriteDWORD(hKey,cfg->SortModes,cfgmask->SortModes,_T("SortModes"));
215216 WriteBool(hKey,cfg->AllColorDepths,cfgmask->AllColorDepths,_T("AllColorDepths"));
216217 WriteBool(hKey,cfg->ExtraModes,cfgmask->ExtraModes,_T("ExtraModes"));
 218+ WriteBool(hKey,cfg->texformat,cfgmask->texformat,_T("TexFormat"));
217219 WriteDWORD(hKey,cfg->vsync,cfgmask->vsync,_T("VSync"));
218220 }
219221
Index: cfgmgr/cfgmgr.h
@@ -35,6 +35,7 @@
3636 DWORD SortModes;
3737 bool AllColorDepths;
3838 bool ExtraModes;
 39+ bool texformat;
3940 } DXGLCFG;
4041
4142 void ReadSettings(HKEY hKey, DXGLCFG *cfg, DXGLCFG *mask, bool global, bool dll, LPTSTR dir);
Index: ddraw/glDirectDrawSurface.cpp
@@ -1,5 +1,5 @@
22 // DXGL
3 -// Copyright (C) 2011 William Feely
 3+// Copyright (C) 2011-2012 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
@@ -349,7 +349,8 @@
350350 case 8:
351351 texformat = GL_LUMINANCE;
352352 texformat2 = GL_UNSIGNED_BYTE;
353 - texformat3 = GL_LUMINANCE8;
 353+ if(dxglcfg.texformat) texformat3 = GL_LUMINANCE8;
 354+ else texformat3 = GL_RGBA8;
354355 ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_PALETTEINDEXED8;
355356 ddsd.ddpfPixelFormat.dwRBitMask = 0;
356357 ddsd.ddpfPixelFormat.dwGBitMask = 0;
@@ -359,7 +360,8 @@
360361 case 15:
361362 texformat = GL_BGRA;
362363 texformat2 = GL_UNSIGNED_SHORT_1_5_5_5_REV;
363 - texformat3 = GL_RGB5_A1;
 364+ if(dxglcfg.texformat) texformat3 = GL_RGB5_A1;
 365+ else texformat3 = GL_RGBA8;
364366 ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
365367 ddsd.ddpfPixelFormat.dwRBitMask = 0x7C00;
366368 ddsd.ddpfPixelFormat.dwGBitMask = 0x3E0;
@@ -370,7 +372,8 @@
371373 case 16:
372374 texformat = GL_RGB;
373375 texformat2 = GL_UNSIGNED_SHORT_5_6_5;
374 - texformat3 = GL_RGB;
 376+ if(dxglcfg.texformat) texformat3 = GL_RGB;
 377+ else texformat3 = GL_RGBA8;
375378 ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
376379 ddsd.ddpfPixelFormat.dwRBitMask = 0xF800;
377380 ddsd.ddpfPixelFormat.dwGBitMask = 0x7E0;
@@ -380,7 +383,8 @@
381384 case 24:
382385 texformat = GL_BGR;
383386 texformat2 = GL_UNSIGNED_BYTE;
384 - texformat3 = GL_RGB8;
 387+ if(dxglcfg.texformat) texformat3 = GL_RGB8;
 388+ else texformat3 = GL_RGBA8;
385389 ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
386390 ddsd.ddpfPixelFormat.dwRBitMask = 0xFF0000;
387391 ddsd.ddpfPixelFormat.dwGBitMask = 0xFF00;
Index: dxglcfg/dxglcfg.cpp
@@ -1,5 +1,5 @@
22 // DXGL
3 -// Copyright (C) 2011 William Feely
 3+// Copyright (C) 2011-2012 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
@@ -552,6 +552,9 @@
553553 else SendDlgItemMessage(hWnd,IDC_EXTRAMODES,BM_SETCHECK,BST_UNCHECKED,0);
554554 // shader path
555555 SetText(hWnd,IDC_SHADER,cfg->shaderfile,cfgmask->shaderfile,false);
 556+ // texture format
 557+ if(cfg->texformat) SendDlgItemMessage(hWnd,IDC_TEXFORMAT,BM_SETCHECK,BST_CHECKED,0);
 558+ else SendDlgItemMessage(hWnd,IDC_TEXFORMAT,BM_SETCHECK,BST_UNCHECKED,0);
556559 // Add installed programs
557560 current_app = 1;
558561 appcount = 1;
@@ -769,7 +772,7 @@
770773 SendDlgItemMessage(hWnd,IDC_HIGHRES,BM_SETSTYLE,BS_AUTO3STATE,(LPARAM)TRUE);
771774 SendDlgItemMessage(hWnd,IDC_UNCOMMONCOLOR,BM_SETSTYLE,BS_AUTO3STATE,(LPARAM)TRUE);
772775 SendDlgItemMessage(hWnd,IDC_EXTRAMODES,BM_SETSTYLE,BS_AUTO3STATE,(LPARAM)TRUE);
773 - SendDlgItemMessage(hWnd,IDC_SYSMEMCACHE,BM_SETSTYLE,BS_AUTO3STATE,(LPARAM)TRUE);
 776+ SendDlgItemMessage(hWnd,IDC_TEXFORMAT,BM_SETSTYLE,BS_AUTO3STATE,(LPARAM)TRUE);
774777 }
775778 else if(!current_app && tristate)
776779 {
@@ -794,7 +797,7 @@
795798 SendDlgItemMessage(hWnd,IDC_HIGHRES,BM_SETSTYLE,BS_AUTOCHECKBOX,(LPARAM)TRUE);
796799 SendDlgItemMessage(hWnd,IDC_UNCOMMONCOLOR,BM_SETSTYLE,BS_AUTOCHECKBOX,(LPARAM)TRUE);
797800 SendDlgItemMessage(hWnd,IDC_EXTRAMODES,BM_SETSTYLE,BS_AUTOCHECKBOX,(LPARAM)TRUE);
798 - SendDlgItemMessage(hWnd,IDC_SYSMEMCACHE,BM_SETSTYLE,BS_AUTOCHECKBOX,(LPARAM)TRUE);
 801+ SendDlgItemMessage(hWnd,IDC_TEXFORMAT,BM_SETSTYLE,BS_AUTOCHECKBOX,(LPARAM)TRUE);
799802 }
800803 // Read settings into controls
801804 SetCombo(hWnd,IDC_VIDMODE,cfg->scaler,cfgmask->scaler,tristate);
@@ -808,6 +811,7 @@
809812 SetCheck(hWnd,IDC_COLOR,cfg->colormode,cfgmask->colormode,tristate);
810813 SetCheck(hWnd,IDC_HIGHRES,cfg->highres,cfgmask->highres,tristate);
811814 SetCheck(hWnd,IDC_UNCOMMONCOLOR,cfg->AllColorDepths,cfgmask->AllColorDepths,tristate);
 815+ SetCheck(hWnd,IDC_TEXFORMAT,cfg->texformat,cfgmask->texformat,tristate);
812816 SetCheck(hWnd,IDC_EXTRAMODES,cfg->ExtraModes,cfgmask->ExtraModes,tristate);
813817 SetText(hWnd,IDC_SHADER,cfg->shaderfile,cfgmask->shaderfile,tristate);
814818 }
@@ -871,6 +875,11 @@
872876 EnableWindow(GetDlgItem(hWnd,IDC_APPLY),true);
873877 *dirty = true;
874878 break;
 879+ case IDC_TEXFORMAT:
 880+ cfg->texformat = GetCheck(hWnd,IDC_TEXFORMAT,cfgmask->texformat);
 881+ EnableWindow(GetDlgItem(hWnd,IDC_APPLY),true);
 882+ *dirty = true;
 883+ break;
875884 case IDC_SHADER:
876885 if(HIWORD(wParam) == EN_CHANGE)
877886 {
Index: dxglcfg/dxglcfg.rc
@@ -60,12 +60,12 @@
6161 COMBOBOX IDC_MSAA, 196, 155, 101, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS
6262 LTEXT "Aspect ratio", IDC_STATIC, 300, 145, 40, 8, SS_LEFT
6363 COMBOBOX IDC_ASPECT, 299, 155, 100, 14, CBS_DROPDOWNLIST | CBS_HASSTRINGS
64 - AUTOCHECKBOX "Always cache surfaces to system memory", IDC_SYSMEMCACHE, 196, 173, 149, 10
6564 AUTOCHECKBOX "Adjust Primary resolution", IDC_HIGHRES, 299, 28, 96, 8
6665 AUTOCHECKBOX "Support All Color Depths", IDC_UNCOMMONCOLOR, 299, 55, 94, 8
6766 AUTOCHECKBOX "Add Extra Display Modes", IDC_EXTRAMODES, 299, 42, 100, 8
6867 LTEXT "Sort video modes", IDC_STATIC, 195, 39, 56, 8, SS_LEFT
6968 COMBOBOX IDC_SORTMODES, 195, 49, 101, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS
 69+ AUTOCHECKBOX "Use optimized texture internal formats", IDC_TEXFORMAT, 196, 173, 149, 10
7070 }
7171
7272
Index: dxglcfg/resource.h
@@ -23,7 +23,7 @@
2424 #define IDI_DXGL 107
2525 #define IDI_DXGLSM 109
2626 #define IDI_STAR 111
27 -#define IDC_SYSMEMCACHE 1001
 27+#define IDC_TEXFORMAT 1001
2828 #define IDC_HIGHRES 1002
2929 #define IDC_SORTMODES 1003
3030 #define IDC_UNCOMMONCOLOR 1004