Counters/Vsync: Adjusted VSync according to an older test we had. Fixes Legendz Gekitou! Saga Battle. Also adjusted the number of scanlines depending on if the game is using interlacing or not.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5900 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
refraction 2014-02-13 22:16:21 +00:00
parent 916537b0f8
commit c979181bd7
2 changed files with 11 additions and 5 deletions

View File

@ -32,7 +32,7 @@
using namespace Threading; using namespace Threading;
extern u8 psxhblankgate; extern u8 psxhblankgate;
extern bool gsIsInterlaced;
static const uint EECNT_FUTURE_TARGET = 0x10000000; static const uint EECNT_FUTURE_TARGET = 0x10000000;
static int gates = 0; static int gates = 0;
@ -193,10 +193,14 @@ static void vSyncInfoCalc( vSyncTimingInfo* info, Fixed100 framesPerSecond, u32
u64 Frame = ((u64)PS2CLK * 1000000ULL) / (framesPerSecond*100).ToIntRounded(); u64 Frame = ((u64)PS2CLK * 1000000ULL) / (framesPerSecond*100).ToIntRounded();
u64 HalfFrame = Frame / 2; u64 HalfFrame = Frame / 2;
u64 Blank = (Frame / scansPerFrame) * 22; // PAL VBlank Period is roughly 22 HSyncs
if(scansPerFrame == SCANLINES_TOTAL_NTSC) // One test we have shows that VBlank lasts for ~22 HBlanks, another we have show that is the time it's off.
Blank = (Frame / scansPerFrame) * 26; // NTSC VBlank Period is roughly 26 HSyncs, so we update // There exists a game (Legendz Gekitou! Saga Battle) Which runs REALLY slowly if VBlank is ~22 HBlanks, so the other test wins.
u64 Blank = (Frame / scansPerFrame) * ((scansPerFrame / 2) - 22); // PAL VBlank Period is off for roughly 22 HSyncs
if(scansPerFrame < SCANLINES_TOTAL_PAL) //Assume NTSC
Blank = (Frame / scansPerFrame) * ((scansPerFrame /2) - 26); // NTSC VBlank Period is off for roughly 26 HSyncs, so we update
//I would have suspected this to be Frame - Blank, but that seems to completely freak it out //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, //and the test results are completely wrong. It seems 100% the same as the PS2 test on this,
@ -263,12 +267,14 @@ u32 UpdateVSyncRate()
isCustom = (EmuConfig.GS.FrameratePAL != 50.0); isCustom = (EmuConfig.GS.FrameratePAL != 50.0);
framerate = EmuConfig.GS.FrameratePAL / 2; framerate = EmuConfig.GS.FrameratePAL / 2;
scanlines = SCANLINES_TOTAL_PAL; scanlines = SCANLINES_TOTAL_PAL;
if (!gsIsInterlaced) scanlines += 3;
} }
else if ( gsRegionMode == Region_NTSC ) else if ( gsRegionMode == Region_NTSC )
{ {
isCustom = (EmuConfig.GS.FramerateNTSC != 59.94); isCustom = (EmuConfig.GS.FramerateNTSC != 59.94);
framerate = EmuConfig.GS.FramerateNTSC / 2; framerate = EmuConfig.GS.FramerateNTSC / 2;
scanlines = SCANLINES_TOTAL_NTSC; scanlines = SCANLINES_TOTAL_NTSC;
if (!gsIsInterlaced) scanlines += 1;
} }
else if ( gsRegionMode == Region_NTSC_PROGRESSIVE ) else if ( gsRegionMode == Region_NTSC_PROGRESSIVE )
{ {

View File

@ -32,7 +32,7 @@ void gsOnModeChanged( Fixed100 framerate, u32 newTickrate )
GetMTGS().SendSimplePacket( GS_RINGTYPE_MODECHANGE, framerate.Raw, newTickrate, 0 ); GetMTGS().SendSimplePacket( GS_RINGTYPE_MODECHANGE, framerate.Raw, newTickrate, 0 );
} }
static bool gsIsInterlaced = false; bool gsIsInterlaced = false;
GS_RegionMode gsRegionMode = Region_NTSC; GS_RegionMode gsRegionMode = Region_NTSC;