mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-29 06:46:22 -05:00
Only update motion for npad and prevent over scheduling events
This commit is contained in:
parent
3b4da2d7fa
commit
2489547dc5
1 changed files with 11 additions and 2 deletions
|
@ -126,14 +126,23 @@ void IAppletResource::UpdateControllers(std::uintptr_t user_data,
|
||||||
controller->OnUpdate(core_timing, shared_mem->GetPointer(), SHARED_MEMORY_SIZE);
|
controller->OnUpdate(core_timing, shared_mem->GetPointer(), SHARED_MEMORY_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If ns_late is higher than the update rate ignore the delay
|
||||||
|
if (ns_late > motion_update_ns) {
|
||||||
|
ns_late = {};
|
||||||
|
}
|
||||||
|
|
||||||
core_timing.ScheduleEvent(pad_update_ns - ns_late, pad_update_event);
|
core_timing.ScheduleEvent(pad_update_ns - ns_late, pad_update_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IAppletResource::UpdateMotion(std::uintptr_t user_data, std::chrono::nanoseconds ns_late) {
|
void IAppletResource::UpdateMotion(std::uintptr_t user_data, std::chrono::nanoseconds ns_late) {
|
||||||
auto& core_timing = system.CoreTiming();
|
auto& core_timing = system.CoreTiming();
|
||||||
|
|
||||||
for (const auto& controller : controllers) {
|
controllers[static_cast<size_t>(HidController::NPad)]->OnMotionUpdate(
|
||||||
controller->OnMotionUpdate(core_timing, shared_mem->GetPointer(), SHARED_MEMORY_SIZE);
|
core_timing, shared_mem->GetPointer(), SHARED_MEMORY_SIZE);
|
||||||
|
|
||||||
|
// If ns_late is higher than the update rate ignore the delay
|
||||||
|
if (ns_late > motion_update_ns) {
|
||||||
|
ns_late = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
core_timing.ScheduleEvent(motion_update_ns - ns_late, motion_update_event);
|
core_timing.ScheduleEvent(motion_update_ns - ns_late, motion_update_event);
|
||||||
|
|
Loading…
Reference in a new issue