From 8160e142e154829c94a7acb8fe026672be6f5908 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Tue, 14 Jul 2020 01:02:10 -0400 Subject: main: Set async gpu properly after loading per-game setting Another error that got pass me and only noticed when I was doing the per-game settings UI rework. This prevents asynchronous GPU emulation from being disabled while multi core is enabled as a result of a poorly put together per-game config. --- src/yuzu/main.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 432379705..8f889be3a 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1053,6 +1053,10 @@ void GMainWindow::BootGame(const QString& filename) { if (!(loader == nullptr || loader->ReadProgramId(title_id) != Loader::ResultStatus::Success)) { // Load per game settings Config per_game_config(fmt::format("{:016X}.ini", title_id), false); + + Settings::values.use_asynchronous_gpu_emulation.SetValue( + Settings::values.use_asynchronous_gpu_emulation.GetValue() || + Settings::values.use_multi_core.GetValue()); } Settings::LogSettings(); -- cgit v1.2.3 From 6d1477f214199d8a59b8ab0eea161e16463e35bb Mon Sep 17 00:00:00 2001 From: lat9nq Date: Tue, 14 Jul 2020 13:36:09 -0400 Subject: settings: Move settings sanitization to its own function Creates a new function that can be expanded later to fix other settings that are known to cause emulation errors across executables. --- src/core/settings.cpp | 6 ++++++ src/core/settings.h | 3 +++ src/yuzu/configuration/config.cpp | 2 ++ src/yuzu/main.cpp | 4 ---- 4 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/core/settings.cpp b/src/core/settings.cpp index d3886c4ec..38f0789a0 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -184,4 +184,10 @@ void RestoreGlobalState() { values.sound_index.SetGlobal(true); } +void Sanitize() { + values.use_asynchronous_gpu_emulation.SetValue( + values.use_asynchronous_gpu_emulation.GetValue() || + values.use_multi_core.GetValue()); +} + } // namespace Settings diff --git a/src/core/settings.h b/src/core/settings.h index 850ca4072..878840116 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -539,4 +539,7 @@ void LogSettings(); // Restore the global state of all applicable settings in the Values struct void RestoreGlobalState(); +// Fixes settings that are known to cause issues with the emulator +void Sanitize(); + } // namespace Settings diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 1b2b1b2bb..e586792bb 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -1342,11 +1342,13 @@ void Config::WriteSettingGlobal(const QString& name, const QVariant& value, bool void Config::Reload() { ReadValues(); + Settings::Sanitize(); // To apply default value changes SaveValues(); Settings::Apply(); } void Config::Save() { + Settings::Sanitize(); SaveValues(); } diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 8f889be3a..432379705 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1053,10 +1053,6 @@ void GMainWindow::BootGame(const QString& filename) { if (!(loader == nullptr || loader->ReadProgramId(title_id) != Loader::ResultStatus::Success)) { // Load per game settings Config per_game_config(fmt::format("{:016X}.ini", title_id), false); - - Settings::values.use_asynchronous_gpu_emulation.SetValue( - Settings::values.use_asynchronous_gpu_emulation.GetValue() || - Settings::values.use_multi_core.GetValue()); } Settings::LogSettings(); -- cgit v1.2.3 From a683e42516a70e7ff6691662556ba56d25b4189c Mon Sep 17 00:00:00 2001 From: lat9nq Date: Tue, 14 Jul 2020 13:46:42 -0400 Subject: clang-format --- src/core/settings.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/core/settings.cpp b/src/core/settings.cpp index 38f0789a0..64a3c69d3 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -186,8 +186,7 @@ void RestoreGlobalState() { void Sanitize() { values.use_asynchronous_gpu_emulation.SetValue( - values.use_asynchronous_gpu_emulation.GetValue() || - values.use_multi_core.GetValue()); + values.use_asynchronous_gpu_emulation.GetValue() || values.use_multi_core.GetValue()); } } // namespace Settings -- cgit v1.2.3