2012-01-19 18:15:49 +00:00
|
|
|
#include "wined3dcfg.h"
|
|
|
|
|
2014-01-19 10:41:43 +00:00
|
|
|
#include <winreg.h>
|
|
|
|
|
2014-05-19 09:58:26 +00:00
|
|
|
WINED3D_SETTINGS gwd3dsShaderLvl[] =
|
2012-01-19 18:15:49 +00:00
|
|
|
{
|
2014-05-19 09:58:26 +00:00
|
|
|
{VALUE_DEFAULT, REG_NONE, 0},
|
|
|
|
{L"1.4", REG_DWORD, 1},
|
|
|
|
{L"2", REG_DWORD, 2},
|
|
|
|
{L"3", REG_DWORD, 3},
|
|
|
|
};
|
2012-01-19 18:15:49 +00:00
|
|
|
|
2014-05-19 09:58:26 +00:00
|
|
|
WINED3D_SETTINGS gwd3dsDisable[] =
|
2012-01-19 18:15:49 +00:00
|
|
|
{
|
2014-05-19 09:58:26 +00:00
|
|
|
{VALUE_DEFAULT, REG_NONE, 0},
|
|
|
|
{VALUE_DISABLED, REG_SZ, 0}
|
|
|
|
};
|
2012-01-19 18:15:49 +00:00
|
|
|
|
2014-05-19 09:58:26 +00:00
|
|
|
WINED3D_SETTINGS gwd3dsEnable[] =
|
2012-01-19 18:15:49 +00:00
|
|
|
{
|
2014-05-19 09:58:26 +00:00
|
|
|
{VALUE_DEFAULT, REG_NONE, 0},
|
|
|
|
{VALUE_ENABLED, REG_SZ, 0}
|
|
|
|
};
|
2012-01-19 18:15:49 +00:00
|
|
|
|
2014-05-19 09:58:26 +00:00
|
|
|
WINED3D_SETTINGS gwd3dsOffscreen[] =
|
|
|
|
{
|
|
|
|
{VALUE_DEFAULT, REG_NONE, 0},
|
|
|
|
{VALUE_BACKBUFFER, REG_SZ, 0},
|
|
|
|
{VALUE_FBO, REG_SZ, 0}
|
|
|
|
};
|
2012-01-19 18:15:49 +00:00
|
|
|
|
2014-05-19 09:58:26 +00:00
|
|
|
WINED3D_SETTINGS gwd3dsVidMem[] =
|
|
|
|
{
|
|
|
|
{VALUE_DEFAULT, REG_NONE, 0},
|
|
|
|
{L"8", REG_SZ, 8},
|
|
|
|
{L"16", REG_SZ, 16},
|
|
|
|
{L"32", REG_SZ, 32},
|
|
|
|
{L"64", REG_SZ, 64},
|
|
|
|
{L"128", REG_SZ, 128},
|
|
|
|
{L"256", REG_SZ, 256},
|
|
|
|
{L"512", REG_SZ, 512},
|
|
|
|
};
|
|
|
|
|
|
|
|
WINED3D_SETTINGS gwd3dsDdRender[] =
|
|
|
|
{
|
|
|
|
{VALUE_DEFAULT, REG_NONE, 0},
|
|
|
|
{VALUE_GDI, REG_SZ, 0}
|
|
|
|
};
|
2012-01-19 18:15:49 +00:00
|
|
|
|
|
|
|
|
2014-05-19 09:58:26 +00:00
|
|
|
void InitControl(HWND hWndDlg, HKEY hKey, PWCHAR szKey, PWINED3D_SETTINGS pSettings, INT iControlId, INT iCount)
|
|
|
|
{
|
|
|
|
WCHAR szBuffer[MAX_KEY_LENGTH];
|
|
|
|
DWORD dwSize = MAX_KEY_LENGTH;
|
|
|
|
DWORD dwType = 0;
|
|
|
|
INT iCurrent;
|
|
|
|
INT iActive = 0;
|
2012-01-19 18:15:49 +00:00
|
|
|
|
2014-05-19 09:58:26 +00:00
|
|
|
RegQueryValueExW(hKey, szKey, NULL, &dwType, (LPBYTE)szBuffer, &dwSize);
|
2012-01-19 18:15:49 +00:00
|
|
|
|
2014-05-19 09:58:26 +00:00
|
|
|
for(iCurrent = 0; iCurrent < iCount; iCurrent++)
|
|
|
|
{
|
|
|
|
SendDlgItemMessageW(hWndDlg, iControlId, CB_ADDSTRING, 0, (LPARAM)pSettings[iCurrent].szValue);
|
2012-01-19 18:15:49 +00:00
|
|
|
|
2014-05-19 09:58:26 +00:00
|
|
|
if(dwSize && ((dwType == REG_DWORD && *szBuffer == pSettings[iCurrent].iValue) ||
|
|
|
|
(dwType == REG_SZ && !wcscmp(szBuffer, pSettings[iCurrent].szValue))))
|
|
|
|
{
|
|
|
|
iActive = iCurrent;
|
|
|
|
}
|
|
|
|
}
|
2012-01-19 18:15:49 +00:00
|
|
|
|
2014-05-19 09:58:26 +00:00
|
|
|
SendDlgItemMessageW(hWndDlg, iControlId, CB_SETCURSEL, iActive, 0);
|
2012-01-19 18:15:49 +00:00
|
|
|
|
2014-05-19 09:58:26 +00:00
|
|
|
}
|
2012-01-19 18:15:49 +00:00
|
|
|
|
2014-05-19 09:58:26 +00:00
|
|
|
static VOID InitSettings(HWND hWndDlg)
|
|
|
|
{
|
|
|
|
HKEY hKey;
|
2012-01-19 18:15:49 +00:00
|
|
|
|
2014-05-19 09:58:26 +00:00
|
|
|
if (RegCreateKeyExW(HKEY_CURRENT_USER, KEY_WINE, 0, NULL, 0, MAXIMUM_ALLOWED, NULL, &hKey, NULL) != ERROR_SUCCESS)
|
|
|
|
return;
|
2012-01-19 18:15:49 +00:00
|
|
|
|
2014-05-19 09:58:26 +00:00
|
|
|
INIT_CONTROL(GLSL, gwd3dsDisable);
|
|
|
|
INIT_CONTROL(OFFSCREEN, gwd3dsOffscreen);
|
|
|
|
INIT_CONTROL(VIDMEMSIZE, gwd3dsVidMem);
|
|
|
|
INIT_CONTROL(MULTISAMPLING, gwd3dsDisable);
|
|
|
|
INIT_CONTROL(STRICTDRAWORDERING, gwd3dsEnable);
|
|
|
|
INIT_CONTROL(ALWAYSOFFSCREEN, gwd3dsEnable);
|
|
|
|
INIT_CONTROL(DDRENDERER, gwd3dsDdRender);
|
|
|
|
INIT_CONTROL(PSLEVEL, gwd3dsShaderLvl);
|
|
|
|
INIT_CONTROL(VSLEVEL, gwd3dsShaderLvl);
|
|
|
|
INIT_CONTROL(GSLEVEL, gwd3dsShaderLvl);
|
2012-01-19 18:15:49 +00:00
|
|
|
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
}
|
|
|
|
|
2014-05-19 09:58:26 +00:00
|
|
|
|
|
|
|
static VOID SaveSetting(HWND hWnd, HKEY hKey, PWCHAR szKey, PWINED3D_SETTINGS pCfg, INT iControlId, INT iCount)
|
2012-01-19 18:15:49 +00:00
|
|
|
{
|
2014-05-19 09:58:26 +00:00
|
|
|
INT iSel = 0;
|
|
|
|
|
|
|
|
iSel = (INT)SendDlgItemMessageW(hWnd, iControlId, CB_GETCURSEL, 0, 0);
|
2012-01-19 18:15:49 +00:00
|
|
|
|
2014-05-19 09:58:26 +00:00
|
|
|
if(iSel < 0 || iSel > iCount)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if(pCfg[iSel].iType == REG_NONE)
|
2012-01-19 18:15:49 +00:00
|
|
|
{
|
2014-05-19 09:58:26 +00:00
|
|
|
RegDeleteValueW(hKey, szKey);
|
2012-01-19 18:15:49 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-05-19 09:58:26 +00:00
|
|
|
if(pCfg[iSel].iType == REG_DWORD)
|
|
|
|
{
|
|
|
|
RegSetValueExW(hKey, szKey, 0, REG_DWORD, (LPBYTE)&pCfg[iSel].iValue, sizeof(pCfg[iSel].iValue));
|
|
|
|
return;
|
|
|
|
} else if (pCfg[iSel].iType == REG_SZ)
|
2012-01-19 18:15:49 +00:00
|
|
|
{
|
2014-05-19 09:58:26 +00:00
|
|
|
RegSetValueExW(hKey, szKey, 0, pCfg[iSel].iType, (LPBYTE)pCfg[iSel].szValue, (wcslen(pCfg[iSel].szValue) + 1) * sizeof(WCHAR));
|
2012-01-19 18:15:49 +00:00
|
|
|
}
|
2014-05-19 09:58:26 +00:00
|
|
|
}
|
2012-01-19 18:15:49 +00:00
|
|
|
|
|
|
|
|
2014-05-19 09:58:26 +00:00
|
|
|
static VOID WriteSettings(HWND hWndDlg)
|
|
|
|
{
|
|
|
|
HKEY hKey;
|
2012-01-19 18:15:49 +00:00
|
|
|
|
2014-05-19 09:58:26 +00:00
|
|
|
if (RegOpenKeyExW(HKEY_CURRENT_USER, KEY_WINE, 0, KEY_WRITE, &hKey) != ERROR_SUCCESS)
|
|
|
|
return;
|
|
|
|
|
|
|
|
SAVE_CONTROL(GLSL, gwd3dsDisable);
|
|
|
|
SAVE_CONTROL(OFFSCREEN, gwd3dsOffscreen);
|
|
|
|
SAVE_CONTROL(VIDMEMSIZE, gwd3dsVidMem);
|
|
|
|
SAVE_CONTROL(MULTISAMPLING, gwd3dsDisable);
|
|
|
|
SAVE_CONTROL(STRICTDRAWORDERING, gwd3dsEnable);
|
|
|
|
SAVE_CONTROL(ALWAYSOFFSCREEN, gwd3dsEnable);
|
|
|
|
SAVE_CONTROL(DDRENDERER, gwd3dsDdRender);
|
|
|
|
SAVE_CONTROL(PSLEVEL, gwd3dsShaderLvl);
|
|
|
|
SAVE_CONTROL(VSLEVEL, gwd3dsShaderLvl);
|
|
|
|
SAVE_CONTROL(GSLEVEL, gwd3dsShaderLvl);
|
2012-01-19 18:15:49 +00:00
|
|
|
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
INT_PTR CALLBACK GeneralPageProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
|
|
|
LPPSHNOTIFY lppsn;
|
|
|
|
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
InitSettings(hWndDlg);
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case WM_COMMAND:
|
2014-05-19 09:58:26 +00:00
|
|
|
if (LOWORD(wParam) > IDC_MIN && LOWORD(wParam) < IDC_MAX)
|
|
|
|
PropSheet_Changed(GetParent(hWndDlg), hWndDlg);
|
2012-01-19 18:15:49 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
lppsn = (LPPSHNOTIFY)lParam;
|
|
|
|
if (lppsn->hdr.code == PSN_APPLY)
|
|
|
|
{
|
|
|
|
WriteSettings(hWndDlg);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|