mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-27 21:42:40 +00:00
Merge pull request #12949 from LillyJadeKatrin/retroachievements-new-dev-branch
RetroAchievements - Dev Branch Refactor
This commit is contained in:
commit
258fc1b209
19 changed files with 359 additions and 51 deletions
|
@ -43,6 +43,7 @@
|
|||
#include "Core/BootManager.h"
|
||||
#include "Core/CommonTitles.h"
|
||||
#include "Core/Config/AchievementSettings.h"
|
||||
#include "Core/Config/FreeLookSettings.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Config/NetplaySettings.h"
|
||||
#include "Core/Config/UISettings.h"
|
||||
|
@ -272,9 +273,15 @@ MainWindow::MainWindow(Core::System& system, std::unique_ptr<BootParameters> boo
|
|||
NetPlayInit();
|
||||
|
||||
#ifdef USE_RETRO_ACHIEVEMENTS
|
||||
AchievementManager::GetInstance().Init();
|
||||
AchievementManager::GetInstance().Init(reinterpret_cast<void*>(winId()));
|
||||
if (AchievementManager::GetInstance().IsHardcoreModeActive())
|
||||
Settings::Instance().SetDebugModeEnabled(false);
|
||||
// This needs to trigger on both RA_HARDCORE_ENABLED and RA_ENABLED
|
||||
Config::AddConfigChangedCallback(
|
||||
[this]() { QueueOnObject(this, [this] { this->OnHardcoreChanged(); }); });
|
||||
// If hardcore is enabled when the emulator starts, make sure it turns off what it needs to
|
||||
if (Config::Get(Config::RA_HARDCORE_ENABLED))
|
||||
OnHardcoreChanged();
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
||||
#if defined(__unix__) || defined(__unix) || defined(__APPLE__)
|
||||
|
@ -935,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;
|
||||
|
@ -960,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.
|
||||
|
@ -1992,6 +2017,13 @@ void MainWindow::ShowAchievementSettings()
|
|||
ShowAchievementsWindow();
|
||||
m_achievements_window->ForceSettingsTab();
|
||||
}
|
||||
|
||||
void MainWindow::OnHardcoreChanged()
|
||||
{
|
||||
if (Config::Get(Config::RA_HARDCORE_ENABLED))
|
||||
Settings::Instance().SetDebugModeEnabled(false);
|
||||
emit Settings::Instance().EmulationStateChanged(Core::GetState(Core::System::GetInstance()));
|
||||
}
|
||||
#endif // USE_RETRO_ACHIEVEMENTS
|
||||
|
||||
void MainWindow::ShowMemcardManager()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue