diff --git a/Source/Core/Core/Src/CoreTiming.cpp b/Source/Core/Core/Src/CoreTiming.cpp index 74ad817bf4..ff9488b4fe 100644 --- a/Source/Core/Core/Src/CoreTiming.cpp +++ b/Source/Core/Core/Src/CoreTiming.cpp @@ -250,8 +250,6 @@ void ScheduleEvent_Threadsafe(int cyclesIntoFuture, int event_type, u64 userdata if(tsLast) tsLast->next = ne; tsLast = ne; - - SetDowncount(ne->type, cyclesIntoFuture); } // Same as ScheduleEvent_Threadsafe(0, ...) EXCEPT if we are already on the CPU thread @@ -262,7 +260,6 @@ void ScheduleEvent_Threadsafe_Immediate(int event_type, u64 userdata) { std::lock_guard lk(externalEventSection); event_types[event_type].callback(userdata, 0); - SetDowncount(event_type, 0); } else ScheduleEvent_Threadsafe(0, event_type, userdata); @@ -416,14 +413,8 @@ void SetMaximumSlice(int maximumSliceLength) maxSliceLength = maximumSliceLength; } -void SetDowncount(int event_type, int cycles) +void ForceExceptionCheck(int cycles) { - if (event_types[event_type].name == "SetToken") - return; - - if (cycles == 0) - cycles = 100; // External Exception latency. Paper Mario TTYD freezes in fight scenes if this is zero. - if (downcount > cycles) { slicelength -= (downcount - cycles); // Account for cycles already executed by adjusting the slicelength @@ -486,7 +477,6 @@ void MoveEvents() void Advance() { - MoveEvents(); int cyclesExecuted = slicelength - downcount; diff --git a/Source/Core/Core/Src/CoreTiming.h b/Source/Core/Core/Src/CoreTiming.h index 88c9de5948..8e00b303f0 100644 --- a/Source/Core/Core/Src/CoreTiming.h +++ b/Source/Core/Core/Src/CoreTiming.h @@ -92,7 +92,7 @@ void SetFakeTBStartValue(u64 val); u64 GetFakeTBStartTicks(); void SetFakeTBStartTicks(u64 val); -void SetDowncount(int event_type, int cycles); +void ForceExceptionCheck(int cycles); extern int downcount; extern int slicelength; diff --git a/Source/Core/Core/Src/HW/DSP.cpp b/Source/Core/Core/Src/HW/DSP.cpp index 6fb6778d9d..a9acf6aedc 100644 --- a/Source/Core/Core/Src/HW/DSP.cpp +++ b/Source/Core/Core/Src/HW/DSP.cpp @@ -696,6 +696,10 @@ void Do_ARAM_DMA() g_dspState.DSPControl.DMAState = 1; CoreTiming::ScheduleEvent_Threadsafe(0, et_GenerateDSPInterrupt, INT_ARAM | (1<<16)); + // Force an early exception check. Fixes RE2 audio. + if (g_arDMA.Cnt.count == 4096) + CoreTiming::ForceExceptionCheck(100); + // Real hardware DMAs in 32byte chunks, but we can get by with 8byte chunks if (g_arDMA.Cnt.dir) { diff --git a/Source/Core/VideoCommon/Src/CommandProcessor.cpp b/Source/Core/VideoCommon/Src/CommandProcessor.cpp index 71b4591bf7..dacec67823 100644 --- a/Source/Core/VideoCommon/Src/CommandProcessor.cpp +++ b/Source/Core/VideoCommon/Src/CommandProcessor.cpp @@ -642,14 +642,11 @@ void SetCpStatusRegister() void SetCpControlRegister() { - // If the new fifo is being attached We make sure there wont be SetFinish event pending. - // This protection fix eternal darkness booting, because the second SetFinish event when it is booting - // seems invalid or has a bug and hang the game. - + // If the new fifo is being attached, force an exception check + // This fixes the hang while booting Eternal Darkness if (!fifo.bFF_GPReadEnable && m_CPCtrlReg.GPReadEnable && !m_CPCtrlReg.BPEnable) { - ProcessFifoEvents(); - PixelEngine::ResetSetFinish(); + CoreTiming::ForceExceptionCheck(0); } fifo.bFF_BPInt = m_CPCtrlReg.BPInt;