ReactOS 0.4.15-dev-7887-g64a59a1
general.c
Go to the documentation of this file.
1#include "wined3dcfg.h"
2
3#include <winreg.h>
4
6{
8 {L"1.4", REG_DWORD, 1},
9 {L"2", REG_DWORD, 2},
10 {L"3", REG_DWORD, 3},
11};
12
14{
17};
18
20{
23};
24
26{
29 {VALUE_FBO, REG_SZ, 0}
30};
31
33{
35 {L"8 MB", REG_SZ, 8},
36 {L"16 MB", REG_SZ, 16},
37 {L"32 MB", REG_SZ, 32},
38 {L"64 MB", REG_SZ, 64},
39 {L"128 MB", REG_SZ, 128},
40 {L"256 MB", REG_SZ, 256},
41 {L"512 MB", REG_SZ, 512},
42};
43
45{
47 {VALUE_GDI, REG_SZ, 0}
48};
49
50
51void InitControl(HWND hWndDlg, HKEY hKey, PWCHAR szKey, PWINED3D_SETTINGS pSettings, INT iControlId, INT iCount)
52{
53 WCHAR szBuffer[MAX_KEY_LENGTH];
54 DWORD dwSize = sizeof(szBuffer);
55 DWORD dwType = 0;
56 INT iCurrent;
57 INT iActive = 0;
58
59 RegQueryValueExW(hKey, szKey, NULL, &dwType, (LPBYTE)szBuffer, &dwSize);
60
61 for(iCurrent = 0; iCurrent < iCount; iCurrent++)
62 {
63 SendDlgItemMessageW(hWndDlg, iControlId, CB_ADDSTRING, 0, (LPARAM)pSettings[iCurrent].szValue);
64
65 if(dwSize && ((dwType == REG_DWORD && *szBuffer == pSettings[iCurrent].iValue) ||
66 (dwType == REG_SZ && !wcscmp(szBuffer, pSettings[iCurrent].szValue))))
67 {
68 iActive = iCurrent;
69 }
70 }
71
72 SendDlgItemMessageW(hWndDlg, iControlId, CB_SETCURSEL, iActive, 0);
73
74}
75
76static VOID InitSettings(HWND hWndDlg)
77{
78 HKEY hKey;
79
81 return;
82
84 INIT_CONTROL(OFFSCREEN, gwd3dsOffscreen);
85 INIT_CONTROL(VIDMEMSIZE, gwd3dsVidMem);
86 INIT_CONTROL(MULTISAMPLING, gwd3dsDisable);
87 INIT_CONTROL(STRICTDRAWORDERING, gwd3dsEnable);
88 INIT_CONTROL(ALWAYSOFFSCREEN, gwd3dsEnable);
89 INIT_CONTROL(DDRENDERER, gwd3dsDdRender);
93
95}
96
97
98static VOID SaveSetting(HWND hWnd, HKEY hKey, PWCHAR szKey, PWINED3D_SETTINGS pCfg, INT iControlId, INT iCount)
99{
100 INT iSel = 0;
101
102 iSel = (INT)SendDlgItemMessageW(hWnd, iControlId, CB_GETCURSEL, 0, 0);
103
104 if(iSel < 0 || iSel > iCount)
105 return;
106
107 if(pCfg[iSel].iType == REG_NONE)
108 {
109 RegDeleteValueW(hKey, szKey);
110 return;
111 }
112
113 if(pCfg[iSel].iType == REG_DWORD)
114 {
115 RegSetValueExW(hKey, szKey, 0, REG_DWORD, (LPBYTE)&pCfg[iSel].iValue, sizeof(pCfg[iSel].iValue));
116 return;
117 } else if (pCfg[iSel].iType == REG_SZ)
118 {
119 RegSetValueExW(hKey, szKey, 0, pCfg[iSel].iType, (LPBYTE)pCfg[iSel].szValue, (wcslen(pCfg[iSel].szValue) + 1) * sizeof(WCHAR));
120 }
121}
122
123
124static VOID WriteSettings(HWND hWndDlg)
125{
126 HKEY hKey;
127
129 return;
130
132 SAVE_CONTROL(OFFSCREEN, gwd3dsOffscreen);
133 SAVE_CONTROL(VIDMEMSIZE, gwd3dsVidMem);
134 SAVE_CONTROL(MULTISAMPLING, gwd3dsDisable);
135 SAVE_CONTROL(STRICTDRAWORDERING, gwd3dsEnable);
136 SAVE_CONTROL(ALWAYSOFFSCREEN, gwd3dsEnable);
137 SAVE_CONTROL(DDRENDERER, gwd3dsDdRender);
141
143}
144
145
147{
148 LPPSHNOTIFY lppsn;
149
150 switch (uMsg)
151 {
152 case WM_INITDIALOG:
153 InitSettings(hWndDlg);
154 return TRUE;
155
156 case WM_COMMAND:
158 PropSheet_Changed(GetParent(hWndDlg), hWndDlg);
159 break;
160
161 case WM_NOTIFY:
162 lppsn = (LPPSHNOTIFY)lParam;
163 if (lppsn->hdr.code == PSN_APPLY)
164 {
165 WriteSettings(hWndDlg);
166 return TRUE;
167 }
168 break;
169 }
170
171 return FALSE;
172}
HWND hWnd
Definition: settings.c:17
#define RegCloseKey(hKey)
Definition: registry.h:49
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
INT_PTR CALLBACK GeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: general.c:174
static VOID InitSettings(HWND hWndDlg)
Definition: general.c:9
void InitControl(HWND hWndDlg, HKEY hKey, PWCHAR szKey, PWINED3D_SETTINGS pSettings, INT iControlId, INT iCount)
Definition: general.c:51
WINED3D_SETTINGS gwd3dsDisable[]
Definition: general.c:13
WINED3D_SETTINGS gwd3dsShaderLvl[]
Definition: general.c:5
WINED3D_SETTINGS gwd3dsEnable[]
Definition: general.c:19
WINED3D_SETTINGS gwd3dsOffscreen[]
Definition: general.c:25
WINED3D_SETTINGS gwd3dsDdRender[]
Definition: general.c:44
static VOID SaveSetting(HWND hWnd, HKEY hKey, PWCHAR szKey, PWINED3D_SETTINGS pCfg, INT iControlId, INT iCount)
Definition: general.c:98
static VOID WriteSettings(HWND hWndDlg)
Definition: general.c:124
WINED3D_SETTINGS gwd3dsVidMem[]
Definition: general.c:32
#define IDC_MIN
Definition: resource.h:10
#define IDC_MAX
Definition: resource.h:21
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2330
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
#define CALLBACK
Definition: compat.h:35
#define MAX_KEY_LENGTH
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define REG_SZ
Definition: layer.c:22
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
unsigned int UINT
Definition: ndis.h:50
#define KEY_WRITE
Definition: nt_native.h:1031
#define REG_NONE
Definition: nt_native.h:1492
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
#define INT
Definition: polytest.cpp:20
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define PSN_APPLY
Definition: prsht.h:117
struct _PSHNOTIFY * LPPSHNOTIFY
#define WM_NOTIFY
Definition: richedit.h:61
#define REG_DWORD
Definition: sdbapi.c:596
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
NMHDR hdr
Definition: prsht.h:330
UINT code
Definition: winuser.h:3159
int32_t INT_PTR
Definition: typedefs.h:64
unsigned char * LPBYTE
Definition: typedefs.h:53
int32_t INT
Definition: typedefs.h:58
uint16_t * PWCHAR
Definition: typedefs.h:56
#define HIWORD(l)
Definition: typedefs.h:247
_In_ ULONG iType
Definition: winddi.h:3748
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define VALUE_BACKBUFFER
Definition: wined3dcfg.h:19
#define VALUE_DISABLED
Definition: wined3dcfg.h:17
#define KEY_WINE
Definition: wined3dcfg.h:23
#define VALUE_GDI
Definition: wined3dcfg.h:15
#define VALUE_DEFAULT
Definition: wined3dcfg.h:21
#define VALUE_ENABLED
Definition: wined3dcfg.h:16
#define VALUE_FBO
Definition: wined3dcfg.h:20
#define SAVE_CONTROL(a, b)
Definition: wined3dcfg.h:37
#define INIT_CONTROL(a, b)
Definition: wined3dcfg.h:36
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define WM_COMMAND
Definition: winuser.h:1740
#define CB_SETCURSEL
Definition: winuser.h:1961
#define WM_INITDIALOG
Definition: winuser.h:1739
#define CBN_SELCHANGE
Definition: winuser.h:1979
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CB_ADDSTRING
Definition: winuser.h:1936
HWND WINAPI GetParent(_In_ HWND)
#define CB_GETCURSEL
Definition: winuser.h:1943
__wchar_t WCHAR
Definition: xmlstorage.h:180