diff options
author | Liam <byteslice@airmail.cc> | 2023-08-15 00:12:06 +0200 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2023-08-15 00:12:06 +0200 |
commit | 0bd9a4456c49b1e5de8f659682a814bb4b5854d2 (patch) | |
tree | 1a9575d019cbab012f2dd3f56675be604737f79a /src/core/hle/kernel/svc/svc_synchronization.cpp | |
parent | Merge pull request #11282 from ameerj/glasm-xfb (diff) | |
download | yuzu-0bd9a4456c49b1e5de8f659682a814bb4b5854d2.tar yuzu-0bd9a4456c49b1e5de8f659682a814bb4b5854d2.tar.gz yuzu-0bd9a4456c49b1e5de8f659682a814bb4b5854d2.tar.bz2 yuzu-0bd9a4456c49b1e5de8f659682a814bb4b5854d2.tar.lz yuzu-0bd9a4456c49b1e5de8f659682a814bb4b5854d2.tar.xz yuzu-0bd9a4456c49b1e5de8f659682a814bb4b5854d2.tar.zst yuzu-0bd9a4456c49b1e5de8f659682a814bb4b5854d2.zip |
Diffstat (limited to 'src/core/hle/kernel/svc/svc_synchronization.cpp')
-rw-r--r-- | src/core/hle/kernel/svc/svc_synchronization.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/core/hle/kernel/svc/svc_synchronization.cpp b/src/core/hle/kernel/svc/svc_synchronization.cpp index 366e8ed4a..8ebc1bd1c 100644 --- a/src/core/hle/kernel/svc/svc_synchronization.cpp +++ b/src/core/hle/kernel/svc/svc_synchronization.cpp @@ -4,6 +4,7 @@ #include "common/scope_exit.h" #include "common/scratch_buffer.h" #include "core/core.h" +#include "core/hle/kernel/k_hardware_timer.h" #include "core/hle/kernel/k_process.h" #include "core/hle/kernel/k_readable_event.h" #include "core/hle/kernel/svc.h" @@ -83,9 +84,20 @@ Result WaitSynchronization(Core::System& system, int32_t* out_index, u64 user_ha } }); + // Convert the timeout from nanoseconds to ticks. + s64 timeout; + if (timeout_ns > 0) { + u64 ticks = kernel.HardwareTimer().GetTick(); + ticks += timeout_ns; + ticks += 2; + + timeout = ticks; + } else { + timeout = timeout_ns; + } + // Wait on the objects. - Result res = - KSynchronizationObject::Wait(kernel, out_index, objs.data(), num_handles, timeout_ns); + Result res = KSynchronizationObject::Wait(kernel, out_index, objs.data(), num_handles, timeout); R_SUCCEED_IF(res == ResultSessionClosed); R_RETURN(res); |