prefix in libc functions to avoid messing with std ones
This commit is contained in:
parent
cad5ac34b0
commit
776a680e85
|
@ -27,7 +27,7 @@ struct CContext {
|
|||
std::vector<CxaDestructor> cxa;
|
||||
};
|
||||
|
||||
static PS4_SYSV_ABI int __cxa_atexit(void (*func)(void*), void* arg, void* dso_handle) {
|
||||
static PS4_SYSV_ABI int ps4___cxa_atexit(void (*func)(void*), void* arg, void* dso_handle) {
|
||||
auto* cc = Common::Singleton<CContext>::Instance();
|
||||
CxaDestructor c{};
|
||||
c.destructor_func = func;
|
||||
|
@ -37,42 +37,42 @@ static PS4_SYSV_ABI int __cxa_atexit(void (*func)(void*), void* arg, void* dso_h
|
|||
return 0;
|
||||
}
|
||||
|
||||
void PS4_SYSV_ABI __cxa_finalize(void* d) {
|
||||
void PS4_SYSV_ABI ps4___cxa_finalize(void* d) {
|
||||
BREAKPOINT();
|
||||
}
|
||||
|
||||
void PS4_SYSV_ABI __cxa_pure_virtual() {
|
||||
void PS4_SYSV_ABI ps4___cxa_pure_virtual() {
|
||||
BREAKPOINT();
|
||||
}
|
||||
|
||||
static PS4_SYSV_ABI void init_env() {
|
||||
static PS4_SYSV_ABI void ps4_init_env() {
|
||||
PRINT_DUMMY_FUNCTION_NAME();
|
||||
}
|
||||
|
||||
static PS4_SYSV_ABI void catchReturnFromMain(int status) {
|
||||
static PS4_SYSV_ABI void ps4_catchReturnFromMain(int status) {
|
||||
LOG_INFO_IF(log_file_libc, "catchReturnFromMain returned ={}\n", status);
|
||||
}
|
||||
|
||||
static PS4_SYSV_ABI void _Assert() {
|
||||
static PS4_SYSV_ABI void ps4__Assert() {
|
||||
PRINT_DUMMY_FUNCTION_NAME();
|
||||
BREAKPOINT();
|
||||
}
|
||||
|
||||
PS4_SYSV_ABI void _ZdlPv(void* ptr) {
|
||||
PS4_SYSV_ABI void ps4__ZdlPv(void* ptr) {
|
||||
std::free(ptr);
|
||||
}
|
||||
|
||||
PS4_SYSV_ABI void _ZSt11_Xbad_allocv() {
|
||||
PS4_SYSV_ABI void ps4__ZSt11_Xbad_allocv() {
|
||||
PRINT_DUMMY_FUNCTION_NAME();
|
||||
BREAKPOINT();
|
||||
}
|
||||
|
||||
PS4_SYSV_ABI void _ZSt14_Xlength_errorPKc() {
|
||||
PS4_SYSV_ABI void ps4__ZSt14_Xlength_errorPKc() {
|
||||
PRINT_DUMMY_FUNCTION_NAME();
|
||||
BREAKPOINT();
|
||||
}
|
||||
|
||||
PS4_SYSV_ABI void* _Znwm(u64 count) {
|
||||
PS4_SYSV_ABI void* ps4__Znwm(u64 count) {
|
||||
if (count == 0) {
|
||||
LOG_ERROR_IF(log_file_libc, "_Znwm count ={}\n", count);
|
||||
BREAKPOINT();
|
||||
|
@ -99,7 +99,7 @@ static constexpr u16 lowercaseTable[256] = {
|
|||
0x00FC, 0x00FD, 0x00FE, 0x00FF,
|
||||
};
|
||||
|
||||
const PS4_SYSV_ABI u16* _Getptolower() { return &lowercaseTable[0]; }
|
||||
const PS4_SYSV_ABI u16* ps4__Getptolower() { return &lowercaseTable[0]; }
|
||||
|
||||
static constexpr u16 uppercaseTable[256] = {
|
||||
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011,
|
||||
|
@ -119,7 +119,7 @@ static constexpr u16 uppercaseTable[256] = {
|
|||
0x00FC, 0x00FD, 0x00FE, 0x00FF,
|
||||
};
|
||||
|
||||
const PS4_SYSV_ABI u16* _Getptoupper() { return &uppercaseTable[0]; }
|
||||
const PS4_SYSV_ABI u16* ps4__Getptoupper() { return &uppercaseTable[0]; }
|
||||
|
||||
namespace CharacterType {
|
||||
enum : u16 {
|
||||
|
@ -396,66 +396,66 @@ static constexpr u16 characterTypeTable[256] = {
|
|||
0,
|
||||
};
|
||||
|
||||
const PS4_SYSV_ABI u16* _Getpctype() { return &characterTypeTable[0]; }
|
||||
const PS4_SYSV_ABI u16* ps4__Getpctype() { return &characterTypeTable[0]; }
|
||||
|
||||
void libcSymbolsRegister(Loader::SymbolsResolver* sym) {
|
||||
// cxa functions
|
||||
LIB_FUNCTION("3GPpjQdAMTw", "libc", 1, "libc", 1, 1, __cxa_guard_acquire);
|
||||
LIB_FUNCTION("9rAeANT2tyE", "libc", 1, "libc", 1, 1, __cxa_guard_release);
|
||||
LIB_FUNCTION("2emaaluWzUw", "libc", 1, "libc", 1, 1, __cxa_guard_abort);
|
||||
LIB_FUNCTION("3GPpjQdAMTw", "libc", 1, "libc", 1, 1, ps4___cxa_guard_acquire);
|
||||
LIB_FUNCTION("9rAeANT2tyE", "libc", 1, "libc", 1, 1, ps4___cxa_guard_release);
|
||||
LIB_FUNCTION("2emaaluWzUw", "libc", 1, "libc", 1, 1, ps4___cxa_guard_abort);
|
||||
|
||||
// stdlib functions
|
||||
LIB_FUNCTION("uMei1W9uyNo", "libc", 1, "libc", 1, 1, exit);
|
||||
LIB_FUNCTION("8G2LB+A3rzg", "libc", 1, "libc", 1, 1, atexit);
|
||||
LIB_FUNCTION("gQX+4GDQjpM", "libc", 1, "libc", 1, 1, malloc);
|
||||
LIB_FUNCTION("tIhsqj0qsFE", "libc", 1, "libc", 1, 1, free);
|
||||
LIB_FUNCTION("cpCOXWMgha0", "libc", 1, "libc", 1, 1, rand);
|
||||
LIB_FUNCTION("AEJdIVZTEmo", "libc", 1, "libc", 1, 1, qsort);
|
||||
LIB_FUNCTION("uMei1W9uyNo", "libc", 1, "libc", 1, 1, ps4_exit);
|
||||
LIB_FUNCTION("8G2LB+A3rzg", "libc", 1, "libc", 1, 1, ps4_atexit);
|
||||
LIB_FUNCTION("gQX+4GDQjpM", "libc", 1, "libc", 1, 1, ps4_malloc);
|
||||
LIB_FUNCTION("tIhsqj0qsFE", "libc", 1, "libc", 1, 1, ps4_free);
|
||||
LIB_FUNCTION("cpCOXWMgha0", "libc", 1, "libc", 1, 1, ps4_rand);
|
||||
LIB_FUNCTION("AEJdIVZTEmo", "libc", 1, "libc", 1, 1, ps4_qsort);
|
||||
|
||||
// math functions
|
||||
LIB_FUNCTION("EH-x713A99c", "libc", 1, "libc", 1, 1, atan2f);
|
||||
LIB_FUNCTION("QI-x0SL8jhw", "libc", 1, "libc", 1, 1, acosf);
|
||||
LIB_FUNCTION("ZE6RNL+eLbk", "libc", 1, "libc", 1, 1, tanf);
|
||||
LIB_FUNCTION("GZWjF-YIFFk", "libc", 1, "libc", 1, 1, asinf);
|
||||
LIB_FUNCTION("9LCjpWyQ5Zc", "libc", 1, "libc", 1, 1, pow);
|
||||
LIB_FUNCTION("cCXjU72Z0Ow", "libc", 1, "libc", 1, 1, _Sin);
|
||||
LIB_FUNCTION("ZtjspkJQ+vw", "libc", 1, "libc", 1, 1, _Fsin);
|
||||
LIB_FUNCTION("dnaeGXbjP6E", "libc", 1, "libc", 1, 1, exp2);
|
||||
LIB_FUNCTION("EH-x713A99c", "libc", 1, "libc", 1, 1, ps4_atan2f);
|
||||
LIB_FUNCTION("QI-x0SL8jhw", "libc", 1, "libc", 1, 1, ps4_acosf);
|
||||
LIB_FUNCTION("ZE6RNL+eLbk", "libc", 1, "libc", 1, 1, ps4_tanf);
|
||||
LIB_FUNCTION("GZWjF-YIFFk", "libc", 1, "libc", 1, 1, ps4_asinf);
|
||||
LIB_FUNCTION("9LCjpWyQ5Zc", "libc", 1, "libc", 1, 1, ps4_pow);
|
||||
LIB_FUNCTION("cCXjU72Z0Ow", "libc", 1, "libc", 1, 1, ps4__Sin);
|
||||
LIB_FUNCTION("ZtjspkJQ+vw", "libc", 1, "libc", 1, 1, ps4__Fsin);
|
||||
LIB_FUNCTION("dnaeGXbjP6E", "libc", 1, "libc", 1, 1, ps4_exp2);
|
||||
|
||||
// string functions
|
||||
LIB_FUNCTION("Ovb2dSJOAuE", "libc", 1, "libc", 1, 1, strcmp);
|
||||
LIB_FUNCTION("j4ViWNHEgww", "libc", 1, "libc", 1, 1, strlen);
|
||||
LIB_FUNCTION("6sJWiWSRuqk", "libc", 1, "libc", 1, 1, strncpy);
|
||||
LIB_FUNCTION("+P6FRGH4LfA", "libc", 1, "libc", 1, 1, memmove);
|
||||
LIB_FUNCTION("kiZSXIWd9vg", "libc", 1, "libc", 1, 1, strcpy);
|
||||
LIB_FUNCTION("Ls4tzzhimqQ", "libc", 1, "libc", 1, 1, strcat);
|
||||
LIB_FUNCTION("DfivPArhucg", "libc", 1, "libc", 1, 1, memcmp);
|
||||
LIB_FUNCTION("Q3VBxCXhUHs", "libc", 1, "libc", 1, 1, memcpy);
|
||||
LIB_FUNCTION("8zTFvBIAIN8", "libc", 1, "libc", 1, 1, memset);
|
||||
LIB_FUNCTION("Ovb2dSJOAuE", "libc", 1, "libc", 1, 1, ps4_strcmp);
|
||||
LIB_FUNCTION("j4ViWNHEgww", "libc", 1, "libc", 1, 1, ps4_strlen);
|
||||
LIB_FUNCTION("6sJWiWSRuqk", "libc", 1, "libc", 1, 1, ps4_strncpy);
|
||||
LIB_FUNCTION("+P6FRGH4LfA", "libc", 1, "libc", 1, 1, ps4_memmove);
|
||||
LIB_FUNCTION("kiZSXIWd9vg", "libc", 1, "libc", 1, 1, ps4_strcpy);
|
||||
LIB_FUNCTION("Ls4tzzhimqQ", "libc", 1, "libc", 1, 1, ps4_strcat);
|
||||
LIB_FUNCTION("DfivPArhucg", "libc", 1, "libc", 1, 1, ps4_memcmp);
|
||||
LIB_FUNCTION("Q3VBxCXhUHs", "libc", 1, "libc", 1, 1, ps4_memcpy);
|
||||
LIB_FUNCTION("8zTFvBIAIN8", "libc", 1, "libc", 1, 1, ps4_memset);
|
||||
|
||||
// stdio functions
|
||||
LIB_FUNCTION("hcuQgD53UxM", "libc", 1, "libc", 1, 1, printf);
|
||||
LIB_FUNCTION("Q2V+iqvjgC0", "libc", 1, "libc", 1, 1, vsnprintf);
|
||||
LIB_FUNCTION("YQ0navp+YIc", "libc", 1, "libc", 1, 1, puts);
|
||||
LIB_FUNCTION("fffwELXNVFA", "libc", 1, "libc", 1, 1, fprintf);
|
||||
LIB_FUNCTION("hcuQgD53UxM", "libc", 1, "libc", 1, 1, ps4_printf);
|
||||
LIB_FUNCTION("Q2V+iqvjgC0", "libc", 1, "libc", 1, 1, ps4_vsnprintf);
|
||||
LIB_FUNCTION("YQ0navp+YIc", "libc", 1, "libc", 1, 1, ps4_puts);
|
||||
LIB_FUNCTION("fffwELXNVFA", "libc", 1, "libc", 1, 1, ps4_fprintf);
|
||||
|
||||
// misc
|
||||
LIB_OBJ("P330P3dFF68", "libc", 1, "libc", 1, 1, &g_need_sceLibc);
|
||||
LIB_OBJ("2sWzhYqFH4E","libc", 1, "libc", 1, 1,stdout);
|
||||
LIB_OBJ("H8AprKeZtNg", "libc", 1, "libc", 1, 1, stderr);
|
||||
LIB_FUNCTION("bzQExy189ZI", "libc", 1, "libc", 1, 1, init_env);
|
||||
LIB_FUNCTION("XKRegsFpEpk", "libc", 1, "libc", 1, 1, catchReturnFromMain);
|
||||
LIB_FUNCTION("-QgqOT5u2Vk", "libc", 1, "libc", 1, 1, _Assert);
|
||||
LIB_FUNCTION("z+P+xCnWLBk", "libc", 1, "libc", 1, 1, _ZdlPv);
|
||||
LIB_FUNCTION("eT2UsmTewbU", "libc", 1, "libc", 1, 1, _ZSt11_Xbad_allocv);
|
||||
LIB_FUNCTION("tQIo+GIPklo", "libc", 1, "libc", 1, 1, _ZSt14_Xlength_errorPKc);
|
||||
LIB_FUNCTION("fJnpuVVBbKk", "libc", 1, "libc", 1, 1, _Znwm);
|
||||
LIB_FUNCTION("tsvEmnenz48", "libc", 1, "libc", 1, 1, __cxa_atexit);
|
||||
LIB_FUNCTION("H2e8t5ScQGc", "libc", 1, "libc", 1, 1, __cxa_finalize);
|
||||
LIB_FUNCTION("zr094EQ39Ww", "libc", 1, "libc", 1, 1, __cxa_pure_virtual);
|
||||
LIB_FUNCTION("1uJgoVq3bQU", "libc", 1, "libc", 1, 1, _Getptolower);
|
||||
LIB_FUNCTION("rcQCUr0EaRU", "libc", 1, "libc", 1, 1, _Getptoupper);
|
||||
LIB_FUNCTION("sUP1hBaouOw", "libc", 1, "libc", 1, 1, _Getpctype);
|
||||
LIB_FUNCTION("bzQExy189ZI", "libc", 1, "libc", 1, 1, ps4_init_env);
|
||||
LIB_FUNCTION("XKRegsFpEpk", "libc", 1, "libc", 1, 1, ps4_catchReturnFromMain);
|
||||
LIB_FUNCTION("-QgqOT5u2Vk", "libc", 1, "libc", 1, 1, ps4__Assert);
|
||||
LIB_FUNCTION("z+P+xCnWLBk", "libc", 1, "libc", 1, 1, ps4__ZdlPv);
|
||||
LIB_FUNCTION("eT2UsmTewbU", "libc", 1, "libc", 1, 1, ps4__ZSt11_Xbad_allocv);
|
||||
LIB_FUNCTION("tQIo+GIPklo", "libc", 1, "libc", 1, 1, ps4__ZSt14_Xlength_errorPKc);
|
||||
LIB_FUNCTION("fJnpuVVBbKk", "libc", 1, "libc", 1, 1, ps4__Znwm);
|
||||
LIB_FUNCTION("tsvEmnenz48", "libc", 1, "libc", 1, 1, ps4___cxa_atexit);
|
||||
LIB_FUNCTION("H2e8t5ScQGc", "libc", 1, "libc", 1, 1, ps4___cxa_finalize);
|
||||
LIB_FUNCTION("zr094EQ39Ww", "libc", 1, "libc", 1, 1, ps4___cxa_pure_virtual);
|
||||
LIB_FUNCTION("1uJgoVq3bQU", "libc", 1, "libc", 1, 1, ps4__Getptolower);
|
||||
LIB_FUNCTION("rcQCUr0EaRU", "libc", 1, "libc", 1, 1, ps4__Getptoupper);
|
||||
LIB_FUNCTION("sUP1hBaouOw", "libc", 1, "libc", 1, 1, ps4__Getpctype);
|
||||
}
|
||||
|
||||
}; // namespace Core::Libraries::LibC
|
||||
|
|
|
@ -73,7 +73,7 @@ static void setNotInUse(u64* guard_object) { ((u08*)guard_object)[1] = 0; }
|
|||
// aborts if called again on the same guard object without an intervening
|
||||
// call to __cxa_guard_release() or __cxa_guard_abort().
|
||||
//
|
||||
int PS4_SYSV_ABI __cxa_guard_acquire(u64* guard_object) {
|
||||
int PS4_SYSV_ABI ps4___cxa_guard_acquire(u64* guard_object) {
|
||||
// Double check that the initializer has not already been run
|
||||
if (initializerHasRun(guard_object)) return 0;
|
||||
|
||||
|
@ -121,7 +121,7 @@ int PS4_SYSV_ABI __cxa_guard_acquire(u64* guard_object) {
|
|||
// Sets the first byte of the guard_object to a non-zero value.
|
||||
// Releases any locks acquired by __cxa_guard_acquire().
|
||||
//
|
||||
void PS4_SYSV_ABI __cxa_guard_release(u64* guard_object) {
|
||||
void PS4_SYSV_ABI ps4___cxa_guard_release(u64* guard_object) {
|
||||
// first mark initalizer as having been run, so
|
||||
// other threads won't try to re-run it.
|
||||
setInitializerHasRun(guard_object);
|
||||
|
@ -136,7 +136,7 @@ void PS4_SYSV_ABI __cxa_guard_release(u64* guard_object) {
|
|||
//
|
||||
// Releases any locks acquired by __cxa_guard_acquire().
|
||||
//
|
||||
void PS4_SYSV_ABI __cxa_guard_abort(u64* guard_object) {
|
||||
void PS4_SYSV_ABI ps4___cxa_guard_abort(u64* guard_object) {
|
||||
int result = ::pthread_mutex_unlock(guard_mutex());
|
||||
if (result != 0) {
|
||||
LOG_TRACE_IF(log_file_cxa, "__cxa_guard_abort(): pthread_mutex_unlock failed with {}\n", result);
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
namespace Core::Libraries::LibC {
|
||||
|
||||
int PS4_SYSV_ABI __cxa_guard_acquire(u64* guard_object);
|
||||
void PS4_SYSV_ABI __cxa_guard_release(u64* guard_object);
|
||||
void PS4_SYSV_ABI __cxa_guard_abort(u64* guard_object);
|
||||
int PS4_SYSV_ABI ps4___cxa_guard_acquire(u64* guard_object);
|
||||
void PS4_SYSV_ABI ps4___cxa_guard_release(u64* guard_object);
|
||||
void PS4_SYSV_ABI ps4___cxa_guard_abort(u64* guard_object);
|
||||
|
||||
} // namespace Core::Libraries::LibC
|
||||
|
|
|
@ -3,35 +3,35 @@
|
|||
|
||||
namespace Core::Libraries::LibC {
|
||||
|
||||
float PS4_SYSV_ABI atan2f(float y, float x) {
|
||||
float PS4_SYSV_ABI ps4_atan2f(float y, float x) {
|
||||
return std::atan2f(y, x);
|
||||
}
|
||||
|
||||
float PS4_SYSV_ABI acosf(float num) {
|
||||
float PS4_SYSV_ABI ps4_acosf(float num) {
|
||||
return std::acosf(num);
|
||||
}
|
||||
|
||||
float PS4_SYSV_ABI tanf(float num) {
|
||||
float PS4_SYSV_ABI ps4_tanf(float num) {
|
||||
return std::tanf(num);
|
||||
}
|
||||
|
||||
float PS4_SYSV_ABI asinf(float num) {
|
||||
float PS4_SYSV_ABI ps4_asinf(float num) {
|
||||
return std::asinf(num);
|
||||
}
|
||||
|
||||
double PS4_SYSV_ABI pow(double base, double exponent) {
|
||||
double PS4_SYSV_ABI ps4_pow(double base, double exponent) {
|
||||
return std::pow(base, exponent);
|
||||
}
|
||||
|
||||
double PS4_SYSV_ABI _Sin(double x) {
|
||||
double PS4_SYSV_ABI ps4__Sin(double x) {
|
||||
return std::sin(x);
|
||||
}
|
||||
|
||||
float PS4_SYSV_ABI _Fsin(float arg) {
|
||||
float PS4_SYSV_ABI ps4__Fsin(float arg) {
|
||||
return std::sinf(arg);
|
||||
}
|
||||
|
||||
double PS4_SYSV_ABI exp2(double arg) {
|
||||
double PS4_SYSV_ABI ps4_exp2(double arg) {
|
||||
return std::exp2(arg);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
namespace Core::Libraries::LibC {
|
||||
|
||||
float PS4_SYSV_ABI atan2f(float y, float x);
|
||||
float PS4_SYSV_ABI acosf(float num);
|
||||
float PS4_SYSV_ABI tanf(float num);
|
||||
float PS4_SYSV_ABI asinf(float num);
|
||||
double PS4_SYSV_ABI pow(double base, double exponent);
|
||||
double PS4_SYSV_ABI _Sin(double x);
|
||||
float PS4_SYSV_ABI _Fsin(float arg);
|
||||
double PS4_SYSV_ABI exp2(double arg);
|
||||
float PS4_SYSV_ABI ps4_atan2f(float y, float x);
|
||||
float PS4_SYSV_ABI ps4_acosf(float num);
|
||||
float PS4_SYSV_ABI ps4_tanf(float num);
|
||||
float PS4_SYSV_ABI ps4_asinf(float num);
|
||||
double PS4_SYSV_ABI ps4_pow(double base, double exponent);
|
||||
double PS4_SYSV_ABI ps4__Sin(double x);
|
||||
float PS4_SYSV_ABI ps4__Fsin(float arg);
|
||||
double PS4_SYSV_ABI ps4_exp2(double arg);
|
||||
|
||||
} // namespace Core::Libraries::LibC
|
||||
|
|
|
@ -6,12 +6,12 @@ namespace Core::Libraries::LibC {
|
|||
|
||||
constexpr bool log_file_libc = true; // disable it to disable logging
|
||||
|
||||
int PS4_SYSV_ABI printf(VA_ARGS) {
|
||||
int PS4_SYSV_ABI ps4_printf(VA_ARGS) {
|
||||
VA_CTX(ctx);
|
||||
return printf_ctx(&ctx);
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI fprintf(FILE* file, VA_ARGS) {
|
||||
int PS4_SYSV_ABI ps4_fprintf(FILE* file, VA_ARGS) {
|
||||
int fd = _fileno(file);
|
||||
if (fd == 1 || fd == 2) { // output stdout and stderr to console
|
||||
VA_CTX(ctx);
|
||||
|
@ -22,11 +22,11 @@ int PS4_SYSV_ABI fprintf(FILE* file, VA_ARGS) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI vsnprintf(char* s, size_t n, const char* format, VaList* arg) {
|
||||
int PS4_SYSV_ABI ps4_vsnprintf(char* s, size_t n, const char* format, VaList* arg) {
|
||||
return vsnprintf_ctx(s, n, format, arg);
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI puts(const char* s) {
|
||||
int PS4_SYSV_ABI ps4_puts(const char* s) {
|
||||
return std::puts(s);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
namespace Core::Libraries::LibC {
|
||||
|
||||
int PS4_SYSV_ABI printf(VA_ARGS);
|
||||
int PS4_SYSV_ABI vsnprintf(char* s, size_t n, const char* format, VaList* arg);
|
||||
int PS4_SYSV_ABI puts(const char* s);
|
||||
int PS4_SYSV_ABI fprintf(FILE* file, VA_ARGS);
|
||||
int PS4_SYSV_ABI ps4_printf(VA_ARGS);
|
||||
int PS4_SYSV_ABI ps4_vsnprintf(char* s, size_t n, const char* format, VaList* arg);
|
||||
int PS4_SYSV_ABI ps4_puts(const char* s);
|
||||
int PS4_SYSV_ABI ps4_fprintf(FILE* file, VA_ARGS);
|
||||
|
||||
} // namespace Core::Libraries::LibC
|
||||
|
|
|
@ -7,11 +7,11 @@ namespace Core::Libraries::LibC {
|
|||
|
||||
constexpr bool log_file_libc = true; // disable it to disable logging
|
||||
|
||||
void PS4_SYSV_ABI exit(int code) {
|
||||
void PS4_SYSV_ABI ps4_exit(int code) {
|
||||
std::exit(code);
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI atexit(void (*func)()) {
|
||||
int PS4_SYSV_ABI ps4_atexit(void (*func)()) {
|
||||
int rt = std::atexit(func);
|
||||
if (rt != 0) {
|
||||
LOG_ERROR_IF(log_file_libc, "atexit returned {}\n", rt);
|
||||
|
@ -20,11 +20,11 @@ int PS4_SYSV_ABI atexit(void (*func)()) {
|
|||
return rt;
|
||||
}
|
||||
|
||||
void* PS4_SYSV_ABI malloc(size_t size) {
|
||||
void* PS4_SYSV_ABI ps4_malloc(size_t size) {
|
||||
return std::malloc(size);
|
||||
}
|
||||
|
||||
void PS4_SYSV_ABI free(void* ptr) {
|
||||
void PS4_SYSV_ABI ps4_free(void* ptr) {
|
||||
std::free(ptr);
|
||||
}
|
||||
|
||||
|
@ -35,12 +35,12 @@ int qsort_compair(const void* arg1, const void* arg2) {
|
|||
return compair_ps4(arg1, arg2);
|
||||
}
|
||||
|
||||
void PS4_SYSV_ABI qsort(void* ptr, size_t count, size_t size, int(PS4_SYSV_ABI* comp)(const void*, const void*)) {
|
||||
void PS4_SYSV_ABI ps4_qsort(void* ptr, size_t count, size_t size, int(PS4_SYSV_ABI* comp)(const void*, const void*)) {
|
||||
compair_ps4 = comp;
|
||||
std::qsort(ptr, count, size, qsort_compair);
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI rand() {
|
||||
int PS4_SYSV_ABI ps4_rand() {
|
||||
return std::rand();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
|
||||
namespace Core::Libraries::LibC {
|
||||
|
||||
void PS4_SYSV_ABI exit(int code);
|
||||
int PS4_SYSV_ABI atexit(void (*func)());
|
||||
void* PS4_SYSV_ABI malloc(size_t size);
|
||||
void PS4_SYSV_ABI free(void* ptr);
|
||||
void PS4_SYSV_ABI qsort(void* ptr, size_t count, size_t size, int(PS4_SYSV_ABI* comp)(const void*, const void*));
|
||||
int PS4_SYSV_ABI rand();
|
||||
void PS4_SYSV_ABI ps4_exit(int code);
|
||||
int PS4_SYSV_ABI ps4_atexit(void (*func)());
|
||||
void* PS4_SYSV_ABI ps4_malloc(size_t size);
|
||||
void PS4_SYSV_ABI ps4_free(void* ptr);
|
||||
void PS4_SYSV_ABI ps4_qsort(void* ptr, size_t count, size_t size, int(PS4_SYSV_ABI* comp)(const void*, const void*));
|
||||
int PS4_SYSV_ABI ps4_rand();
|
||||
|
||||
} // namespace Core::Libraries::LibC
|
||||
|
|
|
@ -3,39 +3,39 @@
|
|||
|
||||
namespace Core::Libraries::LibC {
|
||||
|
||||
int PS4_SYSV_ABI memcmp(const void* s1, const void* s2, size_t n) {
|
||||
int PS4_SYSV_ABI ps4_memcmp(const void* s1, const void* s2, size_t n) {
|
||||
return std::memcmp(s1, s2, n);
|
||||
}
|
||||
|
||||
void* PS4_SYSV_ABI memcpy(void* dest, const void* src, size_t n) {
|
||||
void* PS4_SYSV_ABI ps4_memcpy(void* dest, const void* src, size_t n) {
|
||||
return std::memcpy(dest, src, n);
|
||||
}
|
||||
|
||||
void* PS4_SYSV_ABI memset(void* s, int c, size_t n) {
|
||||
void* PS4_SYSV_ABI ps4_memset(void* s, int c, size_t n) {
|
||||
return std::memset(s, c, n);
|
||||
}
|
||||
|
||||
int PS4_SYSV_ABI strcmp(const char* str1, const char* str2) {
|
||||
int PS4_SYSV_ABI ps4_strcmp(const char* str1, const char* str2) {
|
||||
return std::strcmp(str1, str2);
|
||||
}
|
||||
|
||||
char* PS4_SYSV_ABI strncpy(char* dest, const char* src, size_t count) {
|
||||
char* PS4_SYSV_ABI ps4_strncpy(char* dest, const char* src, size_t count) {
|
||||
return std::strncpy(dest, src, count);
|
||||
}
|
||||
|
||||
void* PS4_SYSV_ABI memmove(void* dest, const void* src, std::size_t count) {
|
||||
void* PS4_SYSV_ABI ps4_memmove(void* dest, const void* src, std::size_t count) {
|
||||
return std::memmove(dest, src, count);
|
||||
}
|
||||
|
||||
char* PS4_SYSV_ABI strcpy(char* dest, const char* src) {
|
||||
char* PS4_SYSV_ABI ps4_strcpy(char* dest, const char* src) {
|
||||
return std::strcpy(dest, src);
|
||||
}
|
||||
|
||||
char* PS4_SYSV_ABI strcat(char* dest, const char* src) {
|
||||
char* PS4_SYSV_ABI ps4_strcat(char* dest, const char* src) {
|
||||
return std::strcat(dest, src);
|
||||
}
|
||||
|
||||
size_t PS4_SYSV_ABI strlen(const char* str) {
|
||||
size_t PS4_SYSV_ABI ps4_strlen(const char* str) {
|
||||
return std::strlen(str);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
|
||||
namespace Core::Libraries::LibC {
|
||||
|
||||
int PS4_SYSV_ABI memcmp(const void* s1, const void* s2, size_t n);
|
||||
void* PS4_SYSV_ABI memcpy(void* dest, const void* src, size_t n);
|
||||
void* PS4_SYSV_ABI memset(void* s, int c, size_t n);
|
||||
int PS4_SYSV_ABI strcmp(const char* str1, const char* str2);
|
||||
char* PS4_SYSV_ABI strncpy(char* dest, const char* src, size_t count);
|
||||
void* PS4_SYSV_ABI memmove(void* dest, const void* src, std::size_t count);
|
||||
char* PS4_SYSV_ABI strcpy(char* destination, const char* source);
|
||||
char* PS4_SYSV_ABI strcat(char* dest, const char* src);
|
||||
size_t PS4_SYSV_ABI strlen(const char* str);
|
||||
int PS4_SYSV_ABI ps4_memcmp(const void* s1, const void* s2, size_t n);
|
||||
void* PS4_SYSV_ABI ps4_memcpy(void* dest, const void* src, size_t n);
|
||||
void* PS4_SYSV_ABI ps4_memset(void* s, int c, size_t n);
|
||||
int PS4_SYSV_ABI ps4_strcmp(const char* str1, const char* str2);
|
||||
char* PS4_SYSV_ABI ps4_strncpy(char* dest, const char* src, size_t count);
|
||||
void* PS4_SYSV_ABI ps4_memmove(void* dest, const void* src, std::size_t count);
|
||||
char* PS4_SYSV_ABI ps4_strcpy(char* destination, const char* source);
|
||||
char* PS4_SYSV_ABI ps4_strcat(char* dest, const char* src);
|
||||
size_t PS4_SYSV_ABI ps4_strlen(const char* str);
|
||||
|
||||
} // namespace Core::Libraries::LibC
|
||||
|
|
Loading…
Reference in New Issue