From dae799dbb5ebe4389befb58f55c3a97322a924c4 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Thu, 9 Jul 2020 14:10:18 +0100 Subject: [PATCH] Implement svcClearEvent This removes a signal from a KEvent. It is used by Mario Odyssey. --- app/src/main/cpp/skyline/kernel/svc.cpp | 6 ++++++ app/src/main/cpp/skyline/kernel/svc.h | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/main/cpp/skyline/kernel/svc.cpp b/app/src/main/cpp/skyline/kernel/svc.cpp index 124e9c5d..7eb51f36 100644 --- a/app/src/main/cpp/skyline/kernel/svc.cpp +++ b/app/src/main/cpp/skyline/kernel/svc.cpp @@ -300,6 +300,12 @@ namespace skyline::kernel::svc { } } + void ClearEvent(DeviceState &state) { + auto object = state.process->GetHandle(state.ctx->registers.w0); + object->signalled = false; + state.ctx->registers.w0 = constant::status::Success; + } + void MapSharedMemory(DeviceState &state) { try { auto object = state.process->GetHandle(state.ctx->registers.w0); diff --git a/app/src/main/cpp/skyline/kernel/svc.h b/app/src/main/cpp/skyline/kernel/svc.h index fd788f7e..de853aa5 100644 --- a/app/src/main/cpp/skyline/kernel/svc.h +++ b/app/src/main/cpp/skyline/kernel/svc.h @@ -100,6 +100,11 @@ namespace skyline { */ void SetThreadPriority(DeviceState &state); + /** + * @brief Clears a KEvent of it's signal (https://switchbrew.org/wiki/SVC#ClearEvent) + */ + void ClearEvent(DeviceState &state); + /** * @brief Maps the block supplied by the handle (https://switchbrew.org/wiki/SVC#MapSharedMemory) */ @@ -202,7 +207,7 @@ namespace skyline { nullptr, // 0x0f nullptr, // 0x10 nullptr, // 0x11 - nullptr, // 0x12 + ClearEvent, // 0x12 MapSharedMemory, // 0x13 nullptr, // 0x14 CreateTransferMemory, // 0x15