From d61d4e508abeebe1c67c687ff74999c49da11a83 Mon Sep 17 00:00:00 2001 From: Baoulettes Date: Thu, 4 Aug 2022 04:45:02 +0200 Subject: [PATCH] fix same name controller entry being unselectable (#1031) This fix being unable to select both entry of controller that has same ID and Name (for example Mayflash mf103 in my tests got two port both ports has same name and ID. --- libultraship/libultraship/InputEditor.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libultraship/libultraship/InputEditor.cpp b/libultraship/libultraship/InputEditor.cpp index f03e94d57a2..a0e444e3889 100644 --- a/libultraship/libultraship/InputEditor.cpp +++ b/libultraship/libultraship/InputEditor.cpp @@ -95,7 +95,11 @@ namespace Ship { if (ControllerName != nullptr && ImGui::BeginCombo("##ControllerEntries", ControllerName)) { for (uint8_t i = 0; i < devices.size(); i++) { - if (ImGui::Selectable(devices[i]->GetControllerName(), i == vDevices[CurrentPort])) { + std::string DeviceName = devices[i]->GetControllerName(); + if (DeviceName != "Keyboard" && DeviceName != "Auto") { + DeviceName+="##"+std::to_string(i); + } + if (ImGui::Selectable(DeviceName.c_str(), i == vDevices[CurrentPort])) { Window::ControllerApi->SetPhysicalDevice(CurrentPort, i); } }