diff options
| author | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-05-12 03:39:20 +0000 |
|---|---|---|
| committer | SND\weimingzhi_cp <SND\weimingzhi_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2010-05-12 03:39:20 +0000 |
| commit | efc4469d646208ee5e2bf18f5089a202a9da27fd (patch) | |
| tree | 255fb03e54688b904edba2c3e1f41ffaae6a3e1b | |
| parent | dc4aa0f1e6f0afa4c78288a1fe9dd681743e758a (diff) | |
| download | pcsxr-efc4469d646208ee5e2bf18f5089a202a9da27fd.tar.gz | |
u8 instead of long
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@47873 e17a0e51-4ae3-4d35-97c3-1a29b211df97
| -rw-r--r-- | gui/Config.c | 38 | ||||
| -rw-r--r-- | libpcsxcore/psxcommon.h | 4 | ||||
| -rw-r--r-- | win32/gui/ConfigurePlugins.c | 116 |
3 files changed, 80 insertions, 78 deletions
diff --git a/gui/Config.c b/gui/Config.c index bb7799e0..32a07847 100644 --- a/gui/Config.c +++ b/gui/Config.c @@ -25,7 +25,7 @@ #include "Linux.h" /* TODO escaping/unescaping would be nice, as would maxchars */ -void GetValue(char *src, char *name, char *outvar) { +static void GetValue(char *src, char *name, char *outvar) { char *tmp; *outvar = 0; @@ -42,22 +42,24 @@ void GetValue(char *src, char *name, char *outvar) { return; } -void GetValuel(char *src, char *name, long *var) { +static long GetValuel(char *src, char *name) { char *tmp = strstr(src, name); if (tmp != NULL) { tmp += strlen(name); while ((*tmp == ' ') || (*tmp == '=')) tmp++; - if (*tmp != '\n') *var = atol(tmp); + if (*tmp != '\n') return atol(tmp); } + return 0; } -void GetValueb(char *src, char *name, boolean *var) { +static boolean GetValueb(char *src, char *name) { char *tmp = strstr(src, name); if (tmp != NULL) { tmp += strlen(name); while ((*tmp == ' ') || (*tmp == '=')) tmp++; - if (*tmp != '\n') *var = (atoi(tmp) != 0); + if (*tmp != '\n') return (atoi(tmp) != 0); } + return false; } #define SetValue(name, var) \ @@ -120,19 +122,19 @@ int LoadConfig(PcsxConfig *Conf) { GetValue(data, "BiosDir", Config.BiosDir); GetValue(data, "PluginsDir", Config.PluginsDir); - GetValueb(data, "Xa", &Config.Xa); - GetValueb(data, "Sio", &Config.Sio); - GetValueb(data, "Mdec", &Config.Mdec); - GetValueb(data, "PsxAuto", &Config.PsxAuto); - GetValueb(data, "Cdda", &Config.Cdda); - GetValueb(data, "Dbg", &Config.Debug); - GetValueb(data, "PsxOut", &Config.PsxOut); - GetValueb(data, "SpuIrq", &Config.SpuIrq); - GetValueb(data, "RCntFix", &Config.RCntFix); - GetValueb(data, "VSyncWA", &Config.VSyncWA); - - GetValuel(data, "Cpu", &Config.Cpu); - GetValuel(data, "PsxType", &Config.PsxType); + Config.Xa = GetValueb(data, "Xa"); + Config.Sio = GetValueb(data, "Sio"); + Config.Mdec = GetValueb(data, "Mdec"); + Config.PsxAuto = GetValueb(data, "PsxAuto"); + Config.Cdda = GetValueb(data, "Cdda"); + Config.Debug = GetValueb(data, "Dbg"); + Config.PsxOut = GetValueb(data, "PsxOut"); + Config.SpuIrq = GetValueb(data, "SpuIrq"); + Config.RCntFix = GetValueb(data, "RCntFix"); + Config.VSyncWA = GetValueb(data, "VSyncWA"); + + Config.Cpu = GetValuel(data, "Cpu"); + Config.PsxType = GetValuel(data, "PsxType"); free(data); diff --git a/libpcsxcore/psxcommon.h b/libpcsxcore/psxcommon.h index fb0cb7ec..d04be1e8 100644 --- a/libpcsxcore/psxcommon.h +++ b/libpcsxcore/psxcommon.h @@ -126,8 +126,8 @@ typedef struct { boolean RCntFix; boolean UseNet; boolean VSyncWA; - long Cpu; // CPU_DYNAREC or CPU_INTERPRETER - long PsxType; // PSX_TYPE_NTSC or PSX_TYPE_PAL + u8 Cpu; // CPU_DYNAREC or CPU_INTERPRETER + u8 PsxType; // PSX_TYPE_NTSC or PSX_TYPE_PAL #ifdef _WIN32 char Lang[256]; #endif diff --git a/win32/gui/ConfigurePlugins.c b/win32/gui/ConfigurePlugins.c index 3eb11fae..362a6d14 100644 --- a/win32/gui/ConfigurePlugins.c +++ b/win32/gui/ConfigurePlugins.c @@ -25,20 +25,20 @@ #include "resource.h"
#include "Win32.h"
-#define QueryKeyB(name, var) \
+#define QueryKeyV(name, var) \
size = sizeof(DWORD); \
if (RegQueryValueEx(myKey, name, 0, &type, (LPBYTE)&tmp, &size) != 0) { if (err) { RegCloseKey(myKey); return -1; } } \
- var = (tmp != 0);
+ var = tmp;
-#define QueryKeyV(s, name, var) \
+#define QueryKey(s, name, var) \
size = s; \
if (RegQueryValueEx(myKey, name, 0, &type, (LPBYTE)var, &size) != 0) { if (err) { RegCloseKey(myKey); return -1; } }
-#define SetKeyB(name, var) \
- tmp = ((var) ? 1 : 0); \
+#define SetKeyV(name, var) \
+ tmp = var; \
RegSetValueEx(myKey, name, 0, REG_DWORD, (LPBYTE)&tmp, sizeof(DWORD));
-#define SetKeyV(name, var, s, t) \
+#define SetKey(name, var, s, t) \
RegSetValueEx(myKey, name, 0, t, (LPBYTE)var, s);
int LoadConfig() {
@@ -53,33 +53,33 @@ int LoadConfig() { if (RegOpenKeyEx(HKEY_CURRENT_USER,cfgfile,0,KEY_ALL_ACCESS,&myKey)!=ERROR_SUCCESS) return -1;
err = 1;
- QueryKeyV(256, "Bios", Conf->Bios);
- QueryKeyV(256, "Gpu", Conf->Gpu);
- QueryKeyV(256, "Spu", Conf->Spu);
- QueryKeyV(256, "Cdr", Conf->Cdr);
- QueryKeyV(256, "Pad1", Conf->Pad1);
- QueryKeyV(256, "Pad2", Conf->Pad2);
- QueryKeyV(256, "Mcd1", Conf->Mcd1);
- QueryKeyV(256, "Mcd2", Conf->Mcd2);
- QueryKeyV(256, "PluginsDir", Conf->PluginsDir);
- QueryKeyV(256, "BiosDir", Conf->BiosDir);
+ QueryKey(256, "Bios", Conf->Bios);
+ QueryKey(256, "Gpu", Conf->Gpu);
+ QueryKey(256, "Spu", Conf->Spu);
+ QueryKey(256, "Cdr", Conf->Cdr);
+ QueryKey(256, "Pad1", Conf->Pad1);
+ QueryKey(256, "Pad2", Conf->Pad2);
+ QueryKey(256, "Mcd1", Conf->Mcd1);
+ QueryKey(256, "Mcd2", Conf->Mcd2);
+ QueryKey(256, "PluginsDir", Conf->PluginsDir);
+ QueryKey(256, "BiosDir", Conf->BiosDir);
err = 0;
- QueryKeyV(256, "Net", Conf->Net);
- QueryKeyV(256, "Lang", Conf->Lang);
-
- 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);
+ QueryKey(256, "Net", Conf->Net);
+ QueryKey(256, "Lang", Conf->Lang);
+
+ QueryKeyV("Xa", Conf->Xa);
+ QueryKeyV("Sio", Conf->Sio);
+ QueryKeyV("Mdec", Conf->Mdec);
+ QueryKeyV("PsxAuto", Conf->PsxAuto);
+ QueryKeyV("Cdda", Conf->Cdda);
+ QueryKeyV("Debug", Conf->Debug);
+ QueryKeyV("PsxOut", Conf->PsxOut);
+ QueryKeyV("SpuIrq", Conf->SpuIrq);
+ QueryKeyV("RCntFix", Conf->RCntFix);
+ QueryKeyV("VSyncWA", Conf->VSyncWA);
+
+ QueryKeyV("Cpu", Conf->Cpu);
+ QueryKeyV("PsxType", Conf->PsxType);
if (Config.Cpu == CPU_DYNAREC) {
Config.Debug = 0; // don't enable debugger if using dynarec core
@@ -104,32 +104,32 @@ void SaveConfig() { RegCreateKeyEx(HKEY_CURRENT_USER, cfgfile, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &myKey, &myDisp);
- SetKeyV("Bios", Conf->Bios, strlen(Conf->Bios), REG_SZ);
- SetKeyV("Gpu", Conf->Gpu, strlen(Conf->Gpu), REG_SZ);
- SetKeyV("Spu", Conf->Spu, strlen(Conf->Spu), REG_SZ);
- SetKeyV("Cdr", Conf->Cdr, strlen(Conf->Cdr), REG_SZ);
- SetKeyV("Pad1", Conf->Pad1, strlen(Conf->Pad1), REG_SZ);
- SetKeyV("Pad2", Conf->Pad2, strlen(Conf->Pad2), REG_SZ);
- SetKeyV("Net", Conf->Net, strlen(Conf->Net), REG_SZ);
- SetKeyV("Mcd1", Conf->Mcd1, strlen(Conf->Mcd1), REG_SZ);
- SetKeyV("Mcd2", Conf->Mcd2, strlen(Conf->Mcd2), REG_SZ);
- 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);
-
- 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("PsxType", &Conf->PsxType, sizeof(Conf->PsxType), REG_DWORD);
+ SetKey("Bios", Conf->Bios, strlen(Conf->Bios), REG_SZ);
+ SetKey("Gpu", Conf->Gpu, strlen(Conf->Gpu), REG_SZ);
+ SetKey("Spu", Conf->Spu, strlen(Conf->Spu), REG_SZ);
+ SetKey("Cdr", Conf->Cdr, strlen(Conf->Cdr), REG_SZ);
+ SetKey("Pad1", Conf->Pad1, strlen(Conf->Pad1), REG_SZ);
+ SetKey("Pad2", Conf->Pad2, strlen(Conf->Pad2), REG_SZ);
+ SetKey("Net", Conf->Net, strlen(Conf->Net), REG_SZ);
+ SetKey("Mcd1", Conf->Mcd1, strlen(Conf->Mcd1), REG_SZ);
+ SetKey("Mcd2", Conf->Mcd2, strlen(Conf->Mcd2), REG_SZ);
+ SetKey("Lang", Conf->Lang, strlen(Conf->Lang), REG_SZ);
+ SetKey("PluginsDir", Conf->PluginsDir, strlen(Conf->PluginsDir), REG_SZ);
+ SetKey("BiosDir", Conf->BiosDir, strlen(Conf->BiosDir), REG_SZ);
+
+ SetKeyV("Xa", Conf->Xa);
+ SetKeyV("Sio", Conf->Sio);
+ SetKeyV("Mdec", Conf->Mdec);
+ SetKeyV("PsxAuto", Conf->PsxAuto);
+ SetKeyV("Cdda", Conf->Cdda);
+ SetKeyV("Debug", Conf->Debug);
+ SetKeyV("PsxOut", Conf->PsxOut);
+ SetKeyV("SpuIrq", Conf->SpuIrq);
+ SetKeyV("RCntFix", Conf->RCntFix);
+ SetKeyV("VSyncWA", Conf->VSyncWA);
+
+ SetKeyV("Cpu", Conf->Cpu);
+ SetKeyV("PsxType", Conf->PsxType);
RegCloseKey(myKey);
}
|
