From 034d37acaf59bb651c9217637391e8afdab1ef6b Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Tue, 2 Feb 2021 04:27:58 +0100 Subject: [PATCH] early-access version 1405 --- README.md | 2 +- .../hle/kernel/k_light_condition_variable.h | 21 ++++++++----------- src/core/hle/kernel/k_resource_limit.cpp | 2 -- src/core/hle/kernel/k_resource_limit.h | 11 +++++----- src/core/hle/service/hid/hid.cpp | 13 ++++++++++-- 5 files changed, 27 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 92275d9f2..8bfb93e49 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 1404. +This is the source code for early-access 1405. ## Legal Notice diff --git a/src/core/hle/kernel/k_light_condition_variable.h b/src/core/hle/kernel/k_light_condition_variable.h index 26573a239..362d0db28 100755 --- a/src/core/hle/kernel/k_light_condition_variable.h +++ b/src/core/hle/kernel/k_light_condition_variable.h @@ -17,44 +17,41 @@ namespace Kernel { class KernelCore; class KLightConditionVariable { -private: - KThreadQueue m_thread_queue; - public: - KLightConditionVariable(KernelCore& kernel) : m_thread_queue(kernel), kernel(kernel) {} + explicit KLightConditionVariable(KernelCore& kernel) : thread_queue(kernel), kernel(kernel) {} - void Wait(KLightLock* lock, s64 timeout = -1ll) { + void Wait(KLightLock* lock, s64 timeout = -1) { WaitImpl(lock, timeout); lock->Lock(); } void Broadcast() { KScopedSchedulerLock lk{kernel}; - while (m_thread_queue.WakeupFrontThread() != nullptr) { - /* We want to signal all threads, and so should continue waking up until there's nothing - * to wake. */ + while (thread_queue.WakeupFrontThread() != nullptr) { + // We want to signal all threads, and so should continue waking up until there's nothing + // to wake. } } private: void WaitImpl(KLightLock* lock, s64 timeout) { KThread* owner = GetCurrentThreadPointer(kernel); - // KHardwareTimer* timer; - /* Sleep the thread. */ + // Sleep the thread. { KScopedSchedulerLockAndSleep lk(kernel, owner, timeout); lock->Unlock(); - if (!m_thread_queue.SleepThread(owner)) { + if (!thread_queue.SleepThread(owner)) { lk.CancelSleep(); return; } } - /* Cancel the task that the sleep setup. */ + // Cancel the task that the sleep setup. kernel.TimeManager().UnscheduleTimeEvent(owner); } + KThreadQueue thread_queue; KernelCore& kernel; }; } // namespace Kernel diff --git a/src/core/hle/kernel/k_resource_limit.cpp b/src/core/hle/kernel/k_resource_limit.cpp index 3cee8d0f7..ab2ab683f 100755 --- a/src/core/hle/kernel/k_resource_limit.cpp +++ b/src/core/hle/kernel/k_resource_limit.cpp @@ -13,9 +13,7 @@ #include "core/hle/kernel/svc_results.h" namespace Kernel { -namespace { constexpr s64 DefaultTimeout = 10000000000; // 10 seconds -} KResourceLimit::KResourceLimit(KernelCore& kernel, Core::System& system) : Object{kernel}, lock{kernel}, cond_var{kernel}, kernel{kernel}, system(system) {} diff --git a/src/core/hle/kernel/k_resource_limit.h b/src/core/hle/kernel/k_resource_limit.h index 5f916c99c..6b3437ea6 100755 --- a/src/core/hle/kernel/k_resource_limit.h +++ b/src/core/hle/kernel/k_resource_limit.h @@ -37,7 +37,7 @@ constexpr bool IsValidResourceType(LimitableResource type) { class KResourceLimit final : public Object { public: - KResourceLimit(KernelCore& kernel, Core::System& system); + explicit KResourceLimit(KernelCore& kernel, Core::System& system); ~KResourceLimit(); s64 GetLimitValue(LimitableResource which) const; @@ -67,10 +67,11 @@ public: virtual void Finalize() override {} private: - std::array(LimitableResource::Count)> limit_values{}; - std::array(LimitableResource::Count)> current_values{}; - std::array(LimitableResource::Count)> current_hints{}; - std::array(LimitableResource::Count)> peak_values{}; + using ResourceArray = std::array(LimitableResource::Count)>; + ResourceArray limit_values{}; + ResourceArray current_values{}; + ResourceArray current_hints{}; + ResourceArray peak_values{}; mutable KLightLock lock; s32 waiter_count{}; KLightConditionVariable cond_var; diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 5efc1237e..4cee4838c 100755 --- 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(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);