From f9a7fba6e2c76a02a1fc57d06a5b56b4652db17f Mon Sep 17 00:00:00 2001 From: ZedB0T <89345505+Zedb0T@users.noreply.github.com> Date: Mon, 22 Jun 2026 19:59:21 -0400 Subject: [PATCH] Support identical imgui controller labels (#4290) ImGUI does have ways to make sure the Internal IDs are unique and separate from the display label, however I still thought that appending a count to the end of the name was more clear/understandable. If you add `ImGui::PushID(i);` Into the loop it appends i to the end of the internal ID without modifying the display label. The other alternative would be to use a syntax like `ImGui::Button((controller_name + "##option1").c_str());` etc.... https://github.com/ocornut/imgui/blob/master/docs/FAQ.md#q-how-can-i-have-multiple-widgets-with-the-same-label In both cases I think just adding a number that increments communicates that its a different controller cleaner to the user. Closes #4289 --- game/graphics/opengl_renderer/debug_gui.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/game/graphics/opengl_renderer/debug_gui.cpp b/game/graphics/opengl_renderer/debug_gui.cpp index aa7e1398ad..c6b58997e1 100644 --- a/game/graphics/opengl_renderer/debug_gui.cpp +++ b/game/graphics/opengl_renderer/debug_gui.cpp @@ -166,12 +166,18 @@ void OpenGlDebugGui::draw(const DmaStats& dma_stats) { if (ImGui::TreeNode(label.c_str())) { const auto num_controllers = Display::GetMainDisplay()->get_input_manager()->get_num_controllers(); + std::unordered_map controller_name_counts; for (int i = 0; i < num_controllers; i++) { const auto controller_name = Display::GetMainDisplay()->get_input_manager()->get_controller_name(i); + int count = controller_name_counts[controller_name]++; + std::string display_name = controller_name; + if (count > 0) { + display_name = fmt::format("{} ({})", display_name, count); + } auto is_controller_active = Display::GetMainDisplay()->get_input_manager()->get_controller_index(port) == i; - if (ImGui::RadioButton(controller_name.c_str(), is_controller_active)) { + if (ImGui::RadioButton(display_name.c_str(), is_controller_active)) { Display::GetMainDisplay()->get_input_manager()->set_controller_for_port(i, port); } } @@ -303,4 +309,4 @@ void applyFontStyle() { io.FontGlobalScale = Gfx::g_debug_settings.imgui_font_scale; } -} // namespace ImGui \ No newline at end of file +} // namespace ImGui