Controller: Add GetPortDisplayName() that takes pad index

This commit is contained in:
Stenzek 2024-12-01 17:47:31 +10:00
parent 9fc9f4b9e9
commit 4fe3e1147d
No known key found for this signature in database
2 changed files with 7 additions and 0 deletions

View File

@ -238,6 +238,12 @@ const char* Controller::GetPortDisplayName(u32 port, u32 slot, bool mtap)
return mtap ? mtap_labels[port][slot] : no_mtap_labels[port]; 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) std::string Controller::GetSettingsSection(u32 pad)
{ {
return fmt::format("Pad{}", pad + 1u); return fmt::format("Pad{}", pad + 1u);

View File

@ -139,6 +139,7 @@ public:
/// Returns a printable label for a given port. /// Returns a printable label for a given port.
static const char* GetPortDisplayName(u32 port, u32 slot, bool mtap); 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. /// List of controller indices in the order that they should be displayed.
static const std::array<u32, NUM_CONTROLLER_AND_CARD_PORTS> PortDisplayOrder; static const std::array<u32, NUM_CONTROLLER_AND_CARD_PORTS> PortDisplayOrder;