early-access version 1405
This commit is contained in:
parent
a5b435bee2
commit
034d37acaf
5 changed files with 27 additions and 22 deletions
|
@ -1,7 +1,7 @@
|
||||||
yuzu emulator early access
|
yuzu emulator early access
|
||||||
=============
|
=============
|
||||||
|
|
||||||
This is the source code for early-access 1404.
|
This is the source code for early-access 1405.
|
||||||
|
|
||||||
## Legal Notice
|
## Legal Notice
|
||||||
|
|
||||||
|
|
|
@ -17,44 +17,41 @@ namespace Kernel {
|
||||||
class KernelCore;
|
class KernelCore;
|
||||||
|
|
||||||
class KLightConditionVariable {
|
class KLightConditionVariable {
|
||||||
private:
|
|
||||||
KThreadQueue m_thread_queue;
|
|
||||||
|
|
||||||
public:
|
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);
|
WaitImpl(lock, timeout);
|
||||||
lock->Lock();
|
lock->Lock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Broadcast() {
|
void Broadcast() {
|
||||||
KScopedSchedulerLock lk{kernel};
|
KScopedSchedulerLock lk{kernel};
|
||||||
while (m_thread_queue.WakeupFrontThread() != nullptr) {
|
while (thread_queue.WakeupFrontThread() != nullptr) {
|
||||||
/* We want to signal all threads, and so should continue waking up until there's nothing
|
// We want to signal all threads, and so should continue waking up until there's nothing
|
||||||
* to wake. */
|
// to wake.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void WaitImpl(KLightLock* lock, s64 timeout) {
|
void WaitImpl(KLightLock* lock, s64 timeout) {
|
||||||
KThread* owner = GetCurrentThreadPointer(kernel);
|
KThread* owner = GetCurrentThreadPointer(kernel);
|
||||||
// KHardwareTimer* timer;
|
|
||||||
|
|
||||||
/* Sleep the thread. */
|
// Sleep the thread.
|
||||||
{
|
{
|
||||||
KScopedSchedulerLockAndSleep lk(kernel, owner, timeout);
|
KScopedSchedulerLockAndSleep lk(kernel, owner, timeout);
|
||||||
lock->Unlock();
|
lock->Unlock();
|
||||||
|
|
||||||
if (!m_thread_queue.SleepThread(owner)) {
|
if (!thread_queue.SleepThread(owner)) {
|
||||||
lk.CancelSleep();
|
lk.CancelSleep();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cancel the task that the sleep setup. */
|
// Cancel the task that the sleep setup.
|
||||||
kernel.TimeManager().UnscheduleTimeEvent(owner);
|
kernel.TimeManager().UnscheduleTimeEvent(owner);
|
||||||
}
|
}
|
||||||
|
KThreadQueue thread_queue;
|
||||||
KernelCore& kernel;
|
KernelCore& kernel;
|
||||||
};
|
};
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
|
|
@ -13,9 +13,7 @@
|
||||||
#include "core/hle/kernel/svc_results.h"
|
#include "core/hle/kernel/svc_results.h"
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
namespace {
|
|
||||||
constexpr s64 DefaultTimeout = 10000000000; // 10 seconds
|
constexpr s64 DefaultTimeout = 10000000000; // 10 seconds
|
||||||
}
|
|
||||||
|
|
||||||
KResourceLimit::KResourceLimit(KernelCore& kernel, Core::System& system)
|
KResourceLimit::KResourceLimit(KernelCore& kernel, Core::System& system)
|
||||||
: Object{kernel}, lock{kernel}, cond_var{kernel}, kernel{kernel}, system(system) {}
|
: Object{kernel}, lock{kernel}, cond_var{kernel}, kernel{kernel}, system(system) {}
|
||||||
|
|
|
@ -37,7 +37,7 @@ constexpr bool IsValidResourceType(LimitableResource type) {
|
||||||
|
|
||||||
class KResourceLimit final : public Object {
|
class KResourceLimit final : public Object {
|
||||||
public:
|
public:
|
||||||
KResourceLimit(KernelCore& kernel, Core::System& system);
|
explicit KResourceLimit(KernelCore& kernel, Core::System& system);
|
||||||
~KResourceLimit();
|
~KResourceLimit();
|
||||||
|
|
||||||
s64 GetLimitValue(LimitableResource which) const;
|
s64 GetLimitValue(LimitableResource which) const;
|
||||||
|
@ -67,10 +67,11 @@ public:
|
||||||
virtual void Finalize() override {}
|
virtual void Finalize() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::array<s64, static_cast<std::size_t>(LimitableResource::Count)> limit_values{};
|
using ResourceArray = std::array<s64, static_cast<std::size_t>(LimitableResource::Count)>;
|
||||||
std::array<s64, static_cast<std::size_t>(LimitableResource::Count)> current_values{};
|
ResourceArray limit_values{};
|
||||||
std::array<s64, static_cast<std::size_t>(LimitableResource::Count)> current_hints{};
|
ResourceArray current_values{};
|
||||||
std::array<s64, static_cast<std::size_t>(LimitableResource::Count)> peak_values{};
|
ResourceArray current_hints{};
|
||||||
|
ResourceArray peak_values{};
|
||||||
mutable KLightLock lock;
|
mutable KLightLock lock;
|
||||||
s32 waiter_count{};
|
s32 waiter_count{};
|
||||||
KLightConditionVariable cond_var;
|
KLightConditionVariable cond_var;
|
||||||
|
|
|
@ -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