From a96c935c1ccb5159da5576906419a96eb7b91ebf Mon Sep 17 00:00:00 2001 From: LillyJadeKatrin Date: Tue, 23 Jul 2024 00:09:38 -0400 Subject: [PATCH] Added modified achievements confirmation Added a line to the close game confirmation dialog to tell the dev if there are unsaved modifications to the achievement assets. --- Source/Core/Core/AchievementManager.h | 1 + Source/Core/DolphinQt/MainWindow.cpp | 34 ++++++++++++++++++++------- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/Source/Core/Core/AchievementManager.h b/Source/Core/Core/AchievementManager.h index b1565d8f92..6ed8a1a1a8 100644 --- a/Source/Core/Core/AchievementManager.h +++ b/Source/Core/Core/AchievementManager.h @@ -172,6 +172,7 @@ public: { m_dev_menu_callback = callback; }; + bool CheckForModifications() { return rc_client_raintegration_has_modifications(m_client); }; #endif // RC_CLIENT_SUPPORTS_RAINTEGRATION void DoState(PointerWrap& p); diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index dcf03e5c18..dcf9c44f99 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -942,7 +942,11 @@ bool MainWindow::RequestStop() else FullScreen(); - if (Config::Get(Config::MAIN_CONFIRM_ON_STOP)) + bool confirm_on_stop = Config::Get(Config::MAIN_CONFIRM_ON_STOP); +#ifdef RC_CLIENT_SUPPORTS_RAINTEGRATION + confirm_on_stop = confirm_on_stop || AchievementManager::GetInstance().CheckForModifications(); +#endif // RC_CLIENT_SUPPORTS_RAINTEGRATION + if (confirm_on_stop) { if (std::exchange(m_stop_confirm_showing, true)) return true; @@ -967,13 +971,27 @@ bool MainWindow::RequestStop() // This is to avoid any "race conditions" between the "Window Activate" message and the // message box returning, which could break cursor locking depending on the order m_render_widget->SetWaitingForMessageBox(true); - auto confirm = ModalMessageBox::question( - confirm_parent, tr("Confirm"), - m_stop_requested ? tr("A shutdown is already in progress. Unsaved data " - "may be lost if you stop the current emulation " - "before it completes. Force stop?") : - tr("Do you want to stop the current emulation?"), - QMessageBox::Yes | QMessageBox::No, QMessageBox::NoButton, Qt::ApplicationModal); + QString message; + if (m_stop_requested) + { + message = tr("A shutdown is already in progress. Unsaved data " + "may be lost if you stop the current emulation " + "before it completes. Force stop?"); + } +#ifdef RC_CLIENT_SUPPORTS_RAINTEGRATION + else if (AchievementManager::GetInstance().CheckForModifications()) + { + message = tr( + "Do you want to stop the current emulation? Unsaved achievement modifications detected."); + } +#endif // RC_CLIENT_SUPPORTS_RAINTEGRATION + else + { + message = tr("Do you want to stop the current emulation?"); + } + auto confirm = ModalMessageBox::question(confirm_parent, tr("Confirm"), message, + QMessageBox::Yes | QMessageBox::No, + QMessageBox::NoButton, Qt::ApplicationModal); // If a user confirmed stopping the emulation, we do not capture the cursor again, // even if the render widget will stay alive for a while.