发现问题是由于close_lib了,现在重新打开,试试看

This commit is contained in:
anod 2023-03-07 18:23:23 +08:00
parent fff24e0093
commit a4df7db8be
2 changed files with 8 additions and 5 deletions

View File

@ -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_append_newirq( page, hookpoint, n_hookpoint );
rom_patch_hookpoint( 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 ); 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; return CCHT_OK;
} }

View File

@ -391,8 +391,14 @@ static Result loadGbaRom(const char *const path, u32 *const romSizeOut)
ptr += 0x100000u; ptr += 0x100000u;
// use the gbaatm cheat // 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 ); 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); *romSizeOut = fixRomPadding(fileSize);
} }
else res = RES_ROM_TOO_BIG; else res = RES_ROM_TOO_BIG;
@ -1039,9 +1045,6 @@ Result oafInitAndRun(void)
LGY_switchMode(); LGY_switchMode();
} }
} while(0); } while(0);
fini_current_cheat();
acl_close_lib();
} }
else res = RES_OUT_OF_MEM; else res = RES_OUT_OF_MEM;