Skip to content

Commit 415f92d

Browse files
committed
Fix misdetecting arm9 binary of M&L: BiS (Japan) as uncompressed
1 parent f8dd128 commit 415f92d

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

retail/bootloader/source/arm7/decompress.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ u32 decompressIBinary(unsigned char *pak_buffer, unsigned int pak_len) {
240240
void ensureBinaryDecompressed(const tNDSHeader* ndsHeader, module_params_t* moduleParams, bool foundModuleParams) {
241241
unpatchedFunctions* unpatchedFuncs = (unpatchedFunctions*)UNPATCHED_FUNCTION_LOCATION;
242242

243-
if ((moduleParams->compressed_static_end/512)*512 == ((((u32)ndsHeader->arm9destination)+ndsHeader->arm9binarySize)/512)*512) {
243+
if (moduleParams->compressed_static_end && ((moduleParams->compressed_static_end/512)*512 == ((((u32)ndsHeader->arm9destination)+ndsHeader->arm9binarySize)/512)*512 || (moduleParams->compressed_static_end/4)*4 == 0xDEC00621)) {
244244
// Compressed
245245
dbg_printf("arm9 is compressed\n");
246246
unpatchedFuncs->compressedFlagOffset = (u32*)((u32)moduleParams+0x14);

retail/bootloaderi/source/arm7/decompress.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ void ensureBinaryDecompressed(const tNDSHeader* ndsHeader, module_params_t* modu
248248

249249
unpatchedFunctions* unpatchedFuncs = (unpatchedFunctions*)UNPATCHED_FUNCTION_LOCATION;
250250

251-
if ((moduleParams->compressed_static_end/512)*512 == ((((u32)ndsHeader->arm9destination)+ndsHeader->arm9binarySize)/512)*512) {
251+
if (moduleParams->compressed_static_end && ((moduleParams->compressed_static_end/512)*512 == ((((u32)ndsHeader->arm9destination)+ndsHeader->arm9binarySize)/512)*512 || (moduleParams->compressed_static_end/4)*4 == 0xDEC00621)) {
252252
// Compressed
253253
dbg_printf("arm9 is compressed\n");
254254
unpatchedFuncs->compressedFlagOffset = (u32*)((u32)moduleParams+0x14);

0 commit comments

Comments
 (0)