mirror of https://github.com/PCSX2/pcsx2.git
PCSX2-Counters: Rename "GS_RegionMode" to "GS_VideoMode"
Technically there's no term called "RegionMode" and the values obtained through the SMODE1 register is actually used for identifying the video mode of the game not any region modes. * Convert "GS_VideoMode" into an enum class
This commit is contained in:
parent
36e82abd12
commit
a1fdf1e625
|
@ -25,7 +25,7 @@
|
|||
#include "CDVD_internal.h"
|
||||
#include "CDVDisoReader.h"
|
||||
|
||||
#include "GS.h" // for gsRegionMode
|
||||
#include "GS.h" // for gsVideoMode
|
||||
#include "Elfheader.h"
|
||||
#include "ps2/BiosTools.h"
|
||||
#include "GameDatabase.h"
|
||||
|
@ -958,7 +958,7 @@ u8 monthmap[13] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
|||
|
||||
void cdvdVsync() {
|
||||
cdvd.RTCcount++;
|
||||
if (cdvd.RTCcount < ((gsRegionMode == Region_NTSC) ? 60 : 50)) return;
|
||||
if (cdvd.RTCcount < ((gsVideoMode == GS_VideoMode::NTSC) ? 60 : 50)) return;
|
||||
cdvd.RTCcount = 0;
|
||||
|
||||
if ( cdvd.Status == CDVD_STATUS_TRAY_OPEN )
|
||||
|
|
|
@ -291,7 +291,7 @@ struct Pcsx2Config
|
|||
// The region mode controls the default Maximum/Minimum FPS settings and also
|
||||
// regulates the vsync rates (which in turn control the IOP's SPU2 tick sync and ensure
|
||||
// proper audio playback speed).
|
||||
int DefaultRegionMode; // 0=NTSC and 1=PAL
|
||||
int DefaultVideoMode; // 0=NTSC and 1=PAL
|
||||
|
||||
int FramesToDraw; // number of consecutive frames (fields) to render
|
||||
int FramesToSkip; // number of consecutive frames (fields) to skip
|
||||
|
@ -318,7 +318,7 @@ struct Pcsx2Config
|
|||
OpEqu( FramerateNTSC ) &&
|
||||
OpEqu( FrameratePAL ) &&
|
||||
|
||||
OpEqu( DefaultRegionMode ) &&
|
||||
OpEqu( DefaultVideoMode ) &&
|
||||
OpEqu( FramesToDraw ) &&
|
||||
OpEqu( FramesToSkip );
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ void rcntInit()
|
|||
vsyncCounter.sCycle = cpuRegs.cycle;
|
||||
|
||||
// Set the video mode to user's default request:
|
||||
gsSetRegionMode( (GS_RegionMode)EmuConfig.GS.DefaultRegionMode );
|
||||
gsSetVideoMode( (GS_VideoMode)EmuConfig.GS.DefaultVideoMode );
|
||||
|
||||
for (i=0; i<4; i++) rcntReset(i);
|
||||
cpuRcntSet();
|
||||
|
@ -173,7 +173,7 @@ static u64 m_iStart=0;
|
|||
struct vSyncTimingInfo
|
||||
{
|
||||
Fixed100 Framerate; // frames per second (8 bit fixed)
|
||||
GS_RegionMode RegionMode; // used to detect change (interlaced/progressive)
|
||||
GS_VideoMode VideoMode; // used to detect change (interlaced/progressive)
|
||||
u32 Render; // time from vblank end to vblank start (cycles)
|
||||
u32 Blank; // time from vblank start to vblank end (cycles)
|
||||
|
||||
|
@ -214,7 +214,7 @@ static void vSyncInfoCalc(vSyncTimingInfo* info, Fixed100 framesPerSecond, u32 s
|
|||
u64 hBlank = Scanline / 2;
|
||||
u64 hRender = Scanline - hBlank;
|
||||
|
||||
if (gsRegionMode == Region_NTSC_PROGRESSIVE)
|
||||
if (gsVideoMode == GS_VideoMode::PROGRESSIVE)
|
||||
{
|
||||
hBlank /= 2;
|
||||
hRender /= 2;
|
||||
|
@ -236,7 +236,7 @@ static void vSyncInfoCalc(vSyncTimingInfo* info, Fixed100 framesPerSecond, u32 s
|
|||
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
|
||||
if (gsVideoMode != GS_VideoMode::PROGRESSIVE) // gets off the chart in that mode
|
||||
{
|
||||
u32 hSyncCycles = ((info->hRender + info->hBlank) * scansPerFrame) / 2;
|
||||
u32 vSyncCycles = (info->Render + info->Blank);
|
||||
|
@ -262,33 +262,33 @@ u32 UpdateVSyncRate()
|
|||
u32 scanlines = 0;
|
||||
bool isCustom = false;
|
||||
|
||||
if( gsRegionMode == Region_PAL )
|
||||
if(gsVideoMode == GS_VideoMode::PAL )
|
||||
{
|
||||
isCustom = (EmuConfig.GS.FrameratePAL != 50.0);
|
||||
framerate = EmuConfig.GS.FrameratePAL / 2;
|
||||
scanlines = SCANLINES_TOTAL_PAL;
|
||||
if (!gsIsInterlaced) scanlines += 3;
|
||||
}
|
||||
else if ( gsRegionMode == Region_NTSC )
|
||||
else if (gsVideoMode == GS_VideoMode::NTSC )
|
||||
{
|
||||
isCustom = (EmuConfig.GS.FramerateNTSC != 59.94);
|
||||
framerate = EmuConfig.GS.FramerateNTSC / 2;
|
||||
scanlines = SCANLINES_TOTAL_NTSC;
|
||||
if (!gsIsInterlaced) scanlines += 1;
|
||||
}
|
||||
else if ( gsRegionMode == Region_NTSC_PROGRESSIVE )
|
||||
else if (gsVideoMode == GS_VideoMode::PROGRESSIVE )
|
||||
{
|
||||
isCustom = (EmuConfig.GS.FramerateNTSC != 59.94);
|
||||
framerate = EmuConfig.GS.FramerateNTSC / 2;
|
||||
scanlines = SCANLINES_TOTAL_NTSC;
|
||||
}
|
||||
|
||||
if (vSyncInfo.Framerate != framerate || vSyncInfo.RegionMode != gsRegionMode)
|
||||
if (vSyncInfo.Framerate != framerate || vSyncInfo.VideoMode != gsVideoMode)
|
||||
{
|
||||
vSyncInfo.RegionMode = gsRegionMode;
|
||||
vSyncInfo.VideoMode = gsVideoMode;
|
||||
vSyncInfoCalc( &vSyncInfo, framerate, scanlines );
|
||||
Console.WriteLn( Color_Green, "(UpdateVSyncRate) Mode Changed to %s.", ( gsRegionMode == Region_PAL ) ? "PAL" :
|
||||
( gsRegionMode == Region_NTSC ) ? "NTSC" : "NTSC Progressive Scan" );
|
||||
Console.WriteLn( Color_Green, "(UpdateVSyncRate) Mode Changed to %s.", (gsVideoMode == GS_VideoMode::PAL ) ? "PAL" :
|
||||
(gsVideoMode == GS_VideoMode::NTSC ) ? "NTSC" : "NTSC Progressive Scan" );
|
||||
|
||||
if( isCustom )
|
||||
Console.Indent().WriteLn( Color_StrongGreen, "... with user configured refresh rate: %.02f Hz", 2 * framerate.ToFloat() );
|
||||
|
|
18
pcsx2/GS.cpp
18
pcsx2/GS.cpp
|
@ -32,15 +32,15 @@ void gsOnModeChanged( Fixed100 framerate, u32 newTickrate )
|
|||
GetMTGS().SendSimplePacket( GS_RINGTYPE_MODECHANGE, framerate.Raw, newTickrate, 0 );
|
||||
}
|
||||
|
||||
bool gsIsInterlaced = false;
|
||||
GS_RegionMode gsRegionMode = Region_NTSC;
|
||||
bool gsIsInterlaced = false;
|
||||
GS_VideoMode gsVideoMode = GS_VideoMode::NTSC;
|
||||
|
||||
|
||||
void gsSetRegionMode( GS_RegionMode region )
|
||||
void gsSetVideoMode(GS_VideoMode mode )
|
||||
{
|
||||
if( gsRegionMode == region ) return;
|
||||
if( gsVideoMode == mode ) return;
|
||||
|
||||
gsRegionMode = region;
|
||||
gsVideoMode = mode;
|
||||
UpdateVSyncRate();
|
||||
}
|
||||
|
||||
|
@ -161,11 +161,11 @@ static void _gsSMODEwrite( u32 mem, u32 value )
|
|||
{
|
||||
case GS_SMODE1:
|
||||
if ( (value & 0x6000) == 0x6000 )
|
||||
gsSetRegionMode( Region_PAL );
|
||||
gsSetVideoMode( GS_VideoMode::PAL );
|
||||
else if (value & 0x400000 || value & 0x200000)
|
||||
gsSetRegionMode( Region_NTSC_PROGRESSIVE );
|
||||
gsSetVideoMode( GS_VideoMode::PROGRESSIVE );
|
||||
else
|
||||
gsSetRegionMode( Region_NTSC );
|
||||
gsSetVideoMode( GS_VideoMode::NTSC );
|
||||
break;
|
||||
|
||||
case GS_SMODE2:
|
||||
|
@ -436,5 +436,5 @@ void gsResetFrameSkip()
|
|||
void SaveStateBase::gsFreeze()
|
||||
{
|
||||
FreezeMem(PS2MEM_GS, 0x2000);
|
||||
Freeze(gsRegionMode);
|
||||
Freeze(gsVideoMode);
|
||||
}
|
||||
|
|
12
pcsx2/GS.h
12
pcsx2/GS.h
|
@ -217,14 +217,14 @@ struct GSRegSIGBLID
|
|||
#define GSIMR ((u32&)*(PS2MEM_GS+0x1010))
|
||||
#define GSSIGLBLID ((GSRegSIGBLID&)*(PS2MEM_GS+0x1080))
|
||||
|
||||
enum GS_RegionMode
|
||||
enum class GS_VideoMode : int
|
||||
{
|
||||
Region_NTSC,
|
||||
Region_PAL,
|
||||
Region_NTSC_PROGRESSIVE
|
||||
NTSC,
|
||||
PAL,
|
||||
PROGRESSIVE
|
||||
};
|
||||
|
||||
extern GS_RegionMode gsRegionMode;
|
||||
extern GS_VideoMode gsVideoMode;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// MTGS Threaded Class Declaration
|
||||
|
@ -363,7 +363,7 @@ extern s32 gsOpen();
|
|||
extern void gsClose();
|
||||
extern void gsReset();
|
||||
extern void gsOnModeChanged( Fixed100 framerate, u32 newTickrate );
|
||||
extern void gsSetRegionMode( GS_RegionMode isPal );
|
||||
extern void gsSetVideoMode( GS_VideoMode mode );
|
||||
extern void gsResetFrameSkip();
|
||||
extern void gsPostVsyncStart();
|
||||
extern void gsFrameSkip();
|
||||
|
|
|
@ -206,7 +206,7 @@ Pcsx2Config::GSOptions::GSOptions()
|
|||
DisableOutput = false;
|
||||
VsyncQueueSize = 2;
|
||||
|
||||
DefaultRegionMode = Region_NTSC;
|
||||
DefaultVideoMode = NTSC;
|
||||
FramesToDraw = 2;
|
||||
FramesToSkip = 2;
|
||||
|
||||
|
@ -233,7 +233,7 @@ void Pcsx2Config::GSOptions::LoadSave( IniInterface& ini )
|
|||
|
||||
// WARNING: array must be NULL terminated to compute it size
|
||||
static const wxChar * const ntsc_pal_str[3] = { L"ntsc", L"pal", NULL };
|
||||
ini.EnumEntry( L"DefaultRegionMode", DefaultRegionMode, ntsc_pal_str, DefaultRegionMode );
|
||||
ini.EnumEntry( L"DefaultRegionMode", DefaultVideoMode, ntsc_pal_str, DefaultVideoMode );
|
||||
|
||||
IniEntry( FramesToDraw );
|
||||
IniEntry( FramesToSkip );
|
||||
|
|
|
@ -591,8 +591,8 @@ void GSFrame::OnUpdateTitle( wxTimerEvent& evt )
|
|||
AppConfig::UiTemplateOptions& templates = g_Conf->Templates;
|
||||
|
||||
double fps = wxGetApp().FpsManager.GetFramerate();
|
||||
// The "not PAL" case covers both Region_NTSC and Region_NTSC_PROGRESSIVE
|
||||
float per = gsRegionMode == Region_PAL ? (fps * 100) / EmuConfig.GS.FrameratePAL.ToFloat() : (fps * 100) / EmuConfig.GS.FramerateNTSC.ToFloat();
|
||||
// The "not PAL" case covers both NTSC and Progressive
|
||||
float per = gsVideoMode == GS_VideoMode::PAL ? (fps * 100) / EmuConfig.GS.FrameratePAL.ToFloat() : (fps * 100) / EmuConfig.GS.FramerateNTSC.ToFloat();
|
||||
|
||||
char gsDest[128];
|
||||
gsDest[0] = 0; // No need to set whole array to NULL.
|
||||
|
|
Loading…
Reference in New Issue