diff options
| author | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-05-12 03:25:52 +0000 |
|---|---|---|
| committer | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-05-12 03:25:52 +0000 |
| commit | dc4aa0f1e6f0afa4c78288a1fe9dd681743e758a (patch) | |
| tree | 9677bf958423d28e0da5a905fc0177f032e09b9c | |
| parent | 0169e4968d17823b71c52961c52417ea8057130c (diff) | |
| download | pcsxr-dc4aa0f1e6f0afa4c78288a1fe9dd681743e758a.tar.gz | |
windows
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@47871 e17a0e51-4ae3-4d35-97c3-1a29b211df97
| -rw-r--r-- | ChangeLog | 1 | ||||
| -rw-r--r-- | win32/gui/ConfigurePlugins.c | 63 | ||||
| -rw-r--r-- | win32/gui/WndMain.c | 15 |
3 files changed, 46 insertions, 33 deletions
@@ -7,6 +7,7 @@ May 12, 2010 Wei Mingzhi <whistler_wmz@users.sf.net> config. * gui/ConfDlg.c: Likewise. * win32/gui/ConfigurePlugins.c: Likewise. + * win32/gui/WndMain.c: Likewise. * libpcsxcore/psxmem.c: Likewise. * libpcsxcore/r3000a.c: Likewise. * libpcsxcore/plugins.c: Likewise. diff --git a/win32/gui/ConfigurePlugins.c b/win32/gui/ConfigurePlugins.c index 54b69b37..3eb11fae 100644 --- a/win32/gui/ConfigurePlugins.c +++ b/win32/gui/ConfigurePlugins.c @@ -25,16 +25,25 @@ #include "resource.h"
#include "Win32.h"
+#define QueryKeyB(name, var) \
+ size = sizeof(DWORD); \
+ if (RegQueryValueEx(myKey, name, 0, &type, (LPBYTE)&tmp, &size) != 0) { if (err) { RegCloseKey(myKey); return -1; } } \
+ var = (tmp != 0);
+
#define QueryKeyV(s, name, var) \
size = s; \
- if (RegQueryValueEx(myKey, name, 0, &type, (LPBYTE) var, &size) != 0) { if (err) { RegCloseKey(myKey); return -1; } }
+ if (RegQueryValueEx(myKey, name, 0, &type, (LPBYTE)var, &size) != 0) { if (err) { RegCloseKey(myKey); return -1; } }
+
+#define SetKeyB(name, var) \
+ tmp = ((var) ? 1 : 0); \
+ RegSetValueEx(myKey, name, 0, REG_DWORD, (LPBYTE)&tmp, sizeof(DWORD));
#define SetKeyV(name, var, s, t) \
- RegSetValueEx(myKey, name, 0, t, (LPBYTE) var, s);
+ RegSetValueEx(myKey, name, 0, t, (LPBYTE)var, s);
int LoadConfig() {
HKEY myKey;
- DWORD type,size;
+ DWORD type, size, tmp;
PcsxConfig *Conf = &Config;
int err;
#ifdef ENABLE_NLS
@@ -57,16 +66,18 @@ int LoadConfig() { err = 0;
QueryKeyV(256, "Net", Conf->Net);
QueryKeyV(256, "Lang", Conf->Lang);
- QueryKeyV(sizeof(Conf->Xa), "Xa", &Conf->Xa);
- QueryKeyV(sizeof(Conf->Sio), "Sio", &Conf->Sio);
- QueryKeyV(sizeof(Conf->Mdec), "Mdec", &Conf->Mdec);
- QueryKeyV(sizeof(Conf->PsxAuto), "PsxAuto", &Conf->PsxAuto);
- QueryKeyV(sizeof(Conf->Cdda), "Cdda", &Conf->Cdda);
- QueryKeyV(sizeof(Conf->Debug), "Debug", &Conf->Debug);
- QueryKeyV(sizeof(Conf->PsxOut), "PsxOut", &Conf->PsxOut);
- QueryKeyV(sizeof(Conf->SpuIrq), "SpuIrq", &Conf->SpuIrq);
- QueryKeyV(sizeof(Conf->RCntFix), "RCntFix", &Conf->RCntFix);
- QueryKeyV(sizeof(Conf->VSyncWA), "VSyncWA", &Conf->VSyncWA);
+
+ QueryKeyB("Xa", Conf->Xa);
+ QueryKeyB("Sio", Conf->Sio);
+ QueryKeyB("Mdec", Conf->Mdec);
+ QueryKeyB("PsxAuto", Conf->PsxAuto);
+ QueryKeyB("Cdda", Conf->Cdda);
+ QueryKeyB("Debug", Conf->Debug);
+ QueryKeyB("PsxOut", Conf->PsxOut);
+ QueryKeyB("SpuIrq", Conf->SpuIrq);
+ QueryKeyB("RCntFix", Conf->RCntFix);
+ QueryKeyB("VSyncWA", Conf->VSyncWA);
+
QueryKeyV(sizeof(Conf->Cpu), "Cpu", &Conf->Cpu);
QueryKeyV(sizeof(Conf->PsxType), "PsxType", &Conf->PsxType);
@@ -88,7 +99,7 @@ int LoadConfig() { void SaveConfig() {
HKEY myKey;
- DWORD myDisp;
+ DWORD myDisp, tmp;
PcsxConfig *Conf = &Config;
RegCreateKeyEx(HKEY_CURRENT_USER, cfgfile, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &myKey, &myDisp);
@@ -105,18 +116,20 @@ void SaveConfig() { SetKeyV("Lang", Conf->Lang, strlen(Conf->Lang), REG_SZ);
SetKeyV("PluginsDir", Conf->PluginsDir, strlen(Conf->PluginsDir), REG_SZ);
SetKeyV("BiosDir", Conf->BiosDir, strlen(Conf->BiosDir), REG_SZ);
- SetKeyV("Xa", &Conf->Xa, sizeof(Conf->Xa), REG_DWORD);
- SetKeyV("Sio", &Conf->Sio, sizeof(Conf->Sio), REG_DWORD);
- SetKeyV("Mdec", &Conf->Mdec, sizeof(Conf->Mdec), REG_DWORD);
- SetKeyV("PsxAuto", &Conf->PsxAuto, sizeof(Conf->PsxAuto), REG_DWORD);
- SetKeyV("PsxType", &Conf->PsxType, sizeof(Conf->PsxType), REG_DWORD);
- SetKeyV("Cdda", &Conf->Cdda, sizeof(Conf->Cdda), REG_DWORD);
+
+ SetKeyB("Xa", Conf->Xa);
+ SetKeyB("Sio", Conf->Sio);
+ SetKeyB("Mdec", Conf->Mdec);
+ SetKeyB("PsxAuto", Conf->PsxAuto);
+ SetKeyB("Cdda", Conf->Cdda);
+ SetKeyB("Debug", Conf->Debug);
+ SetKeyB("PsxOut", Conf->PsxOut);
+ SetKeyB("SpuIrq", Conf->SpuIrq);
+ SetKeyB("RCntFix", Conf->RCntFix);
+ SetKeyB("VSyncWA", Conf->VSyncWA);
+
SetKeyV("Cpu", &Conf->Cpu, sizeof(Conf->Cpu), REG_DWORD);
- SetKeyV("Debug", &Conf->Debug, sizeof(Conf->Debug), REG_DWORD);
- SetKeyV("PsxOut", &Conf->PsxOut, sizeof(Conf->PsxOut), REG_DWORD);
- SetKeyV("SpuIrq", &Conf->SpuIrq, sizeof(Conf->SpuIrq), REG_DWORD);
- SetKeyV("RCntFix", &Conf->RCntFix, sizeof(Conf->RCntFix), REG_DWORD);
- SetKeyV("VSyncWA", &Conf->VSyncWA, sizeof(Conf->VSyncWA), REG_DWORD);
+ SetKeyV("PsxType", &Conf->PsxType, sizeof(Conf->PsxType), REG_DWORD);
RegCloseKey(myKey);
}
diff --git a/win32/gui/WndMain.c b/win32/gui/WndMain.c index 187246d4..3cbc88d5 100644 --- a/win32/gui/WndMain.c +++ b/win32/gui/WndMain.c @@ -1222,17 +1222,17 @@ BOOL CALLBACK ConfigureCpuDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar Button_SetCheck(GetDlgItem(hW,IDC_MDEC), Config.Mdec);
Button_SetCheck(GetDlgItem(hW,IDC_CDDA), Config.Cdda);
Button_SetCheck(GetDlgItem(hW,IDC_PSXAUTO), Config.PsxAuto);
- Button_SetCheck(GetDlgItem(hW,IDC_CPU), Config.Cpu);
+ Button_SetCheck(GetDlgItem(hW,IDC_CPU), (Config.Cpu == CPU_INTERPRETER));
Button_SetCheck(GetDlgItem(hW,IDC_PSXOUT), Config.PsxOut);
Button_SetCheck(GetDlgItem(hW,IDC_DEBUG), Config.Debug);
Button_SetCheck(GetDlgItem(hW,IDC_SPUIRQ), Config.SpuIrq);
Button_SetCheck(GetDlgItem(hW,IDC_RCNTFIX), Config.RCntFix);
Button_SetCheck(GetDlgItem(hW,IDC_VSYNCWA), Config.VSyncWA);
- ComboBox_AddString(GetDlgItem(hW,IDC_PSXTYPES),"NTSC");
- ComboBox_AddString(GetDlgItem(hW,IDC_PSXTYPES),"PAL");
+ ComboBox_AddString(GetDlgItem(hW,IDC_PSXTYPES), "NTSC");
+ ComboBox_AddString(GetDlgItem(hW,IDC_PSXTYPES), "PAL");
ComboBox_SetCurSel(GetDlgItem(hW,IDC_PSXTYPES),Config.PsxType);
- if (!Config.Cpu) {
+ if (Config.Cpu == CPU_DYNAREC) {
Config.Debug = 0;
Button_SetCheck(GetDlgItem(hW, IDC_DEBUG), FALSE);
EnableWindow(GetDlgItem(hW, IDC_DEBUG), FALSE);
@@ -1243,7 +1243,7 @@ BOOL CALLBACK ConfigureCpuDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar case WM_COMMAND: {
switch (LOWORD(wParam)) {
- case IDCANCEL: EndDialog(hW,FALSE); return TRUE;
+ case IDCANCEL: EndDialog(hW, FALSE); return TRUE;
case IDOK:
tmp = ComboBox_GetCurSel(GetDlgItem(hW,IDC_PSXTYPES));
if (tmp == 0) Config.PsxType = 0;
@@ -1255,11 +1255,10 @@ BOOL CALLBACK ConfigureCpuDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lPar Config.Cdda = Button_GetCheck(GetDlgItem(hW,IDC_CDDA));
Config.PsxAuto = Button_GetCheck(GetDlgItem(hW,IDC_PSXAUTO));
tmp = Config.Cpu;
- Config.Cpu = Button_GetCheck(GetDlgItem(hW,IDC_CPU));
+ Config.Cpu = (Button_GetCheck(GetDlgItem(hW,IDC_CPU)) ? CPU_INTERPRETER : CPU_DYNAREC);
if (tmp != Config.Cpu) {
psxCpu->Shutdown();
- if (Config.Cpu)
- psxCpu = &psxInt;
+ if (Config.Cpu == CPU_INTERPRETER) psxCpu = &psxInt;
else psxCpu = &psxRec;
if (psxCpu->Init() == -1) {
SysClose();
|
