DXGL r69 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r68‎ | r69 | r70 >
Date:16:09, 7 January 2012
Author:admin
Status:new
Tags:
Comment:
Remove audio and input settings from dxglcfg and cfgmgr
And audio or input support, if ever created, will be in a separate product.
Add D3DRENDERSTATE_LIGHTING render state
Modified paths:
  • /cfgmgr/cfgmgr.cpp (modified) (history)
  • /cfgmgr/cfgmgr.h (modified) (history)
  • /ddraw/glDirect3DDevice.cpp (modified) (history)
  • /dxglcfg/dxglcfg.rc (modified) (history)
  • /dxglcfg/resource.h (modified) (history)

Diff [purge]

Index: cfgmgr/cfgmgr.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
@@ -139,9 +139,6 @@
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->audio3d = ReadBool(hKey,cfg->audio3d,cfgmask->audio3d,_T("Use3DAudio"));
144 - cfg->audioglobal = ReadBool(hKey,cfg->audioglobal,cfgmask->audioglobal,_T("GlobalAudio"));
145 - cfg->inputglobal = ReadBool(hKey,cfg->inputglobal,cfgmask->inputglobal,_T("GlobalInput"));
146143 if(!global && dll)
147144 {
148145 LPTSTR paths;
Index: cfgmgr/cfgmgr.h
@@ -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
@@ -35,9 +35,6 @@
3636 DWORD SortModes;
3737 bool AllColorDepths;
3838 bool ExtraModes;
39 - bool audio3d;
40 - bool audioglobal;
41 - bool inputglobal;
4239 } DXGLCFG;
4340
4441 void ReadSettings(HKEY hKey, DXGLCFG *cfg, DXGLCFG *mask, bool global, bool dll, LPTSTR dir);
Index: ddraw/glDirect3DDevice.cpp
@@ -418,22 +418,29 @@
419419 glMaterialf(GL_FRONT_AND_BACK,GL_SHININESS,material.power);
420420 return D3D_OK;
421421 }
 422+
 423+inline void dwordto4float(DWORD in, GLfloat *out)
 424+{
 425+
 426+}
 427+
422428 HRESULT WINAPI glDirect3DDevice7::SetRenderState(D3DRENDERSTATETYPE dwRendStateType, DWORD dwRenderState)
423429 {
 430+ GLfloat floats[4];
 431+ if(dwRendStateType > 152) return DDERR_INVALIDPARAMS;
 432+ if(dwRendStateType < 0) return DDERR_INVALIDPARAMS;
 433+ renderstate[dwRendStateType] = dwRenderState;
424434 switch(dwRendStateType)
425435 {
426436 case D3DRENDERSTATE_ANTIALIAS:
427 - renderstate[dwRendStateType] = dwRenderState;
428437 if(dwRenderState == 0) glDisable(GL_MULTISAMPLE);
429438 else glEnable(GL_MULTISAMPLE);
430439 return D3D_OK;
431440 case D3DRENDERSTATE_TEXTUREPERSPECTIVE:
432 - renderstate[dwRendStateType] = dwRenderState;
433441 if(dwRenderState) glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);
434442 else glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_FASTEST);
435443 return D3D_OK;
436444 case D3DRENDERSTATE_ZENABLE:
437 - renderstate[dwRendStateType] = dwRenderState;
438445 switch(dwRenderState)
439446 {
440447 case D3DZB_FALSE:
@@ -445,6 +452,13 @@
446453 glEnable(GL_DEPTH_TEST);
447454 }
448455 return D3D_OK;
 456+ case D3DRENDERSTATE_LIGHTING:
 457+ if(dwRenderState) glEnable(GL_LIGHTING);
 458+ else glDisable(GL_LIGHTING);
 459+ return D3D_OK;
 460+ case D3DRENDERSTATE_AMBIENT:
 461+ dwordto4float(dwRenderState,floats);
 462+
449463 default:
450464 ERR(DDERR_INVALIDPARAMS);
451465 }
Index: dxglcfg/dxglcfg.rc
@@ -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
@@ -41,7 +41,7 @@
4242 LTEXT "Applications", IDC_STATIC, 4, 4, 39, 8, SS_LEFT
4343 PUSHBUTTON "A&dd...", IDC_ADD, 4, 228, 90, 14
4444 PUSHBUTTON "&Remove", IDC_REMOVE, 96, 228, 90, 14, WS_DISABLED
45 - GROUPBOX "Graphics", IDC_STATIC, 190, 4, 211, 184
 45+ GROUPBOX "Graphics", IDC_STATIC, 190, 4, 211, 238
4646 LTEXT "Video mode", IDC_STATIC, 195, 14, 38, 8, SS_LEFT
4747 COMBOBOX IDC_VIDMODE, 195, 24, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS
4848 AUTOCHECKBOX "Change color depth", IDC_COLOR, 299, 14, 79, 10
@@ -60,12 +60,6 @@
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 - GROUPBOX "Audio", IDC_STATIC, 190, 190, 211, 24
65 - AUTOCHECKBOX "Enable 3D audio", IDC_AUDIO3D, 194, 200, 67, 10, WS_DISABLED
66 - AUTOCHECKBOX "Force global audio", IDC_AUDIOGLOBAL, 299, 200, 74, 10, WS_DISABLED
67 - GROUPBOX "Input", IDC_STATIC, 190, 216, 211, 26
68 - AUTOCHECKBOX "Force global input", IDC_INPUTGLOBAL, 194, 227, 73, 10, WS_DISABLED
69 - PUSHBUTTON "Configure controllers...", IDC_INPUTCFG, 299, 223, 80, 14, WS_DISABLED
7064 AUTOCHECKBOX "Always cache surfaces to system memory", IDC_SYSMEMCACHE, 196, 173, 149, 10
7165 AUTOCHECKBOX "Adjust Primary resolution", IDC_HIGHRES, 299, 28, 96, 8
7266 AUTOCHECKBOX "Support All Color Depths", IDC_UNCOMMONCOLOR, 299, 55, 94, 8
@@ -91,6 +85,7 @@
9286 IDI_STAR ICON "..\\common\\star.ico"
9387
9488
 89+
9590 //
9691 // Version Information resources
9792 //
@@ -124,6 +119,7 @@
125120 }
126121
127122
 123+
128124 //
129125 // Manifest resources
130126 //
Index: dxglcfg/resource.h
@@ -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
@@ -31,7 +31,6 @@
3232 #define IDC_APPS 1037
3333 #define IDC_ADD 1038
3434 #define IDC_REMOVE 1039
35 -#define IDC_INSTALL 1040
3635 #define IDC_VIDMODE 1041
3736 #define IDC_SCALE 1042
3837 #define IDC_VSYNC 1043
@@ -42,8 +41,4 @@
4342 #define IDC_MSAA 1048
4443 #define IDC_COLOR 1049
4544 #define IDC_ASPECT 1050
46 -#define IDC_AUDIO3D 1051
47 -#define IDC_AUDIOGLOBAL 1052
48 -#define IDC_INPUTGLOBAL 1053
49 -#define IDC_INPUTCFG 1054
5045 #define IDC_EXTRAMODES 1055