From 60185a56fd60e142c13db53e000d4d9589bd4a4c Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 9 Jun 2014 22:46:54 -0400 Subject: [PATCH] Event: Updated several log messages to be assertions. --- src/core/hle/kernel/event.cpp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp index 0f132e9d6..13b226501 100644 --- a/src/core/hle/kernel/event.cpp +++ b/src/core/hle/kernel/event.cpp @@ -58,10 +58,8 @@ public: */ Result SetPermanentLock(Handle handle, const bool permanent_locked) { Event* evt = g_object_pool.GetFast(handle); - if (!evt) { - ERROR_LOG(KERNEL, "called with unknown handle=0x%08X", handle); - return -1; - } + _assert_msg_(KERNEL, (evt != nullptr), "called, but event is nullptr!"); + evt->permanent_locked = permanent_locked; return 0; } @@ -74,10 +72,8 @@ Result SetPermanentLock(Handle handle, const bool permanent_locked) { */ Result SetEventLocked(const Handle handle, const bool locked) { Event* evt = g_object_pool.GetFast(handle); - if (!evt) { - ERROR_LOG(KERNEL, "called with unknown handle=0x%08X", handle); - return -1; - } + _assert_msg_(KERNEL, (evt != nullptr), "called, but event is nullptr!"); + if (!evt->permanent_locked) { evt->locked = locked; } @@ -91,10 +87,8 @@ Result SetEventLocked(const Handle handle, const bool locked) { */ Result SignalEvent(const Handle handle) { Event* evt = g_object_pool.GetFast(handle); - if (!evt) { - ERROR_LOG(KERNEL, "called with unknown handle=0x%08X", handle); - return -1; - } + _assert_msg_(KERNEL, (evt != nullptr), "called, but event is nullptr!"); + // Resume threads waiting for event to signal bool event_caught = false; for (size_t i = 0; i < evt->waiting_threads.size(); ++i) { @@ -121,10 +115,8 @@ Result SignalEvent(const Handle handle) { */ Result ClearEvent(Handle handle) { Event* evt = g_object_pool.GetFast(handle); - if (!evt) { - ERROR_LOG(KERNEL, "called with unknown handle=0x%08X", handle); - return -1; - } + _assert_msg_(KERNEL, (evt != nullptr), "called, but event is nullptr!"); + if (!evt->permanent_locked) { evt->locked = true; }