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.
This commit is contained in:
Akash 2018-02-08 15:44:37 +05:30
parent 785fe6b2e3
commit c23241c5f4
1 changed files with 5 additions and 4 deletions

View File

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