From 1fc6cbdec288768a017e89bf3ea74b9b82064424 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sat, 10 Oct 2015 09:55:06 +0000 Subject: [PATCH] split processing of internal cheats from AR cheats, and process AR cheats more correctly when an ARM7 IRQ happens --- desmume/AUTHORS | 4 +++- desmume/src/NDSSystem.cpp | 10 ++++++++-- desmume/src/cheatSystem.cpp | 9 +++++++-- desmume/src/cheatSystem.h | 11 +++++++---- desmume/src/windows/AboutBox.cpp | 2 ++ 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/desmume/AUTHORS b/desmume/AUTHORS index 503609d76..615ef947f 100644 --- a/desmume/AUTHORS +++ b/desmume/AUTHORS @@ -45,4 +45,6 @@ dottorleo yki Luigi__ CrazyMax -Riccardo Magliocchetti \ No newline at end of file +Riccardo Magliocchetti +CyberWarriorX +mic \ No newline at end of file diff --git a/desmume/src/NDSSystem.cpp b/desmume/src/NDSSystem.cpp index f0f86b03d..d6fddbf1d 100644 --- a/desmume/src/NDSSystem.cpp +++ b/desmume/src/NDSSystem.cpp @@ -1334,11 +1334,18 @@ static void execHardware_hstart_vblankStart() //fire vblank interrupts if necessary for(int i=0;i<2;i++) + { if(MMU.reg_IF_pending[i] & (1<process(CHEAT_TYPE_AR); } + } //trigger vblank dmas triggerDma(EDMAMode_VBlank); @@ -1990,8 +1997,7 @@ void NDS_exec(s32 nb) } currFrameCounter++; DEBUG_Notify.NextFrame(); - if (cheats) - cheats->process(); + if(cheats) cheats->process(CHEAT_TYPE_INTERNAL); #ifdef GDB_STUB gdbstub_mutex_unlock(); diff --git a/desmume/src/cheatSystem.cpp b/desmume/src/cheatSystem.cpp index 0affe0dec..edeb837d1 100644 --- a/desmume/src/cheatSystem.cpp +++ b/desmume/src/cheatSystem.cpp @@ -747,7 +747,7 @@ BOOL CHEATS::load() return TRUE; } -void CHEATS::process() +void CHEATS::process(int targetType) { if (CommonSettings.cheatsDisable) return; if (list.size() == 0) return; @@ -756,7 +756,12 @@ void CHEATS::process() { if (!list[i].enabled) continue; - switch (list[i].type) + int type = list[i].type; + + if(type != targetType) + continue; + + switch(type) { case 0: // internal cheat system { diff --git a/desmume/src/cheatSystem.h b/desmume/src/cheatSystem.h index 6b3bbf333..ef3eac60c 100644 --- a/desmume/src/cheatSystem.h +++ b/desmume/src/cheatSystem.h @@ -29,6 +29,11 @@ #define CHEAT_FILE_MIN_FGETS_BUFFER 32768 #define CHEAT_DB_GAME_TITLE_SIZE 256 +#define CHEAT_TYPE_EMPTY 0xFF +#define CHEAT_TYPE_INTERNAL 0 +#define CHEAT_TYPE_AR 1 +#define CHEAT_TYPE_CODEBREAKER 2 + struct CHEATS_LIST { CHEATS_LIST() @@ -36,9 +41,7 @@ struct CHEATS_LIST memset(this,0,sizeof(*this)); type = 0xFF; } - u8 type; // 0 - internal cheat system - // 1 - Action Replay - // 2 - Codebreakers + u8 type; BOOL enabled; // TODO u8 freezeType; // 0 - normal freeze @@ -88,7 +91,7 @@ public: void setDescription(const char *description, u32 pos); BOOL save(); BOOL load(); - void process(); + void process(int targetType); void getXXcodeString(CHEATS_LIST cheat, char *res_buf); static BOOL XXCodeFromString(CHEATS_LIST *cheatItem, const std::string codeString); diff --git a/desmume/src/windows/AboutBox.cpp b/desmume/src/windows/AboutBox.cpp index b50d7d26f..1e459f239 100644 --- a/desmume/src/windows/AboutBox.cpp +++ b/desmume/src/windows/AboutBox.cpp @@ -68,6 +68,8 @@ const char *team[] = { "Luigi__", "CrazyMax", "Riccardo Magliocchetti", + "CyberWarriorX", + "mic" }; static HWND gList = NULL;