diff --git a/src/core/libraries/libc_internal/libc_internal.cpp b/src/core/libraries/libc_internal/libc_internal.cpp index 7e78cf919..9f5df04f8 100644 --- a/src/core/libraries/libc_internal/libc_internal.cpp +++ b/src/core/libraries/libc_internal/libc_internal.cpp @@ -10172,17 +10172,14 @@ s32 PS4_SYSV_ABI internal_getwchar() { return ORBIS_OK; } -tm* PS4_SYSV_ABI internal_gmtime(time_t* timer) { - LOG_DEBUG(Lib_LibcInternal, "called"); - return std::gmtime(timer); +s32 PS4_SYSV_ABI internal_gmtime(time_t* timer) { + LOG_ERROR(Lib_LibcInternal, "(STUBBED) called"); + return ORBIS_OK; } -tm* PS4_SYSV_ABI internal_gmtime_s(time_t* timer, u64 flags) { - LOG_DEBUG(Lib_LibcInternal, "called"); - if (timer == nullptr || flags == 0) { - return 0; - } - return std::gmtime(timer); +s32 PS4_SYSV_ABI internal_gmtime_s(time_t* timer, u64 flags) { + LOG_ERROR(Lib_LibcInternal, "(STUBBED) called"); + return ORBIS_OK; } s32 PS4_SYSV_ABI internal_hypot() { @@ -12478,8 +12475,6 @@ void RegisterlibSceLibcInternal(Core::Loader::SymbolsResolver* sym) { internal__Frprep); LIB_FUNCTION("XwRd4IpNEss", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal__FRteps); - LIB_FUNCTION("ZtjspkJQ+vw", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, - internal__FSin); LIB_FUNCTION("fQ+SWrQUQBg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal__FSincos); LIB_FUNCTION("O4L+0oCN9zA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, @@ -12823,7 +12818,6 @@ void RegisterlibSceLibcInternal(Core::Loader::SymbolsResolver* sym) { internal__Setgloballocale); LIB_FUNCTION("KDFy-aPxHVE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal__Shared_ptr_flag); - LIB_FUNCTION("cCXjU72Z0Ow", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal__Sin); LIB_FUNCTION("j9SGTLclro8", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal__Sincos); LIB_FUNCTION("MU25eqxSDTw", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, diff --git a/src/core/libraries/libc_internal/libc_internal_math.cpp b/src/core/libraries/libc_internal/libc_internal_math.cpp index 363a3758f..781f1f729 100644 --- a/src/core/libraries/libc_internal/libc_internal_math.cpp +++ b/src/core/libraries/libc_internal/libc_internal_math.cpp @@ -566,6 +566,19 @@ s32 PS4_SYSV_ABI internal_tanl() { return ORBIS_OK; } +float PS4_SYSV_ABI internal__Fsin(float arg, unsigned int m, int n) { + ASSERT(n == 0); + if (m != 0) { + return cosf(arg); + } else { + return sinf(arg); + } +} + +double PS4_SYSV_ABI internal__Sin(double x) { + return sin(x); +} + void RegisterlibSceLibcInternalMath(Core::Loader::SymbolsResolver* sym) { LIB_FUNCTION("Ye20uNnlglA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_abs); LIB_FUNCTION("JBcgYuW8lPU", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_acos); @@ -752,6 +765,9 @@ void RegisterlibSceLibcInternalMath(Core::Loader::SymbolsResolver* sym) { LIB_FUNCTION("JCmHsYVc2eo", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_tanhl); LIB_FUNCTION("QL+3q43NfEA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_tanl); + LIB_FUNCTION("ZtjspkJQ+vw", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, + internal__FSin); + LIB_FUNCTION("cCXjU72Z0Ow", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal__Sin); } } // namespace Libraries::LibcInternal diff --git a/src/core/libraries/libc_internal/libc_internal_memory.cpp b/src/core/libraries/libc_internal/libc_internal_memory.cpp index 9f3709cda..6666aa6bf 100644 --- a/src/core/libraries/libc_internal/libc_internal_memory.cpp +++ b/src/core/libraries/libc_internal/libc_internal_memory.cpp @@ -49,18 +49,14 @@ s32 PS4_SYSV_ABI internal__sceLibcGetMallocParam() { return ORBIS_OK; } -void* PS4_SYSV_ABI internal_operator_new(size_t size) { - if (size == 0) { - // Size of 1 is used if 0 is provided. - size = 1; - } - void* ptr = std::malloc(size); - ASSERT_MSG(ptr, "Failed to allocate new object with size {}", size); - return ptr; +s32 PS4_SYSV_ABI internal_operator_new(size_t size) { + LOG_ERROR(Lib_LibcInternal, "(STUBBED) called"); + return ORBIS_OK; } -void* PS4_SYSV_ABI internal_malloc(size_t size) { - return std::malloc(size); +s32 PS4_SYSV_ABI internal_malloc(size_t size) { + LOG_ERROR(Lib_LibcInternal, "(STUBBED) called"); + return ORBIS_OK; } s32 PS4_SYSV_ABI internal_malloc_check_memory_bounds() { diff --git a/src/core/libraries/libc_internal/libc_internal_str.cpp b/src/core/libraries/libc_internal/libc_internal_str.cpp index 6f828cf8e..92a131fa1 100644 --- a/src/core/libraries/libc_internal/libc_internal_str.cpp +++ b/src/core/libraries/libc_internal/libc_internal_str.cpp @@ -168,9 +168,12 @@ s32 PS4_SYSV_ABI internal_strcspn(const char* str1, const char* str2) { return std::strcspn(str1, str2); } -s32 PS4_SYSV_ABI internal_strdup() { - LOG_ERROR(Lib_LibcInternal, "(STUBBED) called"); - return ORBIS_OK; +char* PS4_SYSV_ABI internal_strdup() { + LOG_DEBUG(Lib_LibcInternal, "called"); + char* dup = (char*)std::malloc(std::strlen(str1) + 1); + if (dup != NULL) + strcpy(dup, str1); + return dup; } s32 PS4_SYSV_ABI internal_strerror() {