summaryrefslogtreecommitdiff
path: root/src/core/hid
diff options
context:
space:
mode:
authorGravatar liamwhite2023-09-16 11:40:35 -0400
committerGravatar GitHub2023-09-16 11:40:35 -0400
commitfe771b59f4b1d2bf30bfc665eef68518949fe7ad (patch)
treeec30d266f5f5e6f85ef137c9756c36b2523f78ab /src/core/hid
parentMerge pull request #11517 from german77/amiibo-format (diff)
parenthid: service: Remove outdated field from npad (diff)
downloadyuzu-fe771b59f4b1d2bf30bfc665eef68518949fe7ad.tar.gz
yuzu-fe771b59f4b1d2bf30bfc665eef68518949fe7ad.tar.xz
yuzu-fe771b59f4b1d2bf30bfc665eef68518949fe7ad.zip
Merge pull request #11518 from german77/bad-npad
service: hid: Implement last active Npad and fix some errors.
Diffstat (limited to 'src/core/hid')
-rw-r--r--src/core/hid/hid_core.cpp8
-rw-r--r--src/core/hid/hid_core.h7
2 files changed, 15 insertions, 0 deletions
diff --git a/src/core/hid/hid_core.cpp b/src/core/hid/hid_core.cpp
index 7d6373414..cf53c04d9 100644
--- a/src/core/hid/hid_core.cpp
+++ b/src/core/hid/hid_core.cpp
@@ -154,6 +154,14 @@ NpadIdType HIDCore::GetFirstDisconnectedNpadId() const {
154 return NpadIdType::Player1; 154 return NpadIdType::Player1;
155} 155}
156 156
157void HIDCore::SetLastActiveController(NpadIdType npad_id) {
158 last_active_controller = npad_id;
159}
160
161NpadIdType HIDCore::GetLastActiveController() const {
162 return last_active_controller;
163}
164
157void HIDCore::EnableAllControllerConfiguration() { 165void HIDCore::EnableAllControllerConfiguration() {
158 player_1->EnableConfiguration(); 166 player_1->EnableConfiguration();
159 player_2->EnableConfiguration(); 167 player_2->EnableConfiguration();
diff --git a/src/core/hid/hid_core.h b/src/core/hid/hid_core.h
index 5fe36551e..80abab18b 100644
--- a/src/core/hid/hid_core.h
+++ b/src/core/hid/hid_core.h
@@ -48,6 +48,12 @@ public:
48 /// Returns the first disconnected npad id 48 /// Returns the first disconnected npad id
49 NpadIdType GetFirstDisconnectedNpadId() const; 49 NpadIdType GetFirstDisconnectedNpadId() const;
50 50
51 /// Sets the npad id of the last active controller
52 void SetLastActiveController(NpadIdType npad_id);
53
54 /// Returns the npad id of the last controller that pushed a button
55 NpadIdType GetLastActiveController() const;
56
51 /// Sets all emulated controllers into configuring mode. 57 /// Sets all emulated controllers into configuring mode.
52 void EnableAllControllerConfiguration(); 58 void EnableAllControllerConfiguration();
53 59
@@ -77,6 +83,7 @@ private:
77 std::unique_ptr<EmulatedConsole> console; 83 std::unique_ptr<EmulatedConsole> console;
78 std::unique_ptr<EmulatedDevices> devices; 84 std::unique_ptr<EmulatedDevices> devices;
79 NpadStyleTag supported_style_tag{NpadStyleSet::All}; 85 NpadStyleTag supported_style_tag{NpadStyleSet::All};
86 NpadIdType last_active_controller{NpadIdType::Handheld};
80}; 87};
81 88
82} // namespace Core::HID 89} // namespace Core::HID