libcInternal HLE fixes (#2491)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / linux-qt-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions

* internal_vprintf was wrong

* reducing the calls to only needed (and tested one) . Fixed strcpy_s

* clang fix

* Added snprintf
This commit is contained in:
georgemoralis 2025-02-22 10:56:35 +02:00 committed by GitHub
parent 8a793f64bf
commit 0aaeea4837
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 900 additions and 21565 deletions

View file

@ -397,20 +397,17 @@ set(VIDEOOUT_LIB src/core/libraries/videoout/buffer.h
src/core/libraries/videoout/videoout_error.h
)
set(LIBC_SOURCES src/core/libraries/libc_internal/libc_internal.cpp
set(HLE_LIBC_INTERNAL_LIB src/core/libraries/libc_internal/libc_internal.cpp
src/core/libraries/libc_internal/libc_internal.h
src/core/libraries/libc_internal/libc_internal_mspace.cpp
src/core/libraries/libc_internal/libc_internal_mspace.h
src/core/libraries/libc_internal/libc_internal_io.cpp
src/core/libraries/libc_internal/libc_internal_io.h
src/core/libraries/libc_internal/libc_internal_memory.cpp
src/core/libraries/libc_internal/libc_internal_memory.h
src/core/libraries/libc_internal/libc_internal_str.cpp
src/core/libraries/libc_internal/libc_internal_str.h
src/core/libraries/libc_internal/libc_internal_stream.cpp
src/core/libraries/libc_internal/libc_internal_stream.h
src/core/libraries/libc_internal/libc_internal_math.cpp
src/core/libraries/libc_internal/libc_internal_math.h
src/core/libraries/libc_internal/printf.h
)
set(IME_LIB src/core/libraries/ime/error_dialog.cpp
@ -665,7 +662,7 @@ set(CORE src/core/aerolib/stubs.cpp
${KERNEL_LIB}
${NETWORK_LIBS}
${SYSTEM_LIBS}
${LIBC_SOURCES}
${HLE_LIBC_INTERNAL_LIB}
${PAD_LIB}
${VIDEOOUT_LIB}
${NP_LIBS}

File diff suppressed because it is too large Load diff

View file

@ -4,469 +4,21 @@
#include <cstdarg>
#include <cstdio>
#include <common/va_ctx.h>
#include "common/assert.h"
#include "common/logging/log.h"
#include "core/libraries/error_codes.h"
#include "core/libraries/libs.h"
#include "libc_internal_io.h"
#include "printf.h"
namespace Libraries::LibcInternal {
s32 PS4_SYSV_ABI internal___vfprintf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
int PS4_SYSV_ABI internal_snprintf(char* s, size_t n, VA_ARGS) {
VA_CTX(ctx);
return snprintf_ctx(s, n, &ctx);
}
s32 PS4_SYSV_ABI internal__Printf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__WPrintf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_asprintf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_fprintf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_fprintf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_fwprintf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_fwprintf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_printf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_printf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_snprintf(char* s, size_t n, const char* format, ...) {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_snprintf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_snwprintf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_sprintf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_sprintf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_swprintf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_swprintf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_swscanf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_swscanf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vasprintf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vfprintf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vfprintf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vfscanf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vfscanf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vfwprintf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vfwprintf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vfwscanf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vfwscanf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vprintf(const char* format, va_list args) {
// Copy the va_list because vsnprintf consumes it
va_list args_copy;
va_copy(args_copy, args);
// Calculate the required buffer size
int size = std::vsnprintf(nullptr, 0, format, args_copy);
va_end(args_copy);
if (size < 0) {
// Handle vsnprintf error
LOG_ERROR(Lib_LibcInternal, "vsnprintf failed to calculate size");
return size;
}
// Create a string with the required size
std::string buffer(size, '\0');
// Format the string into the buffer
int result =
std::vsnprintf(buffer.data(), buffer.size() + 1, format, args); // +1 for null terminator
if (result >= 0) {
// Log the formatted result
LOG_INFO(Lib_LibcInternal, "{}", buffer);
} else {
LOG_ERROR(Lib_LibcInternal, "vsnprintf failed during formatting");
}
return result;
}
s32 PS4_SYSV_ABI internal_vprintf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vscanf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vscanf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vsnprintf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vsnprintf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vsnwprintf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vsprintf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vsprintf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vsscanf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vsscanf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vswprintf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vswprintf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vswscanf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vswscanf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vwprintf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vwprintf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vwscanf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_vwscanf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_wprintf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_wprintf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_wscanf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_wscanf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Scanf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__WScanf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_fscanf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_fscanf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_fwscanf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_fwscanf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_scanf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_scanf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_sscanf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_sscanf_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
void RegisterlibSceLibcInternalIo(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("yAZ5vOpmBus", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal___vfprintf);
LIB_FUNCTION("FModQzwn1-4", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Printf);
LIB_FUNCTION("kvEP5-KOG1U", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__WPrintf);
LIB_FUNCTION("cOYia2dE0Ik", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_asprintf);
LIB_FUNCTION("fffwELXNVFA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_fprintf);
LIB_FUNCTION("-e-F9HjUFp8", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_fprintf_s);
LIB_FUNCTION("ZRAcn3dPVmA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_fwprintf);
LIB_FUNCTION("9kOFELic7Pk", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_fwprintf_s);
LIB_FUNCTION("a6CYO8YOzfw", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_fwscanf);
LIB_FUNCTION("Bo5wtXSj4kc", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_fwscanf_s);
LIB_FUNCTION("hcuQgD53UxM", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_printf);
LIB_FUNCTION("w1NxRBQqfmQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_printf_s);
LIB_FUNCTION("eLdDw6l0-bU", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_snprintf);
LIB_FUNCTION("3BytPOQgVKc", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_snprintf_s);
LIB_FUNCTION("jbj2wBoiCyg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_snwprintf_s);
LIB_FUNCTION("tcVi5SivF7Q", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_sprintf);
LIB_FUNCTION("xEszJVGpybs", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_sprintf_s);
LIB_FUNCTION("1Pk0qZQGeWo", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_sscanf);
LIB_FUNCTION("24m4Z4bUaoY", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_sscanf_s);
LIB_FUNCTION("nJz16JE1txM", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_swprintf);
LIB_FUNCTION("Im55VJ-Bekc", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_swprintf_s);
LIB_FUNCTION("HNnWdT43ues", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_swscanf);
LIB_FUNCTION("tQNolUV1q5A", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_swscanf_s);
LIB_FUNCTION("qjBlw2cVMAM", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vasprintf);
LIB_FUNCTION("pDBDcY6uLSA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vfprintf);
LIB_FUNCTION("GhTZtaodo7o", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vfprintf_s);
LIB_FUNCTION("lckWSkHDBrY", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vfscanf);
LIB_FUNCTION("JjPXy-HX5dY", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vfscanf_s);
LIB_FUNCTION("M2bGWSqt764", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vfwprintf);
LIB_FUNCTION("XX9KWzJvRf0", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vfwprintf_s);
LIB_FUNCTION("WF4fBmip+38", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vfwscanf);
LIB_FUNCTION("Wvm90I-TGl0", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vfwscanf_s);
LIB_FUNCTION("GMpvxPFW924", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vprintf);
LIB_FUNCTION("YfJUGNPkbK4", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vprintf_s);
LIB_FUNCTION("j7Jk3yd3yC8", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vscanf);
LIB_FUNCTION("fQYpcUzy3zo", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vscanf_s);
LIB_FUNCTION("Q2V+iqvjgC0", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vsnprintf);
LIB_FUNCTION("rWSuTWY2JN0", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vsnprintf_s);
LIB_FUNCTION("8SKVXgeK1wY", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vsnwprintf_s);
LIB_FUNCTION("jbz9I9vkqkk", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vsprintf);
LIB_FUNCTION("+qitMEbkSWk", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vsprintf_s);
LIB_FUNCTION("UTrpOVLcoOA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vsscanf);
LIB_FUNCTION("tfNbpqL3D0M", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vsscanf_s);
LIB_FUNCTION("u0XOsuOmOzc", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vswprintf);
LIB_FUNCTION("oDoV9tyHTbA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vswprintf_s);
LIB_FUNCTION("KGotca3AjYw", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vswscanf);
LIB_FUNCTION("39HHkIWrWNo", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vswscanf_s);
LIB_FUNCTION("QuF2rZGE-v8", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vwprintf);
LIB_FUNCTION("XPrliF5n-ww", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vwprintf_s);
LIB_FUNCTION("QNwdOK7HfJU", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vwscanf);
LIB_FUNCTION("YgZ6qvFH3QI", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_vwscanf_s);
LIB_FUNCTION("OGVdXU3E-xg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_wprintf);
LIB_FUNCTION("FEtOJURNey0", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_wprintf_s);
LIB_FUNCTION("D8JBAR3RiZQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_wscanf);
LIB_FUNCTION("RV7X3FrWfTI", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_wscanf_s);
LIB_FUNCTION("s+MeMHbB1Ro", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Scanf);
LIB_FUNCTION("fzgkSILqRHE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__WScanf);
LIB_FUNCTION("npLpPTaSuHg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_fscanf);
LIB_FUNCTION("vj2WUi2LrfE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_fscanf_s);
LIB_FUNCTION("7XEv6NnznWw", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_scanf);
LIB_FUNCTION("-B76wP6IeVA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_scanf_s);
}
} // namespace Libraries::LibcInternal
} // namespace Libraries::LibcInternal

View file

@ -5,769 +5,152 @@
#include "common/logging/log.h"
#include "core/libraries/error_codes.h"
#include "core/libraries/libs.h"
#include "libc_internal_mspace.h"
namespace Libraries::LibcInternal {
s32 PS4_SYSV_ABI internal_abs() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
double PS4_SYSV_ABI internal_sin(double x) {
return std::sin(x);
}
double PS4_SYSV_ABI internal_acos(double x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::acos(x);
}
float PS4_SYSV_ABI internal_acosf(float x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::acosf(x);
}
float PS4_SYSV_ABI internal_acosh(float x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::acosh(x);
}
float PS4_SYSV_ABI internal_acoshf(float x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::acoshf(x);
}
float PS4_SYSV_ABI internal_acoshl(float x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::acoshl(x);
}
float PS4_SYSV_ABI internal_acosl(float x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::acosl(x);
}
double PS4_SYSV_ABI internal_asin(double x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::asin(x);
}
float PS4_SYSV_ABI internal_asinf(float x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::asinf(x);
}
float PS4_SYSV_ABI internal_asinh(float x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::asinh(x);
}
float PS4_SYSV_ABI internal_asinhf(float x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::asinhf(x);
}
float PS4_SYSV_ABI internal_asinhl(float x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::asinhl(x);
}
float PS4_SYSV_ABI internal_asinl(float x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::asinl(x);
}
double PS4_SYSV_ABI internal_atan(double x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::atan(x);
}
double PS4_SYSV_ABI internal_atan2(double y, double x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::atan2(y, x);
}
s32 PS4_SYSV_ABI internal_atan2f() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_atan2l() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_atanf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_atanh() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_atanhf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_atanhl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_atanl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_ceil() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_ceilf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_ceill() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
float PS4_SYSV_ABI internal_sinf(float x) {
return std::sinf(x);
}
double PS4_SYSV_ABI internal_cos(double x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::cos(x);
}
float PS4_SYSV_ABI internal_cosf(float x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::cosf(x);
}
s32 PS4_SYSV_ABI internal_cosh() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_coshf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_coshl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_cosl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
double PS4_SYSV_ABI internal_exp(double x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::exp(x);
}
double PS4_SYSV_ABI internal_exp2(double x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::exp2(x);
}
float PS4_SYSV_ABI internal_exp2f(float x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::exp2f(x);
}
float PS4_SYSV_ABI internal_exp2l(float x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::exp2l(x);
}
float PS4_SYSV_ABI internal_expf(float x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::expf(x);
}
s32 PS4_SYSV_ABI internal_expl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_expm1() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_expm1f() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_expm1l() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_fabs() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_fabsf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_fabsl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_floor() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_floorf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_floorl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_fmax() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_fmaxf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_fmaxl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_fmin() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_fminf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_fminl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_fmod() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_fmodf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_fmodl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_frexp() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_frexpf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_frexpl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_ilogb() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_ilogbf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_ilogbl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_imaxabs() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_imaxdiv() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_isinf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_islower() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_isnan() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_isnanf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_isupper() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_log() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_log10() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
float PS4_SYSV_ABI internal_log10f(float x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::log10f(x);
}
s32 PS4_SYSV_ABI internal_log10l() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_log1p() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_log1pf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_log1pl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_log2() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_log2f() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_log2l() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_logb() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_logbf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_logbl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_logf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_logl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_lround() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_lroundf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_lroundl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_nan() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_nanf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_nanl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
double PS4_SYSV_ABI internal_pow(double x, double y) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::pow(x, y);
}
float PS4_SYSV_ABI internal_powf(float x, float y) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::powf(x, y);
}
s32 PS4_SYSV_ABI internal_powl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_remainder() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
double PS4_SYSV_ABI internal_sin(double x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::sin(x);
}
void PS4_SYSV_ABI internal_sincos(double x, double* sinp, double* cosp) {
LOG_DEBUG(Lib_LibcInternal, "called");
*sinp = std::sin(x);
*cosp = std::cos(x);
}
void PS4_SYSV_ABI internal_sincosf(double x, double* sinp, double* cosp) {
LOG_DEBUG(Lib_LibcInternal, "called");
void PS4_SYSV_ABI internal_sincosf(float x, float* sinp, float* cosp) {
*sinp = std::sinf(x);
*cosp = std::cosf(x);
}
float PS4_SYSV_ABI internal_sinf(float x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::sinf(x);
double PS4_SYSV_ABI internal_tan(double x) {
return std::tan(x);
}
float PS4_SYSV_ABI internal_sinh(float x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::sinh(x);
float PS4_SYSV_ABI internal_tanf(float x) {
return std::tanf(x);
}
float PS4_SYSV_ABI internal_sinhf(float x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::sinhf(x);
double PS4_SYSV_ABI internal_asin(double x) {
return std::asin(x);
}
float PS4_SYSV_ABI internal_sinhl(float x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::sinhl(x);
float PS4_SYSV_ABI internal_asinf(float x) {
return std::asinf(x);
}
float PS4_SYSV_ABI internal_sinl(float x) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::sinl(x);
double PS4_SYSV_ABI internal_acos(double x) {
return std::acos(x);
}
s32 PS4_SYSV_ABI internal_sqrt() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
float PS4_SYSV_ABI internal_acosf(float x) {
return std::acosf(x);
}
s32 PS4_SYSV_ABI internal_sqrtf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
double PS4_SYSV_ABI internal_atan(double x) {
return std::atan(x);
}
s32 PS4_SYSV_ABI internal_sqrtl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
float PS4_SYSV_ABI internal_atanf(float x) {
return std::atanf(x);
}
s32 PS4_SYSV_ABI internal_srand() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
double PS4_SYSV_ABI internal_atan2(double y, double x) {
return std::atan2(y, x);
}
s32 PS4_SYSV_ABI internal_tan() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
float PS4_SYSV_ABI internal_atan2f(float y, float x) {
return std::atan2f(y, x);
}
s32 PS4_SYSV_ABI internal_tanf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
double PS4_SYSV_ABI internal_exp(double x) {
return std::exp(x);
}
s32 PS4_SYSV_ABI internal_tanh() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
float PS4_SYSV_ABI internal_expf(float x) {
return std::expf(x);
}
s32 PS4_SYSV_ABI internal_tanhf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
double PS4_SYSV_ABI internal_exp2(double x) {
return std::exp2(x);
}
s32 PS4_SYSV_ABI internal_tanhl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
float PS4_SYSV_ABI internal_exp2f(float x) {
return std::exp2f(x);
}
s32 PS4_SYSV_ABI internal_tanl() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
double PS4_SYSV_ABI internal_pow(double x, double y) {
return std::pow(x, y);
}
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);
}
float PS4_SYSV_ABI internal_powf(float x, float y) {
return std::powf(x, y);
}
double PS4_SYSV_ABI internal__Sin(double x) {
return sin(x);
double PS4_SYSV_ABI internal_log(double x) {
return std::log(x);
}
float PS4_SYSV_ABI internal_logf(float x) {
return std::logf(x);
}
double PS4_SYSV_ABI internal_log10(double x) {
return std::log10(x);
}
float PS4_SYSV_ABI internal_log10f(float x) {
return std::log10f(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);
LIB_FUNCTION("QI-x0SL8jhw", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_acosf);
LIB_FUNCTION("Fk7-KFKZi-8", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_acosh);
LIB_FUNCTION("XJp2C-b0tRU", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_acoshf);
LIB_FUNCTION("u14Y1HFh0uY", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_acoshl);
LIB_FUNCTION("iH4YAIRcecA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_acosl);
LIB_FUNCTION("7Ly52zaL44Q", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_asin);
LIB_FUNCTION("GZWjF-YIFFk", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_asinf);
LIB_FUNCTION("2eQpqTjJ5Y4", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_asinh);
LIB_FUNCTION("yPPtp1RMihw", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_asinhf);
LIB_FUNCTION("iCl-Z-g-uuA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_asinhl);
LIB_FUNCTION("Nx-F5v0-qU8", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_asinl);
LIB_FUNCTION("OXmauLdQ8kY", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_atan);
LIB_FUNCTION("HUbZmOnT-Dg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_atan2);
LIB_FUNCTION("EH-x713A99c", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_atan2f);
LIB_FUNCTION("9VeY8wiqf8M", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_atan2l);
LIB_FUNCTION("weDug8QD-lE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_atanf);
LIB_FUNCTION("YjbpxXpi6Zk", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_atanh);
LIB_FUNCTION("cPGyc5FGjy0", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_atanhf);
LIB_FUNCTION("a3BNqojL4LM", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_atanhl);
LIB_FUNCTION("KvOHPTz595Y", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_atanl);
LIB_FUNCTION("gacfOmO8hNs", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_ceil);
LIB_FUNCTION("GAUuLKGhsCw", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_ceilf);
LIB_FUNCTION("aJKn6X+40Z8", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_ceill);
LIB_FUNCTION("H8ya2H00jbI", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_sin);
LIB_FUNCTION("Q4rRL34CEeE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_sinf);
LIB_FUNCTION("2WE3BTYVwKM", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_cos);
LIB_FUNCTION("-P6FNMzk2Kc", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_cosf);
LIB_FUNCTION("m7iLTaO9RMs", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_cosh);
LIB_FUNCTION("RCQAffkEh9A", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_coshf);
LIB_FUNCTION("XK2R46yx0jc", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_coshl);
LIB_FUNCTION("x8dc5Y8zFgc", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_cosl);
LIB_FUNCTION("NVadfnzQhHQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_exp);
LIB_FUNCTION("dnaeGXbjP6E", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_exp2);
LIB_FUNCTION("wuAQt-j+p4o", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_exp2f);
LIB_FUNCTION("9O1Xdko-wSo", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_exp2l);
LIB_FUNCTION("8zsu04XNsZ4", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_expf);
LIB_FUNCTION("qMp2fTDCyMo", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_expl);
LIB_FUNCTION("gqKfOiJaCOo", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_expm1);
LIB_FUNCTION("3EgxfDRefdw", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_expm1f);
LIB_FUNCTION("jVS263HH1b0", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_expm1l);
LIB_FUNCTION("388LcMWHRCA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_fabs);
LIB_FUNCTION("fmT2cjPoWBs", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_fabsf);
LIB_FUNCTION("w-AryX51ObA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_fabsl);
LIB_FUNCTION("mpcTgMzhUY8", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_floor);
LIB_FUNCTION("mKhVDmYciWA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_floorf);
LIB_FUNCTION("06QaR1Cpn-k", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_floorl);
LIB_FUNCTION("fiOgmWkP+Xc", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_fmax);
LIB_FUNCTION("Lyx2DzUL7Lc", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_fmaxf);
LIB_FUNCTION("0H5TVprQSkA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_fmaxl);
LIB_FUNCTION("iU0z6SdUNbI", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_fmin);
LIB_FUNCTION("uVRcM2yFdP4", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_fminf);
LIB_FUNCTION("DQ7K6s8euWY", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_fminl);
LIB_FUNCTION("pKwslsMUmSk", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_fmod);
LIB_FUNCTION("88Vv-AzHVj8", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_fmodf);
LIB_FUNCTION("A1R5T0xOyn8", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_fmodl);
LIB_FUNCTION("kA-TdiOCsaY", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_frexp);
LIB_FUNCTION("aaDMGGkXFxo", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_frexpf);
LIB_FUNCTION("YZk9sHO0yNg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_frexpl);
LIB_FUNCTION("h6pVBKjcLiU", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_ilogb);
LIB_FUNCTION("0dQrYWd7g94", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_ilogbf);
LIB_FUNCTION("wXs12eD3uvA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_ilogbl);
LIB_FUNCTION("UgZ7Rhk60cQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_imaxabs);
LIB_FUNCTION("V0X-mrfdM9E", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_imaxdiv);
LIB_FUNCTION("2q5PPh7HsKE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_isinf);
LIB_FUNCTION("KqYTqtSfGos", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_islower);
LIB_FUNCTION("20qj+7O69XY", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_isnan);
LIB_FUNCTION("3pF7bUSIH8o", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_isnanf);
LIB_FUNCTION("GcFKlTJEMkI", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_isupper);
LIB_FUNCTION("rtV7-jWC6Yg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_log);
LIB_FUNCTION("WuMbPBKN1TU", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_log10);
LIB_FUNCTION("lhpd6Wk6ccs", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_log10f);
LIB_FUNCTION("CT4aR0tBgkQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_log10l);
LIB_FUNCTION("VfsML+n9cDM", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_log1p);
LIB_FUNCTION("MFe91s8apQk", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_log1pf);
LIB_FUNCTION("77qd0ksTwdI", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_log1pl);
LIB_FUNCTION("Y5DhuDKGlnQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_log2);
LIB_FUNCTION("hsi9drzHR2k", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_log2f);
LIB_FUNCTION("CfOrGjBj-RY", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_log2l);
LIB_FUNCTION("owKuegZU4ew", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_logb);
LIB_FUNCTION("RWqyr1OKuw4", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_logbf);
LIB_FUNCTION("txJTOe0Db6M", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_logbl);
LIB_FUNCTION("RQXLbdT2lc4", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_logf);
LIB_FUNCTION("EiHf-aLDImI", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_logl);
LIB_FUNCTION("J3XuGS-cC0Q", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_lround);
LIB_FUNCTION("C6gWCWJKM+U", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_lroundf);
LIB_FUNCTION("4ITASgL50uc", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_lroundl);
LIB_FUNCTION("zck+6bVj5pA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_nan);
LIB_FUNCTION("DZU+K1wozGI", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_nanf);
LIB_FUNCTION("ZUvemFIkkhQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_nanl);
LIB_FUNCTION("9LCjpWyQ5Zc", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_pow);
LIB_FUNCTION("1D0H2KNjshE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_powf);
LIB_FUNCTION("95V3PF0kUEA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_powl);
LIB_FUNCTION("pv2etu4pocs", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_remainder);
LIB_FUNCTION("H8ya2H00jbI", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_sin);
LIB_FUNCTION("jMB7EFyu30Y", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_sincos);
LIB_FUNCTION("pztV4AF18iI", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_sincosf);
LIB_FUNCTION("Q4rRL34CEeE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_sinf);
LIB_FUNCTION("ZjtRqSMJwdw", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_sinh);
LIB_FUNCTION("1t1-JoZ0sZQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_sinhf);
LIB_FUNCTION("lYdqBvDgeHU", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_sinhl);
LIB_FUNCTION("vxgqrJxDPHo", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_sinl);
LIB_FUNCTION("MXRNWnosNlM", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_sqrt);
LIB_FUNCTION("Q+xU11-h0xQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_sqrtf);
LIB_FUNCTION("RIkUZRadZgc", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_sqrtl);
LIB_FUNCTION("VPbJwTCgME0", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_srand);
LIB_FUNCTION("T7uyNqP7vQA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_tan);
LIB_FUNCTION("ZE6RNL+eLbk", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_tanf);
LIB_FUNCTION("JM4EBvWT9rc", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_tanh);
LIB_FUNCTION("SAd0Z3wKwLA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_tanhf);
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);
LIB_FUNCTION("7Ly52zaL44Q", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_asin);
LIB_FUNCTION("GZWjF-YIFFk", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_asinf);
LIB_FUNCTION("JBcgYuW8lPU", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_acos);
LIB_FUNCTION("QI-x0SL8jhw", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_acosf);
LIB_FUNCTION("OXmauLdQ8kY", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_atan);
LIB_FUNCTION("weDug8QD-lE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_atanf);
LIB_FUNCTION("HUbZmOnT-Dg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_atan2);
LIB_FUNCTION("EH-x713A99c", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_atan2f);
LIB_FUNCTION("NVadfnzQhHQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_exp);
LIB_FUNCTION("8zsu04XNsZ4", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_expf);
LIB_FUNCTION("dnaeGXbjP6E", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_exp2);
LIB_FUNCTION("wuAQt-j+p4o", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_exp2f);
LIB_FUNCTION("9LCjpWyQ5Zc", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_pow);
LIB_FUNCTION("1D0H2KNjshE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_powf);
LIB_FUNCTION("rtV7-jWC6Yg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_log);
LIB_FUNCTION("RQXLbdT2lc4", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_logf);
LIB_FUNCTION("WuMbPBKN1TU", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_log10);
LIB_FUNCTION("lhpd6Wk6ccs", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_log10f);
}
} // namespace Libraries::LibcInternal

View file

@ -9,123 +9,15 @@
namespace Libraries::LibcInternal {
s32 PS4_SYSV_ABI internal__malloc_finalize_lv2() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__malloc_fini() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__malloc_init() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__malloc_init_lv2() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__malloc_postfork() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__malloc_prefork() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__malloc_thread_cleanup() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__sceLibcGetMallocParam() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_operator_new(size_t size) {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
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() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_malloc_finalize() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_malloc_get_footer_value() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_malloc_get_malloc_state() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_malloc_initialize() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_malloc_report_memory_blocks() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_malloc_stats() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_malloc_stats_fast() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_malloc_usable_size() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_memalign() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_memchr() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_memcmp(const void* s1, const void* s2, size_t n) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::memcmp(s1, s2, n);
void* PS4_SYSV_ABI internal_memset(void* s, int c, size_t n) {
return std::memset(s, c, n);
}
void* PS4_SYSV_ABI internal_memcpy(void* dest, const void* src, size_t n) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::memcpy(dest, src, n);
}
s32 PS4_SYSV_ABI internal_memcpy_s(void* dest, size_t destsz, const void* src, size_t count) {
LOG_DEBUG(Lib_LibcInternal, "called");
#ifdef _WIN64
return memcpy_s(dest, destsz, src, count);
#else
@ -134,181 +26,20 @@ s32 PS4_SYSV_ABI internal_memcpy_s(void* dest, size_t destsz, const void* src, s
#endif
}
s32 PS4_SYSV_ABI internal_memmove(void* d, void* s, size_t n) {
LOG_DEBUG(Lib_LibcInternal, "called");
std::memmove(d, s, n);
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_memmove_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_memrchr() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
void* PS4_SYSV_ABI internal_memset(void* s, int c, size_t n) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::memset(s, c, n);
}
s32 PS4_SYSV_ABI internal_memset_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_posix_memalign() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_realloc() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_reallocalign() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_reallocf() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_wmemchr() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_wmemcmp() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_wmemcpy() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_wmemcpy_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_wmemmove() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_wmemmove_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_wmemset() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
void PS4_SYSV_ABI internal_operator_delete(void* ptr) {
if (ptr) {
std::free(ptr);
}
}
void PS4_SYSV_ABI internal_free(void* ptr) {
std::free(ptr);
s32 PS4_SYSV_ABI internal_memcmp(const void* s1, const void* s2, size_t n) {
return std::memcmp(s1, s2, n);
}
void RegisterlibSceLibcInternalMemory(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("RnqlvEmvkdw", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__malloc_finalize_lv2);
LIB_FUNCTION("21KFhEQDJ3s", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__malloc_fini);
LIB_FUNCTION("z8GPiQwaAEY", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__malloc_init);
LIB_FUNCTION("20cUk0qX9zo", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__malloc_init_lv2);
LIB_FUNCTION("V94pLruduLg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__malloc_postfork);
LIB_FUNCTION("aLYyS4Kx6rQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__malloc_prefork);
LIB_FUNCTION("Sopthb9ztZI", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__malloc_thread_cleanup);
LIB_FUNCTION("1nZ4Xfnyp38", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__sceLibcGetMallocParam);
LIB_FUNCTION("fJnpuVVBbKk", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_operator_new);
LIB_FUNCTION("cVSk9y8URbc", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_posix_memalign);
LIB_FUNCTION("Ujf3KzMvRmI", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_memalign);
LIB_FUNCTION("8u8lPzUEq+U", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_memchr);
LIB_FUNCTION("DfivPArhucg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_memcmp);
LIB_FUNCTION("Q3VBxCXhUHs", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_memcpy);
LIB_FUNCTION("NFLs+dRJGNg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_memcpy_s);
LIB_FUNCTION("+P6FRGH4LfA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_memmove);
LIB_FUNCTION("B59+zQQCcbU", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_memmove_s);
LIB_FUNCTION("5G2ONUzRgjY", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_memrchr);
LIB_FUNCTION("Q3VBxCXhUHs", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_memcpy);
LIB_FUNCTION("8zTFvBIAIN8", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_memset);
LIB_FUNCTION("h8GwqPFbu6I", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_memset_s);
LIB_FUNCTION("Y7aJ1uydPMo", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_realloc);
LIB_FUNCTION("OGybVuPAhAY", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_reallocalign);
LIB_FUNCTION("YMZO9ChZb0E", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_reallocf);
LIB_FUNCTION("fnUEjBCNRVU", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_wmemchr);
LIB_FUNCTION("QJ5xVfKkni0", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_wmemcmp);
LIB_FUNCTION("fL3O02ypZFE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_wmemcpy);
LIB_FUNCTION("BTsuaJ6FxKM", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_wmemcpy_s);
LIB_FUNCTION("Noj9PsJrsa8", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_wmemmove);
LIB_FUNCTION("F8b+Wb-YQVs", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_wmemmove_s);
LIB_FUNCTION("Al8MZJh-4hM", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_wmemset);
LIB_FUNCTION("gQX+4GDQjpM", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_malloc);
LIB_FUNCTION("ECOPpUQEch0", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_malloc_check_memory_bounds);
LIB_FUNCTION("J6FoFNydpFI", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_malloc_finalize);
LIB_FUNCTION("SlG1FN-y0N0", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_malloc_get_footer_value);
LIB_FUNCTION("Nmezc1Lh7TQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_malloc_get_malloc_state);
LIB_FUNCTION("owT6zLJxrTs", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_malloc_initialize);
LIB_FUNCTION("0F08WOP8G3s", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_malloc_report_memory_blocks);
LIB_FUNCTION("CC-BLMBu9-I", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_malloc_stats);
LIB_FUNCTION("KuOuD58hqn4", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_malloc_stats_fast);
LIB_FUNCTION("NDcSfcYZRC8", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_malloc_usable_size);
LIB_FUNCTION("MLWl90SFWNE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_operator_delete);
LIB_FUNCTION("tIhsqj0qsFE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1, internal_free);
LIB_FUNCTION("DfivPArhucg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_memcmp);
}
} // namespace Libraries::LibcInternal

View file

@ -1,247 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/assert.h"
#include "common/logging/log.h"
#include "core/libraries/error_codes.h"
#include "core/libraries/libs.h"
#include "libc_internal_mspace.h"
namespace Libraries::LibcInternal {
s32 PS4_SYSV_ABI sceLibcMspaceAlignedAlloc() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcMspaceCalloc() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
void* PS4_SYSV_ABI sceLibcMspaceCreate(char* name, u64 param_2, u64 param_3, u32 param_4,
s8* param_5) {
UNREACHABLE_MSG("Missing sceLibcMspace impementation!");
return 0;
}
s32 PS4_SYSV_ABI sceLibcMspaceDestroy() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcMspaceFree() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcMspaceGetAddressRanges() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcMspaceIsHeapEmpty() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcMspaceMalloc() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcMspaceMallocStats() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcMspaceMallocStatsFast() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcMspaceMallocUsableSize() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcMspaceMemalign() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcMspacePosixMemalign() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcMspaceRealloc() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcMspaceReallocalign() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcMspaceSetMallocCallback() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcPafMspaceCalloc() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcPafMspaceCheckMemoryBounds() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcPafMspaceCreate() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcPafMspaceDestroy() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcPafMspaceFree() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcPafMspaceGetFooterValue() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcPafMspaceIsHeapEmpty() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcPafMspaceMalloc() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcPafMspaceMallocStats() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcPafMspaceMallocStatsFast() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcPafMspaceMallocUsableSize() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcPafMspaceMemalign() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcPafMspacePosixMemalign() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcPafMspaceRealloc() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcPafMspaceReallocalign() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcPafMspaceReportMemoryBlocks() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI sceLibcPafMspaceTrim() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
void RegisterlibSceLibcInternalMspace(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("ljkqMcC4-mk", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcMspaceAlignedAlloc);
LIB_FUNCTION("LYo3GhIlB38", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcMspaceCalloc);
LIB_FUNCTION("-hn1tcVHq5Q", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcMspaceCreate);
LIB_FUNCTION("W6SiVSiCDtI", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcMspaceDestroy);
LIB_FUNCTION("Vla-Z+eXlxo", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcMspaceFree);
LIB_FUNCTION("raRgiuQfvWk", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcMspaceGetAddressRanges);
LIB_FUNCTION("pzUa7KEoydw", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcMspaceIsHeapEmpty);
LIB_FUNCTION("OJjm-QOIHlI", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcMspaceMalloc);
LIB_FUNCTION("mfHdJTIvhuo", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcMspaceMallocStats);
LIB_FUNCTION("k04jLXu3+Ic", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcMspaceMallocStatsFast);
LIB_FUNCTION("fEoW6BJsPt4", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcMspaceMallocUsableSize);
LIB_FUNCTION("iF1iQHzxBJU", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcMspaceMemalign);
LIB_FUNCTION("qWESlyXMI3E", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcMspacePosixMemalign);
LIB_FUNCTION("gigoVHZvVPE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcMspaceRealloc);
LIB_FUNCTION("p6lrRW8-MLY", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcMspaceReallocalign);
LIB_FUNCTION("+CbwGRMnlfU", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcMspaceSetMallocCallback);
LIB_FUNCTION("-lZdT34nAAE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcPafMspaceCalloc);
LIB_FUNCTION("Pcq7UoYAcFE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcPafMspaceCheckMemoryBounds);
LIB_FUNCTION("6hdfGRKHefs", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcPafMspaceCreate);
LIB_FUNCTION("qB5nGjWa-bk", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcPafMspaceDestroy);
LIB_FUNCTION("9mMuuhXMwqQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcPafMspaceFree);
LIB_FUNCTION("kv4kgdjswN0", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcPafMspaceGetFooterValue);
LIB_FUNCTION("htdTOnMxDbQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcPafMspaceIsHeapEmpty);
LIB_FUNCTION("QuZzFJD5Hrw", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcPafMspaceMalloc);
LIB_FUNCTION("mO8NB8whKy8", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcPafMspaceMallocStats);
LIB_FUNCTION("OmG3YPCBLJs", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcPafMspaceMallocStatsFast);
LIB_FUNCTION("6JcY5RDA4jY", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcPafMspaceMallocUsableSize);
LIB_FUNCTION("PKJcFUfhKtw", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcPafMspaceMemalign);
LIB_FUNCTION("7hOUKGcT6jM", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcPafMspacePosixMemalign);
LIB_FUNCTION("u32UXVridxQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcPafMspaceRealloc);
LIB_FUNCTION("4SvlEtd0j40", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcPafMspaceReallocalign);
LIB_FUNCTION("0FnzR6qum90", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcPafMspaceReportMemoryBlocks);
LIB_FUNCTION("AUYdq63RG3U", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
sceLibcPafMspaceTrim);
}
} // namespace Libraries::LibcInternal

View file

@ -1,14 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/types.h"
namespace Core::Loader {
class SymbolsResolver;
}
namespace Libraries::LibcInternal {
void RegisterlibSceLibcInternalMspace(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::LibcInternal

View file

@ -9,244 +9,41 @@
namespace Libraries::LibcInternal {
s32 PS4_SYSV_ABI internal__CStrftime() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__CStrxfrm() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Getstr() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Stod() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Stodx() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Stof() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Stoflt() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Stofx() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Stold() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Stoldx() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Stoll() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Stollx() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Stolx() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Stopfx() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Stoul() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Stoull() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Stoullx() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Stoulx() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Stoxflt() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Strcollx() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Strerror() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal__Strxfrmx() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strcasecmp(const char* str1, const char* str2) {
LOG_DEBUG(Lib_LibcInternal, "called");
#ifdef _WIN32
return _stricmp(str1, str2);
s32 PS4_SYSV_ABI internal_strcpy_s(char* dest, size_t dest_size, const char* src) {
#ifdef _WIN64
return strcpy_s(dest, dest_size, src);
#else
return strcasecmp(str1, str2);
std::strcpy(dest, src);
return 0; // ALL OK
#endif
}
char* PS4_SYSV_ABI internal_strcat(char* dest, const char* src) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::strcat(dest, src);
}
s32 PS4_SYSV_ABI internal_strcat_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
const char* PS4_SYSV_ABI internal_strchr(const char* str, int c) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::strchr(str, c);
s32 PS4_SYSV_ABI internal_strcat_s(char* dest, size_t dest_size, const char* src) {
#ifdef _WIN64
return strcat_s(dest, dest_size, src);
#else
std::strcat(dest, src);
return 0; // ALL OK
#endif
}
s32 PS4_SYSV_ABI internal_strcmp(const char* str1, const char* str2) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::strcmp(str1, str2);
}
s32 PS4_SYSV_ABI internal_strcoll() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
char* PS4_SYSV_ABI internal_strcpy(char* dest, const char* src) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::strcpy(dest, src);
}
char* PS4_SYSV_ABI internal_strcpy_s(char* dest, u64 len, const char* src) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::strncpy(dest, src, len);
}
s32 PS4_SYSV_ABI internal_strcspn(const char* str1, const char* str2) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::strcspn(str1, str2);
}
char* PS4_SYSV_ABI internal_strdup(const char* str1) {
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() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strerror_r() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strerror_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strerrorlen_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strftime() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strlcat() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strlcpy() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
size_t PS4_SYSV_ABI internal_strlen(const char* str) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::strlen(str);
}
s32 PS4_SYSV_ABI internal_strncasecmp(const char* str1, const char* str2, size_t num) {
LOG_DEBUG(Lib_LibcInternal, "called");
#ifdef _WIN32
return _strnicmp(str1, str2, num);
#else
return strncasecmp(str1, str2, num);
#endif
}
s32 PS4_SYSV_ABI internal_strncat() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strncat_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strncmp(const char* str1, const char* str2, size_t num) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::strncmp(str1, str2, num);
}
size_t PS4_SYSV_ABI internal_strlen(const char* str) {
return std::strlen(str);
}
char* PS4_SYSV_ABI internal_strncpy(char* dest, const char* src, std::size_t count) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::strncpy(dest, src, count);
}
s32 PS4_SYSV_ABI internal_strncpy_s(char* dest, size_t destsz, const char* src, size_t count) {
LOG_DEBUG(Lib_LibcInternal, "called");
#ifdef _WIN64
return strncpy_s(dest, destsz, src, count);
#else
@ -255,278 +52,33 @@ s32 PS4_SYSV_ABI internal_strncpy_s(char* dest, size_t destsz, const char* src,
#endif
}
s32 PS4_SYSV_ABI internal_strndup() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
char* PS4_SYSV_ABI internal_strcat(char* dest, const char* src) {
return std::strcat(dest, src);
}
s32 PS4_SYSV_ABI internal_strnlen(const char* str, size_t maxlen) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::min(std::strlen(str), maxlen);
}
s32 PS4_SYSV_ABI internal_strnlen_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strnstr() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
const char* PS4_SYSV_ABI internal_strpbrk(const char* str1, const char* str2) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::strpbrk(str1, str2);
}
const char* PS4_SYSV_ABI internal_strrchr(const char* str, int c) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::strrchr(str, c);
}
char* PS4_SYSV_ABI internal_strsep(char** strp, const char* delim) {
LOG_DEBUG(Lib_LibcInternal, "called");
#ifdef _GNU_SOURCE
return strsep(strp, delim);
#else
if (!*strp)
return nullptr;
char* token = *strp;
*strp = std::strpbrk(token, delim);
if (*strp)
*(*strp)++ = '\0';
return token;
#endif
}
s32 PS4_SYSV_ABI internal_strspn(const char* str1, const char* str2) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::strspn(str1, str2);
}
char* PS4_SYSV_ABI internal_strstr(char* h, char* n) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::strstr(h, n);
}
double PS4_SYSV_ABI internal_strtod(const char* str, char** endptr) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::strtod(str, endptr);
}
float PS4_SYSV_ABI internal_strtof(const char* str, char** endptr) {
LOG_DEBUG(Lib_LibcInternal, "called");
return std::strtof(str, endptr);
}
s32 PS4_SYSV_ABI internal_strtoimax() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strtok() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strtok_r() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strtok_s() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strtol() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strtold() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strtoll() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strtoul() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strtoull() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strtoumax() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strtouq() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_strxfrm() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
}
s32 PS4_SYSV_ABI internal_wcsstr() {
LOG_ERROR(Lib_LibcInternal, "(STUBBED) called");
return ORBIS_OK;
const char* PS4_SYSV_ABI internal_strchr(const char* str, int c) {
return std::strchr(str, c);
}
void RegisterlibSceLibcInternalStr(Core::Loader::SymbolsResolver* sym) {
LIB_FUNCTION("ykNF6P3ZsdA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__CStrftime);
LIB_FUNCTION("we-vQBAugV8", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__CStrxfrm);
LIB_FUNCTION("i2yN6xBwooo", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Getstr);
LIB_FUNCTION("c41UEHVtiEA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Stod);
LIB_FUNCTION("QlcJbyd6jxM", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Stodx);
LIB_FUNCTION("CpWcnrEZbLA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Stof);
LIB_FUNCTION("wO1-omboFjo", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Stoflt);
LIB_FUNCTION("7dlAxeH-htg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Stofx);
LIB_FUNCTION("iNbtyJKM0iQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Stold);
LIB_FUNCTION("BKidCxmLC5w", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Stoldx);
LIB_FUNCTION("7pNKcscKrf8", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Stoll);
LIB_FUNCTION("mOnfZ5aNDQE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Stollx);
LIB_FUNCTION("Ecwid6wJMhY", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Stolx);
LIB_FUNCTION("yhbF6MbVuYc", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Stopfx);
LIB_FUNCTION("zlfEH8FmyUA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Stoul);
LIB_FUNCTION("q+9E0X3aWpU", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Stoull);
LIB_FUNCTION("pSpDCDyxkaY", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Stoullx);
LIB_FUNCTION("YDnLaav6W6Q", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Stoulx);
LIB_FUNCTION("Ouz5Q8+SUq4", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Stoxflt);
LIB_FUNCTION("v6rXYSx-WGA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Strcollx);
LIB_FUNCTION("4F11tHMpJa0", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Strerror);
LIB_FUNCTION("CpiD2ZXrhNo", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal__Strxfrmx);
LIB_FUNCTION("AV6ipCNa4Rw", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strcasecmp);
LIB_FUNCTION("Ls4tzzhimqQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strcat);
LIB_FUNCTION("K+gcnFFJKVc", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strcat_s);
LIB_FUNCTION("ob5xAW4ln-0", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strchr);
LIB_FUNCTION("Ovb2dSJOAuE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strcmp);
LIB_FUNCTION("gjbmYpP-XJQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strcoll);
LIB_FUNCTION("kiZSXIWd9vg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strcpy);
LIB_FUNCTION("5Xa2ACNECdo", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strcpy_s);
LIB_FUNCTION("q0F6yS-rCms", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strcspn);
LIB_FUNCTION("g7zzzLDYGw0", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strdup);
LIB_FUNCTION("RIa6GnWp+iU", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strerror);
LIB_FUNCTION("RBcs3uut1TA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strerror_r);
LIB_FUNCTION("o+ok6Y+DtgY", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strerror_s);
LIB_FUNCTION("-g26XITGVgE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strerrorlen_s);
LIB_FUNCTION("Av3zjWi64Kw", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strftime);
LIB_FUNCTION("ByfjUZsWiyg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strlcat);
LIB_FUNCTION("SfQIZcqvvms", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strlcpy);
LIB_FUNCTION("K+gcnFFJKVc", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strcat_s);
LIB_FUNCTION("aesyjrHVWy4", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strcmp);
LIB_FUNCTION("Ovb2dSJOAuE", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strncmp);
LIB_FUNCTION("j4ViWNHEgww", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strlen);
LIB_FUNCTION("pXvbDfchu6k", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strncasecmp);
LIB_FUNCTION("kHg45qPC6f0", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strncat);
LIB_FUNCTION("NC4MSB+BRQg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strncat_s);
LIB_FUNCTION("aesyjrHVWy4", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strncmp);
LIB_FUNCTION("6sJWiWSRuqk", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strncpy);
LIB_FUNCTION("YNzNkJzYqEg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strncpy_s);
LIB_FUNCTION("XGnuIBmEmyk", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strndup);
LIB_FUNCTION("5jNubw4vlAA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strnlen);
LIB_FUNCTION("DQbtGaBKlaw", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strnlen_s);
LIB_FUNCTION("Xnrfb2-WhVw", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strnstr);
LIB_FUNCTION("kDZvoVssCgQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strpbrk);
LIB_FUNCTION("9yDWMxEFdJU", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strrchr);
LIB_FUNCTION("cJWGxiQPmDQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strsep);
LIB_FUNCTION("-kU6bB4M-+k", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strspn);
LIB_FUNCTION("viiwFMaNamA", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strstr);
LIB_FUNCTION("2vDqwBlpF-o", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strtod);
LIB_FUNCTION("xENtRue8dpI", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strtof);
LIB_FUNCTION("q5MWYCDfu3c", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strtoimax);
LIB_FUNCTION("oVkZ8W8-Q8A", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strtok);
LIB_FUNCTION("enqPGLfmVNU", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strtok_r);
LIB_FUNCTION("-vXEQdRADLI", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strtok_s);
LIB_FUNCTION("mXlxhmLNMPg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strtol);
LIB_FUNCTION("nW9JRkciRk4", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strtold);
LIB_FUNCTION("VOBg+iNwB-4", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strtoll);
LIB_FUNCTION("QxmSHBCuKTk", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strtoul);
LIB_FUNCTION("5OqszGpy7Mg", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strtoull);
LIB_FUNCTION("QNyUWGXmXNc", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strtoumax);
LIB_FUNCTION("g-McpZfseZo", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strtouq);
LIB_FUNCTION("zogPrkd46DY", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strxfrm);
LIB_FUNCTION("WDpobjImAb4", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_wcsstr);
LIB_FUNCTION("Ls4tzzhimqQ", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strcat);
LIB_FUNCTION("ob5xAW4ln-0", "libSceLibcInternal", 1, "libSceLibcInternal", 1, 1,
internal_strchr);
}
} // namespace Libraries::LibcInternal

File diff suppressed because it is too large Load diff

View file

@ -1,14 +0,0 @@
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "common/types.h"
namespace Core::Loader {
class SymbolsResolver;
}
namespace Libraries::LibcInternal {
void RegisterlibSceLibcInternalStream(Core::Loader::SymbolsResolver* sym);
} // namespace Libraries::LibcInternal

View file

@ -0,0 +1,763 @@
// SPDX-FileCopyrightText: Copyright 2014-2018 Marco Paland (info@paland.com)
// SPDX-License-Identifier: MIT
///////////////////////////////////////////////////////////////////////////////
// \author (c) Marco Paland (info@paland.com)
// 2014-2018, PALANDesign Hannover, Germany
//
// \license The MIT License (MIT)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// \brief Tiny printf, sprintf and snprintf implementation, optimized for speed on
// embedded systems with a very limited resources.
// Use this instead of bloated standard/newlib printf.
// These routines are thread safe and reentrant!
//
///////////////////////////////////////////////////////////////////////////////
// Vita3K emulator project
// Copyright (C) 2023 Vita3K team
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
// copied from Vita3k project at 6/10/2023 (latest update 30/06/2023)
// modifications for adapting va_args parameters
#pragma once
#include <stdio.h>
#include <cstdarg>
#include <cstdbool>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <string>
#include "common/va_ctx.h"
namespace Libraries::LibcInternal {
// ntoa conversion buffer size, this must be big enough to hold
// one converted numeric number including padded zeros (dynamically created on stack)
// 32 byte is a good default
#define PRINTF_NTOA_BUFFER_SIZE 32U
// ftoa conversion buffer size, this must be big enough to hold
// one converted float number including padded zeros (dynamically created on stack)
// 32 byte is a good default
#define PRINTF_FTOA_BUFFER_SIZE 32U
// define this to support floating point (%f)
#define PRINTF_SUPPORT_FLOAT
// define this to support long long types (%llu or %p)
#define PRINTF_SUPPORT_LONG_LONG
// define this to support the ptrdiff_t type (%t)
// ptrdiff_t is normally defined in <stddef.h> as long or long long type
#define PRINTF_SUPPORT_PTRDIFF_T
///////////////////////////////////////////////////////////////////////////////
// internal flag definitions
#define FLAGS_ZEROPAD (1U << 0U)
#define FLAGS_LEFT (1U << 1U)
#define FLAGS_PLUS (1U << 2U)
#define FLAGS_SPACE (1U << 3U)
#define FLAGS_HASH (1U << 4U)
#define FLAGS_UPPERCASE (1U << 5U)
#define FLAGS_CHAR (1U << 6U)
#define FLAGS_SHORT (1U << 7U)
#define FLAGS_LONG (1U << 8U)
#define FLAGS_LONG_LONG (1U << 9U)
#define FLAGS_PRECISION (1U << 10U)
#define FLAGS_WIDTH (1U << 11U)
// output function type
typedef void (*out_fct_type)(char character, void* buffer, size_t idx, size_t maxlen);
// wrapper (used as buffer) for output function type
typedef struct {
void (*fct)(char character, void* arg);
void* arg;
} out_fct_wrap_type;
// internal buffer output
static inline void _out_buffer(char character, void* buffer, size_t idx, size_t maxlen) {
if (idx < maxlen) {
((char*)buffer)[idx] = character;
}
}
// internal null output
static inline void _out_null(char character, void* buffer, size_t idx, size_t maxlen) {
(void)character;
(void)buffer;
(void)idx;
(void)maxlen;
}
// internal output function wrapper
static inline void _out_fct(char character, void* buffer, size_t idx, size_t maxlen) {
(void)idx;
(void)maxlen;
// buffer is the output fct pointer
((out_fct_wrap_type*)buffer)->fct(character, ((out_fct_wrap_type*)buffer)->arg);
}
// internal strlen
// \return The length of the string (excluding the terminating 0)
static inline unsigned int _strlen(const char* str) {
const char* s;
for (s = str; *s; ++s)
;
return (unsigned int)(s - str);
}
// internal test if char is a digit (0-9)
// \return true if char is a digit
static inline bool _is_digit(char ch) {
return (ch >= '0') && (ch <= '9');
}
// internal ASCII string to unsigned int conversion
static inline unsigned int _atoi(const char** str) {
unsigned int i = 0U;
while (_is_digit(**str)) {
i = i * 10U + (unsigned int)(*((*str)++) - '0');
}
return i;
}
// internal itoa format
static inline size_t _ntoa_format(out_fct_type out, char* buffer, size_t idx, size_t maxlen,
char* buf, size_t len, bool negative, unsigned int base,
unsigned int prec, unsigned int width, unsigned int flags) {
const size_t start_idx = idx;
// pad leading zeros
while (!(flags & FLAGS_LEFT) && (len < prec) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
buf[len++] = '0';
}
while (!(flags & FLAGS_LEFT) && (flags & FLAGS_ZEROPAD) && (len < width) &&
(len < PRINTF_NTOA_BUFFER_SIZE)) {
buf[len++] = '0';
}
// handle hash
if (flags & FLAGS_HASH) {
if (((len == prec) || (len == width)) && (len > 0U)) {
len--;
if ((base == 16U) && (len > 0U)) {
len--;
}
}
if ((base == 16U) && !(flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
buf[len++] = 'x';
}
if ((base == 16U) && (flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) {
buf[len++] = 'X';
}
if (len < PRINTF_NTOA_BUFFER_SIZE) {
buf[len++] = '0';
}
}
// handle sign
if ((len == width) && (negative || (flags & FLAGS_PLUS) || (flags & FLAGS_SPACE))) {
len--;
}
if (len < PRINTF_NTOA_BUFFER_SIZE) {
if (negative) {
buf[len++] = '-';
} else if (flags & FLAGS_PLUS) {
buf[len++] = '+'; // ignore the space if the '+' exists
} else if (flags & FLAGS_SPACE) {
buf[len++] = ' ';
}
}
// pad spaces up to given width
if (!(flags & FLAGS_LEFT) && !(flags & FLAGS_ZEROPAD)) {
for (size_t i = len; i < width; i++) {
out(' ', buffer, idx++, maxlen);
}
}
// reverse string
for (size_t i = 0U; i < len; i++) {
out(buf[len - i - 1U], buffer, idx++, maxlen);
}
// append pad spaces up to given width
if (flags & FLAGS_LEFT) {
while (idx - start_idx < width) {
out(' ', buffer, idx++, maxlen);
}
}
return idx;
}
// internal itoa for 'long' type
static inline size_t _ntoa_long(out_fct_type out, char* buffer, size_t idx, size_t maxlen,
unsigned long value, bool negative, unsigned long base,
unsigned int prec, unsigned int width, unsigned int flags) {
char buf[PRINTF_NTOA_BUFFER_SIZE];
size_t len = 0U;
// write if precision != 0 and value is != 0
if (!(flags & FLAGS_PRECISION) || value) {
do {
const char digit = (char)(value % base);
buf[len++] =
digit < 10 ? '0' + digit : (flags & FLAGS_UPPERCASE ? 'A' : 'a') + digit - 10;
value /= base;
} while (value && (len < PRINTF_NTOA_BUFFER_SIZE));
}
return _ntoa_format(out, buffer, idx, maxlen, buf, len, negative, (unsigned int)base, prec,
width, flags);
}
// internal itoa for 'long long' type
#if defined(PRINTF_SUPPORT_LONG_LONG)
static inline size_t _ntoa_long_long(out_fct_type out, char* buffer, size_t idx, size_t maxlen,
unsigned long long value, bool negative,
unsigned long long base, unsigned int prec, unsigned int width,
unsigned int flags) {
char buf[PRINTF_NTOA_BUFFER_SIZE];
size_t len = 0U;
// write if precision != 0 and value is != 0
if (!(flags & FLAGS_PRECISION) || value) {
do {
const char digit = (char)(value % base);
buf[len++] =
digit < 10 ? '0' + digit : (flags & FLAGS_UPPERCASE ? 'A' : 'a') + digit - 10;
value /= base;
} while (value && (len < PRINTF_NTOA_BUFFER_SIZE));
}
return _ntoa_format(out, buffer, idx, maxlen, buf, len, negative, (unsigned int)base, prec,
width, flags);
}
#endif // PRINTF_SUPPORT_LONG_LONG
#if defined(PRINTF_SUPPORT_FLOAT)
static inline size_t _ftoa(out_fct_type out, char* buffer, size_t idx, size_t maxlen, double value,
unsigned int prec, unsigned int width, unsigned int flags) {
char buf[PRINTF_FTOA_BUFFER_SIZE];
size_t len = 0U;
double diff = 0.0;
// if input is larger than thres_max, revert to exponential
const double thres_max = (double)0x7FFFFFFF;
// powers of 10
static const double pow10[] = {1, 10, 100, 1000, 10000,
100000, 1000000, 10000000, 100000000, 1000000000};
// test for negative
bool negative = false;
if (value < 0) {
negative = true;
value = 0 - value;
}
// set default precision to 6, if not set explicitly
if (!(flags & FLAGS_PRECISION)) {
prec = 6U;
}
// limit precision to 9, cause a prec >= 10 can lead to overflow errors
while ((len < PRINTF_FTOA_BUFFER_SIZE) && (prec > 9U)) {
buf[len++] = '0';
prec--;
}
int whole = (int)value;
double tmp = (value - whole) * pow10[prec];
unsigned long frac = (unsigned long)tmp;
diff = tmp - frac;
if (diff > 0.5) {
++frac;
// handle rollover, e.g. case 0.99 with prec 1 is 1.0
if (frac >= pow10[prec]) {
frac = 0;
++whole;
}
} else if ((diff == 0.5) && ((frac == 0U) || (frac & 1U))) {
// if halfway, round up if odd, OR if last digit is 0
++frac;
}
// TBD: for very large numbers switch back to native sprintf for exponentials. Anyone want to
// write code to replace this? Normal printf behavior is to print EVERY whole number digit which
// can be 100s of characters overflowing your buffers == bad
if (value > thres_max) {
return 0U;
}
if (prec == 0U) {
diff = value - (double)whole;
if (diff > 0.5) {
// greater than 0.5, round up, e.g. 1.6 -> 2
++whole;
} else if ((diff == 0.5) && (whole & 1)) {
// exactly 0.5 and ODD, then round up
// 1.5 -> 2, but 2.5 -> 2
++whole;
}
} else {
unsigned int count = prec;
// now do fractional part, as an unsigned number
while (len < PRINTF_FTOA_BUFFER_SIZE) {
--count;
buf[len++] = (char)(48U + (frac % 10U));
if (!(frac /= 10U)) {
break;
}
}
// add extra 0s
while ((len < PRINTF_FTOA_BUFFER_SIZE) && (count-- > 0U)) {
buf[len++] = '0';
}
if (len < PRINTF_FTOA_BUFFER_SIZE) {
// add decimal
buf[len++] = '.';
}
}
// do whole part, number is reversed
while (len < PRINTF_FTOA_BUFFER_SIZE) {
buf[len++] = (char)(48 + (whole % 10));
if (!(whole /= 10)) {
break;
}
}
// pad leading zeros
while (!(flags & FLAGS_LEFT) && (flags & FLAGS_ZEROPAD) && (len < width) &&
(len < PRINTF_FTOA_BUFFER_SIZE)) {
buf[len++] = '0';
}
// handle sign
if ((len == width) && (negative || (flags & FLAGS_PLUS) || (flags & FLAGS_SPACE))) {
len--;
}
if (len < PRINTF_FTOA_BUFFER_SIZE) {
if (negative) {
buf[len++] = '-';
} else if (flags & FLAGS_PLUS) {
buf[len++] = '+'; // ignore the space if the '+' exists
} else if (flags & FLAGS_SPACE) {
buf[len++] = ' ';
}
}
// pad spaces up to given width
if (!(flags & FLAGS_LEFT) && !(flags & FLAGS_ZEROPAD)) {
for (size_t i = len; i < width; i++) {
out(' ', buffer, idx++, maxlen);
}
}
// reverse string
for (size_t i = 0U; i < len; i++) {
out(buf[len - i - 1U], buffer, idx++, maxlen);
}
// append pad spaces up to given width
if (flags & FLAGS_LEFT) {
while (idx < width) {
out(' ', buffer, idx++, maxlen);
}
}
return idx;
}
#endif // PRINTF_SUPPORT_FLOAT
// internal vsnprintf
static inline int _vsnprintf(out_fct_type out, char* buffer, const char* format,
Common::VaList* va_list) {
unsigned int flags, width, precision, n;
size_t idx = 0U;
auto maxlen = static_cast<size_t>(-1);
if (!buffer) {
// use null output function
out = _out_null;
}
while (*format) {
// format specifier? %[flags][width][.precision][length]
if (*format != '%') {
// no
out(*format, buffer, idx++, maxlen);
format++;
continue;
} else {
// yes, evaluate it
format++;
}
// evaluate flags
flags = 0U;
do {
switch (*format) {
case '0':
flags |= FLAGS_ZEROPAD;
format++;
n = 1U;
break;
case '-':
flags |= FLAGS_LEFT;
format++;
n = 1U;
break;
case '+':
flags |= FLAGS_PLUS;
format++;
n = 1U;
break;
case ' ':
flags |= FLAGS_SPACE;
format++;
n = 1U;
break;
case '#':
flags |= FLAGS_HASH;
format++;
n = 1U;
break;
default:
n = 0U;
break;
}
} while (n);
// evaluate width field
width = 0U;
if (_is_digit(*format)) {
width = _atoi(&format);
} else if (*format == '*') {
const int w = vaArgInteger(va_list); // const int w = va.next<int>(cpu, mem);
if (w < 0) {
flags |= FLAGS_LEFT; // reverse padding
width = (unsigned int)-w;
} else {
width = (unsigned int)w;
}
format++;
}
// evaluate precision field
precision = 0U;
if (*format == '.') {
flags |= FLAGS_PRECISION;
format++;
if (_is_digit(*format)) {
precision = _atoi(&format);
} else if (*format == '*') {
precision =
vaArgInteger(va_list); // precision = (unsigned int)va.next<int>(cpu, mem);
format++;
}
}
// evaluate length field
switch (*format) {
case 'l':
flags |= FLAGS_LONG;
format++;
if (*format == 'l') {
flags |= FLAGS_LONG_LONG;
format++;
}
break;
case 'h':
flags |= FLAGS_SHORT;
format++;
if (*format == 'h') {
flags |= FLAGS_CHAR;
format++;
}
break;
#if defined(PRINTF_SUPPORT_PTRDIFF_T)
case 't':
flags |= (sizeof(ptrdiff_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG);
format++;
break;
#endif
case 'j':
flags |= (sizeof(intmax_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG);
format++;
break;
case 'z':
flags |= (sizeof(size_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG);
format++;
break;
default:
break;
}
// evaluate specifier
switch (*format) {
case 'd':
case 'i':
case 'u':
case 'x':
case 'X':
case 'o':
case 'b': {
// set the base
unsigned int base;
if (*format == 'x' || *format == 'X') {
base = 16U;
} else if (*format == 'o') {
base = 8U;
} else if (*format == 'b') {
base = 2U;
flags &= ~FLAGS_HASH; // no hash for bin format
} else {
base = 10U;
flags &= ~FLAGS_HASH; // no hash for dec format
}
// uppercase
if (*format == 'X') {
flags |= FLAGS_UPPERCASE;
}
// no plus or space flag for u, x, X, o, b
if ((*format != 'i') && (*format != 'd')) {
flags &= ~(FLAGS_PLUS | FLAGS_SPACE);
}
// convert the integer
if ((*format == 'i') || (*format == 'd')) {
// signed
if (flags & FLAGS_LONG_LONG) {
#if defined(PRINTF_SUPPORT_LONG_LONG)
auto value = vaArgLongLong(
va_list); // const long long value = va.next<long long>(cpu, mem);
idx = _ntoa_long_long(out, buffer, idx, maxlen,
(unsigned long long)(value > 0 ? value : 0 - value),
value < 0, base, precision, width, flags);
#endif
} else if (flags & FLAGS_LONG) {
auto value = vaArgLong(va_list); // const long value = va.next<long>(cpu, mem);
idx = _ntoa_long(out, buffer, idx, maxlen,
(unsigned long)(value > 0 ? value : 0 - value), value < 0,
base, precision, width, flags);
} else {
// const int value = (flags & FLAGS_CHAR) ? (char)va.next<int>(cpu, mem) :
// (flags & FLAGS_SHORT) ? (short int)va.next<int>(cpu, mem): va.next<int>(cpu,
// mem);
const int value =
(flags & FLAGS_CHAR) ? static_cast<char>(vaArgInteger(va_list))
: (flags & FLAGS_SHORT) ? static_cast<int16_t>(vaArgInteger(va_list))
: vaArgInteger(va_list);
idx = _ntoa_long(out, buffer, idx, maxlen,
(unsigned int)(value > 0 ? value : 0 - value), value < 0, base,
precision, width, flags);
}
} else {
// unsigned
if (flags & FLAGS_LONG_LONG) {
#if defined(PRINTF_SUPPORT_LONG_LONG)
// idx = _ntoa_long_long(out, buffer, idx, maxlen, va.next<unsigned long
// long>(cpu, mem), false, base, precision, width, flags);
idx = _ntoa_long_long(out, buffer, idx, maxlen,
static_cast<u64>(vaArgLongLong(va_list)), false, base,
precision, width, flags);
#endif
} else if (flags & FLAGS_LONG) {
// idx = _ntoa_long(out, buffer, idx, maxlen, va.next<unsigned long>(cpu, mem),
// false, base, precision, width, flags);
idx = _ntoa_long(out, buffer, idx, maxlen, static_cast<u32>(vaArgLong(va_list)),
false, base, precision, width, flags);
} else {
// const unsigned int value = (flags & FLAGS_CHAR) ? (unsigned
// char)va.next<unsigned int>(cpu, mem) : (flags & FLAGS_SHORT) ?
// (unsigned short int)va.next<unsigned int>(cpu, mem) : va.next<unsigned
// int>(cpu, mem);
const unsigned int value =
(flags & FLAGS_CHAR) ? static_cast<u8>(vaArgInteger(va_list))
: (flags & FLAGS_SHORT) ? static_cast<u16>(vaArgInteger(va_list))
: static_cast<u32>(vaArgInteger(va_list));
idx = _ntoa_long(out, buffer, idx, maxlen, value, false, base, precision, width,
flags);
}
}
format++;
break;
}
#if defined(PRINTF_SUPPORT_FLOAT)
case 'f':
case 'F':
// idx = _ftoa(out, buffer, idx, maxlen, va.next<double>(cpu, mem), precision, width,
// flags);
idx = _ftoa(out, buffer, idx, maxlen, vaArgDouble(va_list), precision, width, flags);
format++;
break;
#endif // PRINTF_SUPPORT_FLOAT
case 'c': {
unsigned int l = 1U;
// pre padding
if (!(flags & FLAGS_LEFT)) {
while (l++ < width) {
out(' ', buffer, idx++, maxlen);
}
}
// char output
// out((char)va.next<int>(cpu, mem), buffer, idx++, maxlen);
out(static_cast<char>(vaArgInteger(va_list)), buffer, idx++, maxlen);
// post padding
if (flags & FLAGS_LEFT) {
while (l++ < width) {
out(' ', buffer, idx++, maxlen);
}
}
format++;
break;
}
case 's': {
const char* p = vaArgPtr<const char>(
va_list); // const char *p = va.next<Ptr<char>>(cpu, mem).get(mem);
p = p != nullptr ? p : "(null)";
unsigned int l = _strlen(p);
// pre padding
if (flags & FLAGS_PRECISION) {
l = (l < precision ? l : precision);
}
if (!(flags & FLAGS_LEFT)) {
while (l++ < width) {
out(' ', buffer, idx++, maxlen);
}
}
// string output
while ((*p != 0) && (!(flags & FLAGS_PRECISION) || precision--)) {
out(*(p++), buffer, idx++, maxlen);
}
// post padding
if (flags & FLAGS_LEFT) {
while (l++ < width) {
out(' ', buffer, idx++, maxlen);
}
}
format++;
break;
}
case 'p': {
width = sizeof(void*) * 2U;
flags |= FLAGS_ZEROPAD | FLAGS_UPPERCASE;
#if defined(PRINTF_SUPPORT_LONG_LONG)
const bool is_ll = sizeof(uintptr_t) == sizeof(long long);
if (is_ll) {
// idx = _ntoa_long_long(out, buffer, idx, maxlen,
// (uintptr_t)va.next<Ptr<void>>(cpu, mem).address(), false, 16U, precision, width,
// flags);
idx = _ntoa_long_long(out, buffer, idx, maxlen,
reinterpret_cast<uintptr_t>(vaArgPtr<void>(va_list)), false,
16U, precision, width, flags);
} else {
#endif
// idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned
// long)((uintptr_t)va.next<Ptr<void>>(cpu, mem).address()), false, 16U, precision,
// width, flags);
idx = _ntoa_long(
out, buffer, idx, maxlen,
static_cast<uint32_t>(reinterpret_cast<uintptr_t>(vaArgPtr<void>(va_list))),
false, 16U, precision, width, flags);
#if defined(PRINTF_SUPPORT_LONG_LONG)
}
#endif
format++;
break;
}
case '%':
out('%', buffer, idx++, maxlen);
format++;
break;
default:
out(*format, buffer, idx++, maxlen);
format++;
break;
}
}
// termination
out((char)0, buffer, idx < maxlen ? idx : maxlen - 1U, maxlen);
// return written chars without terminating \0
return (int)idx;
}
static int printf_ctx(Common::VaCtx* ctx) {
const char* format = vaArgPtr<const char>(&ctx->va_list);
char buffer[256];
int result = _vsnprintf(_out_buffer, buffer, format, &ctx->va_list);
printf("%s", buffer);
return result;
}
static int fprintf_ctx(Common::VaCtx* ctx, char* buf) {
const char* format = vaArgPtr<const char>(&ctx->va_list);
char buffer[256];
int result = _vsnprintf(_out_buffer, buffer, format, &ctx->va_list);
std::strcpy(buf, buffer);
return result;
}
static int vsnprintf_ctx(char* s, size_t n, const char* format, Common::VaList* arg) {
char buffer[n];
int result = _vsnprintf(_out_buffer, buffer, format, arg);
std::strcpy(s, buffer);
return result;
}
static int snprintf_ctx(char* s, size_t n, Common::VaCtx* ctx) {
const char* format = vaArgPtr<const char>(&ctx->va_list);
char buffer[n];
int result = _vsnprintf(_out_buffer, buffer, format, &ctx->va_list);
std::strcpy(s, buffer);
return result;
}
} // namespace Libraries::LibcInternal