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.
This commit is contained in:
Baoulettes
2022-08-04 04:45:02 +02:00
committed by GitHub
parent 0f7a88bd5a
commit d61d4e508a

View File

@@ -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);
}
}