From a7b7ce2720690817ff456220a81f6bc9dbac9bab Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 21 Jan 2024 22:54:39 +1000 Subject: [PATCH] System: Fix crash with replacement precaching --- src/core/imgui_overlays.cpp | 6 ++++++ src/core/system.cpp | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/core/imgui_overlays.cpp b/src/core/imgui_overlays.cpp index 0561b3553..be42d7a8d 100644 --- a/src/core/imgui_overlays.cpp +++ b/src/core/imgui_overlays.cpp @@ -127,6 +127,12 @@ static std::tuple GetMinMax(std::span values) void Host::DisplayLoadingScreen(const char* message, int progress_min /*= -1*/, int progress_max /*= -1*/, int progress_value /*= -1*/) { + if (!g_gpu_device) + { + Log_InfoPrintf("%s: %d/%d", message, progress_value, progress_max); + return; + } + const auto& io = ImGui::GetIO(); const float scale = ImGuiManager::GetGlobalScale(); const float width = (400.0f * scale); diff --git a/src/core/system.cpp b/src/core/system.cpp index 33cfe87b4..ade6cd96a 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -1456,6 +1456,10 @@ bool System::BootSystem(SystemBootParameters parameters) } } + // Texture replacement preloading. + // TODO: Move this and everything else below OnSystemStarted(). + g_texture_replacements.SetGameID(s_running_game_serial); + // Good to go. s_state = State::Running; SPU::GetOutputStream()->SetPaused(false); @@ -3355,7 +3359,8 @@ void System::UpdateRunningGame(const char* path, CDImage* image, bool booting) } } - g_texture_replacements.SetGameID(s_running_game_serial); + if (!booting) + g_texture_replacements.SetGameID(s_running_game_serial); if (booting) Achievements::ResetHardcoreMode();