From 750769240a454421790e75d2cab06bec08ed0420 Mon Sep 17 00:00:00 2001 From: RocketRobz Date: Wed, 10 Jan 2024 22:30:58 -0700 Subject: [PATCH] B4DS: Add support for JPN version of *Ivy the Kiwi? mini* --- .../bootloader/source/arm7/dsi2ds_patches.c | 25 +++++++++++++++++++ retail/bootloaderi/source/arm7/patch_common.c | 21 ++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/retail/bootloader/source/arm7/dsi2ds_patches.c b/retail/bootloader/source/arm7/dsi2ds_patches.c index baac654a5..929a11264 100644 --- a/retail/bootloader/source/arm7/dsi2ds_patches.c +++ b/retail/bootloader/source/arm7/dsi2ds_patches.c @@ -12797,6 +12797,31 @@ void patchDSiModeToDSMode(cardengineArm9* ce9, const tNDSHeader* ndsHeader) { *(u32*)(0x020B1470+offsetChangeS) = 0xE1A00000; // nop } + // Ivy the Kiwi? mini (Japan) + else if (strcmp(romTid, "KIKJ") == 0) { + *(u32*)0x020124D4 = 0xE1A00000; // nop + tonccpy((u32*)0x02013058, dsiSaveGetResultCode, 0xC); + *(u32*)0x02015B74 = 0xE1A00000; // nop + patchInitDSiWare(0x0202546C, heapEnd); + patchUserSettingsReadDSiWare(0x02026994); + *(u32*)0x0202E978 = wirelessReturnCodeArm; + *(u32*)0x0202E97C = 0xE12FFF1E; // bx lr + *(u32*)0x020683A4 = 0xE1A00000; // nop + *(u32*)0x020683B8 = 0xE1A00000; // nop + setBL(0x020B9174, (u32)dsiSaveCreate); + *(u32*)0x020B9450 = 0xE1A00000; // nop + setBL(0x020B9734, (u32)dsiSaveCreate); + setBL(0x020B9744, (u32)dsiSaveOpen); + setBL(0x020B9764, (u32)dsiSaveSetLength); + setBL(0x020B97A4, (u32)dsiSaveWrite); + setBL(0x020B97AC, (u32)dsiSaveClose); + *(u32*)0x020B97F8 = 0xE1A00000; // nop + setBL(0x020B9880, (u32)dsiSaveOpen); + setBL(0x020B98A4, (u32)dsiSaveRead); + setBL(0x020B98AC, (u32)dsiSaveClose); + *(u32*)0x020B9B94 = 0xE1A00000; // nop + } + // Jazzy Billiards (USA) // Saving not supported due to code taking place in the overlays else if (strcmp(romTid, "K9BE") == 0) { diff --git a/retail/bootloaderi/source/arm7/patch_common.c b/retail/bootloaderi/source/arm7/patch_common.c index db80b2c96..4dde337ab 100644 --- a/retail/bootloaderi/source/arm7/patch_common.c +++ b/retail/bootloaderi/source/arm7/patch_common.c @@ -7186,14 +7186,17 @@ void dsiWarePatch(cardengineArm9* ce9, const tNDSHeader* ndsHeader) { u16 offsetChangeS = (romTid[3] == 'X') ? 0 : 0x344; tonccpy((u32*)0x02013058, dsiSaveGetResultCode, 0xC); setBL(0x020B0AB8+offsetChangeS, (u32)dsiSaveCreate); + *(u32*)(0x020B0D94+offsetChangeS) = 0xE1A00000; // nop setBL(0x020B1078+offsetChangeS, (u32)dsiSaveCreate); setBL(0x020B1088+offsetChangeS, (u32)dsiSaveOpen); setBL(0x020B10A8+offsetChangeS, (u32)dsiSaveSetLength); setBL(0x020B10E8+offsetChangeS, (u32)dsiSaveWrite); setBL(0x020B10F0+offsetChangeS, (u32)dsiSaveClose); + *(u32*)(0x020B113C+offsetChangeS) = 0xE1A00000; // nop setBL(0x020B11D8+offsetChangeS, (u32)dsiSaveOpen); setBL(0x020B1200+offsetChangeS, (u32)dsiSaveRead); setBL(0x020B1208+offsetChangeS, (u32)dsiSaveClose); + *(u32*)(0x020B128C+offsetChangeS) = 0xE1A00000; // nop setBL(0x020B1324+offsetChangeS, (u32)dsiSaveCreate); setBL(0x020B1334+offsetChangeS, (u32)dsiSaveOpen); setBL(0x020B135C+offsetChangeS, (u32)dsiSaveSetLength); @@ -7201,6 +7204,24 @@ void dsiWarePatch(cardengineArm9* ce9, const tNDSHeader* ndsHeader) { setBL(0x020B13E8+offsetChangeS, (u32)dsiSaveClose); setBL(0x020B1448+offsetChangeS, (u32)dsiSaveClose); setBL(0x020B1464+offsetChangeS, (u32)dsiSaveClose); + *(u32*)(0x020B1470+offsetChangeS) = 0xE1A00000; // nop + } + + // Ivy the Kiwi? mini (Japan) + else if (strcmp(romTid, "KIKJ") == 0 && saveOnFlashcard) { + tonccpy((u32*)0x02013058, dsiSaveGetResultCode, 0xC); + setBL(0x020B9174, (u32)dsiSaveCreate); + *(u32*)0x020B9450 = 0xE1A00000; // nop + setBL(0x020B9734, (u32)dsiSaveCreate); + setBL(0x020B9744, (u32)dsiSaveOpen); + setBL(0x020B9764, (u32)dsiSaveSetLength); + setBL(0x020B97A4, (u32)dsiSaveWrite); + setBL(0x020B97AC, (u32)dsiSaveClose); + *(u32*)0x020B97F8 = 0xE1A00000; // nop + setBL(0x020B9880, (u32)dsiSaveOpen); + setBL(0x020B98A4, (u32)dsiSaveRead); + setBL(0x020B98AC, (u32)dsiSaveClose); + *(u32*)0x020B9B94 = 0xE1A00000; // nop } // JellyCar 2 (USA)