diff --git a/bootloader/source/arm9clear.arm.c b/bootloader/source/arm9clear.arm.c index 095a89f..4507708 100644 --- a/bootloader/source/arm9clear.arm.c +++ b/bootloader/source/arm9clear.arm.c @@ -88,6 +88,19 @@ Modified by Chishm: --------------------------------------------------------------------------*/ void __attribute__ ((long_call)) __attribute__((noreturn)) __attribute__((naked)) startBinary_ARM9 (void) { + if ((*(u8*)0x2FFE012 == *(u8*)0x2FFFE12) && (*(u8*)0x2FFE012 > 0)) { + *(vu32*)REG_MBK1 = *(u32*)0x02FFE180; + *(vu32*)REG_MBK2 = *(u32*)0x02FFE184; + *(vu32*)REG_MBK3 = *(u32*)0x02FFE188; + *(vu32*)REG_MBK4 = *(u32*)0x02FFE18C; + *(vu32*)REG_MBK5 = *(u32*)0x02FFE190; + REG_MBK6 = *(u32*)0x02FFE194; + REG_MBK7 = *(u32*)0x02FFE198; + REG_MBK8 = *(u32*)0x02FFE19C; + REG_MBK9 = *(u32*)0x02FFE1AC; + WRAM_CR = *(u8*)0x02FFE1AF; + } + REG_IME=0; REG_EXMEMCNT = 0xE880; // set ARM9 load address to 0 and wait for it to change again diff --git a/bootloader/source/boot.c b/bootloader/source/boot.c index a1446f2..6c69159 100644 --- a/bootloader/source/boot.c +++ b/bootloader/source/boot.c @@ -159,6 +159,19 @@ void passArgs_ARM7 (void) { +static void initMBK_dsiMode(void) { + // This function has no effect with ARM7 SCFG locked + *(vu32*)REG_MBK1 = *(u32*)0x02FFE180; + *(vu32*)REG_MBK2 = *(u32*)0x02FFE184; + *(vu32*)REG_MBK3 = *(u32*)0x02FFE188; + *(vu32*)REG_MBK4 = *(u32*)0x02FFE18C; + *(vu32*)REG_MBK5 = *(u32*)0x02FFE190; + REG_MBK6 = *(u32*)0x02FFE1A0; + REG_MBK7 = *(u32*)0x02FFE1A4; + REG_MBK8 = *(u32*)0x02FFE1A8; + REG_MBK9 = *(u32*)0x02FFE1AC; +} + void memset_addrs_arm7(u32 start, u32 end) { if (!dsiMode && !(REG_SCFG_EXT & BIT(16))) { @@ -286,6 +299,8 @@ void loadBinary_ARM7 (u32 fileCluster) fileRead(ARM9i_DST, fileCluster, ARM9i_SRC, ARM9i_LEN); if (ARM7i_LEN) fileRead(ARM7i_DST, fileCluster, ARM7i_SRC, ARM7i_LEN); + + initMBK_dsiMode(); } } @@ -362,7 +377,9 @@ int main (void) { sdRead = false; // Fix for Pictochat and DLP - if (ROM_TID == 0x41444E48 || ROM_TID == 0x41454E48) { + if (ROM_TID == 0x41444E48 || ROM_TID == 0x41454E48 + || ROM_TID == 0x43444E48 || ROM_TID == 0x43454E48 + || ROM_TID == 0x4B444E48 || ROM_TID == 0x4B454E48) { (*(vu16*)0x02FFFCFA) = 0x1041; // NoCash: channel ch1+7+13 } diff --git a/bootloader/source/boot.h b/bootloader/source/boot.h index e71d9ff..81b9ccc 100644 --- a/bootloader/source/boot.h +++ b/bootloader/source/boot.h @@ -3,7 +3,7 @@ #define resetMemory2_ARM9_size 0x400 void __attribute__ ((long_call)) __attribute__((naked)) __attribute__((noreturn)) resetMemory2_ARM9(); -#define startBinary_ARM9_size 0x100 +#define startBinary_ARM9_size 0x200 void __attribute__ ((long_call)) __attribute__((noreturn)) __attribute__((naked)) startBinary_ARM9 (); #define ARM9_START_FLAG (*(vu8*)0x02FFFDFB)