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.
This commit is contained in:
LillyJadeKatrin 2024-07-23 00:09:38 -04:00
parent 8ef51f85ec
commit ae8040bfc5
3 changed files with 24 additions and 7 deletions

View File

@ -24,6 +24,7 @@
#include "Common/Version.h"
#include "Common/WorkQueueThread.h"
#include "Core/Config/AchievementSettings.h"
#include "Core/Config/MainSettings.h"
#include "Core/Core.h"
#include "Core/HW/Memmap.h"
#include "Core/HW/VideoInterface.h"
@ -1372,6 +1373,7 @@ void AchievementManager::LoadIntegrationCallback(int result, const char* error_m
rc_client_raintegration_set_event_handler(instance.m_client, RAIntegrationEventHandler);
rc_client_raintegration_set_write_memory_function(instance.m_client, MemoryPoker);
rc_client_raintegration_set_get_game_name_function(instance.m_client, GameTitleEstimateHandler);
Config::SetBaseOrCurrent(Config::MAIN_CONFIRM_ON_STOP, true);
instance.m_dev_menu_callback();
// TODO: hook up menu and dll event handlers
break;

View File

@ -152,6 +152,7 @@ public:
m_dev_menu_callback = callback;
};
void SetHardcoreCallback(std::function<void(void)> callback) { m_hardcore_callback = callback; };
bool CheckForModifications() { return rc_client_raintegration_has_modifications(m_client); };
#endif // RC_CLIENT_SUPPORTS_RAINTEGRATION
void DoState(PointerWrap& p);

View File

@ -968,13 +968,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.