From 5e0c4b76ac9fefbdbb69840091982b4ecc330019 Mon Sep 17 00:00:00 2001 From: wheremyfoodat Date: Sun, 30 Apr 2023 01:22:43 +0300 Subject: [PATCH] [WaitSyncN] r1 should be -1 on timeout --- src/core/kernel/events.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/kernel/events.cpp b/src/core/kernel/events.cpp index be055d5a..bfaba119 100644 --- a/src/core/kernel/events.cpp +++ b/src/core/kernel/events.cpp @@ -237,7 +237,8 @@ void Kernel::waitSynchronizationN() { } regs[0] = SVCResult::Success; // If the thread times out, this should be adjusted to SVCResult::Timeout - regs[1] = handleCount - 1; // When the thread exits, this will be adjusted to mirror which handle woke us up + // If the thread wakes up without timeout, this will be adjusted to the index of the handle that woke us up + regs[1] = 0xFFFFFFFF; t.waitList.resize(handleCount); t.status = ThreadStatus::WaitSyncAny; t.outPointer = outPointer;