diff options
author | bunnei <bunneidev@gmail.com> | 2021-02-01 18:46:26 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-01 18:46:26 -0800 |
commit | d4ebc9a120d0131d9fbbf428d8468662de7d962c (patch) | |
tree | 5112f6095c49bc158754d3782344a0853ce290b2 | |
parent | 5e49b81d4dfee576765689a0c9ce30df88be3da1 (diff) | |
parent | 2489547dc5bfd57ccadc392daff9a1b980a06680 (diff) |
Merge pull request #5861 from german77/HandheldFix
hid: Only update motion for npad and prevent over scheduling events
-rw-r--r-- | src/core/hle/service/hid/hid.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 5efc1237e..4cee4838c 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -126,14 +126,23 @@ void IAppletResource::UpdateControllers(std::uintptr_t user_data, 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); } void IAppletResource::UpdateMotion(std::uintptr_t user_data, std::chrono::nanoseconds ns_late) { auto& core_timing = system.CoreTiming(); - for (const auto& controller : controllers) { - controller->OnMotionUpdate(core_timing, shared_mem->GetPointer(), SHARED_MEMORY_SIZE); + controllers[static_cast<size_t>(HidController::NPad)]->OnMotionUpdate( + 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); |