diff options
| author | liamwhite <liamwhite@users.noreply.github.com> | 2023-09-16 11:40:35 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-16 11:40:35 -0400 |
| commit | fe771b59f4b1d2bf30bfc665eef68518949fe7ad (patch) | |
| tree | ec30d266f5f5e6f85ef137c9756c36b2523f78ab /src/core/hid | |
| parent | d26c76180d4c5b5324aa4fb53c86c1bf1a2d1436 (diff) | |
| parent | 260bfc4bd245e8025c08922b6910039e9e6d242d (diff) | |
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.cpp | 8 | ||||
| -rw-r--r-- | src/core/hid/hid_core.h | 7 |
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 { return NpadIdType::Player1; } +void HIDCore::SetLastActiveController(NpadIdType npad_id) { + last_active_controller = npad_id; +} + +NpadIdType HIDCore::GetLastActiveController() const { + return last_active_controller; +} + 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 5fe36551e..80abab18b 100644 --- a/src/core/hid/hid_core.h +++ b/src/core/hid/hid_core.h @@ -48,6 +48,12 @@ public: /// Returns the first disconnected npad id NpadIdType GetFirstDisconnectedNpadId() const; + /// Sets the npad id of the last active controller + void SetLastActiveController(NpadIdType npad_id); + + /// Returns the npad id of the last controller that pushed a button + NpadIdType GetLastActiveController() const; + /// Sets all emulated controllers into configuring mode. void EnableAllControllerConfiguration(); @@ -77,6 +83,7 @@ private: std::unique_ptr<EmulatedConsole> console; std::unique_ptr<EmulatedDevices> devices; NpadStyleTag supported_style_tag{NpadStyleSet::All}; + NpadIdType last_active_controller{NpadIdType::Handheld}; }; } // namespace Core::HID |
