service: hid: Implement AssigningSingleOnSlSrPress

This commit is contained in:
german77 2024-01-06 21:54:23 -06:00 committed by Narr the Reg
parent f224ef6185
commit 3516a2d0bf
3 changed files with 24 additions and 2 deletions

View file

@ -251,14 +251,24 @@ void IHidSystemServer::ApplyNpadSystemCommonPolicy(HLERequestContext& ctx) {
} }
void IHidSystemServer::EnableAssigningSingleOnSlSrPress(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}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
} }
void IHidSystemServer::DisableAssigningSingleOnSlSrPress(HLERequestContext& ctx) { 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}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);

View file

@ -1368,4 +1368,14 @@ Result NPad::SetNpadSystemExtStateEnabled(u64 aruid, bool is_enabled) {
return result; 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 } // namespace Service::HID

View file

@ -157,6 +157,8 @@ public:
Result SetNpadSystemExtStateEnabled(u64 aruid, bool is_enabled); Result SetNpadSystemExtStateEnabled(u64 aruid, bool is_enabled);
Result AssigningSingleOnSlSrPress(u64 aruid, bool is_enabled);
private: private:
struct VibrationData { struct VibrationData {
bool device_mounted{}; bool device_mounted{};