core: add a getter for the vsync option

v2: allow all combinations of framelimiter and vsync options
v3:
* disable vsync when the user disable framelimiter with F4
* Use g_Conf->EmuOptions instead of EmuConfig
This commit is contained in:
Gregory Hainaut 2017-07-14 15:10:46 +02:00
parent 17d2d9217b
commit e8636136c8
5 changed files with 32 additions and 8 deletions

View File

@ -305,6 +305,8 @@ struct Pcsx2Config
GSOptions();
void LoadSave( IniInterface& conf );
int GetVsync() const;
bool operator ==( const GSOptions& right ) const
{
return

View File

@ -203,7 +203,7 @@ void SysMtgsThread::OpenPlugin()
result = GSopen( (void*)pDsp, "PCSX2", renderswitch ? 2 : 1 );
GSsetVsync(EmuConfig.GS.FrameLimitEnable && EmuConfig.GS.VsyncEnable);
GSsetVsync(EmuConfig.GS.GetVsync());
if( result != 0 )
{

View File

@ -20,6 +20,7 @@
#include "Utilities/IniInterface.h"
#include "Config.h"
#include "GS.h"
#include "gui/GSFrame.h"
void TraceLogFilters::LoadSave( IniInterface& ini )
{
@ -234,6 +235,14 @@ void Pcsx2Config::GSOptions::LoadSave( IniInterface& ini )
IniEntry( FramesToSkip );
}
int Pcsx2Config::GSOptions::GetVsync() const
{
if (g_LimiterMode == Limit_Turbo)
return 0;
return VsyncEnable;
}
const wxChar *const tbl_GamefixNames[] =
{
L"VuAddSub",

View File

@ -359,9 +359,8 @@ bool AppCorePlugins::OpenPlugin_GS()
bool retval = _parent::OpenPlugin_GS();
if( g_LimiterMode == Limit_Turbo )
GSsetVsync( false );
GSsetVsync(EmuConfig.GS.GetVsync());
return retval;
}

View File

@ -91,7 +91,6 @@ namespace Implementations
}
else if( g_LimiterMode == Limit_Turbo )
{
GSsetVsync( g_Conf->EmuOptions.GS.VsyncEnable );
g_LimiterMode = Limit_Nominal;
if ( g_Conf->Framerate.SkipOnLimit)
@ -107,7 +106,6 @@ namespace Implementations
}
else
{
GSsetVsync( false );
g_LimiterMode = Limit_Turbo;
if ( g_Conf->Framerate.SkipOnTurbo)
@ -121,7 +119,11 @@ namespace Implementations
g_Conf->EmuOptions.GS.FrameSkipEnable = false;
}
}
gsUpdateFrequency(g_Conf->EmuOptions);
GSsetVsync(g_Conf->EmuOptions.GS.GetVsync());
pauser.AllowResume();
}
@ -134,7 +136,6 @@ namespace Implementations
// out a better consistency approach... -air
ScopedCoreThreadPause pauser;
GSsetVsync( g_Conf->EmuOptions.GS.VsyncEnable );
if( g_LimiterMode == Limit_Slomo )
{
g_LimiterMode = Limit_Nominal;
@ -146,7 +147,11 @@ namespace Implementations
OSDlog( Color_StrongRed, true, "(FrameLimiter) SlowMotion ENABLED." );
g_Conf->EmuOptions.GS.FrameLimitEnable = true;
}
gsUpdateFrequency(g_Conf->EmuOptions);
GSsetVsync(g_Conf->EmuOptions.GS.GetVsync());
pauser.AllowResume();
}
@ -154,8 +159,17 @@ namespace Implementations
{
ScopedCoreThreadPause pauser;
g_Conf->EmuOptions.GS.FrameLimitEnable = !g_Conf->EmuOptions.GS.FrameLimitEnable;
GSsetVsync( g_Conf->EmuOptions.GS.FrameLimitEnable && g_Conf->EmuOptions.GS.VsyncEnable );
OSDlog( Color_StrongRed, true, "(FrameLimiter) %s.", g_Conf->EmuOptions.GS.FrameLimitEnable ? "ENABLED" : "DISABLED" );
// Turbo/Slowmo don't make sense when framelimiter is toggled
g_LimiterMode = Limit_Nominal;
// Disable Vsync when frame limited is disabled
if( g_Conf->EmuOptions.GS.FrameLimitEnable )
GSsetVsync(g_Conf->EmuOptions.GS.GetVsync());
else
GSsetVsync(0);
pauser.AllowResume();
}