From 53b56ba123b1fe18e93b4a988fa24ee665dea717 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Tue, 3 Dec 2019 08:47:13 +0100 Subject: [PATCH] Added some SDL2 and libc wrapped lib stuff (and now Torchlight2 boots) --- src/wrapped/generated/wrapper.c | 2 ++ src/wrapped/generated/wrapper.h | 1 + src/wrapped/wrappedlibc_private.h | 6 +++--- src/wrapped/wrappedsdl2.c | 8 +++++++- src/wrapped/wrappedsdl2_private.h | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c index 43c7ae30..6f4460c2 100644 --- a/src/wrapped/generated/wrapper.c +++ b/src/wrapped/generated/wrapper.c @@ -360,6 +360,7 @@ typedef int32_t (*iFiiiu_t)(int32_t, int32_t, int32_t, uint32_t); typedef int32_t (*iFiiip_t)(int32_t, int32_t, int32_t, void*); typedef int32_t (*iFiipi_t)(int32_t, int32_t, void*, int32_t); typedef int32_t (*iFiipu_t)(int32_t, int32_t, void*, uint32_t); +typedef int32_t (*iFiipp_t)(int32_t, int32_t, void*, void*); typedef int32_t (*iFiuii_t)(int32_t, uint32_t, int32_t, int32_t); typedef int32_t (*iFiuui_t)(int32_t, uint32_t, uint32_t, int32_t); typedef int32_t (*iFiupp_t)(int32_t, uint32_t, void*, void*); @@ -1291,6 +1292,7 @@ void iFiiiu(x86emu_t *emu, uintptr_t fcn) { iFiiiu_t fn = (iFiiiu_t)fcn; R_EAX=f void iFiiip(x86emu_t *emu, uintptr_t fcn) { iFiiip_t fn = (iFiiip_t)fcn; R_EAX=fn(*(int32_t*)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(void**)(R_ESP + 16)); } void iFiipi(x86emu_t *emu, uintptr_t fcn) { iFiipi_t fn = (iFiipi_t)fcn; R_EAX=fn(*(int32_t*)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(void**)(R_ESP + 12), *(int32_t*)(R_ESP + 16)); } void iFiipu(x86emu_t *emu, uintptr_t fcn) { iFiipu_t fn = (iFiipu_t)fcn; R_EAX=fn(*(int32_t*)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(void**)(R_ESP + 12), *(uint32_t*)(R_ESP + 16)); } +void iFiipp(x86emu_t *emu, uintptr_t fcn) { iFiipp_t fn = (iFiipp_t)fcn; R_EAX=fn(*(int32_t*)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(void**)(R_ESP + 12), *(void**)(R_ESP + 16)); } void iFiuii(x86emu_t *emu, uintptr_t fcn) { iFiuii_t fn = (iFiuii_t)fcn; R_EAX=fn(*(int32_t*)(R_ESP + 4), *(uint32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16)); } void iFiuui(x86emu_t *emu, uintptr_t fcn) { iFiuui_t fn = (iFiuui_t)fcn; R_EAX=fn(*(int32_t*)(R_ESP + 4), *(uint32_t*)(R_ESP + 8), *(uint32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16)); } void iFiupp(x86emu_t *emu, uintptr_t fcn) { iFiupp_t fn = (iFiupp_t)fcn; R_EAX=fn(*(int32_t*)(R_ESP + 4), *(uint32_t*)(R_ESP + 8), *(void**)(R_ESP + 12), *(void**)(R_ESP + 16)); } diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h index a8d1f0dc..62a45dc7 100644 --- a/src/wrapped/generated/wrapper.h +++ b/src/wrapped/generated/wrapper.h @@ -356,6 +356,7 @@ void iFiiiu(x86emu_t *emu, uintptr_t fnc); void iFiiip(x86emu_t *emu, uintptr_t fnc); void iFiipi(x86emu_t *emu, uintptr_t fnc); void iFiipu(x86emu_t *emu, uintptr_t fnc); +void iFiipp(x86emu_t *emu, uintptr_t fnc); void iFiuii(x86emu_t *emu, uintptr_t fnc); void iFiuui(x86emu_t *emu, uintptr_t fnc); void iFiupp(x86emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h index 4b99fd08..3912c9bf 100755 --- a/src/wrapped/wrappedlibc_private.h +++ b/src/wrapped/wrappedlibc_private.h @@ -1781,9 +1781,9 @@ GOW(textdomain, pFp) GO(time, uFp) GO(timegm, uFp) // timelocal // Weak -// timerfd_create -// timerfd_gettime -// timerfd_settime +GO(timerfd_create, iFii) +GO(timerfd_gettime, iFip) +GO(timerfd_settime, iFiipp) GOW(times, iFp) DATAV(timezone, 4) DATAB(__timezone, 4) // type B diff --git a/src/wrapped/wrappedsdl2.c b/src/wrapped/wrappedsdl2.c index 24ecc09d..e62ca517 100755 --- a/src/wrapped/wrappedsdl2.c +++ b/src/wrapped/wrappedsdl2.c @@ -924,7 +924,13 @@ const char* sdl2Name = "libSDL2-2.0.so.0"; lib->priv.w.p2 = getSDL2My(lib); \ box86->sdl2allocrw = ((sdl2_my_t*)lib->priv.w.p2)->SDL_AllocRW; \ box86->sdl2freerw = ((sdl2_my_t*)lib->priv.w.p2)->SDL_FreeRW; \ - lib->altmy = strdup("my2_"); + lib->altmy = strdup("my2_"); \ + lib->priv.w.needed = 4; \ + lib->priv.w.neededlibs = (char**)calloc(lib->priv.w.needed, sizeof(char*)); \ + lib->priv.w.neededlibs[0] = strdup("libdl.so.2"); \ + lib->priv.w.neededlibs[1] = strdup("libm.so.6"); \ + lib->priv.w.neededlibs[2] = strdup("librt.so.1"); \ + lib->priv.w.neededlibs[3] = strdup("libpthread.so.0"); #define CUSTOM_FINI \ freeSDL2My(lib->priv.w.p2); \ diff --git a/src/wrapped/wrappedsdl2_private.h b/src/wrapped/wrappedsdl2_private.h index 6bf77c30..432fb3cf 100755 --- a/src/wrapped/wrappedsdl2_private.h +++ b/src/wrapped/wrappedsdl2_private.h @@ -589,7 +589,7 @@ GOM(SDL_snprintf, iFEpupVV) GO(SDL_SoftStretch, iFpppp) GO(SDL_sqrt, dFd) GO(SDL_sqrtf, fFf) -// SDL_sscanf +GO2(SDL_sscanf, iFppV, SDL_vsscanf) GO(SDL_StartTextInput, vFv) GO(SDL_StopTextInput, vFv) GO(SDL_strcasecmp, iFpp)