From a36f4d0a9f2c0fee837856e4db3e4ca10bfed25b Mon Sep 17 00:00:00 2001 From: german77 Date: Sat, 6 Jan 2024 21:17:57 -0600 Subject: service: hid: Implement CaptureButtonAssignment --- src/hid_core/resources/npad/npad.cpp | 17 +++++++++++++++++ src/hid_core/resources/npad/npad.h | 6 ++++++ 2 files changed, 23 insertions(+) (limited to 'src/hid_core') diff --git a/src/hid_core/resources/npad/npad.cpp b/src/hid_core/resources/npad/npad.cpp index e6c035628..ea035d759 100644 --- a/src/hid_core/resources/npad/npad.cpp +++ b/src/hid_core/resources/npad/npad.cpp @@ -1339,4 +1339,21 @@ AppletDetailedUiType NPad::GetAppletDetailedUiType(Core::HID::NpadIdType npad_id }; } +Result NPad::SetNpadCaptureButtonAssignment(u64 aruid, Core::HID::NpadStyleSet npad_style_set, + Core::HID::NpadButton button_assignment) { + std::scoped_lock lock{mutex}; + return npad_resource.SetNpadCaptureButtonAssignment(aruid, npad_style_set, button_assignment); +} + +Result NPad::ClearNpadCaptureButtonAssignment(u64 aruid) { + std::scoped_lock lock{mutex}; + return npad_resource.ClearNpadCaptureButtonAssignment(aruid); +} + +std::size_t NPad::GetNpadCaptureButtonAssignment(std::span out_list, + u64 aruid) const { + std::scoped_lock lock{mutex}; + return npad_resource.GetNpadCaptureButtonAssignment(out_list, aruid); +} + } // namespace Service::HID diff --git a/src/hid_core/resources/npad/npad.h b/src/hid_core/resources/npad/npad.h index 58f8c7acf..e602ddaea 100644 --- a/src/hid_core/resources/npad/npad.h +++ b/src/hid_core/resources/npad/npad.h @@ -149,6 +149,12 @@ public: AppletDetailedUiType GetAppletDetailedUiType(Core::HID::NpadIdType npad_id); + Result SetNpadCaptureButtonAssignment(u64 aruid, Core::HID::NpadStyleSet npad_style_set, + Core::HID::NpadButton button_assignment); + Result ClearNpadCaptureButtonAssignment(u64 aruid); + std::size_t GetNpadCaptureButtonAssignment(std::span out_list, + u64 aruid) const; + private: struct VibrationData { bool device_mounted{}; -- cgit v1.2.3 From f224ef6185679338aa8eb8093b150c461f488982 Mon Sep 17 00:00:00 2001 From: german77 Date: Sat, 6 Jan 2024 21:35:10 -0600 Subject: service: hid: Implement SetNpadSystemExtStateEnabled --- src/hid_core/resources/npad/npad.cpp | 12 ++++++++++++ src/hid_core/resources/npad/npad.h | 2 ++ 2 files changed, 14 insertions(+) (limited to 'src/hid_core') diff --git a/src/hid_core/resources/npad/npad.cpp b/src/hid_core/resources/npad/npad.cpp index ea035d759..6be6edb7e 100644 --- a/src/hid_core/resources/npad/npad.cpp +++ b/src/hid_core/resources/npad/npad.cpp @@ -1356,4 +1356,16 @@ std::size_t NPad::GetNpadCaptureButtonAssignment(std::spanEnableAppletToGetInput(aruid); + } + + return result; +} + } // namespace Service::HID diff --git a/src/hid_core/resources/npad/npad.h b/src/hid_core/resources/npad/npad.h index e602ddaea..73e2780c4 100644 --- a/src/hid_core/resources/npad/npad.h +++ b/src/hid_core/resources/npad/npad.h @@ -155,6 +155,8 @@ public: std::size_t GetNpadCaptureButtonAssignment(std::span out_list, u64 aruid) const; + Result SetNpadSystemExtStateEnabled(u64 aruid, bool is_enabled); + private: struct VibrationData { bool device_mounted{}; -- cgit v1.2.3 From 3516a2d0bff5a7d6a22ff1b4fb7cbc021c6b4d1e Mon Sep 17 00:00:00 2001 From: german77 Date: Sat, 6 Jan 2024 21:54:23 -0600 Subject: service: hid: Implement AssigningSingleOnSlSrPress --- src/hid_core/resources/npad/npad.cpp | 10 ++++++++++ src/hid_core/resources/npad/npad.h | 2 ++ 2 files changed, 12 insertions(+) (limited to 'src/hid_core') diff --git a/src/hid_core/resources/npad/npad.cpp b/src/hid_core/resources/npad/npad.cpp index 6be6edb7e..2995634c5 100644 --- a/src/hid_core/resources/npad/npad.cpp +++ b/src/hid_core/resources/npad/npad.cpp @@ -1368,4 +1368,14 @@ Result NPad::SetNpadSystemExtStateEnabled(u64 aruid, bool is_enabled) { return result; } +Result NPad::AssigningSingleOnSlSrPress(u64 aruid, bool is_enabled) { + std::scoped_lock lock{mutex}; + bool is_currently_enabled{}; + Result result = npad_resource.IsAssigningSingleOnSlSrPressEnabled(is_currently_enabled, aruid); + if (result.IsSuccess() && is_enabled != is_currently_enabled) { + result = npad_resource.SetAssigningSingleOnSlSrPress(aruid, is_enabled); + } + return result; +} + } // namespace Service::HID diff --git a/src/hid_core/resources/npad/npad.h b/src/hid_core/resources/npad/npad.h index 73e2780c4..91bc59afd 100644 --- a/src/hid_core/resources/npad/npad.h +++ b/src/hid_core/resources/npad/npad.h @@ -157,6 +157,8 @@ public: Result SetNpadSystemExtStateEnabled(u64 aruid, bool is_enabled); + Result AssigningSingleOnSlSrPress(u64 aruid, bool is_enabled); + private: struct VibrationData { bool device_mounted{}; -- cgit v1.2.3 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') 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