Counters: Present at VSync End

This commit is contained in:
refractionpcsx2 2022-04-19 17:26:04 +01:00
parent 6f595b7d87
commit af0b17bb7a
1 changed files with 10 additions and 9 deletions

View File

@ -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;