VMManager: Fix toggling game fixes per-game (stuck enabled)

This commit is contained in:
Connor McLaughlin 2022-09-13 00:56:26 +10:00 committed by refractionpcsx2
parent f8d9e6eeb8
commit a020e985f2
3 changed files with 19 additions and 1 deletions

View File

@ -1025,6 +1025,9 @@ struct Pcsx2Config
// You shouldn't assign to this class, because it'll mess with the runtime variables (Current...).
// But you can still use this to copy config. Only needed until we drop wx.
void CopyConfig(const Pcsx2Config& cfg);
/// Copies runtime configuration settings (e.g. frame limiter state).
void CopyRuntimeConfig(Pcsx2Config& cfg);
};
extern Pcsx2Config EmuConfig;

View File

@ -1238,6 +1238,17 @@ void Pcsx2Config::CopyConfig(const Pcsx2Config& cfg)
LimiterMode = cfg.LimiterMode;
}
void Pcsx2Config::CopyRuntimeConfig(Pcsx2Config& cfg)
{
GS.LimitScalar = cfg.GS.LimitScalar;
UseBOOT2Injection = cfg.UseBOOT2Injection;
CurrentBlockdump = std::move(cfg.CurrentBlockdump);
CurrentIRX = std::move(cfg.CurrentIRX);
CurrentGameArgs = std::move(cfg.CurrentGameArgs);
CurrentAspectRatio = cfg.CurrentAspectRatio;
LimiterMode = cfg.LimiterMode;
}
void EmuFolders::SetDefaults(SettingsInterface& si)
{
si.SetStringValue("Folders", "Bios", "bios");

View File

@ -1673,7 +1673,11 @@ void VMManager::ApplySettings()
GetMTGS().WaitGS(false);
}
const Pcsx2Config old_config(EmuConfig);
// Reset to a clean Pcsx2Config. Otherwise things which are optional (e.g. gamefixes)
// do not use the correct default values when loading.
Pcsx2Config old_config(std::move(EmuConfig));
EmuConfig = Pcsx2Config();
EmuConfig.CopyRuntimeConfig(old_config);
LoadSettings();
CheckForConfigChanges(old_config);
}