yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

hid: Add static_assert for Parameter size

This commit is contained in:
Morph 2021-01-28 09:41:43 -05:00
parent d4d39aa4c7
commit 4921ba05db
1 changed files with 19 additions and 15 deletions

View File

@ -520,6 +520,7 @@ void Hid::EnableSixAxisSensorFusion(Kernel::HLERequestContext& ctx) {
Controller_NPad::DeviceHandle sixaxis_handle; Controller_NPad::DeviceHandle sixaxis_handle;
u64 applet_resource_user_id; u64 applet_resource_user_id;
}; };
static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
const auto parameters{rp.PopRaw<Parameters>()}; const auto parameters{rp.PopRaw<Parameters>()};
@ -542,6 +543,7 @@ void Hid::SetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) {
f32 parameter2; f32 parameter2;
u64 applet_resource_user_id; u64 applet_resource_user_id;
}; };
static_assert(sizeof(Parameters) == 0x18, "Parameters has incorrect size.");
const auto parameters{rp.PopRaw<Parameters>()}; const auto parameters{rp.PopRaw<Parameters>()};
@ -549,11 +551,11 @@ void Hid::SetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) {
.SetSixAxisFusionParameters(parameters.parameter1, parameters.parameter2); .SetSixAxisFusionParameters(parameters.parameter1, parameters.parameter2);
LOG_WARNING(Service_HID, LOG_WARNING(Service_HID,
"(STUBBED) called, float1={}, float2={}, npad_type={}, npad_id={}, " "(STUBBED) called, npad_type={}, npad_id={}, device_index={}, parameter1={}, "
"device_index={}, applet_resource_user_id={}", "parameter2={}, applet_resource_user_id={}",
parameters.parameter1, parameters.parameter2, parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id,
parameters.sixaxis_handle.npad_id, parameters.sixaxis_handle.device_index, parameters.sixaxis_handle.device_index, parameters.parameter1,
parameters.applet_resource_user_id); parameters.parameter2, parameters.applet_resource_user_id);
IPC::ResponseBuilder rb{ctx, 2}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
@ -565,6 +567,7 @@ void Hid::GetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) {
Controller_NPad::DeviceHandle sixaxis_handle; Controller_NPad::DeviceHandle sixaxis_handle;
u64 applet_resource_user_id; u64 applet_resource_user_id;
}; };
static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
f32 parameter1 = 0; f32 parameter1 = 0;
f32 parameter2 = 0; f32 parameter2 = 0;
@ -574,9 +577,9 @@ void Hid::GetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) {
applet_resource->GetController<Controller_NPad>(HidController::NPad) applet_resource->GetController<Controller_NPad>(HidController::NPad)
.GetSixAxisFusionParameters(); .GetSixAxisFusionParameters();
LOG_WARNING(Service_HID, LOG_WARNING(
"(STUBBED) called, npad_type={}, npad_id={}, " Service_HID,
"device_index={}, applet_resource_user_id={}", "(STUBBED) called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}",
parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id, parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id,
parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id);
@ -592,15 +595,16 @@ void Hid::ResetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) {
Controller_NPad::DeviceHandle sixaxis_handle; Controller_NPad::DeviceHandle sixaxis_handle;
u64 applet_resource_user_id; u64 applet_resource_user_id;
}; };
static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size.");
const auto parameters{rp.PopRaw<Parameters>()}; const auto parameters{rp.PopRaw<Parameters>()};
applet_resource->GetController<Controller_NPad>(HidController::NPad) applet_resource->GetController<Controller_NPad>(HidController::NPad)
.ResetSixAxisFusionParameters(); .ResetSixAxisFusionParameters();
LOG_WARNING(Service_HID, LOG_WARNING(
"(STUBBED) called, npad_type={}, npad_id={}, " Service_HID,
"device_index={}, applet_resource_user_id={}", "(STUBBED) called, npad_type={}, npad_id={}, device_index={}, applet_resource_user_id={}",
parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id, parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id,
parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id); parameters.sixaxis_handle.device_index, parameters.applet_resource_user_id);