diff --git a/src/core/achievements.cpp b/src/core/achievements.cpp index 3efb850ce..e8f65b49e 100644 --- a/src/core/achievements.cpp +++ b/src/core/achievements.cpp @@ -2185,12 +2185,7 @@ void Achievements::ConfirmHardcoreModeDisableAsync(const char* trigger, std::fun void Achievements::ClearUIState() { -#ifndef __ANDROID__ - if (FullscreenUI::IsAchievementsWindowOpen() || FullscreenUI::IsLeaderboardsWindowOpen()) - FullscreenUI::ReturnToPreviousWindow(); - CloseLeaderboard(); -#endif s_state.achievement_badge_paths = {}; @@ -2470,11 +2465,15 @@ void Achievements::DrawAchievementsWindow() using ImGuiFullscreen::LayoutScale; using ImGuiFullscreen::UIStyle; - if (!s_state.achievement_list) - return; - auto lock = Achievements::GetLock(); + // achievements can get turned off via the main UI + if (!s_state.achievement_list) + { + FullscreenUI::ReturnToPreviousWindow(); + return; + } + static constexpr float alpha = 0.8f; static constexpr float heading_alpha = 0.95f; static constexpr float heading_height_unscaled = 110.0f; @@ -2846,7 +2845,12 @@ void Achievements::DrawLeaderboardsWindow() static constexpr float heading_height_unscaled = 110.0f; static constexpr float tab_height_unscaled = 50.0f; - auto lock = Achievements::GetLock(); + const auto lock = Achievements::GetLock(); + if (!s_state.leaderboard_list) + { + FullscreenUI::ReturnToPreviousWindow(); + return; + } const bool is_leaderboard_open = (s_state.open_leaderboard != nullptr); bool close_leaderboard_on_exit = false; @@ -3437,7 +3441,6 @@ void Achievements::CloseLeaderboard() } s_state.open_leaderboard = nullptr; - ImGuiFullscreen::QueueResetFocus(ImGuiFullscreen::FocusResetType::Other); } #if defined(_WIN32) diff --git a/src/core/fullscreen_ui.cpp b/src/core/fullscreen_ui.cpp index 7050fe5e0..9f2a3fe3d 100644 --- a/src/core/fullscreen_ui.cpp +++ b/src/core/fullscreen_ui.cpp @@ -634,25 +634,7 @@ bool FullscreenUI::AreAnyDialogsOpen() void FullscreenUI::CheckForConfigChanges(const Settings& old_settings) { - // NOTE: Called on CPU thread. - if (!IsInitialized()) - return; - - // 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) - { - if (!IsInitialized()) - return; - - GPUThread::RunOnThread([]() { - if (s_state.current_main_window == MainWindowType::Achievements || - s_state.current_main_window == MainWindowType::Leaderboards) - { - ReturnToPreviousWindow(); - } - }); - } + // NOTE: Called on GPU thread. } void FullscreenUI::UpdateRunIdleState() @@ -7635,11 +7617,6 @@ void FullscreenUI::OpenAchievementsWindow() }); } -bool FullscreenUI::IsAchievementsWindowOpen() -{ - return (s_state.current_main_window == MainWindowType::Achievements); -} - void FullscreenUI::OpenLeaderboardsWindow() { if (!System::IsValid()) @@ -7674,11 +7651,6 @@ void FullscreenUI::OpenLeaderboardsWindow() }); } -bool FullscreenUI::IsLeaderboardsWindowOpen() -{ - return (s_state.current_main_window == MainWindowType::Leaderboards); -} - #endif // __ANDROID__ LoadingScreenProgressCallback::LoadingScreenProgressCallback() diff --git a/src/core/fullscreen_ui.h b/src/core/fullscreen_ui.h index e84a00b81..896a33aed 100644 --- a/src/core/fullscreen_ui.h +++ b/src/core/fullscreen_ui.h @@ -29,9 +29,7 @@ void OnRunningGameChanged(); void OpenPauseMenu(); void OpenCheatsMenu(); void OpenAchievementsWindow(); -bool IsAchievementsWindowOpen(); void OpenLeaderboardsWindow(); -bool IsLeaderboardsWindowOpen(); void ReturnToMainWindow(); void ReturnToPreviousWindow(); void SetStandardSelectionFooterText(bool back_instead_of_cancel);