Skip to content

Commit

Permalink
Decouple Hardcore from EmulationStateChanged
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
LillyJadeKatrin committed Jun 20, 2024
1 parent 0cc1d4c commit 29f1b82
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions Source/Core/DolphinQt/Achievements/AchievementsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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}); });
}

Expand Down
1 change: 1 addition & 0 deletions Source/Core/DolphinQt/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ class Settings final : public QObject
void SDCardInsertionChanged(bool inserted);
void USBKeyboardConnectionChanged(bool connected);
void EnableGfxModsChanged(bool enabled);
void HardcoreStateChanged();

private:
Settings();
Expand Down

0 comments on commit 29f1b82

Please sign in to comment.