service: hid: Implement SetNpadSystemExtStateEnabled
This commit is contained in:
parent
a36f4d0a9f
commit
f224ef6185
@ -1444,7 +1444,7 @@ void IHidServer::SetNpadAnalogStickUseCenterClamp(HLERequestContext& ctx) {
|
|||||||
|
|
||||||
const auto parameters{rp.PopRaw<Parameters>()};
|
const auto parameters{rp.PopRaw<Parameters>()};
|
||||||
|
|
||||||
LOG_WARNING(Service_HID, "(STUBBED) called, use_center_clamp={}, applet_resource_user_id={}",
|
LOG_INFO(Service_HID, "called, use_center_clamp={}, applet_resource_user_id={}",
|
||||||
parameters.use_center_clamp, parameters.applet_resource_user_id);
|
parameters.use_center_clamp, parameters.applet_resource_user_id);
|
||||||
|
|
||||||
GetResourceManager()->GetNpad()->SetNpadAnalogStickUseCenterClamp(
|
GetResourceManager()->GetNpad()->SetNpadAnalogStickUseCenterClamp(
|
||||||
|
@ -54,8 +54,8 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr<Resour
|
|||||||
{318, &IHidSystemServer::HasBattery, "HasBattery"},
|
{318, &IHidSystemServer::HasBattery, "HasBattery"},
|
||||||
{319, &IHidSystemServer::HasLeftRightBattery, "HasLeftRightBattery"},
|
{319, &IHidSystemServer::HasLeftRightBattery, "HasLeftRightBattery"},
|
||||||
{321, &IHidSystemServer::GetUniquePadsFromNpad, "GetUniquePadsFromNpad"},
|
{321, &IHidSystemServer::GetUniquePadsFromNpad, "GetUniquePadsFromNpad"},
|
||||||
{322, &IHidSystemServer::GetIrSensorState, "GetIrSensorState"},
|
{322, &IHidSystemServer::SetNpadSystemExtStateEnabled, "SetNpadSystemExtStateEnabled"},
|
||||||
{323, nullptr, "GetXcdHandleForNpadWithIrSensor"},
|
{323, nullptr, "GetLastActiveUniquePad"},
|
||||||
{324, nullptr, "GetUniquePadButtonSet"},
|
{324, nullptr, "GetUniquePadButtonSet"},
|
||||||
{325, nullptr, "GetUniquePadColor"},
|
{325, nullptr, "GetUniquePadColor"},
|
||||||
{326, nullptr, "GetUniquePadAppletDetailedUiType"},
|
{326, nullptr, "GetUniquePadAppletDetailedUiType"},
|
||||||
@ -444,13 +444,25 @@ void IHidSystemServer::GetUniquePadsFromNpad(HLERequestContext& ctx) {
|
|||||||
rb.Push(static_cast<u32>(unique_pads.size()));
|
rb.Push(static_cast<u32>(unique_pads.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IHidSystemServer::GetIrSensorState(HLERequestContext& ctx) {
|
void IHidSystemServer::SetNpadSystemExtStateEnabled(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
|
struct Parameters {
|
||||||
|
bool is_enabled;
|
||||||
|
INSERT_PADDING_BYTES_NOINIT(7);
|
||||||
|
u64 applet_resource_user_id;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
|
||||||
|
|
||||||
LOG_WARNING(Service_HID, "(STUBBED) called");
|
const auto parameters{rp.PopRaw<Parameters>()};
|
||||||
|
|
||||||
|
LOG_INFO(Service_HID, "called, is_enabled={}, applet_resource_user_id={}",
|
||||||
|
parameters.is_enabled, parameters.applet_resource_user_id);
|
||||||
|
|
||||||
|
const auto result = GetResourceManager()->GetNpad()->SetNpadSystemExtStateEnabled(
|
||||||
|
parameters.applet_resource_user_id, parameters.is_enabled);
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
IPC::ResponseBuilder rb{ctx, 2};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(result);
|
||||||
}
|
}
|
||||||
void IHidSystemServer::RegisterAppletResourceUserId(HLERequestContext& ctx) {
|
void IHidSystemServer::RegisterAppletResourceUserId(HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
|
@ -38,7 +38,7 @@ private:
|
|||||||
void HasBattery(HLERequestContext& ctx);
|
void HasBattery(HLERequestContext& ctx);
|
||||||
void HasLeftRightBattery(HLERequestContext& ctx);
|
void HasLeftRightBattery(HLERequestContext& ctx);
|
||||||
void GetUniquePadsFromNpad(HLERequestContext& ctx);
|
void GetUniquePadsFromNpad(HLERequestContext& ctx);
|
||||||
void GetIrSensorState(HLERequestContext& ctx);
|
void SetNpadSystemExtStateEnabled(HLERequestContext& ctx);
|
||||||
void RegisterAppletResourceUserId(HLERequestContext& ctx);
|
void RegisterAppletResourceUserId(HLERequestContext& ctx);
|
||||||
void UnregisterAppletResourceUserId(HLERequestContext& ctx);
|
void UnregisterAppletResourceUserId(HLERequestContext& ctx);
|
||||||
void EnableAppletToGetInput(HLERequestContext& ctx);
|
void EnableAppletToGetInput(HLERequestContext& ctx);
|
||||||
|
@ -1356,4 +1356,16 @@ std::size_t NPad::GetNpadCaptureButtonAssignment(std::span<Core::HID::NpadButton
|
|||||||
return npad_resource.GetNpadCaptureButtonAssignment(out_list, aruid);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Service::HID
|
} // namespace Service::HID
|
||||||
|
@ -155,6 +155,8 @@ public:
|
|||||||
std::size_t GetNpadCaptureButtonAssignment(std::span<Core::HID::NpadButton> out_list,
|
std::size_t GetNpadCaptureButtonAssignment(std::span<Core::HID::NpadButton> out_list,
|
||||||
u64 aruid) const;
|
u64 aruid) const;
|
||||||
|
|
||||||
|
Result SetNpadSystemExtStateEnabled(u64 aruid, bool is_enabled);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct VibrationData {
|
struct VibrationData {
|
||||||
bool device_mounted{};
|
bool device_mounted{};
|
||||||
|
Loading…
Reference in New Issue
Block a user