diff --git a/retail/bootloader/source/arm7/patch_arm9.c b/retail/bootloader/source/arm7/patch_arm9.c index 2904e9521..b60ac9c43 100644 --- a/retail/bootloader/source/arm7/patch_arm9.c +++ b/retail/bootloader/source/arm7/patch_arm9.c @@ -585,6 +585,12 @@ static void patchMpu2(const tNDSHeader* ndsHeader, const module_params_t* module dbg_hexa((u32)mpuInitOffset); dbg_printf("\n\n"); + /* u32 mpuInitOffsetInSrl = (u32)mpuInitOffset; + mpuInitOffsetInSrl -= (u32)ndsHeader->arm9destination; + + if (mpuInitOffsetInSrl >= 0 && mpuInitOffsetInSrl < 0x4000) { + unpatchedFuncs->mpuInitOffset2 = mpuInitOffset; + } */ *mpuInitOffset = 0xE1A00000; // nop // Try to find it diff --git a/retail/bootloaderi/source/arm7/patch_arm9.c b/retail/bootloaderi/source/arm7/patch_arm9.c index e451125cf..ffc56bb15 100644 --- a/retail/bootloaderi/source/arm7/patch_arm9.c +++ b/retail/bootloaderi/source/arm7/patch_arm9.c @@ -1066,6 +1066,12 @@ void patchMpu2(const tNDSHeader* ndsHeader, const module_params_t* moduleParams) dbg_hexa((u32)mpuInitOffset); dbg_printf("\n\n"); + u32 mpuInitOffsetInSrl = (u32)mpuInitOffset; + mpuInitOffsetInSrl -= (u32)ndsHeader->arm9destination; + + if (mpuInitOffsetInSrl >= 0 && mpuInitOffsetInSrl < 0x4000) { + unpatchedFuncs->mpuInitOffset2 = mpuInitOffset; + } *mpuInitOffset = 0xE1A00000; // nop // Try to find it diff --git a/retail/cardengine/arm7/source/cardengine.c b/retail/cardengine/arm7/source/cardengine.c index d3479399d..66e05d038 100644 --- a/retail/cardengine/arm7/source/cardengine.c +++ b/retail/cardengine/arm7/source/cardengine.c @@ -304,6 +304,9 @@ void myIrqHandlerVBlank(void) { } } + /* if (unpatchedFuncs->mpuInitOffset2) { + *unpatchedFuncs->mpuInitOffset2 = 0xEE060F12; + } */ if (unpatchedFuncs->mpuDataOffset2) { if (isSdk5Set) { unpatchedFuncs->mpuDataOffset2[0] = 0xE3A0004A; // mov r0, #0x4A diff --git a/retail/cardenginei/arm7/source/cardengine.c b/retail/cardenginei/arm7/source/cardengine.c index 4f3acbbb4..908fdbaf7 100644 --- a/retail/cardenginei/arm7/source/cardengine.c +++ b/retail/cardenginei/arm7/source/cardengine.c @@ -1531,6 +1531,9 @@ void myIrqHandlerVBlank(void) { *unpatchedFuncs->iCompressedFlagOffset = unpatchedFuncs->ltd_compressed_static_end; } + if (unpatchedFuncs->mpuInitOffset2) { + *unpatchedFuncs->mpuInitOffset2 = 0xEE060F12; + } if (unpatchedFuncs->mpuDataOffset2) { *unpatchedFuncs->mpuDataOffset2 = unpatchedFuncs->mpuInitRegionOldData2; } @@ -1553,6 +1556,9 @@ void myIrqHandlerVBlank(void) { *unpatchedFuncs->mpuDataOffsetAlt = unpatchedFuncs->mpuInitRegionOldDataAlt; } + if (unpatchedFuncs->mpuInitOffset2) { + *unpatchedFuncs->mpuInitOffset2 = 0xEE060F12; + } if (unpatchedFuncs->mpuDataOffset2) { *unpatchedFuncs->mpuDataOffset2 = unpatchedFuncs->mpuInitRegionOldData2; } diff --git a/retail/cardenginei/arm7_dsiware/source/cardengine.c b/retail/cardenginei/arm7_dsiware/source/cardengine.c index 137b33f2e..0ddc450c1 100644 --- a/retail/cardenginei/arm7_dsiware/source/cardengine.c +++ b/retail/cardenginei/arm7_dsiware/source/cardengine.c @@ -733,6 +733,9 @@ void myIrqHandlerVBlank(void) { if (unpatchedFuncs->ltd_compressed_static_end) { *unpatchedFuncs->iCompressedFlagOffset = unpatchedFuncs->ltd_compressed_static_end; } + if (unpatchedFuncs->mpuInitOffset2) { + *unpatchedFuncs->mpuInitOffset2 = 0xEE060F12; + } if (unpatchedFuncs->mpuDataOffset2) { *unpatchedFuncs->mpuDataOffset2 = unpatchedFuncs->mpuInitRegionOldData2; } diff --git a/retail/common/include/unpatched_funcs.h b/retail/common/include/unpatched_funcs.h index ab97d776a..69160163b 100644 --- a/retail/common/include/unpatched_funcs.h +++ b/retail/common/include/unpatched_funcs.h @@ -10,6 +10,7 @@ typedef struct unpatchedFunctions { u32* iCompressedFlagOffset; u32 compressed_static_end; u32 ltd_compressed_static_end; + u32* mpuInitOffset2; u32* mpuDataOffset; u32* mpuDataOffsetAlt; u32* mpuDataOffset2;