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 783a43289..716c93e30 100644 Binary files a/desmume/src/windows/resources.rc and b/desmume/src/windows/resources.rc differ