Skip to content

Commit

Permalink
Do not patch MPU region 2 for TWL games running in DS mode
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Dec 25, 2024
1 parent 725856c commit 2ab59cc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion retail/bootloader/source/arm7/patch_arm9.c
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ static void patchMpu(const tNDSHeader* ndsHeader, const module_params_t* moduleP
}

static void patchMpu2(const tNDSHeader* ndsHeader, const module_params_t* moduleParams, const bool usesCloneboot) {
if ((moduleParams->sdk_version < 0x2008000) && !extendedMemory) {
if (((moduleParams->sdk_version < 0x2008000) && !extendedMemory) || ndsHeader->unitCode > 0) {
return;
}

Expand Down
4 changes: 2 additions & 2 deletions retail/bootloaderi/source/arm7/patch_arm9.c
Original file line number Diff line number Diff line change
Expand Up @@ -995,9 +995,9 @@ static void patchMpu(const tNDSHeader* ndsHeader, const module_params_t* moduleP
}

void patchMpu2(const tNDSHeader* ndsHeader, const module_params_t* moduleParams, const bool usesCloneboot) {
/* if (moduleParams->sdk_version > 0x5000000 && (ndsHeader->unitCode == 0 || !dsiModeConfirmed)) {
if (ndsHeader->unitCode > 0 && !dsiModeConfirmed) {
return;
} */
}

unpatchedFunctions* unpatchedFuncs = (unpatchedFunctions*)UNPATCHED_FUNCTION_LOCATION;

Expand Down
4 changes: 4 additions & 0 deletions retail/cardenginei/arm7/source/patcher/patch_arm9.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,10 @@ static void patchMpu(const tNDSHeader* ndsHeader, const module_params_t* moduleP
}

static void patchMpu2(const tNDSHeader* ndsHeader, const module_params_t* moduleParams) {
if (ndsHeader->unitCode > 0) {
return;
}

unpatchedFunctions* unpatchedFuncs = (unpatchedFunctions*)UNPATCHED_FUNCTION_LOCATION;

// Find the mpu init
Expand Down

0 comments on commit 2ab59cc

Please sign in to comment.