From 43e3055d11181cf1bc2efc7380406604550d3781 Mon Sep 17 00:00:00 2001 From: kojin Date: Thu, 9 Sep 2021 12:23:30 -0400 Subject: [PATCH] config: normalize limiter values before saving --- pcsx2/GS.cpp | 6 +++--- pcsx2/gui/AppConfig.cpp | 6 +++--- pcsx2/gui/AppConfig.h | 6 +++--- pcsx2/gui/Panels/VideoPanel.cpp | 15 ++++++++------- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/pcsx2/GS.cpp b/pcsx2/GS.cpp index 0035e0139c..49fae78e9d 100644 --- a/pcsx2/GS.cpp +++ b/pcsx2/GS.cpp @@ -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!"); diff --git a/pcsx2/gui/AppConfig.cpp b/pcsx2/gui/AppConfig.cpp index 0e2fb87812..f762dc0043 100644 --- a/pcsx2/gui/AppConfig.cpp +++ b/pcsx2/gui/AppConfig.cpp @@ -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 ) diff --git a/pcsx2/gui/AppConfig.h b/pcsx2/gui/AppConfig.h index bcf17b09c2..b9aedf41fe 100644 --- a/pcsx2/gui/AppConfig.h +++ b/pcsx2/gui/AppConfig.h @@ -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(); diff --git a/pcsx2/gui/Panels/VideoPanel.cpp b/pcsx2/gui/Panels/VideoPanel.cpp index 289095724c..a3be0bcee8 100644 --- a/pcsx2/gui/Panels/VideoPanel.cpp +++ b/pcsx2/gui/Panels/VideoPanel.cpp @@ -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(m_spin_NominalPct->GetValue()) / 100.0; + appfps.TurboScalar = static_cast(m_spin_TurboPct->GetValue()) / 100.0; + appfps.SlomoScalar = static_cast(m_spin_SlomoPct->GetValue()) / 100.0; wxString ntsc_framerate_string = m_text_BaseNtsc->GetValue(); wxString pal_framerate_string = m_text_BasePal->GetValue();