From 6ec524adeceeecfa25f585b2ddac37f15d643528 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 9 Aug 2023 21:53:56 +1000 Subject: [PATCH] USB/GunCon2: Fix cursor not starting in center --- pcsx2/USB/usb-lightgun/guncon2.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pcsx2/USB/usb-lightgun/guncon2.cpp b/pcsx2/USB/usb-lightgun/guncon2.cpp index 6b8de71652..a69dbb1584 100644 --- a/pcsx2/USB/usb-lightgun/guncon2.cpp +++ b/pcsx2/USB/usb-lightgun/guncon2.cpp @@ -536,14 +536,19 @@ namespace usb_lightgun ImGuiManager::ClearSoftwareCursor(prev_pointer_index); // Pointer changed, so need to update software cursor. - if (!cursor_path.empty()) - ImGuiManager::SetSoftwareCursor(new_pointer_index, cursor_path, cursor_scale, cursor_color); - else if (!s->cursor_path.empty()) - ImGuiManager::ClearSoftwareCursor(new_pointer_index); - + const bool had_software_cursor = !s->cursor_path.empty(); s->cursor_path = std::move(cursor_path); s->cursor_scale = cursor_scale; s->cursor_color = cursor_color; + if (!s->cursor_path.empty()) + { + ImGuiManager::SetSoftwareCursor(new_pointer_index, s->cursor_path, s->cursor_scale, s->cursor_color); + s->UpdateSoftwarePointerPosition(); + } + else if (had_software_cursor) + { + ImGuiManager::ClearSoftwareCursor(new_pointer_index); + } } }