Skip to content

Commit d616a5a

Browse files
committed
B4DS: Add support for USA and Europe versions of *Treasure Hunter X*/*Fall in the Dark*
1 parent f20be63 commit d616a5a

File tree

3 files changed

+61
-21
lines changed

3 files changed

+61
-21
lines changed

retail/arm9/include/dsiwaresSetForBootloader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ static const char dsiWareForBootloader1[][4] = {
200200
"K5K", // Escape Trick: Convenience Store (bootloaderi-exclusive)
201201
"KER", // G.G Series: Exciting River
202202
"KYB", // Face Pilot: Fly With Your Nintendo DSi Camera! (bootloaderi-exclusive)
203-
"K4E", // Fall in the Dark
204203
"Z2E", // Famicom Wars DS: Ushinawareta Hikari
205204
"KFK", // Farm Frenzy
206205
"KU7", // Fashion Tycoon
@@ -542,6 +541,7 @@ static const char dsiWareForBootloader3[][4] = {
542541
"KWV", // The Tower DS: Hotel
543542
"KW4", // The Tower DS: Shopping Santa
544543
"KDZ", // Trajectile
544+
"K4E", // Treasure Hunter X
545545
"KB7", // Trollboarder
546546
"K72", // True Swing Golf Express
547547
"KTI", // Turn: The Lost Artifact

retail/bootloader/source/arm7/dsi2ds_patches.c

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11588,20 +11588,6 @@ void patchDSiModeToDSMode(cardengineArm9* ce9, const tNDSHeader* ndsHeader) {
1158811588
} */
1158911589
}
1159011590

11591-
// Fall in the Dark (Japan)
11592-
// A bit hard/confusing to add save support
11593-
else if (strcmp(romTid, "K4EJ") == 0) {
11594-
useSharedFont = twlFontFound;
11595-
*(u32*)0x02010284 = 0xE1A00000; // nop
11596-
*(u32*)0x02013894 = 0xE1A00000; // nop
11597-
patchInitDSiWare(0x02019000, heapEnd);
11598-
patchUserSettingsReadDSiWare(0x0201A5C0);
11599-
*(u32*)0x02022CA0 = 0xE12FFF1E; // bx lr
11600-
if (!twlFontFound) {
11601-
*(u32*)0x0203EE0C = 0xE1A00000; // nop (Skip Manual screen)
11602-
}
11603-
}
11604-
1160511591
// Famicom Wars DS: Ushinawareta Hikari (Japan)
1160611592
// DSi save function patching not needed
1160711593
else if (strcmp(romTid, "Z2EJ") == 0) {
@@ -26693,6 +26679,48 @@ void patchDSiModeToDSMode(cardengineArm9* ce9, const tNDSHeader* ndsHeader) {
2669326679
*(u32*)0x02103DF8 = 0x1E0000; // Shrink sound heap from 0x300000
2669426680
}
2669526681

26682+
// Treasure Hunter X (USA)
26683+
// A bit hard/confusing to add save support
26684+
else if (strcmp(romTid, "K4EE") == 0) {
26685+
useSharedFont = twlFontFound;
26686+
*(u32*)0x02010290 = 0xE1A00000; // nop
26687+
*(u32*)0x020138AC = 0xE1A00000; // nop
26688+
patchInitDSiWare(0x02019034, heapEnd);
26689+
patchUserSettingsReadDSiWare(0x0201A604);
26690+
*(u32*)0x02022CBC = 0xE12FFF1E; // bx lr
26691+
if (!twlFontFound) {
26692+
*(u32*)0x0203EE90 = 0xE1A00000; // nop (Skip Manual screen)
26693+
}
26694+
}
26695+
26696+
// Treasure Hunter X (Europe)
26697+
// A bit hard/confusing to add save support
26698+
else if (strcmp(romTid, "K4EP") == 0) {
26699+
useSharedFont = twlFontFound;
26700+
*(u32*)0x020102CC = 0xE1A00000; // nop
26701+
*(u32*)0x02013970 = 0xE1A00000; // nop
26702+
patchInitDSiWare(0x02019114, heapEnd);
26703+
patchUserSettingsReadDSiWare(0x0201A6E4);
26704+
*(u32*)0x02022DB0 = 0xE12FFF1E; // bx lr
26705+
if (!twlFontFound) {
26706+
*(u32*)0x0203EF6C = 0xE1A00000; // nop (Skip Manual screen)
26707+
}
26708+
}
26709+
26710+
// Fall in the Dark (Japan)
26711+
// A bit hard/confusing to add save support
26712+
else if (strcmp(romTid, "K4EJ") == 0) {
26713+
useSharedFont = twlFontFound;
26714+
*(u32*)0x02010284 = 0xE1A00000; // nop
26715+
*(u32*)0x02013894 = 0xE1A00000; // nop
26716+
patchInitDSiWare(0x02019000, heapEnd);
26717+
patchUserSettingsReadDSiWare(0x0201A5C0);
26718+
*(u32*)0x02022CA0 = 0xE12FFF1E; // bx lr
26719+
if (!twlFontFound) {
26720+
*(u32*)0x0203EE0C = 0xE1A00000; // nop (Skip Manual screen)
26721+
}
26722+
}
26723+
2669626724
// Trollboarder (USA)
2669726725
// Trollboarder (Europe)
2669826726
else if (strcmp(romTid, "KB7E") == 0 || strcmp(romTid, "KB7P") == 0) {

retail/bootloaderi/source/arm7/patch_common.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6318,12 +6318,6 @@ void dsiWarePatch(cardengineArm9* ce9, const tNDSHeader* ndsHeader) {
63186318
// *(u32*)0x0203C9E4 = 0xE12FFF1E; // bx lr
63196319
}
63206320

6321-
// Fall in the Dark (Japan)
6322-
// A bit hard/confusing to add save support
6323-
else if (strcmp(romTid, "K4EJ") == 0 && !twlFontFound) {
6324-
*(u32*)0x0203EE0C = 0xE1A00000; // nop (Skip Manual screen)
6325-
}
6326-
63276321
// Farm Frenzy (USA)
63286322
else if (strcmp(romTid, "KFKE") == 0 && saveOnFlashcardNtr) {
63296323
tonccpy((u32*)0x0200F4CC, dsiSaveGetResultCode, 0xC);
@@ -15223,6 +15217,24 @@ void dsiWarePatch(cardengineArm9* ce9, const tNDSHeader* ndsHeader) {
1522315217
toncset16((u16*)0x020B8F88, nopT, 0x4A/sizeof(u16)); // Do not use DSi WRAM
1522415218
}
1522515219

15220+
// Treasure Hunter X (USA)
15221+
// A bit hard/confusing to add save support
15222+
else if (strcmp(romTid, "K4EE") == 0 && !twlFontFound) {
15223+
*(u32*)0x0203EE90 = 0xE1A00000; // nop (Skip Manual screen)
15224+
}
15225+
15226+
// Treasure Hunter X (Europe)
15227+
// A bit hard/confusing to add save support
15228+
else if (strcmp(romTid, "K4EP") == 0 && !twlFontFound) {
15229+
*(u32*)0x0203EF6C = 0xE1A00000; // nop (Skip Manual screen)
15230+
}
15231+
15232+
// Fall in the Dark (Japan)
15233+
// A bit hard/confusing to add save support
15234+
else if (strcmp(romTid, "K4EJ") == 0 && !twlFontFound) {
15235+
*(u32*)0x0203EE0C = 0xE1A00000; // nop (Skip Manual screen)
15236+
}
15237+
1522615238
// Trollboarder (USA)
1522715239
// Trollboarder (Europe)
1522815240
else if ((strcmp(romTid, "KB7E") == 0 || strcmp(romTid, "KB7P") == 0) && saveOnFlashcardNtr) {

0 commit comments

Comments
 (0)