Added a temporary workaround to prevent panics if booted from bootloaders with broken screen init.
This commit is contained in:
parent
ef79b4343d
commit
8fdc74a3c4
|
@ -66,6 +66,10 @@ void GFX_init(GfxFbFmt fmtTop, GfxFbFmt fmtBot)
|
|||
g_gfxState.doubleBuf[0] = 1;
|
||||
g_gfxState.doubleBuf[1] = 1;
|
||||
|
||||
// FIXME: Temporary workaround for screen init compatibility (Luma/fb3DS 1.2).
|
||||
TIMER_sleepMs(50);
|
||||
(void)MCU_getEvents(0x3Fu<<24); // Discard any screen init events.
|
||||
|
||||
REG_CFG11_GPUPROT = 0;
|
||||
|
||||
// Reset
|
||||
|
|
|
@ -58,6 +58,28 @@ static Result loadGbaRom(const char *const path, u32 *const rsOut)
|
|||
*rsOut = romSize;
|
||||
// Pad ROM area with "open bus" value.
|
||||
memset((void*)(ROM_LOC + romSize), 0xFFFFFFFFu, MAX_ROM_SIZE - romSize);
|
||||
|
||||
// Round up to the next power of 2.
|
||||
// https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
|
||||
/*u32 realRomSize = romSize;
|
||||
realRomSize--;
|
||||
realRomSize |= realRomSize>>1;
|
||||
realRomSize |= realRomSize>>2;
|
||||
realRomSize |= realRomSize>>4;
|
||||
realRomSize |= realRomSize>>8;
|
||||
realRomSize |= realRomSize>>16;
|
||||
realRomSize++;
|
||||
|
||||
// Pad unused ROM area with 0xFFs.
|
||||
if(realRomSize < 1024u * 1024) realRomSize = 1024u * 1024; // Smallest retail cart.
|
||||
memset((void*)(ROM_LOC + romSize), 0xFFFFFFFFu, realRomSize - romSize);
|
||||
|
||||
// Mirror ROM area across the entire 32 MiB range.
|
||||
for(uintptr_t i = ROM_LOC + realRomSize; i < ROM_LOC + MAX_ROM_SIZE; i += realRomSize)
|
||||
{
|
||||
//memcpy((void*)i, (void*)(i - realRomSize), realRomSize);
|
||||
memcpy((void*)i, (void*)ROM_LOC, realRomSize);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
else res = RES_ROM_TOO_BIG;
|
||||
|
|
|
@ -52,8 +52,7 @@ static void setupBiosOverlay(bool biosIntro)
|
|||
//iomemcpy(REGs_LGY_A7_VECTOR, biosVectors, 32);
|
||||
|
||||
NDMA_copy((u32*)ARM7_STUB_LOC9, _arm7_stub_start, (u32)_arm7_stub_size);
|
||||
// Patch swi 0x01 (RegisterRamReset) to swi 0x26 (HardReset).
|
||||
if(biosIntro) *((u8*)_arm7_stub_swi) = 0x26;
|
||||
if(biosIntro) *((u8*)_arm7_stub_swi) = 0x26; // Patch swi 0x01 (RegisterRamReset) to swi 0x26 (HardReset).
|
||||
}
|
||||
|
||||
static u32 setupSaveType(u16 saveType)
|
||||
|
|
Loading…
Reference in New Issue