Skip to content

Commit 19a32f4

Browse files
committed
Avoid excessive emulation state changes (fix "Stopped Game" bug)
1 parent a36eb56 commit 19a32f4

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Source/Core/DolphinQt/MainWindow.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2049,9 +2049,14 @@ void MainWindow::ShowAchievementSettings()
20492049

20502050
void MainWindow::OnHardcoreChanged()
20512051
{
2052-
if (AchievementManager::GetInstance().IsHardcoreModeActive())
2052+
bool hardcore_active = AchievementManager::GetInstance().IsHardcoreModeActive();
2053+
if (hardcore_active)
20532054
Settings::Instance().SetDebugModeEnabled(false);
2054-
emit Settings::Instance().EmulationStateChanged(Core::GetState(Core::System::GetInstance()));
2055+
// EmulationStateChanged causes several dialogs to redraw, including anything affected by hardcore
2056+
// mode. Every dialog that depends on hardcore mode is redrawn by EmulationStateChanged.
2057+
if (hardcore_active != m_former_hardcore_setting)
2058+
emit Settings::Instance().EmulationStateChanged(Core::GetState(Core::System::GetInstance()));
2059+
m_former_hardcore_setting = hardcore_active;
20552060
}
20562061
#endif // USE_RETRO_ACHIEVEMENTS
20572062

Source/Core/DolphinQt/MainWindow.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ class MainWindow final : public QMainWindow
270270
#ifdef USE_RETRO_ACHIEVEMENTS
271271
AchievementsWindow* m_achievements_window = nullptr;
272272
Config::ConfigChangedCallbackID m_config_changed_callback_id;
273+
bool m_former_hardcore_setting = false;
273274
#endif // USE_RETRO_ACHIEVEMENTS
274275

275276
AssemblerWidget* m_assembler_widget;

0 commit comments

Comments
 (0)