From 1d7d7df7e9f93918c9951de7e517ae59c2f3a1ec Mon Sep 17 00:00:00 2001 From: mtabachenko Date: Sat, 26 Dec 2009 10:10:55 +0000 Subject: [PATCH] winport: - fix load a settings of GuitarGrip; - add saving a status of cheats (disabled/enabled); --- desmume/src/NDSSystem.h | 3 +++ desmume/src/cheatSystem.cpp | 7 +------ desmume/src/cheatSystem.h | 4 +--- desmume/src/windows/inputdx.cpp | 2 +- desmume/src/windows/main.cpp | 16 ++++++++-------- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/desmume/src/NDSSystem.h b/desmume/src/NDSSystem.h index 297dae8ae..db4092980 100644 --- a/desmume/src/NDSSystem.h +++ b/desmume/src/NDSSystem.h @@ -460,6 +460,7 @@ extern struct TCommonSettings { , micMode(InternalNoise) , spuInterpolationMode(SPUInterpolation_Linear) , manualBackupType(0) + , cheatsDisable(false) { strcpy(ARM9BIOS, "biosnds9.bin"); strcpy(ARM7BIOS, "biosnds7.bin"); @@ -487,6 +488,8 @@ extern struct TCommonSettings { bool DebugConsole; bool EnsataEmulation; + bool cheatsDisable; + int num_cores; bool single_core() { return num_cores==1; } diff --git a/desmume/src/cheatSystem.cpp b/desmume/src/cheatSystem.cpp index b1c436dec..264f809b9 100644 --- a/desmume/src/cheatSystem.cpp +++ b/desmume/src/cheatSystem.cpp @@ -717,7 +717,7 @@ void CHEATS::stackClear() void CHEATS::process() { - if (disabled) return; + if (CommonSettings.cheatsDisable) return; if (!num) return; for (int i = 0; i < num; i++) { @@ -764,11 +764,6 @@ void CHEATS::getXXcodeString(CHEATS_LIST list, char *res_buf) } } -void CHEATS::disable(bool disable) -{ - disabled = disable; -} - // ========================================== search BOOL CHEATSEARCH::start(u8 type, u8 size, u8 sign) { diff --git a/desmume/src/cheatSystem.h b/desmume/src/cheatSystem.h index 58f8ee598..bcea4a1b5 100644 --- a/desmume/src/cheatSystem.h +++ b/desmume/src/cheatSystem.h @@ -52,7 +52,6 @@ private: u8 *stack; u16 numStack; - bool disabled; void clear(); void ARparser(CHEATS_LIST cheat); @@ -61,7 +60,7 @@ private: public: CHEATS(): - num(0), currentGet(0), stack(0), numStack(0), disabled(0) + num(0), currentGet(0), stack(0), numStack(0) { memset(list, 0, sizeof(list)); memset(filename, 0, sizeof(filename)); @@ -87,7 +86,6 @@ public: void stackClear(); void process(); void getXXcodeString(CHEATS_LIST cheat, char *res_buf); - void disable(bool disable); }; class CHEATSEARCH diff --git a/desmume/src/windows/inputdx.cpp b/desmume/src/windows/inputdx.cpp index 2fc2f1010..7c46cb4ab 100644 --- a/desmume/src/windows/inputdx.cpp +++ b/desmume/src/windows/inputdx.cpp @@ -394,7 +394,7 @@ static void LoadGuitarConfig() memcpy(&Guitar,&DefaultGuitar,sizeof(Guitar)); //Guitar.Enabled = true; -#define DO(X) ReadControl(#X,Guitar.X); +#define DO(X) ReadGuitarControl(#X,Guitar.X); DO(GREEN); DO(RED); DO(YELLOW); diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index be9e6b514..fd32c025e 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -176,8 +176,6 @@ static BOOL OpenCore(const char* filename); BOOL Mic_DeInit_Physical(); BOOL Mic_Init_Physical(); -static bool _cheatsDisabled = false; - void UpdateHotkeyAssignments(); //Appends hotkey mappings to corresponding menu items HMENU mainMenu = NULL; //Holds handle to the main DeSmuME menu @@ -2298,12 +2296,12 @@ int _main() GetSystemInfo(&systemInfo); CommonSettings.num_cores = systemInfo.dwNumberOfProcessors; - _cheatsDisabled = false; - char text[80]; GetINIPath(); + CommonSettings.cheatsDisable = GetPrivateProfileInt("General", "cheatsDisable", false, IniName); + addon_type = GetPrivateProfileInt("GBAslot", "type", NDS_ADDON_NONE, IniName); win32_CFlash_cfgMode = GetPrivateProfileInt("GBAslot.CFlash", "fileMode", 2, IniName); win32_CFlash_cfgDirectory = GetPrivateProfileStdString("GBAslot.CFlash", "path", ""); @@ -2362,7 +2360,7 @@ int _main() CommonSettings.showGpu.main = GetPrivateProfileInt("Display", "MainGpu", 1, IniName) != 0; CommonSettings.showGpu.sub = GetPrivateProfileInt("Display", "SubGpu", 1, IniName) != 0; lostFocusPause = GetPrivateProfileBool("Focus", "BackgroundPause", false, IniName); - + //Get Ram-Watch values RWSaveWindowPos = GetPrivateProfileBool("RamWatch", "SaveWindowPos", false, IniName); ramw_x = GetPrivateProfileInt("RamWatch", "RWWindowPosX", 0, IniName); @@ -3695,6 +3693,8 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM MainWindow->checkMenu(IDM_EJECTCARD, nds.cardEjected != FALSE); + MainWindow->checkMenu(IDM_CHEATS_DISABLE, CommonSettings.cheatsDisable == true); + //Save type const int savelist[] = {IDC_SAVETYPE1,IDC_SAVETYPE2,IDC_SAVETYPE3,IDC_SAVETYPE4,IDC_SAVETYPE5,IDC_SAVETYPE6,IDC_SAVETYPE7,IDC_SAVETYPE8}; for(int i=0;i<8;i++) @@ -4846,9 +4846,9 @@ DOKEYDOWN: return 0; case IDM_CHEATS_DISABLE: - _cheatsDisabled = !_cheatsDisabled; - cheats->disable(_cheatsDisabled); - MainWindow->checkMenu(IDM_CHEATS_DISABLE, _cheatsDisabled ); + CommonSettings.cheatsDisable = !CommonSettings.cheatsDisable; + WritePrivateProfileBool("General", "cheatsDisable", CommonSettings.cheatsDisable, IniName); + MainWindow->checkMenu(IDM_CHEATS_DISABLE, CommonSettings.cheatsDisable ); return 0; case IDM_RECORD_MOVIE: