From 6328d08c14c01a838c67c7098c6e889b8ab622eb Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 17 Dec 2023 00:09:15 +1000 Subject: [PATCH] System: Don't unconditionally refresh save state UI --- src/core/imgui_overlays.cpp | 5 +++++ src/core/imgui_overlays.h | 1 + src/core/system.cpp | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/imgui_overlays.cpp b/src/core/imgui_overlays.cpp index 7e7a97df2..2f0b3cfba 100644 --- a/src/core/imgui_overlays.cpp +++ b/src/core/imgui_overlays.cpp @@ -688,6 +688,11 @@ static ImAnimatedFloat s_background_animated; static bool s_open = false; } // namespace SaveStateSelectorUI +bool SaveStateSelectorUI::IsOpen() +{ + return s_open; +} + void SaveStateSelectorUI::Open(float open_time /* = DEFAULT_OPEN_TIME */) { s_open_time = 0.0f; diff --git a/src/core/imgui_overlays.h b/src/core/imgui_overlays.h index 599e5fcc8..77866a4b6 100644 --- a/src/core/imgui_overlays.h +++ b/src/core/imgui_overlays.h @@ -15,6 +15,7 @@ namespace SaveStateSelectorUI { static constexpr float DEFAULT_OPEN_TIME = 5.0f; +bool IsOpen(); void Open(float open_time = DEFAULT_OPEN_TIME); void RefreshList(); void DestroyTextures(); diff --git a/src/core/system.cpp b/src/core/system.cpp index 6f6358230..85f9edcda 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -3366,7 +3366,8 @@ void System::UpdateRunningGame(const char* path, CDImage* image, bool booting) if (s_running_game_serial != prev_serial) UpdateSessionTime(prev_serial); - SaveStateSelectorUI::RefreshList(); + if (SaveStateSelectorUI::IsOpen()) + SaveStateSelectorUI::RefreshList(); #ifdef ENABLE_DISCORD_PRESENCE UpdateDiscordPresence();