DXGL r340 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r339‎ | r340 | r341 >
Date:01:30, 27 February 2013
Author:admin
Status:new
Tags:
Comment:
Enable all color depths by default on Windows 8 (and above).
Modified paths:
  • /cfgmgr/cfgmgr.cpp (modified) (history)
  • /cfgmgr/cfgmgr.h (modified) (history)

Diff [purge]

Index: cfgmgr/cfgmgr.cpp
@@ -141,6 +141,7 @@
142142 cfg->vsync = ReadDWORD(hKey,cfg->vsync,cfgmask->vsync,_T("VSync"));
143143 cfg->TextureFormat = ReadDWORD(hKey,cfg->TextureFormat,cfgmask->TextureFormat,_T("TextureFormat"));
144144 cfg->TexUpload = ReadDWORD(hKey,cfg->TexUpload,cfgmask->TexUpload,_T("TexUpload"));
 145+ cfg->Windows8Detected = ReadBool(hKey,cfg->Windows8Detected,cfgmask->Windows8Detected,_T("Windows8Detected"));
145146 if(!global && dll)
146147 {
147148 LPTSTR paths;
@@ -220,6 +221,7 @@
221222 WriteDWORD(hKey,cfg->vsync,cfgmask->vsync,_T("VSync"));
222223 WriteDWORD(hKey,cfg->TextureFormat,cfgmask->TextureFormat,_T("TextureFormat"));
223224 WriteDWORD(hKey,cfg->TexUpload,cfgmask->TexUpload,_T("TexUpload"));
 225+ WriteBool(hKey,cfg->Windows8Detected,cfgmask->Windows8Detected,_T("Windows8Detected"));
224226 }
225227
226228 tstring newregname;
@@ -412,6 +414,15 @@
413415 ZeroMemory(cfg,sizeof(DXGLCFG));
414416 RegCreateKeyEx(HKEY_CURRENT_USER,regkeyglobal,0,NULL,0,KEY_ALL_ACCESS,NULL,&hKey,NULL);
415417 ReadSettings(hKey,cfg,NULL,true,false,NULL);
 418+ if(!cfg->Windows8Detected)
 419+ {
 420+ OSVERSIONINFO osver;
 421+ osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
 422+ GetVersionEx(&osver);
 423+ if(osver.dwMajorVersion > 6) cfg->Windows8Detected = true;
 424+ if((osver.dwMajorVersion == 6) && (osver.dwMinorVersion >= 2)) cfg->Windows8Detected = true;
 425+ if(cfg->Windows8Detected) cfg->AllColorDepths = true;
 426+ }
416427 RegCloseKey(hKey);
417428 }
418429
Index: cfgmgr/cfgmgr.h
@@ -37,6 +37,7 @@
3838 bool ExtraModes;
3939 DWORD TextureFormat;
4040 DWORD TexUpload;
 41+ bool Windows8Detected;
4142 } DXGLCFG;
4243
4344 void ReadSettings(HKEY hKey, DXGLCFG *cfg, DXGLCFG *mask, bool global, bool dll, LPTSTR dir);