From 9b59fb0db89de1b7c66f33d8fdf8260a0a51dd69 Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 6 Jun 2014 00:19:40 -0400 Subject: [PATCH] HLE: Updated various handle debug assertions to be more clear. --- src/core/hle/kernel/mutex.cpp | 2 +- src/core/hle/kernel/thread.cpp | 4 ++-- src/core/hle/service/gsp.cpp | 2 +- src/core/hle/svc.cpp | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index eee7c4935..ee7507edf 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp @@ -122,7 +122,7 @@ bool ReleaseMutex(Mutex* mutex) { Result ReleaseMutex(Handle handle) { Mutex* mutex = Kernel::g_object_pool.GetFast(handle); - _assert_msg_(KERNEL, mutex, "ReleaseMutex tried to release a NULL mutex!"); + _assert_msg_(KERNEL, (mutex != NULL), "ReleaseMutex tried to release a NULL mutex!"); if (!ReleaseMutex(mutex)) { return -1; diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index ef67c6924..f0f1dd82d 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp @@ -352,7 +352,7 @@ Handle CreateThread(const char* name, u32 entry_point, s32 priority, u32 arg, s3 /// Get the priority of the thread specified by handle u32 GetThreadPriority(const Handle handle) { Thread* thread = g_object_pool.GetFast(handle); - _assert_msg_(KERNEL, thread, "called, but thread is NULL!"); + _assert_msg_(KERNEL, (thread != NULL), "called, but thread is NULL!"); return thread->current_priority; } @@ -364,7 +364,7 @@ Result SetThreadPriority(Handle handle, s32 priority) { } else { thread = g_object_pool.GetFast(handle); } - _assert_msg_(KERNEL, thread, "called, but thread is NULL!"); + _assert_msg_(KERNEL, (thread != NULL), "called, but thread is NULL!"); // If priority is invalid, clamp to valid range if (priority < THREADPRIO_HIGHEST || priority > THREADPRIO_LOWEST) { diff --git a/src/core/hle/service/gsp.cpp b/src/core/hle/service/gsp.cpp index 2635a2eb8..c181e296f 100644 --- a/src/core/hle/service/gsp.cpp +++ b/src/core/hle/service/gsp.cpp @@ -104,7 +104,7 @@ void RegisterInterruptRelayQueue(Service::Interface* self) { u32 flags = cmd_buff[1]; u32 event_handle = cmd_buff[3]; - _assert_msg_(GSP, event_handle, "called, but event is NULL!"); + _assert_msg_(GSP, (event_handle != 0), "called, but event is NULL!"); g_event_handle = event_handle; diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 0ce831103..c389bbaac 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -81,7 +81,7 @@ Result ConnectToPort(void* _out, const char* port_name) { Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); DEBUG_LOG(SVC, "called port_name=%s", port_name); - _assert_msg_(KERNEL, service, "called, but service is not implemented!"); + _assert_msg_(KERNEL, (service != NULL), "called, but service is not implemented!"); *out = service->GetHandle(); @@ -93,7 +93,7 @@ Result SendSyncRequest(Handle handle) { bool wait = false; Kernel::Object* object = Kernel::g_object_pool.GetFast(handle); - _assert_msg_(KERNEL, object, "called, but kernel object is NULL!"); + _assert_msg_(KERNEL, (object != NULL), "called, but kernel object is NULL!"); DEBUG_LOG(SVC, "called handle=0x%08X(%s)", handle, object->GetTypeName()); Result res = object->SyncRequest(&wait); @@ -122,7 +122,7 @@ Result WaitSynchronization1(Handle handle, s64 nano_seconds) { DEBUG_LOG(SVC, "called handle=0x%08X(%s:%s), nanoseconds=%d", handle, object->GetTypeName(), object->GetName(), nano_seconds); - _assert_msg_(KERNEL, object, "called, but kernel object is NULL!"); + _assert_msg_(KERNEL, (object != NULL), "called, but kernel object is NULL!"); Result res = object->WaitSynchronization(&wait); @@ -150,9 +150,9 @@ Result WaitSynchronizationN(void* _out, void* _handles, u32 handle_count, u32 wa // Iterate through each handle, synchronize kernel object for (u32 i = 0; i < handle_count; i++) { bool wait = false; - Kernel::Object* object = Kernel::g_object_pool.GetFast(handles[i]); // 0 handle + Kernel::Object* object = Kernel::g_object_pool.GetFast(handles[i]); - _assert_msg_(KERNEL, object, "called handle=0x%08X, but kernel object " + _assert_msg_(KERNEL, (object != NULL), "called handle=0x%08X, but kernel object " "is NULL!", handles[i]); DEBUG_LOG(SVC, "\thandle[%d] = 0x%08X(%s:%s)", i, handles[i], object->GetTypeName(), @@ -278,7 +278,7 @@ Result CreateMutex(void* _mutex, u32 initial_locked) { /// Release a mutex Result ReleaseMutex(Handle handle) { DEBUG_LOG(SVC, "called handle=0x%08X", handle); - _assert_msg_(KERNEL, handle, "called, but handle is NULL!"); + _assert_msg_(KERNEL, (handle != 0), "called, but handle is NULL!"); Kernel::ReleaseMutex(handle); return 0; }