From 38a687eed8a3a9d481570e610d717df48a7b6037 Mon Sep 17 00:00:00 2001 From: mtabachenko Date: Fri, 13 Nov 2009 10:00:19 +0000 Subject: [PATCH] winport: - add cheats disable menu item; --- desmume/src/cheatSystem.cpp | 7 +++++++ desmume/src/cheatSystem.h | 1 + desmume/src/windows/main.cpp | 11 +++++++++++ desmume/src/windows/resource.h | 3 ++- desmume/src/windows/resources.rc | Bin 449002 -> 451554 bytes 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/desmume/src/cheatSystem.cpp b/desmume/src/cheatSystem.cpp index e04143cca..9c2571eed 100644 --- a/desmume/src/cheatSystem.cpp +++ b/desmume/src/cheatSystem.cpp @@ -35,6 +35,7 @@ static u32 cheatsCurrentGet = 0; static u8 *cheatsStack = NULL; static u16 cheatsNumStack = 0; +static bool cheatsDisabled = false; static void cheatsClear() { @@ -710,6 +711,7 @@ void cheatsStackClear() void cheatsProcess() { + if (cheatsDisabled) return; if (!cheatsNum) return; for (int i = 0; i < cheatsNum; i++) { @@ -756,6 +758,11 @@ void cheatGetXXcodeString(CHEATS_LIST cheat, char *res_buf) } } +void cheatsDisable(bool disable) +{ + cheatsDisabled = disable; +} + // ========================================== search u8 *searchStatMem = NULL; u8 *searchMem = NULL; diff --git a/desmume/src/cheatSystem.h b/desmume/src/cheatSystem.h index 365632eb2..eb8e9b973 100644 --- a/desmume/src/cheatSystem.h +++ b/desmume/src/cheatSystem.h @@ -60,6 +60,7 @@ extern BOOL cheatsPop(); extern void cheatsStackClear(); extern void cheatsProcess(); extern void cheatGetXXcodeString(CHEATS_LIST cheat, char *res_buf); +extern void cheatsDisable(bool disable); // ==================================================== cheat search extern void cheatsSearchInit(u8 type, u8 size, u8 sign); diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index 702d47904..c32b955b9 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -68,6 +68,7 @@ #include "throttle.h" #include "gbaslot_config.h" #include "cheatsWin.h" +#include "../cheatSystem.h" #include "Mmsystem.h" #include "../mic.h" #include "../common.h" @@ -160,6 +161,7 @@ const unsigned int clearid = IDM_RECENT_RESERVED0; // ID for the Clear recent const unsigned int baseid = IDM_RECENT_RESERVED1; //Base identifier for the recent ROMs items static HMENU recentromsmenu; //Handle to the recent ROMs submenu //-------------------------------------- +static bool _cheatsDisabled = false; void UpdateHotkeyAssignments(); //Appends hotkey mappings to corresponding menu items @@ -2145,6 +2147,8 @@ int _main() GetSystemInfo(&systemInfo); CommonSettings.num_cores = systemInfo.dwNumberOfProcessors; + _cheatsDisabled = false; + char text[80]; GetINIPath(); @@ -4602,6 +4606,13 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM case IDM_CHEATS_SEARCH: CheatsSearchDialog(hwnd); return 0; + + case IDM_CHEATS_DISABLE: + _cheatsDisabled = !_cheatsDisabled; + cheatsDisable(_cheatsDisabled); + MainWindow->checkMenu(IDM_CHEATS_DISABLE, _cheatsDisabled ); + return 0; + case IDM_RECORD_MOVIE: MovieRecordTo(); return 0; diff --git a/desmume/src/windows/resource.h b/desmume/src/windows/resource.h index 3bdbd995e..d06b38a38 100644 --- a/desmume/src/windows/resource.h +++ b/desmume/src/windows/resource.h @@ -710,7 +710,6 @@ #define IDM_GBASLOT 40042 #define IDM_CHEATS_LIST 40050 #define IDC_BGMAP_ROTSCALEPARAMS 40051 -#define IDM_CHEATS_SEARCH 40051 #define IDC_BGMAP_ROTSCALE 40052 #define IDM_SHUT_UP 40053 #define IDC_WINDOW2_5X 40054 @@ -721,6 +720,8 @@ #define ID_LCDS_NOSWAP 40059 #define ID_LCDS_MAINGPU 40060 #define ID_LCDS_SUBGPU 40061 +#define IDM_CHEATS_DISABLE 40062 +#define IDM_CHEATS_SEARCH 40063 #define IDC_LABEL_UP 50000 #define IDC_LABEL_RIGHT 50001 #define IDC_LABEL_LEFT 50002 diff --git a/desmume/src/windows/resources.rc b/desmume/src/windows/resources.rc index 783a432893380725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