summaryrefslogtreecommitdiffstats
path: root/src/core/hid
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-12-08 06:03:42 +0100
committerGitHub <noreply@github.com>2021-12-08 06:03:42 +0100
commitf6e8e61e3ef3bbac1f78e4bedf7383474da39adb (patch)
tree4f19053fdabd34255f64d070853ad30c4815a58f /src/core/hid
parentMerge pull request #7488 from vonchenplus/support_multiple_videos_playing (diff)
parentservice/hid: Implement SetNpadJoyAssignmentMode (diff)
downloadyuzu-f6e8e61e3ef3bbac1f78e4bedf7383474da39adb.tar
yuzu-f6e8e61e3ef3bbac1f78e4bedf7383474da39adb.tar.gz
yuzu-f6e8e61e3ef3bbac1f78e4bedf7383474da39adb.tar.bz2
yuzu-f6e8e61e3ef3bbac1f78e4bedf7383474da39adb.tar.lz
yuzu-f6e8e61e3ef3bbac1f78e4bedf7383474da39adb.tar.xz
yuzu-f6e8e61e3ef3bbac1f78e4bedf7383474da39adb.tar.zst
yuzu-f6e8e61e3ef3bbac1f78e4bedf7383474da39adb.zip
Diffstat (limited to 'src/core/hid')
-rw-r--r--src/core/hid/hid_core.cpp10
-rw-r--r--src/core/hid/hid_core.h3
2 files changed, 13 insertions, 0 deletions
diff --git a/src/core/hid/hid_core.cpp b/src/core/hid/hid_core.cpp
index 0c3eb5a62..a1c3bbb57 100644
--- a/src/core/hid/hid_core.cpp
+++ b/src/core/hid/hid_core.cpp
@@ -145,6 +145,16 @@ NpadIdType HIDCore::GetFirstNpadId() const {
return NpadIdType::Player1;
}
+NpadIdType HIDCore::GetFirstDisconnectedNpadId() const {
+ for (std::size_t player_index = 0; player_index < available_controllers; ++player_index) {
+ const auto* const controller = GetEmulatedControllerByIndex(player_index);
+ if (!controller->IsConnected()) {
+ return controller->GetNpadIdType();
+ }
+ }
+ return NpadIdType::Player1;
+}
+
void HIDCore::EnableAllControllerConfiguration() {
player_1->EnableConfiguration();
player_2->EnableConfiguration();
diff --git a/src/core/hid/hid_core.h b/src/core/hid/hid_core.h
index 2fb0f7e19..837f7de49 100644
--- a/src/core/hid/hid_core.h
+++ b/src/core/hid/hid_core.h
@@ -45,6 +45,9 @@ public:
/// Returns the first connected npad id
NpadIdType GetFirstNpadId() const;
+ /// Returns the first disconnected npad id
+ NpadIdType GetFirstDisconnectedNpadId() const;
+
/// Sets all emulated controllers into configuring mode.
void EnableAllControllerConfiguration();