From 29f1b82f5e4662662dce1a51e111483e6431d359 Mon Sep 17 00:00:00 2001 From: LillyJadeKatrin Date: Thu, 20 Jun 2024 07:59:59 -0400 Subject: [PATCH] Decouple Hardcore from EmulationStateChanged Rerendering the entire Achievements dialog every EmulationStateChanged signal is far too often when it turns out that signal fires multiple times to confirm game close, for example. This change results in only the settings changing on EmulationStateChanged, and having the Hardcore mode toggle (which DOES require redrawing the entire dialog) emit its own signal alongside EmulationStateChanged. --- .../Core/DolphinQt/Achievements/AchievementSettingsWidget.cpp | 4 ++++ Source/Core/DolphinQt/Achievements/AchievementsWindow.cpp | 2 ++ Source/Core/DolphinQt/Settings.h | 1 + 3 files changed, 7 insertions(+) diff --git a/Source/Core/DolphinQt/Achievements/AchievementSettingsWidget.cpp b/Source/Core/DolphinQt/Achievements/AchievementSettingsWidget.cpp index 5b8a07d24f..fe83fe9146 100644 --- a/Source/Core/DolphinQt/Achievements/AchievementSettingsWidget.cpp +++ b/Source/Core/DolphinQt/Achievements/AchievementSettingsWidget.cpp @@ -237,7 +237,10 @@ void AchievementSettingsWidget::ToggleRAIntegration() else instance.Shutdown(); if (Config::Get(Config::RA_HARDCORE_ENABLED)) + { emit Settings::Instance().EmulationStateChanged(Core::GetState(Core::System::GetInstance())); + emit Settings::Instance().HardcoreStateChanged(); + } } void AchievementSettingsWidget::Login() @@ -267,6 +270,7 @@ void AchievementSettingsWidget::ToggleHardcore() Settings::Instance().SetDebugModeEnabled(false); } emit Settings::Instance().EmulationStateChanged(Core::GetState(Core::System::GetInstance())); + emit Settings::Instance().HardcoreStateChanged(); } void AchievementSettingsWidget::ToggleUnofficial() diff --git a/Source/Core/DolphinQt/Achievements/AchievementsWindow.cpp b/Source/Core/DolphinQt/Achievements/AchievementsWindow.cpp index b796b9dc3e..a0e750c4ba 100644 --- a/Source/Core/DolphinQt/Achievements/AchievementsWindow.cpp +++ b/Source/Core/DolphinQt/Achievements/AchievementsWindow.cpp @@ -34,6 +34,8 @@ AchievementsWindow::AchievementsWindow(QWidget* parent) : QDialog(parent) }); }); connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, + [this] { m_settings_widget->UpdateData(); }); + connect(&Settings::Instance(), &Settings::HardcoreStateChanged, this, [this] { AchievementsWindow::UpdateData({.all = true}); }); } diff --git a/Source/Core/DolphinQt/Settings.h b/Source/Core/DolphinQt/Settings.h index 479d723e59..591be0b88a 100644 --- a/Source/Core/DolphinQt/Settings.h +++ b/Source/Core/DolphinQt/Settings.h @@ -224,6 +224,7 @@ signals: void SDCardInsertionChanged(bool inserted); void USBKeyboardConnectionChanged(bool connected); void EnableGfxModsChanged(bool enabled); + void HardcoreStateChanged(); private: Settings();