From 02c3600f1a2db5d72de0fcaa3d57439570dfe246 Mon Sep 17 00:00:00 2001 From: RocketRobz Date: Wed, 10 Jan 2024 21:52:46 -0700 Subject: [PATCH] B4DS: Add support for *ACT Series: Tangocho* --- .../arm9/include/dsiwaresSetForBootloader.h | 3 + .../bootloader/source/arm7/dsi2ds_patches.c | 62 +++++++++++++++++++ retail/bootloaderi/source/arm7/patch_common.c | 60 ++++++++++++++++++ 3 files changed, 125 insertions(+) diff --git a/retail/arm9/include/dsiwaresSetForBootloader.h b/retail/arm9/include/dsiwaresSetForBootloader.h index b5d6fca3f..ff73015bc 100644 --- a/retail/arm9/include/dsiwaresSetForBootloader.h +++ b/retail/arm9/include/dsiwaresSetForBootloader.h @@ -40,6 +40,9 @@ static const char dsiWareForBootloader1[][4] = { "KXG", // Abyss "KT3", // Academy Tic-Tac-Toe "KQK", // Ace Mathician + "KE5", // ACT Series: Tangocho: Ni Chi Hen + "KCS", // ACT Series: Tangocho: Ni Chu Hen + "KRE", // ACT Series: Tangocho: Ni Kan Hen "KAC", // Advanced Circuits "K5H", // Ah! Heaven "K25", // G.G Series: Air Pinball Hockey diff --git a/retail/bootloader/source/arm7/dsi2ds_patches.c b/retail/bootloader/source/arm7/dsi2ds_patches.c index ae801663c..baac654a5 100644 --- a/retail/bootloader/source/arm7/dsi2ds_patches.c +++ b/retail/bootloader/source/arm7/dsi2ds_patches.c @@ -2172,6 +2172,68 @@ void patchDSiModeToDSMode(cardengineArm9* ce9, const tNDSHeader* ndsHeader) { *(u32*)0x02039B90 = 0xE1A00000; // nop } + // ACT Series: Tangocho: Ni Chi Hen (Japan) + // Saving not supported due to using more than one file in filesystem + else if (strcmp(romTid, "KE5J") == 0) { + /* setBL(0x0200BFC4, (u32)dsiSaveOpen); + setBL(0x0200BFFC, (u32)dsiSaveGetLength); + setBL(0x0200C010, (u32)dsiSaveRead); + setBL(0x0200C024, (u32)dsiSaveClose); + setBL(0x0200C034, (u32)dsiSaveClose); + setBL(0x0200C088, (u32)dsiSaveCreate); + setBL(0x0200C09C, (u32)dsiSaveOpen); + setBL(0x0200C0D8, (u32)dsiSaveSetLength); + setBL(0x0200C0E8, (u32)dsiSaveWrite); + setBL(0x0200C0F0, (u32)dsiSaveClose); */ + *(u32*)0x0200C1A8 = 0xE12FFF1E; // bx lr (Skip Manual screen) + *(u32*)0x0203B5B0 = 0xE1A00000; // nop + *(u32*)0x0203EFEC = 0xE1A00000; // nop + patchInitDSiWare(0x0204574C, heapEnd); + patchUserSettingsReadDSiWare(0x02046C18); + } + + // ACT Series: Tangocho: Ni Chu Hen (Japan) + // Saving not supported due to using more than one file in filesystem + else if (strcmp(romTid, "KCSJ") == 0) { + /* setBL(0x0200BC84, (u32)dsiSaveOpen); + setBL(0x0200BCBC, (u32)dsiSaveGetLength); + setBL(0x0200BCD0, (u32)dsiSaveRead); + setBL(0x0200BCE4, (u32)dsiSaveClose); + setBL(0x0200BCF4, (u32)dsiSaveClose); + setBL(0x0200BD48, (u32)dsiSaveCreate); + setBL(0x0200BD5C, (u32)dsiSaveOpen); + setBL(0x0200BD98, (u32)dsiSaveSetLength); + setBL(0x0200BDA8, (u32)dsiSaveWrite); + setBL(0x0200BDB0, (u32)dsiSaveClose); */ + *(u32*)0x0200BE68 = 0xE12FFF1E; // bx lr (Skip Manual screen) + *(u32*)0x0203777C = 0xE1A00000; // nop + *(u32*)0x0203B1B8 = 0xE1A00000; // nop + patchInitDSiWare(0x02041918, heapEnd); + patchUserSettingsReadDSiWare(0x02042DE4); + } + + // ACT Series: Tangocho: Ni Kan Hen (Japan) + // Saving not supported due to using more than one file in filesystem + else if (strcmp(romTid, "KREJ") == 0) { + *(u32*)0x020050A4 = 0xE1A00000; // nop + /* setBL(0x0200C0F0, (u32)dsiSaveOpen); + setBL(0x0200C128, (u32)dsiSaveGetLength); + setBL(0x0200C13C, (u32)dsiSaveRead); + setBL(0x0200C150, (u32)dsiSaveClose); + setBL(0x0200C160, (u32)dsiSaveClose); + setBL(0x0200C1B4, (u32)dsiSaveCreate); + setBL(0x0200C1C8, (u32)dsiSaveOpen); + setBL(0x0200C204, (u32)dsiSaveSetLength); + setBL(0x0200C214, (u32)dsiSaveWrite); + setBL(0x0200C21C, (u32)dsiSaveClose); */ + *(u32*)0x0200C2D4 = 0xE12FFF1E; // bx lr (Skip Manual screen) + *(u32*)0x0200C618 = 0xE12FFF1E; // bx lr + *(u32*)0x0203B974 = 0xE1A00000; // nop + *(u32*)0x0203F3B0 = 0xE1A00000; // nop + patchInitDSiWare(0x02045B10, heapEnd); + patchUserSettingsReadDSiWare(0x02046FDC); + } + // Advanced Circuits (USA) // Advanced Circuits (Europe, Australia) // Saving not supported due to using more than one file in filesystem diff --git a/retail/bootloaderi/source/arm7/patch_common.c b/retail/bootloaderi/source/arm7/patch_common.c index 19487fcd1..db80b2c96 100644 --- a/retail/bootloaderi/source/arm7/patch_common.c +++ b/retail/bootloaderi/source/arm7/patch_common.c @@ -1384,6 +1384,66 @@ void dsiWarePatch(cardengineArm9* ce9, const tNDSHeader* ndsHeader) { *(u32*)0x02005098 = 0xE1A00000; // nop (Disable NFTR font loading from TWLNAND) } + // ACT Series: Tangocho: Ni Chi Hen (Japan) + // Saving not supported due to using more than one file in filesystem + else if (strcmp(romTid, "KE5J") == 0) { + /* if (saveOnFlashcard) { + setBL(0x0200BFC4, (u32)dsiSaveOpen); + setBL(0x0200BFFC, (u32)dsiSaveGetLength); + setBL(0x0200C010, (u32)dsiSaveRead); + setBL(0x0200C024, (u32)dsiSaveClose); + setBL(0x0200C034, (u32)dsiSaveClose); + setBL(0x0200C088, (u32)dsiSaveCreate); + setBL(0x0200C09C, (u32)dsiSaveOpen); + setBL(0x0200C0D8, (u32)dsiSaveSetLength); + setBL(0x0200C0E8, (u32)dsiSaveWrite); + setBL(0x0200C0F0, (u32)dsiSaveClose); + } */ + if (!twlFontFound) { + *(u32*)0x0200C1A8 = 0xE12FFF1E; // bx lr (Skip Manual screen) + } + } + + // ACT Series: Tangocho: Ni Chu Hen (Japan) + // Saving not supported due to using more than one file in filesystem + else if (strcmp(romTid, "KCSJ") == 0) { + /* if (saveOnFlashcard) { + setBL(0x0200BC84, (u32)dsiSaveOpen); + setBL(0x0200BCBC, (u32)dsiSaveGetLength); + setBL(0x0200BCD0, (u32)dsiSaveRead); + setBL(0x0200BCE4, (u32)dsiSaveClose); + setBL(0x0200BCF4, (u32)dsiSaveClose); + setBL(0x0200BD48, (u32)dsiSaveCreate); + setBL(0x0200BD5C, (u32)dsiSaveOpen); + setBL(0x0200BD98, (u32)dsiSaveSetLength); + setBL(0x0200BDA8, (u32)dsiSaveWrite); + setBL(0x0200BDB0, (u32)dsiSaveClose); + } */ + if (!twlFontFound) { + *(u32*)0x0200BE68 = 0xE12FFF1E; // bx lr (Skip Manual screen) + } + } + + // ACT Series: Tangocho: Ni Kan Hen (Japan) + // Saving not supported due to using more than one file in filesystem + else if (strcmp(romTid, "KREJ") == 0) { + /* if (saveOnFlashcard) { + setBL(0x0200C0F0, (u32)dsiSaveOpen); + setBL(0x0200C128, (u32)dsiSaveGetLength); + setBL(0x0200C13C, (u32)dsiSaveRead); + setBL(0x0200C150, (u32)dsiSaveClose); + setBL(0x0200C160, (u32)dsiSaveClose); + setBL(0x0200C1B4, (u32)dsiSaveCreate); + setBL(0x0200C1C8, (u32)dsiSaveOpen); + setBL(0x0200C204, (u32)dsiSaveSetLength); + setBL(0x0200C214, (u32)dsiSaveWrite); + setBL(0x0200C21C, (u32)dsiSaveClose); + } */ + if (!twlFontFound) { + *(u32*)0x0200C2D4 = 0xE12FFF1E; // bx lr (Skip Manual screen) + } + } + // Advanced Circuits (USA) // Advanced Circuits (Europe, Australia) else if (strncmp(romTid, "KAC", 3) == 0 && saveOnFlashcard) {