Skip to content

Commit

Permalink
Port commit b5c3268 to B4DS mode
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Dec 25, 2023
1 parent 223ff26 commit 969a0d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions retail/bootloader/source/arm7/patch_arm9.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,12 +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;
u32 mpuInitOffsetInSrl = (u32)mpuInitOffset;
mpuInitOffsetInSrl -= (u32)ndsHeader->arm9destination;

if (mpuInitOffsetInSrl >= 0 && mpuInitOffsetInSrl < 0x4000) {
unpatchedFuncs->mpuInitOffset2 = mpuInitOffset;
} */
}
*mpuInitOffset = 0xE1A00000; // nop

// Try to find it
Expand Down
10 changes: 8 additions & 2 deletions retail/cardengine/arm7/source/cardengine.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ vu32* volatile sharedAddr = (vu32*)CARDENGINE_SHARED_ADDRESS_SDK1;

static bool initialized = false;
static bool bootloaderCleared = false;
#ifndef MUSIC
static bool funcsUnpatched = false;
#endif

//static int saveReadTimeOut = 0;

Expand Down Expand Up @@ -235,7 +237,9 @@ void reset(void) {
REG_POWERCNT = 1; // Turn off power to stuff

initialized = false;
#ifndef MUSIC
funcsUnpatched = false;
#endif
languageTimer = 0;

while (sharedAddr[0] != 0x544F4F42) { // 'BOOT'
Expand Down Expand Up @@ -279,6 +283,7 @@ void myIrqHandlerVBlank(void) {
languageTimer++;
}

#ifndef MUSIC
if (!funcsUnpatched && *(int*)(isSdk5Set ? 0x02FFFC3C : 0x027FFC3C) >= 60) {
unpatchedFunctions* unpatchedFuncs = (unpatchedFunctions*)UNPATCHED_FUNCTION_LOCATION;

Expand Down Expand Up @@ -309,9 +314,9 @@ void myIrqHandlerVBlank(void) {
}
}

/* if (unpatchedFuncs->mpuInitOffset2) {
if (unpatchedFuncs->mpuInitOffset2) {
*unpatchedFuncs->mpuInitOffset2 = 0xEE060F12;
} */
}
if (unpatchedFuncs->mpuDataOffset2) {
if (isSdk5Set) {
unpatchedFuncs->mpuDataOffset2[0] = 0xE3A0004A; // mov r0, #0x4A
Expand All @@ -324,6 +329,7 @@ void myIrqHandlerVBlank(void) {

funcsUnpatched = true;
}
#endif

if ((0 == (REG_KEYINPUT & igmHotkey) && 0 == (REG_EXTKEYINPUT & (((igmHotkey >> 10) & 3) | ((igmHotkey >> 6) & 0xC0)))
#ifndef MUSIC
Expand Down

0 comments on commit 969a0d0

Please sign in to comment.