config: normalize limiter values before saving

This commit is contained in:
kojin 2021-09-09 12:23:30 -04:00 committed by Kojin
parent ab64023e56
commit 43e3055d11
4 changed files with 17 additions and 16 deletions

View File

@ -51,13 +51,13 @@ void gsUpdateFrequency(Pcsx2Config& config)
switch (g_LimiterMode)
{
case LimiterModeType::Limit_Nominal:
config.GS.LimitScalar = g_Conf->Framerate.NominalScalar / 100.0;
config.GS.LimitScalar = g_Conf->Framerate.NominalScalar;
break;
case LimiterModeType::Limit_Slomo:
config.GS.LimitScalar = g_Conf->Framerate.SlomoScalar / 100.0;
config.GS.LimitScalar = g_Conf->Framerate.SlomoScalar;
break;
case LimiterModeType::Limit_Turbo:
config.GS.LimitScalar = g_Conf->Framerate.TurboScalar / 100.0;
config.GS.LimitScalar = g_Conf->Framerate.TurboScalar;
break;
default:
pxAssert("Unknown framelimiter mode!");

View File

@ -865,9 +865,9 @@ void AppConfig::FramerateOptions::SanityCheck()
{
// Ensure Conformation of various options...
NominalScalar = std::clamp(NominalScalar, 5.0, 1000.0);
TurboScalar = std::clamp(TurboScalar, 5.0, 1000.0);
SlomoScalar = std::clamp(SlomoScalar, 5.0, 1000.0);
NominalScalar = std::clamp(NominalScalar, 0.05, 10.0);
TurboScalar = std::clamp(TurboScalar, 0.05, 10.0);
SlomoScalar = std::clamp(SlomoScalar, 0.05, 10.0);
}
void AppConfig::FramerateOptions::LoadSave( IniInterface& ini )

View File

@ -239,9 +239,9 @@ public:
bool SkipOnLimit{ false };
bool SkipOnTurbo{ false };
double NominalScalar{ 100.0 };
double TurboScalar{ 200.0 };
double SlomoScalar{ 50.0 };
double NominalScalar{ 1.0 };
double TurboScalar{ 2.0 };
double SlomoScalar{ 0.5 };
void LoadSave( IniInterface& conf );
void SanityCheck();

View File

@ -111,12 +111,13 @@ void Panels::FramelimiterPanel::ApplyConfigToGui( AppConfig& configToApply, int
const AppConfig::FramerateOptions& appfps( configToApply.Framerate );
const Pcsx2Config::GSOptions& gsconf( configToApply.EmuOptions.GS );
if( ! (flags & AppConfig::APPLY_FLAG_FROM_PRESET) ){ //Presets don't control these: only change if config doesn't come from preset.
if( ! (flags & AppConfig::APPLY_FLAG_FROM_PRESET) )
{ //Presets don't control these: only change if config doesn't come from preset.
m_check_LimiterDisable->SetValue(!gsconf.FrameLimitEnable);
m_spin_TurboPct->SetValue(appfps.TurboScalar);
m_spin_SlomoPct->SetValue(appfps.SlomoScalar);
m_spin_TurboPct->SetValue(appfps.TurboScalar * 100.0);
m_spin_SlomoPct->SetValue(appfps.SlomoScalar * 100.0);
m_spin_TurboPct->Enable(true);
m_spin_SlomoPct->Enable(true);
@ -125,7 +126,7 @@ void Panels::FramelimiterPanel::ApplyConfigToGui( AppConfig& configToApply, int
m_text_BaseNtsc->ChangeValue(wxString::FromDouble(gsconf.FramerateNTSC, 2));
m_text_BasePal->ChangeValue(wxString::FromDouble(gsconf.FrameratePAL, 2));
m_spin_NominalPct->SetValue(appfps.NominalScalar);
m_spin_NominalPct->SetValue(appfps.NominalScalar * 100.0);
m_spin_NominalPct->Enable(!configToApply.EnablePresets);
m_text_BaseNtsc->Enable(!configToApply.EnablePresets);
@ -139,9 +140,9 @@ void Panels::FramelimiterPanel::Apply()
gsconf.FrameLimitEnable = !m_check_LimiterDisable->GetValue();
appfps.NominalScalar = m_spin_NominalPct->GetValue();
appfps.TurboScalar = m_spin_TurboPct->GetValue();
appfps.SlomoScalar = m_spin_SlomoPct->GetValue();
appfps.NominalScalar = static_cast<double>(m_spin_NominalPct->GetValue()) / 100.0;
appfps.TurboScalar = static_cast<double>(m_spin_TurboPct->GetValue()) / 100.0;
appfps.SlomoScalar = static_cast<double>(m_spin_SlomoPct->GetValue()) / 100.0;
wxString ntsc_framerate_string = m_text_BaseNtsc->GetValue();
wxString pal_framerate_string = m_text_BasePal->GetValue();