Achievements: Improve HC self-disable

This commit is contained in:
Stenzek 2025-04-06 21:25:52 +10:00
parent 5034fb943c
commit b794e841a9
No known key found for this signature in database
2 changed files with 9 additions and 3 deletions

View File

@ -1822,8 +1822,9 @@ bool Achievements::ResetHardcoreMode(bool is_booting)
// If we're not logged in, don't apply hardcore mode restrictions. // If we're not logged in, don't apply hardcore mode restrictions.
// If we later log in, we'll start with it off anyway. // If we later log in, we'll start with it off anyway.
const bool wanted_hardcore_mode = const bool wanted_hardcore_mode = (IsLoggedInOrLoggingIn() || s_state.load_game_request) &&
(IsLoggedInOrLoggingIn() || s_state.load_game_request) && g_settings.achievements_hardcore_mode; (HasActiveGame() || s_state.load_game_request) &&
g_settings.achievements_hardcore_mode;
if (s_state.hardcore_mode == wanted_hardcore_mode) if (s_state.hardcore_mode == wanted_hardcore_mode)
return false; return false;
@ -1864,7 +1865,7 @@ void Achievements::SetHardcoreMode(bool enabled, bool force_display_message)
} }
// Reload setting to permit cheating-like things if we were just disabled. // Reload setting to permit cheating-like things if we were just disabled.
if (!enabled) if (!enabled && System::IsValid())
Host::RunOnCPUThread([]() { System::ApplySettings(false); }); Host::RunOnCPUThread([]() { System::ApplySettings(false); });
// Toss away UI state, because it's invalid now // Toss away UI state, because it's invalid now

View File

@ -1756,6 +1756,7 @@ bool System::BootSystem(SystemBootParameters parameters, Error* error)
if (disc) if (disc)
{ {
// Check for resuming with hardcore mode. // Check for resuming with hardcore mode.
const bool hc_mode_was_enabled = Achievements::IsHardcoreModeActive();
if (parameters.disable_achievements_hardcore_mode) if (parameters.disable_achievements_hardcore_mode)
Achievements::DisableHardcoreMode(); Achievements::DisableHardcoreMode();
else else
@ -1793,6 +1794,10 @@ bool System::BootSystem(SystemBootParameters parameters, Error* error)
return true; return true;
} }
} }
// Need to reinit things like emulation speed, cpu overclock, etc.
if (Achievements::IsHardcoreModeActive() != hc_mode_was_enabled)
ApplySettings(false);
} }
// Are we fast booting? Must be checked after updating game settings. // Are we fast booting? Must be checked after updating game settings.