From a585a27d1e69429c9f3091d30f7c1b9a85ad4591 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 3 Oct 2021 13:11:28 +1100 Subject: [PATCH] Wx: Fix regressions from settings decouple Wx: Fix GS hotkeys losing values after reboot Wx: Fix trace log hotkey losing value after reboot WxSettingsInterface: Fix uint value loads Wx: Fix presets resetting GS window settings Common/SettingsWrapper: Fix SettingsWrapBitfield --- common/SettingsWrapper.h | 2 +- pcsx2/gui/AppConfig.cpp | 9 +++++---- pcsx2/gui/GlobalCommands.cpp | 14 ++++++++++++-- pcsx2/gui/wxSettingsInterface.cpp | 3 ++- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/common/SettingsWrapper.h b/common/SettingsWrapper.h index 9dcb5ba70b..55e6954e47 100644 --- a/common/SettingsWrapper.h +++ b/common/SettingsWrapper.h @@ -103,7 +103,7 @@ protected: #define SettingsWrapSection(section) const char* CURRENT_SETTINGS_SECTION = section; #define SettingsWrapEntry(var) wrap.Entry(CURRENT_SETTINGS_SECTION, #var, var, var) -#define SettingsWrapBitfield(var) wrap.EntryBitfield(CURRENT_SETTINGS_SECTION, #var, var, var) +#define SettingsWrapBitfield(varname) varname = wrap.EntryBitfield(CURRENT_SETTINGS_SECTION, #varname, varname, varname) #define SettingsWrapBitBool(varname) varname = wrap.EntryBitBool(CURRENT_SETTINGS_SECTION, #varname, !!varname, varname) #define SettingsWrapBitfieldEx(varname, textname) varname = wrap.EntryBitfield(CURRENT_SETTINGS_SECTION, textname, varname, varname) #define SettingsWrapBitBoolEx(varname, textname) varname = wrap.EntryBitBool(CURRENT_SETTINGS_SECTION, textname, !!varname, varname) diff --git a/pcsx2/gui/AppConfig.cpp b/pcsx2/gui/AppConfig.cpp index b5bf809de6..023c29c04d 100644 --- a/pcsx2/gui/AppConfig.cpp +++ b/pcsx2/gui/AppConfig.cpp @@ -912,10 +912,11 @@ bool AppConfig::IsOkApplyPreset(int n, bool ignoreMTVU) EnableGameFixes = false; EmuOptions.EnablePatches = true; - EmuOptions.GS = default_Pcsx2Config.GS; - EmuOptions.GS.FrameLimitEnable = original_GS.FrameLimitEnable; //Frame limiter is not modified by presets - EmuOptions.GS.VsyncEnable = original_GS.VsyncEnable; - EmuOptions.GS.VsyncQueueSize = original_GS.VsyncQueueSize; + + EmuOptions.GS.SynchronousMTGS = default_Pcsx2Config.GS.SynchronousMTGS; + EmuOptions.GS.FrameSkipEnable = default_Pcsx2Config.GS.FrameSkipEnable; + EmuOptions.GS.FramesToDraw = default_Pcsx2Config.GS.FramesToDraw; + EmuOptions.GS.FramesToSkip = default_Pcsx2Config.GS.FramesToSkip; EmuOptions.Cpu = default_Pcsx2Config.Cpu; EmuOptions.Gamefixes = default_Pcsx2Config.Gamefixes; diff --git a/pcsx2/gui/GlobalCommands.cpp b/pcsx2/gui/GlobalCommands.cpp index fb0c7fc744..b4f0f97f56 100644 --- a/pcsx2/gui/GlobalCommands.cpp +++ b/pcsx2/gui/GlobalCommands.cpp @@ -192,6 +192,10 @@ namespace Implementations break; } + // Sync the mode with the settings. This is kinda silly, since they won't be + // saved until shutdown, but it matches the behavior pre-settings-move. + g_Conf->EmuOptions.GS.AspectRatio = art; + OSDlog(Color_StrongBlue, true, "(GSwindow) Aspect ratio: %s", arts); } @@ -199,6 +203,8 @@ namespace Implementations { EmuConfig.GS.OffsetX = x; EmuConfig.GS.OffsetY = y; + g_Conf->EmuOptions.GS.OffsetX = x; + g_Conf->EmuOptions.GS.OffsetY = y; OSDlog(Color_StrongBlue, true, "(GSwindow) Offset: x=%f, y=%f", x, y); } @@ -232,6 +238,7 @@ namespace Implementations if (zoom <= 0) return; EmuConfig.GS.StretchY = zoom; + g_Conf->EmuOptions.GS.StretchY = zoom; OSDlog(Color_StrongBlue, true, "(GSwindow) Vertical stretch: %f", zoom); } @@ -253,6 +260,7 @@ namespace Implementations if (zoom < 0) return; EmuConfig.GS.Zoom = zoom; + g_Conf->EmuOptions.GS.Zoom = zoom; if (zoom == 0) OSDlog(Color_StrongBlue, true, "(GSwindow) Zoom: 0 (auto, no black bars)"); @@ -401,8 +409,10 @@ namespace Implementations // FIXME: Some of the trace logs will require recompiler resets to be activated properly. #ifdef PCSX2_DEVBUILD - EmuConfig.Trace.Enabled = !EmuConfig.Trace.Enabled; - Console.WriteLn(EmuConfig.Trace.Enabled ? "Logging Enabled." : "Logging Disabled."); + // This is touching the CPU thread's settings, it really shouldn't be, but it'll desync with the UI if we don't. + g_Conf->EmuOptions.Trace.Enabled = !g_Conf->EmuOptions.Trace.Enabled; + EmuConfig.Trace.Enabled = g_Conf->EmuOptions.Trace.Enabled; + Console.WriteLn(g_Conf->EmuOptions.Trace.Enabled ? "Logging Enabled." : "Logging Disabled."); #endif } diff --git a/pcsx2/gui/wxSettingsInterface.cpp b/pcsx2/gui/wxSettingsInterface.cpp index 2283eeb2ef..934bbb036b 100644 --- a/pcsx2/gui/wxSettingsInterface.cpp +++ b/pcsx2/gui/wxSettingsInterface.cpp @@ -64,7 +64,8 @@ bool wxSettingsInterface::GetUIntValue(const char* section, const char* key, uin if (!m_config->Read(key, &lvalue)) return false; - return static_cast(lvalue); + *value = static_cast(lvalue); + return true; } bool wxSettingsInterface::GetFloatValue(const char* section, const char* key, float* value) const