diff options
Diffstat (limited to 'src/core/hid/hid_core.cpp')
-rw-r--r-- | src/core/hid/hid_core.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/core/hid/hid_core.cpp b/src/core/hid/hid_core.cpp index ee76db110..bd17081bd 100644 --- a/src/core/hid/hid_core.cpp +++ b/src/core/hid/hid_core.cpp @@ -111,6 +111,27 @@ NpadStyleTag HIDCore::GetSupportedStyleTag() const { return supported_style_tag; } +s8 HIDCore::GetPlayerCount() const { + s8 active_players = 0; + for (std::size_t player_index = 0; player_index < 8; player_index++) { + const auto* controller = GetEmulatedControllerByIndex(player_index); + if (controller->IsConnected()) { + active_players++; + } + } + return active_players; +} + +NpadIdType HIDCore::GetFirstNpadId() const { + for (std::size_t player_index = 0; player_index < 10; player_index++) { + const auto* controller = GetEmulatedControllerByIndex(player_index); + if (controller->IsConnected()) { + return controller->GetNpadIdType(); + } + } + return NpadIdType::Player1; +} + void HIDCore::ReloadInputDevices() { player_1->ReloadFromSettings(); player_2->ReloadFromSettings(); |