diff options
author | LC <mathew1800@gmail.com> | 2021-01-28 16:51:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-28 16:51:04 +0100 |
commit | 0e125dfd43113251e1ea1164c47c2f003bd61a8c (patch) | |
tree | 0ed3f37dbb26d38a93cdd652a175b1bff4667fce /src/core | |
parent | Merge pull request #5786 from ReinUsesLisp/glsl-cbuf (diff) | |
parent | hid: Add static_assert for Parameter size (diff) | |
download | yuzu-0e125dfd43113251e1ea1164c47c2f003bd61a8c.tar yuzu-0e125dfd43113251e1ea1164c47c2f003bd61a8c.tar.gz yuzu-0e125dfd43113251e1ea1164c47c2f003bd61a8c.tar.bz2 yuzu-0e125dfd43113251e1ea1164c47c2f003bd61a8c.tar.lz yuzu-0e125dfd43113251e1ea1164c47c2f003bd61a8c.tar.xz yuzu-0e125dfd43113251e1ea1164c47c2f003bd61a8c.tar.zst yuzu-0e125dfd43113251e1ea1164c47c2f003bd61a8c.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 7 | ||||
-rw-r--r-- | src/core/hle/service/hid/controllers/npad.h | 6 | ||||
-rw-r--r-- | src/core/hle/service/hid/hid.cpp | 41 |
3 files changed, 28 insertions, 26 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 265c986e2..0c227b135 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -946,20 +946,19 @@ void Controller_NPad::SetSixAxisEnabled(bool six_axis_status) { sixaxis_sensors_enabled = six_axis_status; } -void Controller_NPad::SetSixAxisFusionParameters(const DeviceHandle& handle, f32 parameter1, - f32 parameter2) { +void Controller_NPad::SetSixAxisFusionParameters(f32 parameter1, f32 parameter2) { sixaxis_fusion_parameter1 = parameter1; sixaxis_fusion_parameter2 = parameter2; } -std::pair<f32, f32> Controller_NPad::GetSixAxisFusionParameters(const DeviceHandle& handle) { +std::pair<f32, f32> Controller_NPad::GetSixAxisFusionParameters() { return { sixaxis_fusion_parameter1, sixaxis_fusion_parameter2, }; } -void Controller_NPad::ResetSixAxisFusionParameters(const DeviceHandle& handle) { +void Controller_NPad::ResetSixAxisFusionParameters() { sixaxis_fusion_parameter1 = 0.0f; sixaxis_fusion_parameter2 = 0.0f; } diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index bfd06372a..2e13922b9 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h @@ -202,9 +202,9 @@ public: GyroscopeZeroDriftMode GetGyroscopeZeroDriftMode() const; bool IsSixAxisSensorAtRest() const; void SetSixAxisEnabled(bool six_axis_status); - void SetSixAxisFusionParameters(const DeviceHandle& handle, f32 parameter1, f32 parameter2); - std::pair<f32, f32> GetSixAxisFusionParameters(const DeviceHandle& handle); - void ResetSixAxisFusionParameters(const DeviceHandle& handle); + void SetSixAxisFusionParameters(f32 parameter1, f32 parameter2); + std::pair<f32, f32> GetSixAxisFusionParameters(); + void ResetSixAxisFusionParameters(); LedPattern GetLedPattern(u32 npad_id); bool IsUnintendedHomeButtonInputProtectionEnabled(u32 npad_id) const; void SetUnintendedHomeButtonInputProtectionEnabled(bool is_protection_enabled, u32 npad_id); diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 7fd3161e8..5efc1237e 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -520,6 +520,7 @@ void Hid::EnableSixAxisSensorFusion(Kernel::HLERequestContext& ctx) { Controller_NPad::DeviceHandle sixaxis_handle; u64 applet_resource_user_id; }; + static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); const auto parameters{rp.PopRaw<Parameters>()}; @@ -542,19 +543,19 @@ void Hid::SetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) { f32 parameter2; u64 applet_resource_user_id; }; + static_assert(sizeof(Parameters) == 0x18, "Parameters has incorrect size."); const auto parameters{rp.PopRaw<Parameters>()}; applet_resource->GetController<Controller_NPad>(HidController::NPad) - .SetSixAxisFusionParameters(parameters.sixaxis_handle, parameters.parameter1, - parameters.parameter2); + .SetSixAxisFusionParameters(parameters.parameter1, parameters.parameter2); LOG_WARNING(Service_HID, - "(STUBBED) called, float1={}, float2={}, npad_type={}, npad_id={}, " - "device_index={}, applet_resource_user_id={}", - parameters.parameter1, parameters.parameter2, parameters.sixaxis_handle.npad_type, - parameters.sixaxis_handle.npad_id, parameters.sixaxis_handle.device_index, - parameters.applet_resource_user_id); + "(STUBBED) called, npad_type={}, npad_id={}, device_index={}, parameter1={}, " + "parameter2={}, applet_resource_user_id={}", + parameters.sixaxis_handle.npad_type, parameters.sixaxis_handle.npad_id, + parameters.sixaxis_handle.device_index, parameters.parameter1, + parameters.parameter2, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); @@ -566,6 +567,7 @@ void Hid::GetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) { Controller_NPad::DeviceHandle sixaxis_handle; u64 applet_resource_user_id; }; + static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); f32 parameter1 = 0; f32 parameter2 = 0; @@ -573,13 +575,13 @@ void Hid::GetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) { std::tie(parameter1, parameter2) = applet_resource->GetController<Controller_NPad>(HidController::NPad) - .GetSixAxisFusionParameters(parameters.sixaxis_handle); + .GetSixAxisFusionParameters(); - LOG_WARNING(Service_HID, - "(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.device_index, parameters.applet_resource_user_id); + LOG_WARNING( + Service_HID, + "(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.device_index, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 4}; rb.Push(RESULT_SUCCESS); @@ -593,17 +595,18 @@ void Hid::ResetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) { Controller_NPad::DeviceHandle sixaxis_handle; u64 applet_resource_user_id; }; + static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); const auto parameters{rp.PopRaw<Parameters>()}; applet_resource->GetController<Controller_NPad>(HidController::NPad) - .ResetSixAxisFusionParameters(parameters.sixaxis_handle); + .ResetSixAxisFusionParameters(); - LOG_WARNING(Service_HID, - "(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.device_index, parameters.applet_resource_user_id); + LOG_WARNING( + Service_HID, + "(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.device_index, parameters.applet_resource_user_id); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(RESULT_SUCCESS); |