diff options
| author | 2021-02-01 18:46:26 -0800 | |
|---|---|---|
| committer | 2021-02-01 18:46:26 -0800 | |
| commit | d4ebc9a120d0131d9fbbf428d8468662de7d962c (patch) | |
| tree | 5112f6095c49bc158754d3782344a0853ce290b2 | |
| parent | Merge pull request #5864 from MerryMage/is-thumb (diff) | |
| parent | Only update motion for npad and prevent over scheduling events (diff) | |
| download | yuzu-d4ebc9a120d0131d9fbbf428d8468662de7d962c.tar.gz yuzu-d4ebc9a120d0131d9fbbf428d8468662de7d962c.tar.xz yuzu-d4ebc9a120d0131d9fbbf428d8468662de7d962c.zip | |
Merge pull request #5861 from german77/HandheldFix
hid: Only update motion for npad and prevent over scheduling events
Diffstat (limited to '')
| -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, | |||
| 126 | controller->OnUpdate(core_timing, shared_mem->GetPointer(), SHARED_MEMORY_SIZE); | 126 | controller->OnUpdate(core_timing, shared_mem->GetPointer(), SHARED_MEMORY_SIZE); |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | // If ns_late is higher than the update rate ignore the delay | ||
| 130 | if (ns_late > motion_update_ns) { | ||
| 131 | ns_late = {}; | ||
| 132 | } | ||
| 133 | |||
| 129 | core_timing.ScheduleEvent(pad_update_ns - ns_late, pad_update_event); | 134 | core_timing.ScheduleEvent(pad_update_ns - ns_late, pad_update_event); |
| 130 | } | 135 | } |
| 131 | 136 | ||
| 132 | void IAppletResource::UpdateMotion(std::uintptr_t user_data, std::chrono::nanoseconds ns_late) { | 137 | void IAppletResource::UpdateMotion(std::uintptr_t user_data, std::chrono::nanoseconds ns_late) { |
| 133 | auto& core_timing = system.CoreTiming(); | 138 | auto& core_timing = system.CoreTiming(); |
| 134 | 139 | ||
| 135 | for (const auto& controller : controllers) { | 140 | controllers[static_cast<size_t>(HidController::NPad)]->OnMotionUpdate( |
| 136 | controller->OnMotionUpdate(core_timing, shared_mem->GetPointer(), SHARED_MEMORY_SIZE); | 141 | core_timing, shared_mem->GetPointer(), SHARED_MEMORY_SIZE); |
| 142 | |||
| 143 | // If ns_late is higher than the update rate ignore the delay | ||
| 144 | if (ns_late > motion_update_ns) { | ||
| 145 | ns_late = {}; | ||
| 137 | } | 146 | } |
| 138 | 147 | ||
| 139 | core_timing.ScheduleEvent(motion_update_ns - ns_late, motion_update_event); | 148 | core_timing.ScheduleEvent(motion_update_ns - ns_late, motion_update_event); |