From a6193b0a514b8514e8ef921b3d0b4f1ed4ec3b66 Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Tue, 25 May 2021 09:52:08 +0100 Subject: [PATCH] Core: Make DMA's instant during the BIOS --- pcsx2/R5900.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pcsx2/R5900.cpp b/pcsx2/R5900.cpp index c8c5518ca5..809c547122 100644 --- a/pcsx2/R5900.cpp +++ b/pcsx2/R5900.cpp @@ -269,7 +269,7 @@ static __fi void TESTINT( u8 n, void (*callback)() ) { if( !(cpuRegs.interrupt & (1 << n)) ) return; - if( cpuTestCycle( cpuRegs.sCycle[n], cpuRegs.eCycle[n] ) ) + if(!g_GameStarted || cpuTestCycle( cpuRegs.sCycle[n], cpuRegs.eCycle[n] ) ) { cpuClearInt( n ); callback(); @@ -398,7 +398,17 @@ __fi void _cpuEventTest_Shared() // These are basically just DMAC-related events, which also piggy-back the same bits as // the PS2's own DMA channel IRQs and IRQ Masks. - _cpuTestInterrupts(); + // This is a BIOS hack because the coding in the BIOS is terrible but the bug is masked by Data Cache + // where a DMA buffer is overwritten without waiting for the transfer to end, which causes the fonts to get all messed up + // so to fix it, we run all the DMA's instantly when in the BIOS. + // Only use the lower 17 bits of the cpuRegs.interrupt as the upper bits are for VU0/1 sync which can't be done in a tight loop + if (!g_GameStarted && dmacRegs.ctrl.DMAE && !(psHu8(DMAC_ENABLER + 2) & 1) && (cpuRegs.interrupt & 0x1FFFF)) + { + while(cpuRegs.interrupt & 0x1FFFF) + _cpuTestInterrupts(); + } + else + _cpuTestInterrupts(); // ---- IOP ------------- // * It's important to run a iopEventTest before calling ExecuteBlock. This