Qt: Prompt user to enable HC mode on achievement login

This commit is contained in:
Stenzek 2023-12-04 14:07:04 +10:00
parent 41f821513b
commit 07fac1fb19
No known key found for this signature in database
2 changed files with 52 additions and 0 deletions

View File

@ -75,6 +75,45 @@ void AchievementLoginDialog::processLoginResult(bool result, const QString& mess
return;
}
if (!Host::GetBaseBoolSettingValue("Cheevos", "Enabled", false) &&
QMessageBox::question(this, tr("Enable Achievements"),
tr("Achievement tracking is not currently enabled. Your login will have no effect until "
"after tracking is enabled.\n\nDo you want to enable tracking now?"),
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
{
Host::SetBaseBoolSettingValue("Cheevos", "Enabled", true);
Host::CommitBaseSettingChanges();
g_emu_thread->applySettings();
}
if (!Host::GetBaseBoolSettingValue("Cheevos", "ChallengeMode", false) &&
QMessageBox::question(
this, tr("Enable Hardcore Mode"),
tr("Hardcore mode is not currently enabled. Enabling hardcore mode allows you to set times, scores, and "
"participate in game-specific leaderboards.\n\nHowever, hardcore mode also prevents the usage of save "
"states, cheats and slowdown functionality.\n\nDo you want to enable hardcore mode?"),
QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
{
Host::SetBaseBoolSettingValue("Cheevos", "ChallengeMode", true);
Host::CommitBaseSettingChanges();
g_emu_thread->applySettings();
bool has_active_game;
{
auto lock = Achievements::GetLock();
has_active_game = Achievements::HasActiveGame();
}
if (has_active_game &&
QMessageBox::question(
QtUtils::GetRootWidget(this), tr("Reset System"),
tr("Hardcore mode will not be enabled until the system is reset. Do you want to reset the system now?")) ==
QMessageBox::Yes)
{
g_emu_thread->resetSystem();
}
}
done(0);
}

View File

@ -210,6 +210,19 @@ void AchievementSettingsWidget::onLoginLogoutPressed()
return;
updateLoginState();
// Login can enable achievements/hardcore.
if (!m_ui.enable->isChecked() && Host::GetBaseBoolSettingValue("Cheevos", "Enabled", false))
{
QSignalBlocker sb(m_ui.enable);
m_ui.enable->setChecked(true);
updateEnableState();
}
if (!m_ui.hardcoreMode->isChecked() && Host::GetBaseBoolSettingValue("Cheevos", "ChallengeMode", false))
{
QSignalBlocker sb(m_ui.hardcoreMode);
m_ui.hardcoreMode->setChecked(true);
}
}
void AchievementSettingsWidget::onViewProfilePressed()