added some more stdio functions

This commit is contained in:
georgemoralis 2023-11-13 14:06:57 +02:00
parent 30e9012914
commit 57985304c6
3 changed files with 14 additions and 3 deletions

View file

@ -444,6 +444,10 @@ void libcSymbolsRegister(Loader::SymbolsResolver* sym) {
LIB_FUNCTION("tcVi5SivF7Q", "libc", 1, "libc", 1, 1, sprintf);
LIB_FUNCTION("xeYO4u7uyJ0", "libc", 1, "libc", 1, 1, fopen);
LIB_FUNCTION("uodLYyUip20", "libc", 1, "libc", 1, 1, fclose);
LIB_FUNCTION("QMFyLoqNxIg", "libc", 1, "libc", 1, 1, setvbuf);
LIB_FUNCTION("rQFVBXp-Cxg", "libc", 1, "libc", 1, 1, fseek);
LIB_FUNCTION("SHlt7EhOtqA", "libc", 1, "libc", 1, 1, fgetpos);
LIB_FUNCTION("lbB+UlZqVG0", "libc", 1, "libc", 1, 1, fread);
// misc
LIB_OBJ("P330P3dFF68", "libc", 1, "libc", 1, 1, &g_need_sceLibc);
LIB_OBJ("2sWzhYqFH4E","libc", 1, "libc", 1, 1,stdout);

View file

@ -51,12 +51,15 @@ FILE* PS4_SYSV_ABI fopen(const char* filename, const char* mode) {
FILE* f = std::fopen(file->m_host_name.c_str(), mode);
return f;
}
int PS4_SYSV_ABI fclose(FILE* stream) {
int PS4_SYSV_ABI fclose(FILE* stream) {
LOG_ERROR_IF(log_file_libc, "fclose\n");
if (stream != nullptr)
{
if (stream != nullptr) {
std::fclose(stream);
}
return 0;
}
int PS4_SYSV_ABI setvbuf(FILE* stream, char* buffer, int mode, size_t size) { return std::setvbuf(stream, buffer, mode, size); }
int PS4_SYSV_ABI fseek(FILE* stream, long int offset, int origin) { return std::fseek(stream, offset, origin); }
int PS4_SYSV_ABI fgetpos(FILE* stream, fpos_t* pos) { return std::fgetpos(stream, pos); }
size_t PS4_SYSV_ABI fread(void* ptr, size_t size, size_t count, FILE* stream) { return std::fread(ptr, size, count, stream); }
} // namespace Core::Libraries::LibC

View file

@ -13,4 +13,8 @@ int PS4_SYSV_ABI snprintf(char* s, size_t n, VA_ARGS);
int PS4_SYSV_ABI sprintf(char* s, VA_ARGS);
FILE* PS4_SYSV_ABI fopen(const char* filename, const char* mode);
int PS4_SYSV_ABI fclose(FILE* stream);
int PS4_SYSV_ABI setvbuf(FILE* stream, char* buffer, int mode, size_t size);
int PS4_SYSV_ABI fseek(FILE* stream, long int offset, int origin);
int PS4_SYSV_ABI fgetpos(FILE* stream, fpos_t* pos);
size_t PS4_SYSV_ABI fread(void* ptr, size_t size, size_t count, FILE* stream);
} // namespace Core::Libraries::LibC