mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-06-07 10:14:59 -06:00
Initial definitions
This commit is contained in:
parent
b43573112c
commit
304d04a100
@ -21,4 +21,9 @@ void RegisterLib(Core::Loader::SymbolsResolver* sym) {
|
|||||||
RegisterlibSceLibcInternalMemory(sym);
|
RegisterlibSceLibcInternalMemory(sym);
|
||||||
RegisterlibSceLibcInternalIo(sym);
|
RegisterlibSceLibcInternalIo(sym);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ForceRegisterLib(Core::Loader::SymbolsResolver* sym) {
|
||||||
|
// Used to forcibly enable HLEs for broken LLE functions.
|
||||||
|
ForceRegisterlibSceLibcInternalIo(sym);
|
||||||
|
}
|
||||||
} // namespace Libraries::LibcInternal
|
} // namespace Libraries::LibcInternal
|
||||||
@ -15,4 +15,5 @@ namespace Libraries::LibcInternal {
|
|||||||
// so everything is just in the .cpp file
|
// so everything is just in the .cpp file
|
||||||
|
|
||||||
void RegisterLib(Core::Loader::SymbolsResolver* sym);
|
void RegisterLib(Core::Loader::SymbolsResolver* sym);
|
||||||
|
void ForceRegisterLib(Core::Loader::SymbolsResolver* sym);
|
||||||
} // namespace Libraries::LibcInternal
|
} // namespace Libraries::LibcInternal
|
||||||
@ -8,16 +8,47 @@
|
|||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/libraries/error_codes.h"
|
#include "core/libraries/error_codes.h"
|
||||||
|
#include "core/libraries/kernel/file_system.h"
|
||||||
#include "core/libraries/libs.h"
|
#include "core/libraries/libs.h"
|
||||||
#include "libc_internal_io.h"
|
#include "libc_internal_io.h"
|
||||||
#include "printf.h"
|
#include "printf.h"
|
||||||
|
|
||||||
namespace Libraries::LibcInternal {
|
namespace Libraries::LibcInternal {
|
||||||
int PS4_SYSV_ABI internal_snprintf(char* s, size_t n, VA_ARGS) {
|
|
||||||
|
s32 PS4_SYSV_ABI internal_snprintf(char* s, size_t n, VA_ARGS) {
|
||||||
VA_CTX(ctx);
|
VA_CTX(ctx);
|
||||||
return snprintf_ctx(s, n, &ctx);
|
return snprintf_ctx(s, n, &ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterlibSceLibcInternalIo(Core::Loader::SymbolsResolver* sym) {
|
void RegisterlibSceLibcInternalIo(Core::Loader::SymbolsResolver* sym) {
|
||||||
LIB_FUNCTION("eLdDw6l0-bU", "libSceLibcInternal", 1, "libSceLibcInternal", internal_snprintf);
|
LIB_FUNCTION("eLdDw6l0-bU", "libSceLibcInternal", 1, "libSceLibcInternal", internal_snprintf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OrbisFILE* PS4_SYSV_ABI internal_fopen(const char* path, const char* mode) {
|
||||||
|
std::scoped_lock lk{g_stream_mtx};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 PS4_SYSV_ABI internal_fseek(OrbisFILE* stream, s64 offset, s32 whence) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 PS4_SYSV_ABI internal_fread(void* ptr, u64 size, u64 nmemb, OrbisFILE* stream) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 PS4_SYSV_ABI internal_fclose(OrbisFILE* stream) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ForceRegisterlibSceLibcInternalIo(Core::Loader::SymbolsResolver* sym) {
|
||||||
|
LIB_FUNCTION("xeYO4u7uyJ0", "libSceLibcInternal", 1, "libSceLibcInternal", internal_fopen);
|
||||||
|
LIB_FUNCTION("rQFVBXp-Cxg", "libSceLibcInternal", 1, "libSceLibcInternal", internal_fseek);
|
||||||
|
LIB_FUNCTION("lbB+UlZqVG0", "libSceLibcInternal", 1, "libSceLibcInternal", internal_fread);
|
||||||
|
LIB_FUNCTION("uodLYyUip20", "libSceLibcInternal", 1, "libSceLibcInternal", internal_fclose);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Libraries::LibcInternal
|
} // namespace Libraries::LibcInternal
|
||||||
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <mutex>
|
||||||
#include "common/types.h"
|
#include "common/types.h"
|
||||||
|
|
||||||
namespace Core::Loader {
|
namespace Core::Loader {
|
||||||
@ -10,5 +11,79 @@ class SymbolsResolver;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace Libraries::LibcInternal {
|
namespace Libraries::LibcInternal {
|
||||||
|
|
||||||
|
static std::recursive_mutex g_stream_mtx{};
|
||||||
|
|
||||||
|
union Orbis__mbstate_t {
|
||||||
|
u8 __mbstate8[128];
|
||||||
|
s64 _mbstateL;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Orbis_Mbstatet {
|
||||||
|
u64 _Wchar;
|
||||||
|
u16 _Byte, _State;
|
||||||
|
s32 : 32;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Orbisfpos_t {
|
||||||
|
s64 _Off;
|
||||||
|
Orbis_Mbstatet _Wstate;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Orbis__sbuf {
|
||||||
|
u8* _base;
|
||||||
|
s32 _size;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct OrbisFILE {
|
||||||
|
u16 _Mode;
|
||||||
|
u8 _Idx;
|
||||||
|
s32 _Handle;
|
||||||
|
|
||||||
|
u8 *_Buf, *_Bend, *_Next;
|
||||||
|
u8 *_Rend, *_Wend, *_Rback;
|
||||||
|
|
||||||
|
u16 *_WRback, _WBack[2];
|
||||||
|
u8 *_Rsave, *_WRend, *_WWend;
|
||||||
|
|
||||||
|
Orbis_Mbstatet _Wstate;
|
||||||
|
u8* _Tmpnam;
|
||||||
|
u8 _Back[6], _Cbuf;
|
||||||
|
void* _Mutex;
|
||||||
|
|
||||||
|
u8* _p;
|
||||||
|
s32 _r;
|
||||||
|
s32 _w;
|
||||||
|
s16 _flags;
|
||||||
|
s16 _file;
|
||||||
|
Orbis__sbuf _bf;
|
||||||
|
s32 _lbfsize;
|
||||||
|
|
||||||
|
void* _cookie;
|
||||||
|
s32 PS4_SYSV_ABI (*_close)(void*);
|
||||||
|
s32 PS4_SYSV_ABI (*_read)(void*, char*, s32);
|
||||||
|
Orbisfpos_t PS4_SYSV_ABI (*_seek)(void*, Orbisfpos_t, s32);
|
||||||
|
s32 (*_write)(void*, const char*, s32);
|
||||||
|
|
||||||
|
Orbis__sbuf _ub;
|
||||||
|
u8* _up;
|
||||||
|
s32 _ur;
|
||||||
|
|
||||||
|
u8 _ubuf[3];
|
||||||
|
u8 _nbuf[1];
|
||||||
|
|
||||||
|
Orbis__sbuf _lb;
|
||||||
|
|
||||||
|
s32 _blksize;
|
||||||
|
Orbisfpos_t _offset;
|
||||||
|
|
||||||
|
void* _fl_mutex;
|
||||||
|
void* _fl_owner;
|
||||||
|
s32 _fl_count;
|
||||||
|
s32 _orientation;
|
||||||
|
Orbis__mbstate_t _mbstate;
|
||||||
|
};
|
||||||
|
|
||||||
void RegisterlibSceLibcInternalIo(Core::Loader::SymbolsResolver* sym);
|
void RegisterlibSceLibcInternalIo(Core::Loader::SymbolsResolver* sym);
|
||||||
|
void ForceRegisterlibSceLibcInternalIo(Core::Loader::SymbolsResolver* sym);
|
||||||
} // namespace Libraries::LibcInternal
|
} // namespace Libraries::LibcInternal
|
||||||
@ -80,6 +80,7 @@ namespace Libraries {
|
|||||||
void InitHLELibs(Core::Loader::SymbolsResolver* sym) {
|
void InitHLELibs(Core::Loader::SymbolsResolver* sym) {
|
||||||
LOG_INFO(Lib_Kernel, "Initializing HLE libraries");
|
LOG_INFO(Lib_Kernel, "Initializing HLE libraries");
|
||||||
Libraries::Kernel::RegisterLib(sym);
|
Libraries::Kernel::RegisterLib(sym);
|
||||||
|
Libraries::LibcInternal::ForceRegisterLib(sym);
|
||||||
Libraries::GnmDriver::RegisterLib(sym);
|
Libraries::GnmDriver::RegisterLib(sym);
|
||||||
Libraries::VideoOut::RegisterLib(sym);
|
Libraries::VideoOut::RegisterLib(sym);
|
||||||
Libraries::UserService::RegisterLib(sym);
|
Libraries::UserService::RegisterLib(sym);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user