diff options
author | Narr the Reg <juangerman-13@hotmail.com> | 2021-11-29 19:40:29 +0100 |
---|---|---|
committer | german77 <juangerman-13@hotmail.com> | 2021-12-13 06:26:04 +0100 |
commit | 316f80af87c3290ad3ceda99fe9cf02f1d935b0c (patch) | |
tree | 6b933d2399f02ff42c077d0f2f342b9ffbb21cf5 /src/core/hle/service/hid/controllers/console_sixaxis.cpp | |
parent | Merge pull request #7488 from vonchenplus/support_multiple_videos_playing (diff) | |
download | yuzu-316f80af87c3290ad3ceda99fe9cf02f1d935b0c.tar yuzu-316f80af87c3290ad3ceda99fe9cf02f1d935b0c.tar.gz yuzu-316f80af87c3290ad3ceda99fe9cf02f1d935b0c.tar.bz2 yuzu-316f80af87c3290ad3ceda99fe9cf02f1d935b0c.tar.lz yuzu-316f80af87c3290ad3ceda99fe9cf02f1d935b0c.tar.xz yuzu-316f80af87c3290ad3ceda99fe9cf02f1d935b0c.tar.zst yuzu-316f80af87c3290ad3ceda99fe9cf02f1d935b0c.zip |
Diffstat (limited to 'src/core/hle/service/hid/controllers/console_sixaxis.cpp')
-rw-r--r-- | src/core/hle/service/hid/controllers/console_sixaxis.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/core/hle/service/hid/controllers/console_sixaxis.cpp b/src/core/hle/service/hid/controllers/console_sixaxis.cpp index f0f3105dc..a727b3582 100644 --- a/src/core/hle/service/hid/controllers/console_sixaxis.cpp +++ b/src/core/hle/service/hid/controllers/console_sixaxis.cpp @@ -33,15 +33,14 @@ void Controller_ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_ti const auto& last_entry = seven_sixaxis_lifo.ReadCurrentEntry().state; next_seven_sixaxis_state.sampling_number = last_entry.sampling_number + 1; - // Try to read sixaxis sensor states const auto motion_status = console->GetMotion(); + last_global_timestamp = core_timing.GetGlobalTimeNs().count(); - console_six_axis.is_seven_six_axis_sensor_at_rest = motion_status.is_at_rest; - + // This value increments every time the switch goes to sleep + next_seven_sixaxis_state.unknown = 1; + next_seven_sixaxis_state.timestamp = last_global_timestamp - last_saved_timestamp; next_seven_sixaxis_state.accel = motion_status.accel; - // Zero gyro values as they just mess up with the camera - // Note: Probably a correct sensivity setting must be set - next_seven_sixaxis_state.gyro = {}; + next_seven_sixaxis_state.gyro = motion_status.gyro; next_seven_sixaxis_state.quaternion = { { motion_status.quaternion.xyz.y, @@ -52,9 +51,9 @@ void Controller_ConsoleSixAxis::OnUpdate(const Core::Timing::CoreTiming& core_ti }; console_six_axis.sampling_number++; - // TODO(German77): Find the purpose of those values - console_six_axis.verticalization_error = 0.0f; - console_six_axis.gyro_bias = {0.0f, 0.0f, 0.0f}; + console_six_axis.is_seven_six_axis_sensor_at_rest = motion_status.is_at_rest; + console_six_axis.verticalization_error = motion_status.verticalization_error; + console_six_axis.gyro_bias = motion_status.gyro_bias; // Update console six axis shared memory std::memcpy(data + SHARED_MEMORY_OFFSET, &console_six_axis, sizeof(console_six_axis)); @@ -69,7 +68,6 @@ void Controller_ConsoleSixAxis::SetTransferMemoryPointer(u8* t_mem) { } void Controller_ConsoleSixAxis::ResetTimestamp() { - seven_sixaxis_lifo.buffer_count = 0; - seven_sixaxis_lifo.buffer_tail = 0; + last_saved_timestamp = last_global_timestamp; } } // namespace Service::HID |