From 4fe3e1147d4e98347ac0d1cee8039595a2a32494 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 1 Dec 2024 17:47:31 +1000 Subject: [PATCH] Controller: Add GetPortDisplayName() that takes pad index --- src/core/controller.cpp | 6 ++++++ src/core/controller.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/core/controller.cpp b/src/core/controller.cpp index 1fdfbc47a..4608f2528 100644 --- a/src/core/controller.cpp +++ b/src/core/controller.cpp @@ -238,6 +238,12 @@ const char* Controller::GetPortDisplayName(u32 port, u32 slot, bool mtap) return mtap ? mtap_labels[port][slot] : no_mtap_labels[port]; } +const char* Controller::GetPortDisplayName(u32 index) +{ + const auto& [port, slot] = ConvertPadToPortAndSlot(index); + return GetPortDisplayName(port, slot, g_settings.IsMultitapPortEnabled(port)); +} + std::string Controller::GetSettingsSection(u32 pad) { return fmt::format("Pad{}", pad + 1u); diff --git a/src/core/controller.h b/src/core/controller.h index bf2bc766d..9ff91a88c 100644 --- a/src/core/controller.h +++ b/src/core/controller.h @@ -139,6 +139,7 @@ public: /// Returns a printable label for a given port. static const char* GetPortDisplayName(u32 port, u32 slot, bool mtap); + static const char* GetPortDisplayName(u32 index); /// List of controller indices in the order that they should be displayed. static const std::array PortDisplayOrder;