aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/hid_core
diff options
context:
space:
mode:
authorliamwhite <[email protected]>2024-01-07 20:41:06 -0500
committerGitHub <[email protected]>2024-01-07 20:41:06 -0500
commit2a4ac7cfac9ebdc916a95dbc576a850162886b13 (patch)
tree152196b6412c5ef7118810fbceb92804f079d4ba /src/hid_core
parentab513c378a773c194ea3ea6a11e5d6d8569e23e4 (diff)
parent5105b900179e639a766c8013e7d24551e6a58a95 (diff)
downloadyuzu-mainline-2a4ac7cfac9ebdc916a95dbc576a850162886b13.tar.gz
yuzu-mainline-2a4ac7cfac9ebdc916a95dbc576a850162886b13.zip
Merge pull request #12600 from german77/npad-impl
service: hid: Hook interface implementations
Diffstat (limited to 'src/hid_core')
-rw-r--r--src/hid_core/resources/npad/npad.cpp45
-rw-r--r--src/hid_core/resources/npad/npad.h12
2 files changed, 57 insertions, 0 deletions
diff --git a/src/hid_core/resources/npad/npad.cpp b/src/hid_core/resources/npad/npad.cpp
index 97f31d26e..1f8a0f8ab 100644
--- a/src/hid_core/resources/npad/npad.cpp
+++ b/src/hid_core/resources/npad/npad.cpp
@@ -1344,4 +1344,49 @@ 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<Core::HID::NpadButton> out_list,
+ u64 aruid) const {
+ std::scoped_lock lock{mutex};
+ return npad_resource.GetNpadCaptureButtonAssignment(out_list, aruid);
+}
+
+Result NPad::SetNpadSystemExtStateEnabled(u64 aruid, bool is_enabled) {
+ std::scoped_lock lock{mutex};
+ const auto result = npad_resource.SetNpadSystemExtStateEnabled(aruid, is_enabled);
+
+ if (result.IsSuccess()) {
+ std::scoped_lock shared_lock{*applet_resource_holder.shared_mutex};
+ // TODO: abstracted_pad->EnableAppletToGetInput(aruid);
+ }
+
+ 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;
+}
+
+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 58f8c7acf..01f3dabb1 100644
--- a/src/hid_core/resources/npad/npad.h
+++ b/src/hid_core/resources/npad/npad.h
@@ -149,6 +149,18 @@ 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<Core::HID::NpadButton> out_list,
+ u64 aruid) const;
+
+ Result SetNpadSystemExtStateEnabled(u64 aruid, bool is_enabled);
+
+ Result AssigningSingleOnSlSrPress(u64 aruid, bool is_enabled);
+
+ Result GetLastActiveNpad(Core::HID::NpadIdType& out_npad_id) const;
+
private:
struct VibrationData {
bool device_mounted{};