Skip to content

Commit

Permalink
B4DS: Play music in *Pop Island: Paperfield* and *Glory Days: Tactica…
Browse files Browse the repository at this point in the history
…l Defense* on debug consoles
  • Loading branch information
RocketRobz committed Dec 10, 2023
1 parent b5c3268 commit 79e3fca
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
22 changes: 22 additions & 0 deletions retail/bootloader/source/arm7/dsi2ds_patches.c
Original file line number Diff line number Diff line change
Expand Up @@ -11426,30 +11426,36 @@ void patchDSiModeToDSMode(cardengineArm9* ce9, const tNDSHeader* ndsHeader) {

// Glory Days: Tactical Defense (USA)
// Glory Days: Tactical Defense (Europe)
// Music does not play on retail consoles
else if (strcmp(romTid, "KGKE") == 0 || strcmp(romTid, "KGKP") == 0) {
// *(u32*)0x02004B9C = 0x0200002F;
*(u32*)0x0200B488 = 0xE1A00000; // nop
*(u32*)0x0200E7A0 = 0xE1A00000; // nop
patchInitDSiWare(0x02018F08, heapEnd);
*(u32*)0x02019294 = *(u32*)0x02004FD0;
patchUserSettingsReadDSiWare(0x0201A404);
*(u32*)0x0201FB24 = wirelessReturnCodeArm;
*(u32*)0x0201FB28 = 0xE12FFF1E; // bx lr
if (romTid[3] == 'E') {
*(u32*)0x02065B20 = 0x368940; // Shrink sound heap from 0x958940
for (int i = 0; i < 12; i++) {
u32* offset = (u32*)0x0206710C;
offset[i] = 0xE1A00000; // nop
}
*(u32*)0x020671B4 = 0xE1A00000; // nop
*(u32*)0x020671F0 = 0xE1A00000; // nop
for (int i = 0; i < 10; i++) {
u32* offset = (u32*)0x02075514;
offset[i] = 0xE1A00000; // nop
}
} else {
*(u32*)0x02065C80 = 0x368940; // Shrink sound heap from 0x958940
for (int i = 0; i < 12; i++) {
u32* offset = (u32*)0x02067264;
offset[i] = 0xE1A00000; // nop
}
*(u32*)0x0206730C = 0xE1A00000; // nop
*(u32*)0x02067348 = 0xE1A00000; // nop
for (int i = 0; i < 10; i++) {
u32* offset = (u32*)0x0207566C;
offset[i] = 0xE1A00000; // nop
Expand Down Expand Up @@ -19264,6 +19270,22 @@ void patchDSiModeToDSMode(cardengineArm9* ce9, const tNDSHeader* ndsHeader) {
*(u32*)0x020863B0 = 0xE1A00000; // nop
}

// Pop Island: Paperfield (USA)
// Full version plays on debug consoles
else if (strcmp(romTid, "KPFE") == 0 && ndsHeader->fatSize > 0 && extendedMemory) {
*(u32*)0x0200F820 = 0xE3A00001; // mov r0, #1 (Enable NitroFS reads)
*(u32*)0x0204E940 = 0x35C940; // Shrink sound heap from 0x958940
*(u8*)0x021C69D8 = 0; // Hide "DEMO" text
}

// Pop Island: Paperfield (Europe)
// Full version plays on debug consoles
else if (strcmp(romTid, "KPFP") == 0 && ndsHeader->fatSize > 0 && extendedMemory) {
*(u32*)0x0200F820 = 0xE3A00001; // mov r0, #1 (Enable NitroFS reads)
*(u32*)0x0204E968 = 0x35C940; // Shrink sound heap from 0x958940
*(u8*)0x021C4AB8 = 0; // Hide "DEMO" text
}

// Pop+ Solo (USA)
// Pop+ Solo (Europe, Australia)
else if (strcmp(romTid, "KPIE") == 0 || strcmp(romTid, "KPIV") == 0) {
Expand Down
4 changes: 2 additions & 2 deletions retail/bootloader/source/arm7/main.arm7.c
Original file line number Diff line number Diff line change
Expand Up @@ -1100,8 +1100,8 @@ static void setMemoryAddress(const tNDSHeader* ndsHeader, const module_params_t*

const char* romTid = getRomTid(ndsHeader);
if (strncmp(romTid, "KPP", 3) == 0 // Pop Island
|| strncmp(romTid, "KPF", 3) == 0 // Pop Island: Paperfield
|| strncmp(romTid, "KGK", 3) == 0 // Glory Days: Tactical Defense
|| (strncmp(romTid, "KPF", 3) == 0 && (ndsHeader->fatSize == 0 || !extendedMemory)) // Pop Island: Paperfield
|| (strncmp(romTid, "KGK", 3) == 0 && (ndsHeader->fatSize == 0 || !extendedMemory)) // Glory Days: Tactical Defense
|| (strcmp(romTid, "NTRJ") == 0 && (ndsHeader->headerCRC16 == 0x53E2 || ndsHeader->headerCRC16 == 0x681E || ndsHeader->headerCRC16 == 0xCD01)) || srlFromPageFile)
{
*((u16*)(isSdk5(moduleParams) ? 0x02fffc40 : 0x027ffc40)) = 0x2; // Boot Indicator (Cloneboot/Multiboot)
Expand Down

0 comments on commit 79e3fca

Please sign in to comment.