diff options
| author | 2021-12-05 16:17:52 -0600 | |
|---|---|---|
| committer | 2021-12-05 16:18:23 -0600 | |
| commit | d6ae9c68f80792cf11f13ca2c81ac34ddf01dafa (patch) | |
| tree | c09f3cbe3806d91999a1d36fad5842e7ae89669e /src/core/hid | |
| parent | Merge pull request #7518 from german77/is_npad_valid (diff) | |
| download | yuzu-d6ae9c68f80792cf11f13ca2c81ac34ddf01dafa.tar.gz yuzu-d6ae9c68f80792cf11f13ca2c81ac34ddf01dafa.tar.xz yuzu-d6ae9c68f80792cf11f13ca2c81ac34ddf01dafa.zip | |
service/hid: Implement SetNpadJoyAssignmentMode
Diffstat (limited to 'src/core/hid')
| -rw-r--r-- | src/core/hid/hid_core.cpp | 10 | ||||
| -rw-r--r-- | src/core/hid/hid_core.h | 3 |
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 { | |||
| 145 | return NpadIdType::Player1; | 145 | return NpadIdType::Player1; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | NpadIdType HIDCore::GetFirstDisconnectedNpadId() const { | ||
| 149 | for (std::size_t player_index = 0; player_index < available_controllers; ++player_index) { | ||
| 150 | const auto* const controller = GetEmulatedControllerByIndex(player_index); | ||
| 151 | if (!controller->IsConnected()) { | ||
| 152 | return controller->GetNpadIdType(); | ||
| 153 | } | ||
| 154 | } | ||
| 155 | return NpadIdType::Player1; | ||
| 156 | } | ||
| 157 | |||
| 148 | void HIDCore::EnableAllControllerConfiguration() { | 158 | void HIDCore::EnableAllControllerConfiguration() { |
| 149 | player_1->EnableConfiguration(); | 159 | player_1->EnableConfiguration(); |
| 150 | player_2->EnableConfiguration(); | 160 | 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: | |||
| 45 | /// Returns the first connected npad id | 45 | /// Returns the first connected npad id |
| 46 | NpadIdType GetFirstNpadId() const; | 46 | NpadIdType GetFirstNpadId() const; |
| 47 | 47 | ||
| 48 | /// Returns the first disconnected npad id | ||
| 49 | NpadIdType GetFirstDisconnectedNpadId() const; | ||
| 50 | |||
| 48 | /// Sets all emulated controllers into configuring mode. | 51 | /// Sets all emulated controllers into configuring mode. |
| 49 | void EnableAllControllerConfiguration(); | 52 | void EnableAllControllerConfiguration(); |
| 50 | 53 | ||