diff options
| author | 2024-01-06 21:54:23 -0600 | |
|---|---|---|
| committer | 2024-01-06 23:30:42 -0600 | |
| commit | 3516a2d0bff5a7d6a22ff1b4fb7cbc021c6b4d1e (patch) | |
| tree | 62a10dcbdeef6bab4c8776e1c0d570e377f2c19c /src | |
| parent | service: hid: Implement SetNpadSystemExtStateEnabled (diff) | |
| download | yuzu-3516a2d0bff5a7d6a22ff1b4fb7cbc021c6b4d1e.tar.gz yuzu-3516a2d0bff5a7d6a22ff1b4fb7cbc021c6b4d1e.tar.xz yuzu-3516a2d0bff5a7d6a22ff1b4fb7cbc021c6b4d1e.zip | |
service: hid: Implement AssigningSingleOnSlSrPress
Diffstat (limited to 'src')
| -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) { | |||
| 251 | } | 251 | } |
| 252 | 252 | ||
| 253 | void IHidSystemServer::EnableAssigningSingleOnSlSrPress(HLERequestContext& ctx) { | 253 | void IHidSystemServer::EnableAssigningSingleOnSlSrPress(HLERequestContext& ctx) { |
| 254 | LOG_WARNING(Service_HID, "(STUBBED) called"); | 254 | IPC::RequestParser rp{ctx}; |
| 255 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 256 | |||
| 257 | LOG_INFO(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | ||
| 258 | |||
| 259 | GetResourceManager()->GetNpad()->AssigningSingleOnSlSrPress(applet_resource_user_id, true); | ||
| 255 | 260 | ||
| 256 | IPC::ResponseBuilder rb{ctx, 2}; | 261 | IPC::ResponseBuilder rb{ctx, 2}; |
| 257 | rb.Push(ResultSuccess); | 262 | rb.Push(ResultSuccess); |
| 258 | } | 263 | } |
| 259 | 264 | ||
| 260 | void IHidSystemServer::DisableAssigningSingleOnSlSrPress(HLERequestContext& ctx) { | 265 | void IHidSystemServer::DisableAssigningSingleOnSlSrPress(HLERequestContext& ctx) { |
| 261 | LOG_WARNING(Service_HID, "(STUBBED) called"); | 266 | IPC::RequestParser rp{ctx}; |
| 267 | const auto applet_resource_user_id{rp.Pop<u64>()}; | ||
| 268 | |||
| 269 | LOG_INFO(Service_HID, "called, applet_resource_user_id={}", applet_resource_user_id); | ||
| 270 | |||
| 271 | GetResourceManager()->GetNpad()->AssigningSingleOnSlSrPress(applet_resource_user_id, false); | ||
| 262 | 272 | ||
| 263 | IPC::ResponseBuilder rb{ctx, 2}; | 273 | IPC::ResponseBuilder rb{ctx, 2}; |
| 264 | rb.Push(ResultSuccess); | 274 | 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) { | |||
| 1368 | return result; | 1368 | return result; |
| 1369 | } | 1369 | } |
| 1370 | 1370 | ||
| 1371 | Result NPad::AssigningSingleOnSlSrPress(u64 aruid, bool is_enabled) { | ||
| 1372 | std::scoped_lock lock{mutex}; | ||
| 1373 | bool is_currently_enabled{}; | ||
| 1374 | Result result = npad_resource.IsAssigningSingleOnSlSrPressEnabled(is_currently_enabled, aruid); | ||
| 1375 | if (result.IsSuccess() && is_enabled != is_currently_enabled) { | ||
| 1376 | result = npad_resource.SetAssigningSingleOnSlSrPress(aruid, is_enabled); | ||
| 1377 | } | ||
| 1378 | return result; | ||
| 1379 | } | ||
| 1380 | |||
| 1371 | } // namespace Service::HID | 1381 | } // 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: | |||
| 157 | 157 | ||
| 158 | Result SetNpadSystemExtStateEnabled(u64 aruid, bool is_enabled); | 158 | Result SetNpadSystemExtStateEnabled(u64 aruid, bool is_enabled); |
| 159 | 159 | ||
| 160 | Result AssigningSingleOnSlSrPress(u64 aruid, bool is_enabled); | ||
| 161 | |||
| 160 | private: | 162 | private: |
| 161 | struct VibrationData { | 163 | struct VibrationData { |
| 162 | bool device_mounted{}; | 164 | bool device_mounted{}; |