Skip to content

Commit

Permalink
Achievements: Fix crash when toggling off with list open
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Sep 21, 2022
1 parent 5568de1 commit 065472d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/frontend-common/common_host.cpp
Expand Up @@ -372,6 +372,8 @@ void CommonHost::CheckForSettingsChanges(const Settings& old_settings)
Achievements::UpdateSettings(old_settings);
#endif

FullscreenUI::CheckForConfigChanges(old_settings);

if (g_settings.log_level != old_settings.log_level || g_settings.log_filter != old_settings.log_filter ||
g_settings.log_to_console != old_settings.log_to_console ||
g_settings.log_to_debug != old_settings.log_to_debug || g_settings.log_to_window != old_settings.log_to_window ||
Expand Down
13 changes: 13 additions & 0 deletions src/frontend-common/fullscreen_ui.cpp
Expand Up @@ -578,6 +578,19 @@ bool FullscreenUI::HasActiveWindow()
ImGuiFullscreen::IsChoiceDialogOpen() || ImGuiFullscreen::IsFileSelectorOpen());
}

void FullscreenUI::CheckForConfigChanges(const Settings& old_settings)
{
if (!IsInitialized())
return;

#ifdef WITH_CHEEVOS
// 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();
#endif
}

void FullscreenUI::OnSystemStarted()
{
if (!IsInitialized())
Expand Down
3 changes: 3 additions & 0 deletions src/frontend-common/fullscreen_ui.h
Expand Up @@ -6,10 +6,13 @@

class HostDisplayTexture;

struct Settings;

namespace FullscreenUI {
bool Initialize();
bool IsInitialized();
bool HasActiveWindow();
void CheckForConfigChanges(const Settings& old_settings);
void OnSystemStarted();
void OnSystemPaused();
void OnSystemResumed();
Expand Down

0 comments on commit 065472d

Please sign in to comment.