Skip to content

Commit

Permalink
fix same name controller entry being unselectable (HarbourMasters#1031)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Baoulettes authored Aug 4, 2022
1 parent 0f7a88b commit d61d4e5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libultraship/libultraship/InputEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit d61d4e5

Please sign in to comment.