_ZdlPv , _Znwm needed for breakout homebrew

This commit is contained in:
georgemoralis 2023-10-09 12:31:31 +03:00
parent fe62e435ed
commit bc6b740ffe
1 changed files with 17 additions and 4 deletions

View File

@ -4,10 +4,9 @@
#include <pthread.h> #include <pthread.h>
#include "../Loader/Elf.h" #include "../Loader/Elf.h"
#include "Libs.h"
#include "Emulator/HLE/Libraries/LibC/libc.h" #include "Emulator/HLE/Libraries/LibC/libc.h"
#include "ErrorCodes.h" #include "ErrorCodes.h"
#include "Libs.h"
namespace HLE::Libs::LibC { namespace HLE::Libs::LibC {
@ -72,8 +71,6 @@ void PS4_SYSV_ABI __cxa_guard_release(u64* guard_object) {
} }
} }
static PS4_SYSV_ABI void catchReturnFromMain(int status) { static PS4_SYSV_ABI void catchReturnFromMain(int status) {
// dummy // dummy
} }
@ -87,6 +84,17 @@ PS4_SYSV_ABI int puts(const char* s) {
PS4_SYSV_ABI int rand() { return std::rand(); } PS4_SYSV_ABI int rand() { return std::rand(); }
PS4_SYSV_ABI void _ZdlPv(void* ptr) { std::free(ptr); }
PS4_SYSV_ABI void _ZSt11_Xbad_allocv() { BREAKPOINT(); }
PS4_SYSV_ABI void _ZSt14_Xlength_errorPKc() { BREAKPOINT(); }
PS4_SYSV_ABI void* _Znwm(u64 count) {
if (count == 0) {
BREAKPOINT();
}
void* ptr = std::malloc(count);
return ptr;
}
void LibC_Register(SymbolsResolver* sym) { void LibC_Register(SymbolsResolver* sym) {
LIB_FUNCTION("bzQExy189ZI", "libc", 1, "libc", 1, 1, init_env); LIB_FUNCTION("bzQExy189ZI", "libc", 1, "libc", 1, 1, init_env);
LIB_FUNCTION("3GPpjQdAMTw", "libc", 1, "libc", 1, 1, __cxa_guard_acquire); LIB_FUNCTION("3GPpjQdAMTw", "libc", 1, "libc", 1, 1, __cxa_guard_acquire);
@ -102,6 +110,11 @@ void LibC_Register(SymbolsResolver* sym) {
LIB_FUNCTION("YQ0navp+YIc", "libc", 1, "libc", 1, 1, puts); LIB_FUNCTION("YQ0navp+YIc", "libc", 1, "libc", 1, 1, puts);
LIB_FUNCTION("cpCOXWMgha0", "libc", 1, "libc", 1, 1, rand); LIB_FUNCTION("cpCOXWMgha0", "libc", 1, "libc", 1, 1, rand);
LIB_OBJ("P330P3dFF68", "libc", 1, "libc", 1, 1, &HLE::Libs::LibC::g_need_sceLibc); LIB_OBJ("P330P3dFF68", "libc", 1, "libc", 1, 1, &HLE::Libs::LibC::g_need_sceLibc);
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);
} }
}; // namespace HLE::Libs::LibC }; // namespace HLE::Libs::LibC