@@ -74,11 +74,11 @@ void patchDSiModeToDSMode(cardengineArm9* ce9, const tNDSHeader* ndsHeader) {
7474 const u32 heapEnd = extendedMemory ? (((u32)ndsHeader->arm9destination >= 0x02004000) ? 0x027D8000 : 0x02700000) : heapEndRetail;
7575 const u32 heapEnd8MBHack = extendedMemory ? heapEnd : heapEndRetail+0x400000; // extendedMemory ? #0x27B0000 : #0x27E0000 (mirrors to 0x23E0000 on retail DS units)
7676 const u32 heapEndExceed = extendedMemory ? heapEnd+0x800000 : heapEndRetail+0xC00000; // extendedMemory ? #0x2FB0000 (mirrors to 0x27B0000 on debug DS units) : #0x2FE0000 (mirrors to 0x23E0000 on retail DS units)
77- const u32 heapEndMaxForRetail = maxHeapOpen ? ((_io_dldi_size == 0x0F) ? 0x023F6000 : (_io_dldi_size == 0x0E) ? 0x023FA000 : 0x023FC000) : heapEnd;
78- const u32 heapEndMaxForRetail2 = maxHeapOpen ? ((_io_dldi_size == 0x0F) ? heapEndMaxForRetail : 0x023FF000) : heapEnd;
79- const u32 heapEndMaxForRetail32 = maxHeapOpen ? 0x023FF000 : heapEnd;
80- const u32 heapEndMaxForRetailMus = maxHeapOpen ? heapEndMaxForRetail-0x4000 : heapEnd;
81- // const u32 heapEndMaxForDebug = maxHeapOpen ? ((_io_dldi_size == 0x0F) ? 0x027F6000 : (_io_dldi_size == 0x0E) ? 0x027FA000 : 0x027FC000) : heapEnd;
77+ const u32 heapEndMaxForRetail = ( maxHeapOpen && !extendedMemory) ? ((_io_dldi_size == 0x0F) ? 0x023F6000 : (_io_dldi_size == 0x0E) ? 0x023FA000 : 0x023FC000) : heapEnd;
78+ const u32 heapEndMaxForRetail2 = ( maxHeapOpen && !extendedMemory) ? ((_io_dldi_size == 0x0F) ? heapEndMaxForRetail : 0x023FF000) : heapEnd;
79+ const u32 heapEndMaxForRetail32 = ( maxHeapOpen && !extendedMemory) ? 0x023FF000 : heapEnd;
80+ const u32 heapEndMaxForRetailMus = ( maxHeapOpen && !extendedMemory) ? heapEndMaxForRetail-0x4000 : heapEnd;
81+ // const u32 heapEndMaxForDebug = ( maxHeapOpen && extendedMemory) ? ((_io_dldi_size == 0x0F) ? 0x027F6000 : (_io_dldi_size == 0x0E) ? 0x027FA000 : 0x027FC000) : heapEnd;
8282 const u32 heapEnd_512KBFreeForDebug = extendedMemory ? 0x02740000 : heapEnd;
8383 // const u32 heapEnd_512KBFreeForDebugAlt = extendedMemory ? 0x02700000 : heapEnd;
8484 const u32 heapEndMaxForRetail_512KBFreeForDebugAlt = extendedMemory ? 0x02700000 : heapEndMaxForRetail;
@@ -15055,6 +15055,33 @@ void patchDSiModeToDSMode(cardengineArm9* ce9, const tNDSHeader* ndsHeader) {
1505515055 setBL(0x02024980, (u32)dsiSaveCreate);
1505615056 }
1505715057
15058+ // Kuniya Burete Sanga Ari: Hills and Rivers Remain (Japan)
15059+ // Saving not supported due to using more than one file in filesystem
15060+ // Requires either 8MB of RAM or Memory Expansion Pak
15061+ else if (strcmp(romTid, "KY3J") == 0 && twlFontFound && debugOrMep) {
15062+ useSharedFont = true;
15063+ if (!extendedMemory) {
15064+ const u32 newCodeAddr = 0x02019224;
15065+ codeCopy((u32*)newCodeAddr, (u32*)0x0201F874, 0x28);
15066+ setBL(0x0202A74C, newCodeAddr);
15067+ patchTwlFontLoad(false, newCodeAddr+0x10, 0x02018590);
15068+ }
15069+
15070+ *(u32*)0x02004AA0 = 0xE1A00000; // nop
15071+ *(u32*)0x0200E4E8 = 0xE1A00000; // nop
15072+ *(u32*)0x02011A24 = 0xE1A00000; // nop
15073+ *(u32*)0x02016AC8 = 0xE3A00001; // mov r0, #1
15074+ patchInitDSiWare(0x02016AE0, heapEndMaxForRetail2);
15075+ patchUserSettingsReadDSiWare(0x02017FD8);
15076+ *(u32*)0x02018000 = wirelessReturnCodeArm;
15077+ *(u32*)0x02018004 = 0xE12FFF1E; // bx lr
15078+ *(u32*)0x0201800C = 0xE3A00000; // mov r0, #0
15079+ *(u32*)0x02018010 = 0xE12FFF1E; // bx lr
15080+ if (!extendedMemory) {
15081+ *(u32*)0x0202B328 = 0xE3A01901; // mov r1, #0x4000 (Shrink SDAT heap from 0x80000)
15082+ }
15083+ }
15084+
1505815085 // Kyara Pasha!: Hello Kitty (Japan)
1505915086 // Shows Japanese error screen (Possibly related to camera)
1506015087 /*else if (strcmp(romTid, "KYKJ") == 0) {
0 commit comments