示例#1
0
void IniSaver::Entry( const wxString& var, Fixed100& value, const Fixed100 defvalue )
{
	if( !m_Config ) return;

	// Note: the "easy" way would be to convert to double and load/save that, but floating point
	// has way too much rounding error so we really need to do things out manually, using strings.

	m_Config->Write( var, value.ToString() );
}
示例#2
0
void IniLoader::Entry( const wxString& var, Fixed100& value, const Fixed100 defvalue )
{
	// Note: the "easy" way would be to convert to double and load/save that, but floating point
	// has way too much rounding error so we really need to do things out manually.. >_<

	wxString readval( value.ToString() );
	if( m_Config ) m_Config->Read( var, &readval );
	value = Fixed100::FromString( readval, value );
}
示例#3
0
u32 UpdateVSyncRate()
{
	// Notice:  (and I probably repeat this elsewhere, but it's worth repeating)
	//  The PS2's vsync timer is an *independent* crystal that is fixed to either 59.94 (NTSC)
	//  or 50.0 (PAL) Hz.  It has *nothing* to do with real TV timings or the real vsync of
	//  the GS's output circuit.  It is the same regardless if the GS is outputting interlace
	//  or progressive scan content. 

	Fixed100	framerate;
	u32			scanlines;
	bool		isCustom;

	if( gsRegionMode == Region_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 )
	{
		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 )
	{
		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" : 
			( gsRegionMode == Region_NTSC ) ? "NTSC" : "Progressive Scan" );
		
		if( isCustom )
			Console.Indent().WriteLn( Color_StrongGreen, "... with user configured refresh rate: %.02f Hz", framerate.ToFloat() );

		hsyncCounter.CycleT = vSyncInfo.hRender;	// Amount of cycles before the counter will be updated
		vsyncCounter.CycleT = vSyncInfo.Render;		// Amount of cycles before the counter will be updated

		cpuRcntSet();
	}

	Fixed100 fpslimit = framerate *
		( pxAssert( EmuConfig.GS.LimitScalar > 0 ) ? EmuConfig.GS.LimitScalar : 1.0 );

	//s64 debugme = GetTickFrequency() / 3000;
	s64	ticks = (GetTickFrequency()*500) / (fpslimit * 1000).ToIntRounded();

	if( m_iTicks != ticks )
	{
		m_iTicks = ticks;
		gsOnModeChanged( vSyncInfo.Framerate, m_iTicks );
		Console.WriteLn( Color_Green, "(UpdateVSyncRate) FPS Limit Changed : %.02f fps", fpslimit.ToFloat()*2 );
	}

	m_iStart = GetCPUTicks();

	return (u32)m_iTicks;
}
示例#4
0
u32 UpdateVSyncRate()
{
	// Notice:  (and I probably repeat this elsewhere, but it's worth repeating)
	//  The PS2's vsync timer is an *independent* crystal that is fixed to either 59.94 (NTSC)
	//  or 50.0 (PAL) Hz.  It has *nothing* to do with real TV timings or the real vsync of
	//  the GS's output circuit.  It is the same regardless if the GS is outputting interlace
	//  or progressive scan content. 

	Fixed100	framerate = GetVerticalFrequency() / 2;
	u32			scanlines = 0;
	bool		isCustom  = false;

	//Set up scanlines and framerate based on video mode
	switch (gsVideoMode)
	{
	case GS_VideoMode::Uninitialized: // SYSCALL instruction hasn't executed yet, give some temporary values.
		scanlines = SCANLINES_TOTAL_NTSC;
		break;

	case GS_VideoMode::PAL:
	case GS_VideoMode::DVD_PAL:
		isCustom = (EmuConfig.GS.FrameratePAL != 50.0);
		scanlines = SCANLINES_TOTAL_PAL;
		if (!gsIsInterlaced) scanlines += 3;
		break;

	case GS_VideoMode::NTSC:
	case GS_VideoMode::DVD_NTSC:
		isCustom = (EmuConfig.GS.FramerateNTSC != 59.94);
		scanlines = SCANLINES_TOTAL_NTSC;
		if (!gsIsInterlaced) scanlines += 1;
		break;

	case GS_VideoMode::SDTV_480P:
	case GS_VideoMode::SDTV_576P:
	case GS_VideoMode::HDTV_1080P:
	case GS_VideoMode::HDTV_1080I:
	case GS_VideoMode::HDTV_720P:
	case GS_VideoMode::VESA:
		scanlines = SCANLINES_TOTAL_NTSC;
		break;

	case GS_VideoMode::Unknown:
	default:
		// Falls through to default when unidentified mode parameter of SetGsCrt is detected.
		// For Release builds, keep using the NTSC timing values when unknown video mode is detected.
		// Assert will be triggered for debug/dev builds.
		scanlines = SCANLINES_TOTAL_NTSC;
		Console.Error("PCSX2-Counters: Unknown video mode detected");
		pxAssertDev(false , "Unknown video mode detected via SetGsCrt");
	}

	bool ActiveVideoMode = gsVideoMode != GS_VideoMode::Uninitialized;
	if (vSyncInfo.Framerate != framerate || vSyncInfo.VideoMode != gsVideoMode)
	{
		vSyncInfo.VideoMode = gsVideoMode;
		vSyncInfoCalc( &vSyncInfo, framerate, scanlines );
		if(ActiveVideoMode)
			Console.WriteLn( Color_Green, "(UpdateVSyncRate) Mode Changed to %s.", ReportVideoMode());
		
		if( isCustom && ActiveVideoMode)
			Console.Indent().WriteLn( Color_StrongGreen, "... with user configured refresh rate: %.02f Hz", 2 * framerate.ToFloat() );

		hsyncCounter.CycleT = vSyncInfo.hRender;	// Amount of cycles before the counter will be updated
		vsyncCounter.CycleT = vSyncInfo.Render;		// Amount of cycles before the counter will be updated

		cpuRcntSet();
	}

	Fixed100 fpslimit = framerate *
		( pxAssert( EmuConfig.GS.LimitScalar > 0 ) ? EmuConfig.GS.LimitScalar : 1.0 );

	//s64 debugme = GetTickFrequency() / 3000;
	s64	ticks = (GetTickFrequency()*500) / (fpslimit * 1000).ToIntRounded();

	if( m_iTicks != ticks )
	{
		m_iTicks = ticks;
		gsOnModeChanged( vSyncInfo.Framerate, m_iTicks );
		if (ActiveVideoMode)
			Console.WriteLn( Color_Green, "(UpdateVSyncRate) FPS Limit Changed : %.02f fps", fpslimit.ToFloat()*2 );
	}

	m_iStart = GetCPUTicks();

	return (u32)m_iTicks;
}