From a4df7db8bea2b77f77bf26f4c3481bd0942bbce4 Mon Sep 17 00:00:00 2001 From: anod <182859762@qq.com> Date: Tue, 7 Mar 2023 18:23:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E7=8E=B0=E9=97=AE=E9=A2=98=E6=98=AF?= =?UTF-8?q?=E7=94=B1=E4=BA=8Eclose=5Flib=E4=BA=86=EF=BC=8C=E7=8E=B0?= =?UTF-8?q?=E5=9C=A8=E9=87=8D=E6=96=B0=E6=89=93=E5=BC=80=EF=BC=8C=E8=AF=95?= =?UTF-8?q?=E8=AF=95=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/arm11/cheat.c | 2 +- source/arm11/open_agb_firm.c | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) 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;