Preliminary NTSC progressive scan support.

The detection is based on a quickly reversed smode1 flag and needs to be done properly.
The timing itself also needs reversing and has only been tested on the VP2 intro video.
(That video now runs without audio / video desync when progressive scan is enabled :) )

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5179 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2 2012-04-26 17:07:36 +00:00
parent 5dee597d9b
commit 2cb99f0e05
4 changed files with 27 additions and 9 deletions

View File

@ -209,6 +209,12 @@ static void vSyncInfoCalc( vSyncTimingInfo* info, Fixed100 framesPerSecond, u32
u64 Scanline = Frame / scansPerFrame;
u64 hBlank = Scanline / 2;
u64 hRender = Scanline - hBlank;
if ( gsRegionMode == Region_NTSC_PROGRESSIVE )
{
hBlank /= 2;
hRender /= 2;
}
info->Framerate = framesPerSecond;
info->Render = (u32)(Render/10000);
@ -226,12 +232,14 @@ static void vSyncInfoCalc( vSyncTimingInfo* info, Fixed100 framesPerSecond, u32
else if( ( hBlank - info->hBlank ) >= 5000 ) info->hBlank++;
// Calculate accumulative hSync rounding error per half-frame:
if ( gsRegionMode != Region_NTSC_PROGRESSIVE ) // gets off the chart in that mode
{
u32 hSyncCycles = ((info->hRender + info->hBlank) * scansPerFrame) / 2;
u32 vSyncCycles = (info->Render + info->Blank);
info->hSyncError = vSyncCycles - hSyncCycles;
u32 hSyncCycles = ((info->hRender + info->hBlank) * scansPerFrame) / 2;
u32 vSyncCycles = (info->Render + info->Blank);
info->hSyncError = vSyncCycles - hSyncCycles;
//Console.Warning("%d",info->hSyncError);
}
else info->hSyncError = 0;
// Note: In NTSC modes there is some small rounding error in the vsync too,
// however it would take thousands of frames for it to amount to anything and
// is thus not worth the effort at this time.
@ -256,17 +264,25 @@ u32 UpdateVSyncRate()
framerate = EmuConfig.GS.FrameratePAL / 2;
scanlines = SCANLINES_TOTAL_PAL;
}
else
else if ( gsRegionMode == Region_NTSC )
{
isCustom = (EmuConfig.GS.FramerateNTSC != 59.94);
framerate = EmuConfig.GS.FramerateNTSC / 2;
scanlines = SCANLINES_TOTAL_NTSC;
}
else if ( gsRegionMode == Region_NTSC_PROGRESSIVE )
{
isCustom = (EmuConfig.GS.FramerateNTSC != 59.94);
framerate = 30; // Cheating here to avoid a complex change to the below "vSyncInfo.Framerate != framerate" branch
scanlines = SCANLINES_TOTAL_NTSC;
}
if( vSyncInfo.Framerate != framerate )
{
vSyncInfoCalc( &vSyncInfo, framerate, scanlines );
Console.WriteLn( Color_Green, "(UpdateVSyncRate) Mode Changed to %s.", ( gsRegionMode == Region_PAL ) ? "PAL" : "NTSC" );
Console.WriteLn( Color_Green, "(UpdateVSyncRate) Mode Changed to %s.", ( gsRegionMode == Region_PAL ) ? "PAL" :
( gsRegionMode == Region_NTSC ) ? "NTSC" : "Progressive Scan" );
if( isCustom )
Console.Indent().WriteLn( Color_StrongGreen, "... with user configured refresh rate: %.02f Hz", framerate.ToFloat() );
}

View File

@ -173,7 +173,8 @@ static __fi void _gsSMODEwrite( u32 mem, u32 value )
switch (mem)
{
case GS_SMODE1:
gsSetRegionMode( ((value & 0x6000) == 0x6000) ? Region_PAL : Region_NTSC );
// ToDo: There's other flags determining which mode to set. The only tested one so far is the PAL / NTSC one.
gsSetRegionMode( ((value & 0x6000) == 0x6000) ? Region_PAL : (value & 0x400000) ? Region_NTSC_PROGRESSIVE : Region_NTSC );
break;
case GS_SMODE2:

View File

@ -220,7 +220,8 @@ struct GSRegSIGBLID
enum GS_RegionMode
{
Region_NTSC,
Region_PAL
Region_PAL,
Region_NTSC_PROGRESSIVE
};
extern GS_RegionMode gsRegionMode;

View File

@ -94,7 +94,7 @@ bool GSRenderer::Merge(int field)
baseline = min(dr[i].top, baseline);
// printf("[%d]: %d %d %d %d, %d %d %d %d\n", i, fr[i], dr[i]);
//printf("[%d]: %d %d %d %d, %d %d %d %d\n", i, fr[i].x,fr[i].y,fr[i].z,fr[i].w , dr[i].x,dr[i].y,dr[i].z,dr[i].w);
}
}