split processing of internal cheats from AR cheats, and process AR cheats more correctly when an ARM7 IRQ happens

This commit is contained in:
zeromus 2015-10-10 09:55:06 +00:00
parent 18caac989b
commit 1fc6cbdec2
5 changed files with 27 additions and 9 deletions

View File

@ -45,4 +45,6 @@ dottorleo
yki
Luigi__
CrazyMax
Riccardo Magliocchetti
Riccardo Magliocchetti
CyberWarriorX
mic

View File

@ -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<<IRQ_BIT_LCD_VBLANK))
{
MMU.reg_IF_pending[i] &= ~(1<<IRQ_BIT_LCD_VBLANK);
NDS_makeIrq(i,IRQ_BIT_LCD_VBLANK);
//for ARM7, cheats process when a vblank IRQ fires. necessary for AR compatibility and to stop cheats from breaking game boot-ups.
//note that how we process raw cheats is up to us. so we'll do it the same way we used to, elsewhere
if (i==1 && cheats)
cheats->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();

View File

@ -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
{

View File

@ -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);

View File

@ -68,6 +68,8 @@ const char *team[] = {
"Luigi__",
"CrazyMax",
"Riccardo Magliocchetti",
"CyberWarriorX",
"mic"
};
static HWND gList = NULL;