Skip to content

Commit f2430a4

Browse files
committed
B4DS: Add support for *Bloons*
Saving does not work
1 parent fcf3d1b commit f2430a4

File tree

3 files changed

+44
-6
lines changed

3 files changed

+44
-6
lines changed

retail/arm9/include/dsiwaresSetForBootloader.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ static const char dsiWareForBootloader1[][4] = {
9393
"K96", // G.G Series: Black x Block
9494
"KBZ", // BlayzBloo: Super Melee Brawlers Battle Royale
9595
"KZ4", // Blockado: Puzzle Island (bootloaderi-exclusive)
96+
"KBL", // Bloons
9697
"KLN", // Bloons TD
9798
"KUV", // Bloons TD 4
9899
"KA5", // Boardwalk Ball Toss

retail/bootloader/source/arm7/dsi2ds_patches.c

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5273,11 +5273,14 @@ void patchDSiModeToDSMode(cardengineArm9* ce9, const tNDSHeader* ndsHeader) {
52735273
}*/
52745274

52755275
// Bloons (USA)
5276-
/*else if (strcmp(romTid, "KBLE") == 0) {
5276+
// Saving not supported due to using more than one file in filesystem
5277+
else if (strcmp(romTid, "KBLE") == 0) {
5278+
*(u32*)0x0203E020 = 0xE12FFF1E; // bx lr (Disable save writing)
52775279
*(u32*)0x0206A808 = 0xE1A00000; // nop
52785280
*(u32*)0x0206A810 = 0xE1A00000; // nop
52795281
*(u32*)0x0206A860 = 0xE12FFF1E; // bx lr
5280-
setBL(0x0206AC38, (u32)dsiSaveOpenR);
5282+
*(u32*)0x0206AD10 = 0xE1A00000; // nop (Disable save reading)
5283+
/* setBL(0x0206AC38, (u32)dsiSaveOpenR);
52815284
setBL(0x0206ACFC, (u32)dsiSaveGetLength);
52825285
setBL(0x0206AD68, (u32)dsiSaveClose);
52835286
setBL(0x0206B040, (u32)dsiSaveSeek);
@@ -5301,15 +5304,31 @@ void patchDSiModeToDSMode(cardengineArm9* ce9, const tNDSHeader* ndsHeader) {
53015304
setBL(0x0206B930, (u32)dsiSaveGetLength);
53025305
setBL(0x0206BF34, (u32)dsiSaveDelete);
53035306
*(u32*)0x0206C060 = 0xE3A00001; // mov r0, #1 (dsiSaveGetArcSrc)
5304-
*(u32*)0x0206C078 = 0xE3A00001; // mov r0, #1 (dsiSaveFreeSpaceAvailable)
5307+
*(u32*)0x0206C078 = 0xE3A00001; // mov r0, #1 (dsiSaveFreeSpaceAvailable) */
53055308
*(u32*)0x0206C09C = 0xE12FFF1E; // bx lr
53065309
*(u32*)0x0207569C = 0xE1A00000; // nop
5307-
tonccpy((u32*)0x020771C0, dsiSaveGetResultCode, 0xC);
5310+
// tonccpy((u32*)0x020771C0, dsiSaveGetResultCode, 0xC);
53085311
*(u32*)0x02079EB0 = 0xE1A00000; // nop
53095312
patchInitDSiWare(0x02080EC0, heapEnd);
5310-
*(u32*)0x0208124C = 0x020E0380;
5313+
*(u32*)0x0208124C = *(u32*)0x02004FD0;
53115314
patchUserSettingsReadDSiWare(0x020820F4);
5312-
}*/
5315+
}
5316+
5317+
// Bloons (Europe)
5318+
// Saving not supported due to using more than one file in filesystem
5319+
else if (strcmp(romTid, "KBLP") == 0) {
5320+
*(u32*)0x0203E044 = 0xE12FFF1E; // bx lr (Disable save writing)
5321+
*(u32*)0x0206A82C = 0xE1A00000; // nop
5322+
*(u32*)0x0206A834 = 0xE1A00000; // nop
5323+
*(u32*)0x0206A904 = 0xE12FFF1E; // bx lr
5324+
*(u32*)0x0206ADB4 = 0xE1A00000; // nop (Disable save reading)
5325+
*(u32*)0x0206C140 = 0xE12FFF1E; // bx lr
5326+
*(u32*)0x02075740 = 0xE1A00000; // nop
5327+
*(u32*)0x02079F54 = 0xE1A00000; // nop
5328+
patchInitDSiWare(0x02080F64, heapEnd);
5329+
*(u32*)0x020812F0 = *(u32*)0x02004FD0;
5330+
patchUserSettingsReadDSiWare(0x02082198);
5331+
}
53135332

53145333
// Bloons TD (USA)
53155334
// Bloons TD (Europe)

retail/bootloaderi/source/arm7/patch_common.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3123,6 +3123,24 @@ void dsiWarePatch(cardengineArm9* ce9, const tNDSHeader* ndsHeader) {
31233123
} */
31243124
}
31253125

3126+
// Bloons (USA)
3127+
// Saving not supported due to using more than one file in filesystem
3128+
else if (strcmp(romTid, "KBLE") == 0 && saveOnFlashcardNtr) {
3129+
*(u32*)0x0203E020 = 0xE12FFF1E; // bx lr (Disable save writing)
3130+
*(u32*)0x0206A860 = 0xE12FFF1E; // bx lr
3131+
*(u32*)0x0206AD10 = 0xE1A00000; // nop (Disable save reading)
3132+
*(u32*)0x0206C09C = 0xE12FFF1E; // bx lr
3133+
}
3134+
3135+
// Bloons (Europe)
3136+
// Saving not supported due to using more than one file in filesystem
3137+
else if (strcmp(romTid, "KBLP") == 0 && saveOnFlashcardNtr) {
3138+
*(u32*)0x0203E044 = 0xE12FFF1E; // bx lr (Disable save writing)
3139+
*(u32*)0x0206A904 = 0xE12FFF1E; // bx lr
3140+
*(u32*)0x0206ADB4 = 0xE1A00000; // nop (Disable save reading)
3141+
*(u32*)0x0206C140 = 0xE12FFF1E; // bx lr
3142+
}
3143+
31263144
// Bloons TD (USA)
31273145
// Bloons TD (Europe)
31283146
// A weird bug is preventing save support

0 commit comments

Comments
 (0)