From 8e9fd91cee4b8dde01e17b893457830f8fa97fbc Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Tue, 7 Nov 2023 18:19:29 +0000 Subject: [PATCH] Counters: Pass correct start cycle --- pcsx2/Counters.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/pcsx2/Counters.cpp b/pcsx2/Counters.cpp index 44fbda722f2c8..deff108499833 100644 --- a/pcsx2/Counters.cpp +++ b/pcsx2/Counters.cpp @@ -600,13 +600,13 @@ __fi void rcntUpdate_hScanline() //iopEventAction = 1; if (hsyncCounter.Mode == MODE_HBLANK) { //HBLANK Start - rcntStartGate(false, hsyncCounter.sCycle); - psxCheckStartGate16(0); - // Setup the hRender's start and end cycle information: hsyncCounter.sCycle += vSyncInfo.hBlank; // start (absolute cycle value) hsyncCounter.CycleT = vSyncInfo.hRender; // endpoint (delta from start value) hsyncCounter.Mode = MODE_HRENDER; + + rcntStartGate(false, hsyncCounter.sCycle); + psxCheckStartGate16(0); } else { //HBLANK END / HRENDER Begin @@ -616,16 +616,17 @@ __fi void rcntUpdate_hScanline() if (!GSIMR.HSMSK) gsIrq(); } - if (gates) - rcntEndGate(false, hsyncCounter.sCycle); - if (psxhblankgate) - psxCheckEndGate16(0); // set up the hblank's start and end cycle information: hsyncCounter.sCycle += vSyncInfo.hRender; // start (absolute cycle value) hsyncCounter.CycleT = vSyncInfo.hBlank; // endpoint (delta from start value) hsyncCounter.Mode = MODE_HBLANK; + if (gates) + rcntEndGate(false, hsyncCounter.sCycle); + if (psxhblankgate) + psxCheckEndGate16(0); + #ifdef VSYNC_DEBUG hsc++; #endif @@ -639,11 +640,11 @@ __fi void rcntUpdate_vSync() if (vsyncCounter.Mode == MODE_VSYNC) { - VSyncEnd(vsyncCounter.sCycle); - vsyncCounter.sCycle += vSyncInfo.Blank; vsyncCounter.CycleT = vSyncInfo.Render; vsyncCounter.Mode = MODE_VRENDER; + + VSyncEnd(vsyncCounter.sCycle); } else if (vsyncCounter.Mode == MODE_GSBLANK) // GS CSR Swap and interrupt { @@ -655,8 +656,6 @@ __fi void rcntUpdate_vSync() } else // VSYNC end / VRENDER begin { - VSyncStart(vsyncCounter.sCycle); - vsyncCounter.sCycle += vSyncInfo.Render; vsyncCounter.CycleT = vSyncInfo.GSBlank; vsyncCounter.Mode = MODE_GSBLANK; @@ -664,6 +663,8 @@ __fi void rcntUpdate_vSync() // Accumulate hsync rounding errors: hsyncCounter.sCycle += vSyncInfo.hSyncError; + VSyncStart(vsyncCounter.sCycle); + #ifdef VSYNC_DEBUG vblankinc++; if (vblankinc > 1)