VERY experimental Nintendo Switch 2 emulator
C++
HLE: Updated various handle debug assertions to be more clear.
bunneid7363322c79d
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cppindex eee7c4935e..ee7507edfb 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<Mutex>(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.cppindex da93e006c3..5fdb4fbe65 100644--- a/src/core/hle/kernel/thread.cpp+++ b/src/core/hle/kernel/thread.cpp@@ -353,7 +353,7 @@ Handle CreateThread(const char* name, u32 entry_point, s32 priority, u32 arg, s3/// Get the priority of the thread specified by handleu32 GetThreadPriority(const Handle handle) {Thread* thread = g_object_pool.GetFast<Thread>(handle);- _assert_msg_(KERNEL, thread, "called, but thread is NULL!");+ _assert_msg_(KERNEL, (thread != NULL), "called, but thread is NULL!");return thread->current_priority;}@@ -365,7 +365,7 @@ Result SetThreadPriority(Handle handle, s32 priority) {} else {thread = g_object_pool.GetFast<Thread>(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 rangeif (priority < THREADPRIO_HIGHEST || priority > THREADPRIO_LOWEST) {diff --git a/src/core/hle/service/gsp.cpp b/src/core/hle/service/gsp.cppindex 2635a2eb81..c181e296f8 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.cppindex 0ce8311038..c389bbaace 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<Kernel::Object>(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 objectfor (u32 i = 0; i < handle_count; i++) {bool wait = false;- Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(handles[i]); // 0 handle+ Kernel::Object* object = Kernel::g_object_pool.GetFast<Kernel::Object>(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 mutexResult 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;}