Improve controller port identity matching (#305)

* Improve controller port identity matching

* fill in old saved port identities
This commit is contained in:
patchzyy
2026-10-18 15:08:03 +02:00
committed by GitHub
parent c255df5136
commit 8676d1ab14
3 changed files with 119 additions and 59 deletions
+8 -1
View File
@@ -780,8 +780,15 @@ void DrawControllerSettings() {
if (ImGui::BeginMenu("Assign connected controller")) {
for (uint32_t index = 0; index < controllerCount; ++index) {
const char* name = PADGetNameForControllerIndex(index);
std::string label = name != nullptr ? name : "Unknown controller";
for (int port = 0; port < PAD_MAX_CONTROLLERS; ++port) {
if (PADGetIndexForPort(port) == static_cast<s32>(index)) {
label += " (Port " + std::to_string(port + 1) + ")";
break;
}
}
ImGui::PushID(static_cast<int>(index));
if (ImGui::MenuItem(name != nullptr ? name : "Unknown controller")) {
if (ImGui::MenuItem(label.c_str())) {
PADSetPortForIndex(index, selectedGamePort);
g_configuredControllerIndices.fill(std::numeric_limits<int32_t>::min());
ApplyConfiguredMappings();