diff options
author | bunnei <bunneidev@gmail.com> | 2018-12-04 12:25:40 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-04 12:25:40 -0500 |
commit | d5337676233d2493eefd895901ef499fc49023d9 (patch) | |
tree | d1769fdd7a74f5a4abd4d4aa9d86d8493d1c4dc9 /src/core/hle/kernel/svc.cpp | |
parent | ab2108fb2a485abd50c4ea9459c807f37e8bc3dd (diff) | |
parent | 5eb057f422ac316cd1b943f6cd00aabc673dc238 (diff) |
Merge pull request #1853 from lioncash/event
kernel/object: Amend handle types to distinguish between readable and writable events
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r-- | src/core/hle/kernel/svc.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index b022a7bc5e..812b320057 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -1602,14 +1602,21 @@ static ResultCode ClearEvent(Handle handle) { LOG_TRACE(Kernel_SVC, "called, event=0x{:08X}", handle); const auto& handle_table = Core::CurrentProcess()->GetHandleTable(); - SharedPtr<ReadableEvent> evt = handle_table.Get<ReadableEvent>(handle); - if (evt == nullptr) { - LOG_ERROR(Kernel_SVC, "Event handle does not exist, handle=0x{:08X}", handle); - return ERR_INVALID_HANDLE; + + auto writable_event = handle_table.Get<WritableEvent>(handle); + if (writable_event) { + writable_event->Clear(); + return RESULT_SUCCESS; } - evt->Clear(); - return RESULT_SUCCESS; + auto readable_event = handle_table.Get<ReadableEvent>(handle); + if (readable_event) { + readable_event->Clear(); + return RESULT_SUCCESS; + } + + LOG_ERROR(Kernel_SVC, "Event handle does not exist, handle=0x{:08X}", handle); + return ERR_INVALID_HANDLE; } static ResultCode GetProcessInfo(u64* out, Handle process_handle, u32 type) { |