From c23241c5f41c50dbe2b218875d944c52628efee8 Mon Sep 17 00:00:00 2001 From: Akash Date: Thu, 8 Feb 2018 15:44:37 +0530 Subject: [PATCH] PCSX2-Counters: Fix rounding of blank and render I guess the intention of the older logic was to get the truncated part by comparing with the original value, but that went wrong due to using the pre-normalized value (before the division) for comparison. Hence let's just do a modulo for rounding the render and blank. --- pcsx2/Counters.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pcsx2/Counters.cpp b/pcsx2/Counters.cpp index c45bef86ef..87ac43c650 100644 --- a/pcsx2/Counters.cpp +++ b/pcsx2/Counters.cpp @@ -229,11 +229,12 @@ static void vSyncInfoCalc(vSyncTimingInfo* info, Fixed100 framesPerSecond, u32 s info->hScanlinesPerFrame = scansPerFrame; // Apply rounding: - if ((Render - info->Render) >= 5000) info->Render++; - else if ((Blank - info->Blank) >= 5000) info->Blank++; + // To investigate: Why is render rounding prioritized over blank? why skip the latter? + if ((Render % 10000) >= 5000) info->Render++; + else if ((Blank % 10000) >= 5000) info->Blank++; - if ((hRender - info->hRender) >= 5000) info->hRender++; - else if ((hBlank - info->hBlank) >= 5000) info->hBlank++; + if ((hRender % 10000) >= 5000) info->hRender++; + else if ((hBlank % 10000) >= 5000) info->hBlank++; // Calculate accumulative hSync rounding error per half-frame: if (IsAnalogVideoMode()) // gets off the chart in that mode