From d53b2ae104317f0a6227396a9ee0095b50272e12 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 24 Jun 2024 21:09:31 +1000 Subject: [PATCH] ImGuiManager: Avoid invalid scale update on surfaceless --- pcsx2/ImGui/ImGuiFullscreen.cpp | 4 ++-- pcsx2/ImGui/ImGuiManager.cpp | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pcsx2/ImGui/ImGuiFullscreen.cpp b/pcsx2/ImGui/ImGuiFullscreen.cpp index 709fec77aa..49b06a50bd 100644 --- a/pcsx2/ImGui/ImGuiFullscreen.cpp +++ b/pcsx2/ImGui/ImGuiFullscreen.cpp @@ -425,8 +425,8 @@ bool ImGuiFullscreen::UpdateLayoutScale() static constexpr float LAYOUT_RATIO = LAYOUT_SCREEN_WIDTH / LAYOUT_SCREEN_HEIGHT; const ImGuiIO& io = ImGui::GetIO(); - const float screen_width = io.DisplaySize.x; - const float screen_height = io.DisplaySize.y; + const float screen_width = std::max(io.DisplaySize.x, 1.0f); + const float screen_height = std::max(io.DisplaySize.y, 1.0f); const float screen_ratio = screen_width / screen_height; const float old_scale = g_layout_scale; diff --git a/pcsx2/ImGui/ImGuiManager.cpp b/pcsx2/ImGui/ImGuiManager.cpp index 703f6a80f1..7e62e69a5b 100644 --- a/pcsx2/ImGui/ImGuiManager.cpp +++ b/pcsx2/ImGui/ImGuiManager.cpp @@ -235,7 +235,8 @@ void ImGuiManager::WindowResized() void ImGuiManager::RequestScaleUpdate() { - s_scale_changed = true; + if (s_window_width > 0 && s_window_height > 0) + s_scale_changed = true; } void ImGuiManager::UpdateScale()