From 5105b900179e639a766c8013e7d24551e6a58a95 Mon Sep 17 00:00:00 2001 From: german77 Date: Sat, 6 Jan 2024 22:04:14 -0600 Subject: service: hid: Implement GetLastActiveNpad --- src/hid_core/resources/npad/npad.cpp | 6 ++++++ src/hid_core/resources/npad/npad.h | 2 ++ 2 files changed, 8 insertions(+) (limited to 'src/hid_core/resources/npad') diff --git a/src/hid_core/resources/npad/npad.cpp b/src/hid_core/resources/npad/npad.cpp index 2995634c5..14871ebee 100644 --- a/src/hid_core/resources/npad/npad.cpp +++ b/src/hid_core/resources/npad/npad.cpp @@ -1378,4 +1378,10 @@ Result NPad::AssigningSingleOnSlSrPress(u64 aruid, bool is_enabled) { return result; } +Result NPad::GetLastActiveNpad(Core::HID::NpadIdType& out_npad_id) const { + std::scoped_lock lock{mutex}; + out_npad_id = hid_core.GetLastActiveController(); + return ResultSuccess; +} + } // namespace Service::HID diff --git a/src/hid_core/resources/npad/npad.h b/src/hid_core/resources/npad/npad.h index 91bc59afd..01f3dabb1 100644 --- a/src/hid_core/resources/npad/npad.h +++ b/src/hid_core/resources/npad/npad.h @@ -159,6 +159,8 @@ public: Result AssigningSingleOnSlSrPress(u64 aruid, bool is_enabled); + Result GetLastActiveNpad(Core::HID::NpadIdType& out_npad_id) const; + private: struct VibrationData { bool device_mounted{}; -- cgit v1.2.3