From f2250fa4852905bcf9e0891f6bccdf94554c1c9d Mon Sep 17 00:00:00 2001 From: Masamune3210 <1053504+Masamune3210@users.noreply.github.com> Date: Thu, 14 May 2026 17:41:14 -0500 Subject: [PATCH] kernel: extend NullWaitObject fix to WaitSynchronization1 (svc 0x24) The previous NullWaitObject fix only covered WaitSynchronizationN (0x25). WaitSynchronization1 (0x24) had the same issue: handle=0 returned ResultInvalidHandle immediately, crashing any process whose wait handle had not been populated yet. Apply the same fix: handle=0 is substituted with a NullWaitObject so the thread sleeps until the timeout expires and receives ResultTimeout, matching real hardware behaviour. Co-Authored-By: Claude Sonnet 4.6 --- src/core/hle/kernel/svc.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 4ef9933fd..ac1ef2c65 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -827,7 +827,15 @@ private: Result SVC::WaitSynchronization1(Handle handle, s64 nano_seconds) { auto object = kernel.GetCurrentProcess()->handle_table.Get(handle); Thread* thread = kernel.GetCurrentThreadManager().GetCurrentThread(); - R_UNLESS(object, ResultInvalidHandle); + if (!object) { + // Null handle (0) behaves as a permanently-unavailable object on real hardware — + // the thread sleeps until the timeout expires and then receives ResultTimeout. + if (handle == 0) { + object = std::make_shared(kernel); + } else { + return ResultInvalidHandle; + } + } LOG_TRACE(Kernel_SVC, "called handle=0x{:08X}({}:{}), nanoseconds={}", handle, object->GetTypeName(), object->GetName(), nano_seconds);