service: hid: Implement AssigningSingleOnSlSrPress
This commit is contained in:
		| @@ -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); | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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{}; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user