diff --git a/include/arm11/cheat.h b/include/arm11/cheat.h index 6cdab85..6c6b083 100644 --- a/include/arm11/cheat.h +++ b/include/arm11/cheat.h @@ -18,7 +18,7 @@ typedef int cheat_error_t; #define CHEAT_MODE_FULLTIME 1 #define CHEAT_MODE_ENABYKEY 2 #define CHEAT_MODE_KEYONOFF 3 -#define CHEAT_MODE_SIZE 3 +#define CHEAT_MODE_SIZE 4 #define MAKE_ENTID(hole, key) (((key)+1)<<16|((hole)+1)) #define ENT_USING(entid) ((entid) > 0xffff) diff --git a/source/arm11/open_agb_firm.c b/source/arm11/open_agb_firm.c index 8da9841..a394d05 100644 --- a/source/arm11/open_agb_firm.c +++ b/source/arm11/open_agb_firm.c @@ -390,9 +390,12 @@ static Result loadGbaRom(const char *const path, u32 *const romSizeOut) while((res = fRead(f, ptr, 0x100000u, &read)) == RES_OK && read == 0x100000u) ptr += 0x100000u; + // use the gbaatm cheat if( g_oafConfig.cheatMode != CHEAT_MODE_DISABLED ) { apply_cheat( g_oafConfig.cheatMode, fileSize, g_oafConfig.cheatKeys, CHEAT_INUSE_ADDR, &fileSize ); + fini_current_cheat(); + acl_close_lib(); } *romSizeOut = fixRomPadding(fileSize); } @@ -847,7 +850,7 @@ static int cfgIniCallback(void* user, const char* section, const char* name, con { if( strcmp(name, "cheatMode") == 0 ) config->cheatMode = (u8)strtoul(value, NULL, 10); - if( config->cheatMode > CHEAT_MODE_SIZE ) config->cheatMode = CHEAT_MODE_DISABLED; + if( config->cheatMode >= CHEAT_MODE_SIZE ) config->cheatMode = CHEAT_MODE_DISABLED; } else return 0; // Error.