Skip to content

Commit

Permalink
Fix 32KB DLDI workaround for homebrew made with libnds2
Browse files Browse the repository at this point in the history
  • Loading branch information
RocketRobz committed Nov 14, 2024
1 parent 7d8b4c9 commit d852daa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bootloader/source/dldi_patcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,11 @@ bool dldiPatchBinary (data_t *binData, u32 binSize) {
const bool largeDldi = (pDH[DO_driverSize] > pAH[DO_allocatedSpace]);

if (largeDldi) {
if (memOffset < 0x02000000 || memOffset >= 0x03000000) {
const u32 a9exeAddress = *(u32*)0x02FFFE24;
u32* a9exe = (u32*)a9exeAddress;
const bool libnds2 = (a9exe[0] == 0xEA000007 && a9exe[1] == 0x39444F4D);

if (!libnds2 && (memOffset < 0x02000000 || memOffset >= 0x03000000)) {
// Not enough space for patch in arm7 WRAM
return false;
}
Expand Down

0 comments on commit d852daa

Please sign in to comment.