Achievements: Don't prompt for system reset if enabling Hardcore Mode on a game without achievements/leaderboards

Also improves behaviour parity between Qt and Fullscreen UI,
since the latter used to prompt for system reset even if the game had
no RetroAchievements entry.
This commit is contained in:
Silent 2023-10-24 10:18:43 +02:00 committed by Connor McLaughlin
parent 22590754fd
commit af07ee9abb
2 changed files with 13 additions and 8 deletions

View File

@ -127,7 +127,7 @@ void AchievementSettingsWidget::onHardcoreModeStateChanged()
// don't bother prompting if the game doesn't have achievements // don't bother prompting if the game doesn't have achievements
auto lock = Achievements::GetLock(); auto lock = Achievements::GetLock();
if (!Achievements::HasActiveGame()) if (!Achievements::HasActiveGame() || !Achievements::HasAchievementsOrLeaderboards())
return; return;
if (QMessageBox::question( if (QMessageBox::question(

View File

@ -6299,14 +6299,19 @@ void FullscreenUI::DrawAchievementsSettingsPage(std::unique_lock<std::mutex>& se
// Check for challenge mode just being enabled. // Check for challenge mode just being enabled.
if (check_challenge_state && enabled && bsi->GetBoolValue("Achievements", "ChallengeMode", false) && VMManager::HasValidVM()) if (check_challenge_state && enabled && bsi->GetBoolValue("Achievements", "ChallengeMode", false) && VMManager::HasValidVM())
{ {
ImGuiFullscreen::OpenConfirmMessageDialog(FSUI_STR("Reset System"), // don't bother prompting if the game doesn't have achievements
FSUI_STR("Hardcore mode will not be enabled until the system is reset. Do you want to reset the system now?"), [](bool reset) { auto lock = Achievements::GetLock();
if (!VMManager::HasValidVM()) if (Achievements::HasActiveGame() && Achievements::HasAchievementsOrLeaderboards())
return; {
ImGuiFullscreen::OpenConfirmMessageDialog(FSUI_STR("Reset System"),
FSUI_STR("Hardcore mode will not be enabled until the system is reset. Do you want to reset the system now?"), [](bool reset) {
if (!VMManager::HasValidVM())
return;
if (reset) if (reset)
DoReset(); DoReset();
}); });
}
} }
if (!IsEditingGameSettings(bsi)) if (!IsEditingGameSettings(bsi))