diff --git a/source/arm11/open_agb_firm.c b/source/arm11/open_agb_firm.c index cc2fe6b..9220620 100644 --- a/source/arm11/open_agb_firm.c +++ b/source/arm11/open_agb_firm.c @@ -389,6 +389,7 @@ static Result loadGbaRom(const char *const path, u32 *const romSizeOut) u32 read; while((res = fRead(f, ptr, 0x100000u, &read)) == RES_OK && read == 0x100000u) ptr += 0x100000u; + fClose(f); // use the gbaatm cheat char gamecode[5]; @@ -400,11 +401,14 @@ static Result loadGbaRom(const char *const path, u32 *const romSizeOut) debug_printf("cheat res: %s => %d\n", gamecode, err); acl_close_lib(); fini_current_cheat(); + *romSizeOut = fixRomPadding(fileSize); } - else res = RES_ROM_TOO_BIG; - - fClose(f); + else + { + res = RES_ROM_TOO_BIG; + fClose(f); + } } return res;