Skip to content
Browse files

pcsx2-counters: Revert to older VRender/VBlank timings

This fixes timing issues in Dynasty Warriors 3 Xtreme Legends
(fake save corruption), Jak II (random speedup issues) and Shadow of
Rome (FMV audio issues).

Also update the comments since a lot of them refer to past revisions of
the code.
  • Loading branch information...
FlatOutPS2 authored and turtleli committed Feb 1, 2019
1 parent aef0f94 commit 0e84e2c43875161a7c4a235763b3d4def99c02dc
Showing with 13 additions and 15 deletions.
  1. +13 −15 pcsx2/Counters.cpp
@@ -196,26 +196,24 @@ static void vSyncInfoCalc(vSyncTimingInfo* info, Fixed100 framesPerSecond, u32 s
// I use fixed point math here to have strict control over rounding errors. --air

// NOTE: mgs3 likes a /4 vsync, but many games prefer /2. This seems to indicate a
// problem in the counters vsync gates somewhere.

u64 Frame = ((u64)PS2CLK * 1000000ULL) / (framesPerSecond * 100).ToIntRounded();
u64 HalfFrame = Frame / 2;

// One test we have shows that VBlank lasts for ~22 HBlanks, another we have show that is the time it's off.
// There exists a game (Legendz Gekitou! Saga Battle) Which runs REALLY slowly if VBlank is ~22 HBlanks, so the other test wins.

u64 Blank = HalfFrame / 2; // PAL VBlank Period is off for roughly 22 HSyncs

//I would have suspected this to be Frame - Blank, but that seems to completely freak it out
//and the test results are completely wrong. It seems 100% the same as the PS2 test on this,
//So let's roll with it :P
u64 Render = HalfFrame - Blank; // so use the half-frame value for these...
const u64 Scanline = Frame / scansPerFrame;

// There are two renders and blanks per frame. This matches the PS2 test results.
// The PAL and NTSC VBlank periods respectively lasts for approximately 22 and 26 scanlines.
// An older test suggests that these periods are actually the periods that VBlank is off, but
// Legendz Gekitou! Saga Battle runs very slowly if the VBlank period is inverted.
// Some of the more timing sensitive games and their symptoms when things aren't right:
// Dynasty Warriors 3 Xtreme Legends - fake save corruption when loading save
// Jak II - random speedups
// Shadow of Rome - FMV audio issues
const u64 HalfFrame = Frame / 2;
const u64 Blank = Scanline * (gsVideoMode == GS_VideoMode::NTSC ? 26 : 22);
const u64 Render = HalfFrame - Blank;

// Important! The hRender/hBlank timers should be 50/50 for best results.
// (this appears to be what the real EE's timing crystal does anyway)

u64 Scanline = Frame / scansPerFrame;
u64 hBlank = Scanline / 2;
u64 hRender = Scanline - hBlank;

0 comments on commit 0e84e2c

Please sign in to comment.
You can’t perform that action at this time.