FullscreenUI: Fix possible crash with RAIntegration

This commit is contained in:
Stenzek 2025-05-06 22:50:32 +10:00
parent e67ce7b54d
commit b2dcf39f8b
No known key found for this signature in database
3 changed files with 10 additions and 1 deletions

View File

@ -734,7 +734,8 @@ bool FullscreenUI::Initialize()
if (s_state.initialized)
return true;
if (s_state.tried_to_initialize)
// some achievement callbacks fire early while e.g. there is a load state popup blocking system init
if (s_state.tried_to_initialize || !ImGuiManager::IsInitialized())
return false;
ImGuiFullscreen::SetAnimations(Host::GetBaseBoolSettingValue("Main", "FullscreenUIAnimations", true));

View File

@ -311,6 +311,11 @@ ImGuiContext* ImGuiManager::GetMainContext()
return s_state.imgui_context;
}
bool ImGuiManager::IsInitialized()
{
return (s_state.imgui_context != nullptr);
}
void ImGuiManager::SetScreenMargin(float margin)
{
s_state.screen_margin = std::max(margin, 0.0f);

View File

@ -86,6 +86,9 @@ void Shutdown();
/// Returns main ImGui context.
ImGuiContext* GetMainContext();
/// Returns true if there is currently a context created.
bool IsInitialized();
/// Sets the size of the screen margins, or "safe zone".
void SetScreenMargin(float margin);