diff options
author | german <german@thesoftwareartisans.com> | 2021-01-24 17:27:04 +0100 |
---|---|---|
committer | german <german@thesoftwareartisans.com> | 2021-01-24 18:28:52 +0100 |
commit | a8245cf2f1f3abb73833baa574b047eaa28d39ca (patch) | |
tree | a078c66b13cfbf9e9d6cde3942b2afac19e80e27 | |
parent | Merge pull request #5808 from ReinUsesLisp/glslang-quiet (diff) | |
download | yuzu-a8245cf2f1f3abb73833baa574b047eaa28d39ca.tar yuzu-a8245cf2f1f3abb73833baa574b047eaa28d39ca.tar.gz yuzu-a8245cf2f1f3abb73833baa574b047eaa28d39ca.tar.bz2 yuzu-a8245cf2f1f3abb73833baa574b047eaa28d39ca.tar.lz yuzu-a8245cf2f1f3abb73833baa574b047eaa28d39ca.tar.xz yuzu-a8245cf2f1f3abb73833baa574b047eaa28d39ca.tar.zst yuzu-a8245cf2f1f3abb73833baa574b047eaa28d39ca.zip |
-rw-r--r-- | src/core/hle/service/hid/controllers/npad.cpp | 18 | ||||
-rw-r--r-- | src/core/hle/service/hid/controllers/npad.h | 5 | ||||
-rw-r--r-- | src/core/hle/service/hid/hid.cpp | 81 | ||||
-rw-r--r-- | src/core/hle/service/hid/hid.h | 3 |
4 files changed, 104 insertions, 3 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index ff783b3cc..265c986e2 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -946,6 +946,24 @@ 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) { + sixaxis_fusion_parameter1 = parameter1; + sixaxis_fusion_parameter2 = parameter2; +} + +std::pair<f32, f32> Controller_NPad::GetSixAxisFusionParameters(const DeviceHandle& handle) { + return { + sixaxis_fusion_parameter1, + sixaxis_fusion_parameter2, + }; +} + +void Controller_NPad::ResetSixAxisFusionParameters(const DeviceHandle& handle) { + sixaxis_fusion_parameter1 = 0.0f; + sixaxis_fusion_parameter2 = 0.0f; +} + void Controller_NPad::MergeSingleJoyAsDualJoy(u32 npad_id_1, u32 npad_id_2) { const auto npad_index_1 = NPadIdToIndex(npad_id_1); const auto npad_index_2 = NPadIdToIndex(npad_id_2); diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index bc85ca4df..bfd06372a 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h @@ -202,6 +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); LedPattern GetLedPattern(u32 npad_id); bool IsUnintendedHomeButtonInputProtectionEnabled(u32 npad_id) const; void SetUnintendedHomeButtonInputProtectionEnabled(bool is_protection_enabled, u32 npad_id); @@ -458,6 +461,8 @@ private: std::array<bool, 10> unintended_home_button_input_protection{}; GyroscopeZeroDriftMode gyroscope_zero_drift_mode{GyroscopeZeroDriftMode::Standard}; bool sixaxis_sensors_enabled{true}; + f32 sixaxis_fusion_parameter1{}; + f32 sixaxis_fusion_parameter2{}; bool sixaxis_at_rest{true}; std::array<ControllerPad, 10> npad_pad_states{}; bool is_in_lr_assignment_mode{false}; diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 2b13d6fe6..7fd3161e8 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -209,9 +209,9 @@ Hid::Hid(Core::System& system_) : ServiceFramework{system_, "hid"} { {67, &Hid::StopSixAxisSensor, "StopSixAxisSensor"}, {68, nullptr, "IsSixAxisSensorFusionEnabled"}, {69, &Hid::EnableSixAxisSensorFusion, "EnableSixAxisSensorFusion"}, - {70, nullptr, "SetSixAxisSensorFusionParameters"}, - {71, nullptr, "GetSixAxisSensorFusionParameters"}, - {72, nullptr, "ResetSixAxisSensorFusionParameters"}, + {70, &Hid::SetSixAxisSensorFusionParameters, "SetSixAxisSensorFusionParameters"}, + {71, &Hid::GetSixAxisSensorFusionParameters, "GetSixAxisSensorFusionParameters"}, + {72, &Hid::ResetSixAxisSensorFusionParameters, "ResetSixAxisSensorFusionParameters"}, {73, nullptr, "SetAccelerometerParameters"}, {74, nullptr, "GetAccelerometerParameters"}, {75, nullptr, "ResetAccelerometerParameters"}, @@ -534,6 +534,81 @@ void Hid::EnableSixAxisSensorFusion(Kernel::HLERequestContext& ctx) { rb.Push(RESULT_SUCCESS); } +void Hid::SetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + struct Parameters { + Controller_NPad::DeviceHandle sixaxis_handle; + f32 parameter1; + f32 parameter2; + u64 applet_resource_user_id; + }; + + const auto parameters{rp.PopRaw<Parameters>()}; + + applet_resource->GetController<Controller_NPad>(HidController::NPad) + .SetSixAxisFusionParameters(parameters.sixaxis_handle, 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); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(RESULT_SUCCESS); +} + +void Hid::GetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + struct Parameters { + Controller_NPad::DeviceHandle sixaxis_handle; + u64 applet_resource_user_id; + }; + + f32 parameter1 = 0; + f32 parameter2 = 0; + const auto parameters{rp.PopRaw<Parameters>()}; + + std::tie(parameter1, parameter2) = + applet_resource->GetController<Controller_NPad>(HidController::NPad) + .GetSixAxisFusionParameters(parameters.sixaxis_handle); + + 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); + rb.Push(parameter1); + rb.Push(parameter2); +} + +void Hid::ResetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + struct Parameters { + Controller_NPad::DeviceHandle sixaxis_handle; + u64 applet_resource_user_id; + }; + + const auto parameters{rp.PopRaw<Parameters>()}; + + applet_resource->GetController<Controller_NPad>(HidController::NPad) + .ResetSixAxisFusionParameters(parameters.sixaxis_handle); + + 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); +} + void Hid::SetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto sixaxis_handle{rp.PopRaw<Controller_NPad::DeviceHandle>()}; diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index b87bfdde1..d991bd721 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h @@ -97,6 +97,9 @@ private: void StartSixAxisSensor(Kernel::HLERequestContext& ctx); void StopSixAxisSensor(Kernel::HLERequestContext& ctx); void EnableSixAxisSensorFusion(Kernel::HLERequestContext& ctx); + void SetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx); + void GetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx); + void ResetSixAxisSensorFusionParameters(Kernel::HLERequestContext& ctx); void SetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx); void GetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx); void ResetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx); |