diff options
author | german77 <juangerman-13@hotmail.com> | 2024-01-07 04:54:23 +0100 |
---|---|---|
committer | Narr the Reg <juangerman-13@hotmail.com> | 2024-01-07 06:30:42 +0100 |
commit | 3516a2d0bff5a7d6a22ff1b4fb7cbc021c6b4d1e (patch) | |
tree | 62a10dcbdeef6bab4c8776e1c0d570e377f2c19c | |
parent | service: hid: Implement SetNpadSystemExtStateEnabled (diff) | |
download | yuzu-3516a2d0bff5a7d6a22ff1b4fb7cbc021c6b4d1e.tar yuzu-3516a2d0bff5a7d6a22ff1b4fb7cbc021c6b4d1e.tar.gz yuzu-3516a2d0bff5a7d6a22ff1b4fb7cbc021c6b4d1e.tar.bz2 yuzu-3516a2d0bff5a7d6a22ff1b4fb7cbc021c6b4d1e.tar.lz yuzu-3516a2d0bff5a7d6a22ff1b4fb7cbc021c6b4d1e.tar.xz yuzu-3516a2d0bff5a7d6a22ff1b4fb7cbc021c6b4d1e.tar.zst yuzu-3516a2d0bff5a7d6a22ff1b4fb7cbc021c6b4d1e.zip |
-rw-r--r-- | src/core/hle/service/hid/hid_system_server.cpp | 14 | ||||
-rw-r--r-- | src/hid_core/resources/npad/npad.cpp | 10 | ||||
-rw-r--r-- | src/hid_core/resources/npad/npad.h | 2 |
3 files changed, 24 insertions, 2 deletions
diff --git a/src/core/hle/service/hid/hid_system_server.cpp b/src/core/hle/service/hid/hid_system_server.cpp index ead593ab3..94d566650 100644 --- a/src/core/hle/service/hid/hid_system_server.cpp +++ b/src/core/hle/service/hid/hid_system_server.cpp @@ -251,14 +251,24 @@ void IHidSystemServer::ApplyNpadSystemCommonPolicy(HLERequestContext& ctx) { } void IHidSystemServer::EnableAssigningSingleOnSlSrPress(HLERequestContext& ctx) { - LOG_WARNING(Service_HID, "(STUBBED) called"); + IPC::RequestParser rp{ctx}; + const auto applet_resource_user_id{rp.Pop<u64>()}; + + LOG_INFO(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); + + GetResourceManager()->GetNpad()->AssigningSingleOnSlSrPress(applet_resource_user_id, true); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } void IHidSystemServer::DisableAssigningSingleOnSlSrPress(HLERequestContext& ctx) { - LOG_WARNING(Service_HID, "(STUBBED) called"); + IPC::RequestParser rp{ctx}; + const auto applet_resource_user_id{rp.Pop<u64>()}; + + LOG_INFO(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); + + GetResourceManager()->GetNpad()->AssigningSingleOnSlSrPress(applet_resource_user_id, false); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); 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{}; |