From 35b6978dfebc8c71df9c7ea1325441f7f9237483 Mon Sep 17 00:00:00 2001 From: RocketRobz Date: Wed, 10 Jan 2024 19:47:51 -0700 Subject: [PATCH] B4DS: Add support for *Academy Tic-Tac-Toe* Requires DS Debug console --- .../arm9/include/dsiwaresSetForBootloader.h | 1 + .../bootloader/source/arm7/dsi2ds_patches.c | 19 +++++++++++++++++++ retail/bootloaderi/source/arm7/patch_common.c | 6 ++++++ 3 files changed, 26 insertions(+) diff --git a/retail/arm9/include/dsiwaresSetForBootloader.h b/retail/arm9/include/dsiwaresSetForBootloader.h index b1168a413..b5d6fca3f 100644 --- a/retail/arm9/include/dsiwaresSetForBootloader.h +++ b/retail/arm9/include/dsiwaresSetForBootloader.h @@ -38,6 +38,7 @@ static const char dsiWareForBootloader1[][4] = { "KCZ", // Absolute Chess (bootloaderi-exclusive) "KA8", // Absolute Reversi (bootloaderi-exclusive) "KXG", // Abyss + "KT3", // Academy Tic-Tac-Toe "KQK", // Ace Mathician "KAC", // Advanced Circuits "K5H", // Ah! Heaven diff --git a/retail/bootloader/source/arm7/dsi2ds_patches.c b/retail/bootloader/source/arm7/dsi2ds_patches.c index 03e06b7fe..ae801663c 100644 --- a/retail/bootloader/source/arm7/dsi2ds_patches.c +++ b/retail/bootloader/source/arm7/dsi2ds_patches.c @@ -2112,6 +2112,23 @@ void patchDSiModeToDSMode(cardengineArm9* ce9, const tNDSHeader* ndsHeader) { *(u32*)(0x02070920+offsetChange) = 0xE1A00000; // nop } + // Academy Tic-Tac-Toe (USA) + // Academy Tic-Tac-Toe: Noughts and Crosses (Europe, Australia) + // Saving not supported due to a weird bug + // Requires 8MB of RAM + else if (strncmp(romTid, "KT3", 3) == 0 && extendedMemory) { + u8 offsetChange = (romTid[3] == 'E') ? 0 : 0x78; + + *(u32*)0x02005098 = 0xE1A00000; // nop (Disable NFTR font loading from TWLNAND) + *(u32*)0x02005128 = 0xE1A00000; // nop + *(u32*)0x02005140 = 0xE1A00000; // nop + *(u32*)(0x02039378-offsetChange) = 0xE1A00000; // nop + *(u32*)(0x0203CCF0-offsetChange) = 0xE1A00000; // nop + patchInitDSiWare(0x020420A0-offsetChange, heapEnd); + *(u32*)(0x0204242C-offsetChange) = *(u32*)0x02004FD0; + patchUserSettingsReadDSiWare(0x0204356C-offsetChange); + } + // Ace Mathician (USA) // Saving not supported due to using more than one file in filesystem else if (strcmp(romTid, "KQKE") == 0) { @@ -5264,6 +5281,7 @@ void patchDSiModeToDSMode(cardengineArm9* ce9, const tNDSHeader* ndsHeader) { }*/ // Boom Boom Squaries (USA) + // Saving not supported due to a weird bug else if (strcmp(romTid, "KBME") == 0) { *(u32*)0x02005150 = 0xE1A00000; // nop (Disable NFTR font loading from TWLNAND) *(u32*)0x020051CC = 0xE1A00000; // nop @@ -5292,6 +5310,7 @@ void patchDSiModeToDSMode(cardengineArm9* ce9, const tNDSHeader* ndsHeader) { } // Boom Boom Squaries (Europe, Australia) + // Saving not supported due to a weird bug else if (strcmp(romTid, "KBMV") == 0) { *(u32*)0x02005150 = 0xE1A00000; // nop (Disable NFTR font loading from TWLNAND) *(u32*)0x020051CC = 0xE1A00000; // nop diff --git a/retail/bootloaderi/source/arm7/patch_common.c b/retail/bootloaderi/source/arm7/patch_common.c index 60b15fd11..19487fcd1 100644 --- a/retail/bootloaderi/source/arm7/patch_common.c +++ b/retail/bootloaderi/source/arm7/patch_common.c @@ -1378,6 +1378,12 @@ void dsiWarePatch(cardengineArm9* ce9, const tNDSHeader* ndsHeader) { setBL(0x02031AC4+offsetChange, (u32)dsiSaveClose); } + // Academy Tic-Tac-Toe (USA) + // Academy Tic-Tac-Toe: Noughts and Crosses (Europe, Australia) + else if (strncmp(romTid, "KT3", 3) == 0 && !twlFontFound) { + *(u32*)0x02005098 = 0xE1A00000; // nop (Disable NFTR font loading from TWLNAND) + } + // Advanced Circuits (USA) // Advanced Circuits (Europe, Australia) else if (strncmp(romTid, "KAC", 3) == 0 && saveOnFlashcard) {