Skip to content

Commit

Permalink
gbapatcher: Fix GBA *Fire Emblem* games not booting
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Feb 7, 2024
1 parent 93dca4e commit fb2e40a
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions gbapatcher/arm9/source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,19 @@ ITCM_CODE void gptc_patchWait()
// General fix for white screen crash
// Patch out wait states
for (u32 addr = 0x080000C0; addr < searchRange; addr+=4) {
if (*(u32*)addr == 0x04000204
&& (*(u8*)(addr-1) == 0x00 || *(u8*)(addr-1) == 0x03 || *(u8*)(addr-1) == 0x04 || *(u8*)(addr+7) == 0x04
|| *(u8*)(addr-1) == 0x08 || *(u8*)(addr-1) == 0x09
|| *(u8*)(addr-1) == 0x47 || *(u8*)(addr-1) == 0x81 || *(u8*)(addr-1) == 0x85
|| *(u8*)(addr-1) == 0xE0 || *(u8*)(addr-1) == 0xE7 || *(u16*)(addr-2) == 0xFFFE))
if (*(u32*)addr != 0x04000204) {
continue;
}
const u8 data8_last = *(u8*)(addr-1);
if (data8_last == 0x00 || data8_last == 0x03 || data8_last == 0x04 || *(u8*)(addr+7) == 0x04 || *(u8*)(addr+0xB) == 0x04
|| data8_last == 0x08 || data8_last == 0x09
|| data8_last == 0x47 || data8_last == 0x81 || data8_last == 0x85
|| data8_last == 0xE0 || data8_last == 0xE7 || *(u16*)(addr-2) == 0xFFFE)
{
toncset((u16*)addr, 0, sizeof(u32));
}
}

// Also check at 0x410
if (*(u32*)0x08000410 == 0x04000204) {
toncset((u16*)0x08000410, 0, sizeof(u32));
}

scanKeys();
int keys = keysHeld();

Expand Down

0 comments on commit fb2e40a

Please sign in to comment.