diff --git a/source/arm11/cheat.c b/source/arm11/cheat.c index a4e775b..e717a29 100644 --- a/source/arm11/cheat.c +++ b/source/arm11/cheat.c @@ -431,6 +431,6 @@ cheat_error_t apply_cheat( int mode, u32 szrom, u16 bindkey, u32 storagemem, u32 rom_append_newirq( page, hookpoint, n_hookpoint ); rom_patch_hookpoint( page, hookpoint, n_hookpoint ); rom_append_cheatproc( mode, page + n_hookpoint * IW_INSTR_LEN, GBA_KEYCODE(bindkey), storagemem ); - debug_printf( "patch: mode=%d,size=%ld,hp=%d,key=%d", mode, *outsize, n_hookpoint, bindkey ); + debug_printf( "patch: mode=%d,size=%ld,hp=%d,key=%d\n", mode, *outsize, n_hookpoint, bindkey ); return CCHT_OK; } \ No newline at end of file diff --git a/source/arm11/open_agb_firm.c b/source/arm11/open_agb_firm.c index 127ffc3..d6c8af2 100644 --- a/source/arm11/open_agb_firm.c +++ b/source/arm11/open_agb_firm.c @@ -391,8 +391,14 @@ static Result loadGbaRom(const char *const path, u32 *const romSizeOut) ptr += 0x100000u; // use the gbaatm cheat + char gamecode[5]; + memcpy( gamecode, ROM_LOC+0xac, 4 ); + gamecode[4] = '\0'; + acl_open_lib( "gba.acl" ); int err = apply_cheat( g_oafConfig.cheatMode, fileSize, g_oafConfig.cheatKeys, CHEAT_INUSE_ADDR, &fileSize ); - debug_printf("cheat res: %d", err); + debug_printf("cheat res: %d\n", err); + acl_close_lib(); + fini_current_cheat(); *romSizeOut = fixRomPadding(fileSize); } else res = RES_ROM_TOO_BIG; @@ -1039,9 +1045,6 @@ Result oafInitAndRun(void) LGY_switchMode(); } } while(0); - - fini_current_cheat(); - acl_close_lib(); } else res = RES_OUT_OF_MEM;