mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-30 19:44:16 +01:00
Merge pull request #5812 from german77/StubSixaxisFusion
HID: Stub Set/Get/Reset SixaxisSensorFusionParameters
This commit is contained in:
commit
fb0fe3b8c3
@ -946,6 +946,24 @@ void Controller_NPad::SetSixAxisEnabled(bool six_axis_status) {
|
|||||||
sixaxis_sensors_enabled = 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) {
|
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_1 = NPadIdToIndex(npad_id_1);
|
||||||
const auto npad_index_2 = NPadIdToIndex(npad_id_2);
|
const auto npad_index_2 = NPadIdToIndex(npad_id_2);
|
||||||
|
@ -202,6 +202,9 @@ public:
|
|||||||
GyroscopeZeroDriftMode GetGyroscopeZeroDriftMode() const;
|
GyroscopeZeroDriftMode GetGyroscopeZeroDriftMode() const;
|
||||||
bool IsSixAxisSensorAtRest() const;
|
bool IsSixAxisSensorAtRest() const;
|
||||||
void SetSixAxisEnabled(bool six_axis_status);
|
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);
|
LedPattern GetLedPattern(u32 npad_id);
|
||||||
bool IsUnintendedHomeButtonInputProtectionEnabled(u32 npad_id) const;
|
bool IsUnintendedHomeButtonInputProtectionEnabled(u32 npad_id) const;
|
||||||
void SetUnintendedHomeButtonInputProtectionEnabled(bool is_protection_enabled, u32 npad_id);
|
void SetUnintendedHomeButtonInputProtectionEnabled(bool is_protection_enabled, u32 npad_id);
|
||||||
@ -458,6 +461,8 @@ private:
|
|||||||
std::array<bool, 10> unintended_home_button_input_protection{};
|
std::array<bool, 10> unintended_home_button_input_protection{};
|
||||||
GyroscopeZeroDriftMode gyroscope_zero_drift_mode{GyroscopeZeroDriftMode::Standard};
|
GyroscopeZeroDriftMode gyroscope_zero_drift_mode{GyroscopeZeroDriftMode::Standard};
|
||||||
bool sixaxis_sensors_enabled{true};
|
bool sixaxis_sensors_enabled{true};
|
||||||
|
f32 sixaxis_fusion_parameter1{};
|
||||||
|
f32 sixaxis_fusion_parameter2{};
|
||||||
bool sixaxis_at_rest{true};
|
bool sixaxis_at_rest{true};
|
||||||
std::array<ControllerPad, 10> npad_pad_states{};
|
std::array<ControllerPad, 10> npad_pad_states{};
|
||||||
bool is_in_lr_assignment_mode{false};
|
bool is_in_lr_assignment_mode{false};
|
||||||
|
@ -209,9 +209,9 @@ Hid::Hid(Core::System& system_) : ServiceFramework{system_, "hid"} {
|
|||||||
{67, &Hid::StopSixAxisSensor, "StopSixAxisSensor"},
|
{67, &Hid::StopSixAxisSensor, "StopSixAxisSensor"},
|
||||||
{68, nullptr, "IsSixAxisSensorFusionEnabled"},
|
{68, nullptr, "IsSixAxisSensorFusionEnabled"},
|
||||||
{69, &Hid::EnableSixAxisSensorFusion, "EnableSixAxisSensorFusion"},
|
{69, &Hid::EnableSixAxisSensorFusion, "EnableSixAxisSensorFusion"},
|
||||||
{70, nullptr, "SetSixAxisSensorFusionParameters"},
|
{70, &Hid::SetSixAxisSensorFusionParameters, "SetSixAxisSensorFusionParameters"},
|
||||||
{71, nullptr, "GetSixAxisSensorFusionParameters"},
|
{71, &Hid::GetSixAxisSensorFusionParameters, "GetSixAxisSensorFusionParameters"},
|
||||||
{72, nullptr, "ResetSixAxisSensorFusionParameters"},
|
{72, &Hid::ResetSixAxisSensorFusionParameters, "ResetSixAxisSensorFusionParameters"},
|
||||||
{73, nullptr, "SetAccelerometerParameters"},
|
{73, nullptr, "SetAccelerometerParameters"},
|
||||||
{74, nullptr, "GetAccelerometerParameters"},
|
{74, nullptr, "GetAccelerometerParameters"},
|
||||||
{75, nullptr, "ResetAccelerometerParameters"},
|
{75, nullptr, "ResetAccelerometerParameters"},
|
||||||
@ -534,6 +534,81 @@ void Hid::EnableSixAxisSensorFusion(Kernel::HLERequestContext& ctx) {
|
|||||||
rb.Push(RESULT_SUCCESS);
|
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) {
|
void Hid::SetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx) {
|
||||||
IPC::RequestParser rp{ctx};
|
IPC::RequestParser rp{ctx};
|
||||||
const auto sixaxis_handle{rp.PopRaw<Controller_NPad::DeviceHandle>()};
|
const auto sixaxis_handle{rp.PopRaw<Controller_NPad::DeviceHandle>()};
|
||||||
|
@ -97,6 +97,9 @@ private:
|
|||||||
void StartSixAxisSensor(Kernel::HLERequestContext& ctx);
|
void StartSixAxisSensor(Kernel::HLERequestContext& ctx);
|
||||||
void StopSixAxisSensor(Kernel::HLERequestContext& ctx);
|
void StopSixAxisSensor(Kernel::HLERequestContext& ctx);
|
||||||
void EnableSixAxisSensorFusion(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 SetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx);
|
||||||
void GetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx);
|
void GetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx);
|
||||||
void ResetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx);
|
void ResetGyroscopeZeroDriftMode(Kernel::HLERequestContext& ctx);
|
||||||
|
Loading…
Reference in New Issue
Block a user