diff --git a/pcsx2/Counters.cpp b/pcsx2/Counters.cpp index 7c10ff6c4c..f662141d1a 100644 --- a/pcsx2/Counters.cpp +++ b/pcsx2/Counters.cpp @@ -543,12 +543,16 @@ static __fi void DoFMVSwitch() RendererSwitched = false; } -// Convenience function to update UI thread and set patches. -static __fi void frameLimitUpdateCore() +// Convenience function to update UI thread and set patches. +static __fi void VSyncUpdateCore() { DoFMVSwitch(); VMManager::Internal::VSyncOnCPUThread(); +} + +static __fi void VSyncCheckExit() +{ if (VMManager::Internal::IsExecutionInterrupted()) Cpu->ExitExecution(); } @@ -559,10 +563,7 @@ static __fi void frameLimit() { // Framelimiter off in settings? Framelimiter go brrr. if (EmuConfig.GS.LimitScalar == 0.0f || s_use_vsync_for_timing) - { - frameLimitUpdateCore(); return; - } const u64 uExpectedEnd = m_iStart + m_iTicks; // Compute when we would expect this frame to end, assuming everything goes perfectly perfect. const u64 iEnd = GetCPUTicks(); // The current tick we actually stopped on. @@ -573,7 +574,6 @@ static __fi void frameLimit() { // ... Fudge the next frame start over a bit. Prevents fast forward zoomies. m_iStart += (sDeltaTime / m_iTicks) * m_iTicks; - frameLimitUpdateCore(); return; } @@ -597,7 +597,6 @@ static __fi void frameLimit() // Finally, set our next frame start to when this one ends m_iStart = uExpectedEnd; - frameLimitUpdateCore(); } static __fi void VSyncStart(u32 sCycle) @@ -605,8 +604,7 @@ static __fi void VSyncStart(u32 sCycle) // Update vibration at the end of a frame. PAD::Update(); - frameLimit(); // limit FPS - gsPostVsyncStart(); // MUST be after framelimit; doing so before causes funk with frame times! + VSyncUpdateCore(); if(EmuConfig.Trace.Enabled && EmuConfig.Trace.EE.m_EnableAll) SysTrace.EE.Counters.Write( " ================ EE COUNTER VSYNC START (frame: %d) ================", g_FrameCount ); @@ -673,6 +671,9 @@ static __fi void VSyncEnd(u32 sCycle) if (!(g_FrameCount % 60)) sioNextFrame(); + frameLimit(); // limit FPS + gsPostVsyncStart(); // MUST be after framelimit; doing so before causes funk with frame times! + VSyncCheckExit(); // This doesn't seem to be needed here. Games only seem to break with regard to the // vsyncstart irq. //cpuRegs.eCycle[30] = 2;