mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-25 15:15:40 +00:00
Achievements: Fix a few minor issues
This commit is contained in:
parent
8d53eb5df8
commit
42768c3101
|
@ -15,7 +15,7 @@ extern bool DoState(StateWrapper& sw);
|
|||
extern void GameChanged(const std::string& path, CDImage* image);
|
||||
|
||||
/// Re-enables hardcode mode if it is enabled in the settings.
|
||||
extern void ResetChallengeMode();
|
||||
extern bool ResetChallengeMode();
|
||||
|
||||
/// Forces hardcore mode off until next reset.
|
||||
extern void DisableChallengeMode();
|
||||
|
@ -43,7 +43,10 @@ static constexpr inline bool ChallengeModeActive()
|
|||
return false;
|
||||
}
|
||||
|
||||
static inline void ResetChallengeMode() {}
|
||||
static inline bool ResetChallengeMode()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline void DisableChallengeMode() {}
|
||||
|
||||
|
|
|
@ -908,6 +908,9 @@ void System::ResetSystem()
|
|||
#ifdef WITH_CHEEVOS
|
||||
if (!Achievements::ConfirmSystemReset())
|
||||
return;
|
||||
|
||||
if (Achievements::ResetChallengeMode())
|
||||
ApplySettings(false);
|
||||
#endif
|
||||
|
||||
InternalReset();
|
||||
|
@ -915,10 +918,6 @@ void System::ResetSystem()
|
|||
ResetThrottler();
|
||||
Host::AddOSDMessage(Host::TranslateStdString("OSDMessage", "System reset."));
|
||||
|
||||
#ifdef WITH_CHEEVOS
|
||||
Achievements::ResetChallengeMode();
|
||||
#endif
|
||||
|
||||
// need to clear this here, because of eject disc -> reset.
|
||||
s_running_bios = !s_running_game_path.empty();
|
||||
}
|
||||
|
@ -2925,21 +2924,21 @@ void System::UpdateRunningGame(const char* path, CDImage* image, bool booting)
|
|||
|
||||
g_texture_replacements.SetGameID(s_running_game_serial);
|
||||
|
||||
s_cheat_list.reset();
|
||||
if (g_settings.auto_load_cheats && !Achievements::ChallengeModeActive())
|
||||
LoadCheatListFromGameTitle();
|
||||
|
||||
UpdateGameSettingsLayer();
|
||||
ApplySettings(true);
|
||||
|
||||
Host::OnGameChanged(s_running_game_path, s_running_game_serial, s_running_game_title);
|
||||
|
||||
#ifdef WITH_CHEEVOS
|
||||
if (booting)
|
||||
Achievements::ResetChallengeMode();
|
||||
|
||||
Achievements::GameChanged(s_running_game_path, image);
|
||||
#endif
|
||||
|
||||
UpdateGameSettingsLayer();
|
||||
ApplySettings(true);
|
||||
|
||||
s_cheat_list.reset();
|
||||
if (g_settings.auto_load_cheats && !Achievements::ChallengeModeActive())
|
||||
LoadCheatListFromGameTitle();
|
||||
|
||||
Host::OnGameChanged(s_running_game_path, s_running_game_serial, s_running_game_title);
|
||||
}
|
||||
|
||||
bool System::CheckForSBIFile(CDImage* image)
|
||||
|
|
|
@ -498,9 +498,9 @@ void Achievements::UpdateSettings(const Settings& old_config)
|
|||
}
|
||||
else if (!s_challenge_mode && g_settings.achievements_challenge_mode)
|
||||
{
|
||||
Host::AddKeyedOSDMessage(
|
||||
"challenge_mode_reset",
|
||||
Host::TranslateStdString("Achievements", "Hardcore mode will be enabled on system reset."), 10.0f);
|
||||
ImGuiFullscreen::ShowToast(
|
||||
std::string(), Host::TranslateStdString("Achievements", "Hardcore mode will be enabled on system reset."),
|
||||
10.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -560,13 +560,13 @@ void Achievements::DisableChallengeMode()
|
|||
SetChallengeMode(false);
|
||||
}
|
||||
|
||||
void Achievements::ResetChallengeMode()
|
||||
bool Achievements::ResetChallengeMode()
|
||||
{
|
||||
if (!s_active)
|
||||
return;
|
||||
if (!s_active || s_challenge_mode == g_settings.achievements_challenge_mode)
|
||||
return false;
|
||||
|
||||
if (s_challenge_mode != g_settings.achievements_challenge_mode)
|
||||
SetChallengeMode(g_settings.achievements_challenge_mode);
|
||||
SetChallengeMode(g_settings.achievements_challenge_mode);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Achievements::SetChallengeMode(bool enabled)
|
||||
|
@ -579,10 +579,10 @@ void Achievements::SetChallengeMode(bool enabled)
|
|||
|
||||
if (HasActiveGame())
|
||||
{
|
||||
Host::AddKeyedOSDMessage("achievements_set_challenge_mode",
|
||||
enabled ? Host::TranslateStdString("Achievements", "Hardcore mode is now enabled.") :
|
||||
Host::TranslateStdString("Achievements", "Hardcore mode is now disabled."),
|
||||
10.0f);
|
||||
ImGuiFullscreen::ShowToast(std::string(),
|
||||
enabled ? Host::TranslateStdString("Achievements", "Hardcore mode is now enabled.") :
|
||||
Host::TranslateStdString("Achievements", "Hardcore mode is now disabled."),
|
||||
10.0f);
|
||||
}
|
||||
|
||||
if (HasActiveGame() && !IsTestModeActive())
|
||||
|
|
|
@ -119,7 +119,7 @@ void Logout();
|
|||
void GameChanged(const std::string& path, CDImage* image);
|
||||
|
||||
/// Re-enables hardcode mode if it is enabled in the settings.
|
||||
void ResetChallengeMode();
|
||||
bool ResetChallengeMode();
|
||||
|
||||
/// Forces hardcore mode off until next reset.
|
||||
void DisableChallengeMode();
|
||||
|
|
|
@ -585,7 +585,10 @@ void FullscreenUI::CheckForConfigChanges(const Settings& old_settings)
|
|||
// If achievements got disabled, we might have the menu open...
|
||||
// That means we're going to be reading achievement state.
|
||||
if (old_settings.achievements_enabled && !g_settings.achievements_enabled)
|
||||
ReturnToMainWindow();
|
||||
{
|
||||
if (s_current_main_window == MainWindowType::Achievements || s_current_main_window == MainWindowType::Leaderboards)
|
||||
ReturnToMainWindow();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -2144,7 +2144,7 @@ void ImGuiFullscreen::DrawMessageDialog()
|
|||
}
|
||||
}
|
||||
|
||||
static float s_notification_vertical_position = 0.3f;
|
||||
static float s_notification_vertical_position = 0.15f;
|
||||
static float s_notification_vertical_direction = 1.0f;
|
||||
|
||||
float ImGuiFullscreen::GetNotificationVerticalPosition()
|
||||
|
|
Loading…
Reference in a new issue