2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

hid: Use nanosecond timestamps instead of ticks

This commit is contained in:
Morph 2023-03-07 19:24:13 -05:00
parent 3053a62375
commit 1073346c7f
2 changed files with 5 additions and 5 deletions

View file

@ -26,7 +26,7 @@ void Controller_Stubbed::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
} }
CommonHeader header{}; CommonHeader header{};
header.timestamp = core_timing.GetCPUTicks(); header.timestamp = core_timing.GetGlobalTimeNs().count();
header.total_entry_count = 17; header.total_entry_count = 17;
header.entry_count = 0; header.entry_count = 0;
header.last_entry_index = 0; header.last_entry_index = 0;

View file

@ -32,7 +32,7 @@ void Controller_Touchscreen::OnInit() {}
void Controller_Touchscreen::OnRelease() {} void Controller_Touchscreen::OnRelease() {}
void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timing) { void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
shared_memory->touch_screen_lifo.timestamp = core_timing.GetCPUTicks(); shared_memory->touch_screen_lifo.timestamp = core_timing.GetGlobalTimeNs().count();
if (!IsControllerActivated()) { if (!IsControllerActivated()) {
shared_memory->touch_screen_lifo.buffer_count = 0; shared_memory->touch_screen_lifo.buffer_count = 0;
@ -85,7 +85,7 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin
const auto active_fingers_count = const auto active_fingers_count =
static_cast<std::size_t>(std::distance(active_fingers.begin(), end_iter)); static_cast<std::size_t>(std::distance(active_fingers.begin(), end_iter));
const u64 tick = core_timing.GetCPUTicks(); const u64 timestamp = static_cast<u64>(core_timing.GetGlobalTimeNs().count());
const auto& last_entry = shared_memory->touch_screen_lifo.ReadCurrentEntry().state; const auto& last_entry = shared_memory->touch_screen_lifo.ReadCurrentEntry().state;
next_state.sampling_number = last_entry.sampling_number + 1; next_state.sampling_number = last_entry.sampling_number + 1;
@ -102,8 +102,8 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin
touch_entry.diameter_x = Settings::values.touchscreen.diameter_x; touch_entry.diameter_x = Settings::values.touchscreen.diameter_x;
touch_entry.diameter_y = Settings::values.touchscreen.diameter_y; touch_entry.diameter_y = Settings::values.touchscreen.diameter_y;
touch_entry.rotation_angle = Settings::values.touchscreen.rotation_angle; touch_entry.rotation_angle = Settings::values.touchscreen.rotation_angle;
touch_entry.delta_time = tick - active_fingers[id].last_touch; touch_entry.delta_time = timestamp - active_fingers[id].last_touch;
fingers[active_fingers[id].id].last_touch = tick; fingers[active_fingers[id].id].last_touch = timestamp;
touch_entry.finger = active_fingers[id].id; touch_entry.finger = active_fingers[id].id;
touch_entry.attribute.raw = active_fingers[id].attribute.raw; touch_entry.attribute.raw = active_fingers[id].attribute.raw;
} else { } else {