From 59fa831542de74a48d1ac612eb422a91434e6fa2 Mon Sep 17 00:00:00 2001 From: Akash Date: Mon, 17 Jul 2017 21:41:17 +0530 Subject: [PATCH] PCSX2-Counters: Fix tracking of scalar limit The scalar limit value was updated only during any turbo/slowmotion toggle, let's also update it properly after any change in the emulation settings. This prevents the need of toggling from turbo/slowmotion to update to your requested frame rate percentage. --- pcsx2/GS.cpp | 20 ++++++++++++++++++++ pcsx2/GS.h | 1 + pcsx2/gui/AppCoreThread.cpp | 8 +++++--- pcsx2/gui/GlobalCommands.cpp | 7 ++----- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/pcsx2/GS.cpp b/pcsx2/GS.cpp index 6938d6be72..235f2c6891 100644 --- a/pcsx2/GS.cpp +++ b/pcsx2/GS.cpp @@ -21,6 +21,7 @@ #include "GS.h" #include "Gif_Unit.h" #include "Counters.h" +#include "GSFrame.h" using namespace Threading; using namespace R5900; @@ -55,6 +56,25 @@ void gsReset() GSIMR.reset(); } +void gsUpdateFrequency(Pcsx2Config& config) +{ + switch (g_LimiterMode) + { + case LimiterModeType::Limit_Nominal: + config.GS.LimitScalar = g_Conf->Framerate.NominalScalar; + break; + case LimiterModeType::Limit_Slomo: + config.GS.LimitScalar = g_Conf->Framerate.SlomoScalar; + break; + case LimiterModeType::Limit_Turbo: + config.GS.LimitScalar = g_Conf->Framerate.TurboScalar; + break; + default: + pxAssert("Unknown framelimiter mode!"); + } + UpdateVSyncRate(); +} + static __fi void gsCSRwrite( const tGS_CSR& csr ) { if (csr.RESET) { diff --git a/pcsx2/GS.h b/pcsx2/GS.h index 4ef84f9901..326fe21941 100644 --- a/pcsx2/GS.h +++ b/pcsx2/GS.h @@ -414,6 +414,7 @@ extern void gsSetVideoMode( GS_VideoMode mode ); extern void gsResetFrameSkip(); extern void gsPostVsyncStart(); extern void gsFrameSkip(); +extern void gsUpdateFrequency( Pcsx2Config& config ); // Some functions shared by both the GS and MTGS extern void _gs_ResetFrameskip(); diff --git a/pcsx2/gui/AppCoreThread.cpp b/pcsx2/gui/AppCoreThread.cpp index e6c538d0b8..c448850284 100644 --- a/pcsx2/gui/AppCoreThread.cpp +++ b/pcsx2/gui/AppCoreThread.cpp @@ -458,13 +458,15 @@ static void _ApplySettings( const Pcsx2Config& src, Pcsx2Config& fixup ) } } + // When we're booting, the bios loader will set a a title which would be more interesting than this + // to most users - with region, version, etc, so don't overwrite it with patch info. That's OK. Those + // users which want to know the status of the patches at the bios can check the console content. wxString consoleTitle = gameName + gameSerial; consoleTitle += L" [" + gameCRC.MakeUpper() + L"]" + gameCompat + gameFixes + gamePatch + gameCheats + gameWsHacks; if (ingame) Console.SetTitle(consoleTitle); - // When we're booting, the bios loader will set a a title which would be more interesting than this - // to most users - with region, version, etc, so don't overwrite it with patch info. That's OK. Those - // users which want to know the status of the patches at the bios can check the console content. + + gsUpdateFrequency(fixup); } // FIXME: This function is not for general consumption. Its only consumer (and diff --git a/pcsx2/gui/GlobalCommands.cpp b/pcsx2/gui/GlobalCommands.cpp index 02dae99253..3800b74fa6 100644 --- a/pcsx2/gui/GlobalCommands.cpp +++ b/pcsx2/gui/GlobalCommands.cpp @@ -86,7 +86,6 @@ namespace Implementations { g_Conf->EmuOptions.GS.FrameLimitEnable = true; g_LimiterMode = Limit_Turbo; - g_Conf->EmuOptions.GS.LimitScalar = g_Conf->Framerate.TurboScalar; OSDlog( Color_StrongRed, true, "(FrameLimiter) Turbo + FrameLimit ENABLED." ); g_Conf->EmuOptions.GS.FrameSkipEnable = !!g_Conf->Framerate.SkipOnTurbo; } @@ -94,7 +93,6 @@ namespace Implementations { GSsetVsync( g_Conf->EmuOptions.GS.VsyncEnable ); g_LimiterMode = Limit_Nominal; - g_Conf->EmuOptions.GS.LimitScalar = g_Conf->Framerate.NominalScalar; if ( g_Conf->Framerate.SkipOnLimit) { @@ -111,7 +109,6 @@ namespace Implementations { GSsetVsync( false ); g_LimiterMode = Limit_Turbo; - g_Conf->EmuOptions.GS.LimitScalar = g_Conf->Framerate.TurboScalar; if ( g_Conf->Framerate.SkipOnTurbo) { @@ -124,6 +121,7 @@ namespace Implementations g_Conf->EmuOptions.GS.FrameSkipEnable = false; } } + gsUpdateFrequency(g_Conf->EmuOptions); pauser.AllowResume(); } @@ -140,16 +138,15 @@ namespace Implementations if( g_LimiterMode == Limit_Slomo ) { g_LimiterMode = Limit_Nominal; - g_Conf->EmuOptions.GS.LimitScalar = g_Conf->Framerate.NominalScalar; OSDlog( Color_StrongRed, true, "(FrameLimiter) SlowMotion DISABLED." ); } else { g_LimiterMode = Limit_Slomo; - g_Conf->EmuOptions.GS.LimitScalar = g_Conf->Framerate.SlomoScalar; OSDlog( Color_StrongRed, true, "(FrameLimiter) SlowMotion ENABLED." ); g_Conf->EmuOptions.GS.FrameLimitEnable = true; } + gsUpdateFrequency(g_Conf->EmuOptions); pauser.AllowResume(); }