From 489dd2c8fc765a9a1fcb601e370df0f8f62bd177 Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Tue, 26 Mar 2024 19:20:55 +0200 Subject: [PATCH] scePthreadMutexattrDestroy again --- .../libraries/libkernel/thread_management.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/core/hle/libraries/libkernel/thread_management.cpp b/src/core/hle/libraries/libkernel/thread_management.cpp index 343a64a8..771391d5 100644 --- a/src/core/hle/libraries/libkernel/thread_management.cpp +++ b/src/core/hle/libraries/libkernel/thread_management.cpp @@ -187,7 +187,6 @@ void* createMutex(void* addr) { int PS4_SYSV_ABI scePthreadMutexInit(ScePthreadMutex* mutex, const ScePthreadMutexattr* attr, const char* name) { - LOG_INFO(Kernel_Pthread, "called"); if (mutex == nullptr) { return SCE_KERNEL_ERROR_EINVAL; } @@ -329,6 +328,23 @@ int PS4_SYSV_ABI scePthreadMutexUnlock(ScePthreadMutex* mutex) { } } +int PS4_SYSV_ABI scePthreadMutexattrDestroy(ScePthreadMutexattr* attr) { + + int result = pthread_mutexattr_destroy(&(*attr)->pth_mutex_attr); + + delete *attr; + *attr = nullptr; + + switch (result) { + case 0: + return SCE_OK; + case ENOMEM: + return SCE_KERNEL_ERROR_ENOMEM; + default: + return SCE_KERNEL_ERROR_EINVAL; + } +} + void* createCond(void* addr) { if (addr == nullptr || *static_cast(addr) != nullptr) { return addr; @@ -470,6 +486,7 @@ void pthreadSymbolsRegister(Loader::SymbolsResolver* sym) { // mutex calls LIB_FUNCTION("cmo1RIYva9o", "libkernel", 1, "libkernel", 1, 1, scePthreadMutexInit); LIB_FUNCTION("F8bUHwAG284", "libkernel", 1, "libkernel", 1, 1, scePthreadMutexattrInit); + LIB_FUNCTION("smWEktiyyG0", "libkernel", 1, "libkernel", 1, 1, scePthreadMutexattrDestroy); LIB_FUNCTION("iMp8QpE+XO4", "libkernel", 1, "libkernel", 1, 1, scePthreadMutexattrSettype); LIB_FUNCTION("1FGvU0i9saQ", "libkernel", 1, "libkernel", 1, 1, scePthreadMutexattrSetprotocol); LIB_FUNCTION("9UK1vLZQft4", "libkernel", 1, "libkernel", 1, 1, scePthreadMutexLock);