Skip to content

Commit

Permalink
Controller: Add GetPortDisplayName() that takes pad index
Browse files Browse the repository at this point in the history
  • Loading branch information
stenzek committed Dec 1, 2024
1 parent 9fc9f4b commit 4fe3e11
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/core/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/core/controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ class Controller

/// 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<u32, NUM_CONTROLLER_AND_CARD_PORTS> PortDisplayOrder;
Expand Down

0 comments on commit 4fe3e11

Please sign in to comment.