From 5f825fc8a8fc64e5b2effe8b3b8fa7f8212d140c Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Sat, 11 Nov 2023 09:45:47 +0200 Subject: [PATCH] implemented posix error return codes --- src/core/hle/libraries/libkernel/thread_management.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/hle/libraries/libkernel/thread_management.cpp b/src/core/hle/libraries/libkernel/thread_management.cpp index e8a7003e..531add18 100644 --- a/src/core/hle/libraries/libkernel/thread_management.cpp +++ b/src/core/hle/libraries/libkernel/thread_management.cpp @@ -233,7 +233,8 @@ int PS4_SYSV_ABI posix_pthread_mutex_init(ScePthreadMutex* mutex, const ScePthre LOG_INFO_IF(log_pthread_file, "posix pthread_mutex_init redirect to scePthreadMutexInit\n"); int result = scePthreadMutexInit(mutex, attr, nullptr); if (result < 0) { - BREAKPOINT(); // posix calls different only for their return values + int rt = result > 0x80020000 && result <= 0x80020065 ? result + -0x80020000 : 1062; + return rt; } return result; } @@ -242,7 +243,8 @@ int PS4_SYSV_ABI posix_pthread_mutex_lock(ScePthreadMutex* mutex) { LOG_INFO_IF(log_pthread_file, "posix pthread_mutex_lock redirect to scePthreadMutexLock\n"); int result = scePthreadMutexLock(mutex); if (result < 0) { - BREAKPOINT(); // posix calls different only for their return values + int rt = result > 0x80020000 && result <= 0x80020065 ? result + -0x80020000 : 1062; + return rt; } return result; } @@ -251,7 +253,8 @@ int PS4_SYSV_ABI posix_pthread_mutex_unlock(ScePthreadMutex* mutex) { LOG_INFO_IF(log_pthread_file, "posix pthread_mutex_unlock redirect to scePthreadMutexUnlock\n"); int result = scePthreadMutexUnlock(mutex); if (result < 0) { - BREAKPOINT(); // posix calls different only for their return values + int rt = result > 0x80020000 && result <= 0x80020065 ? result + -0x80020000 : 1062; + return rt; } return result; }