diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-12-04 15:20:09 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-12-04 15:20:14 +0100 |
| commit | 2a9d863131229119c7882385e670c488aa88f342 (patch) | |
| tree | 716902f50f9d4c11d076e57d9557cd0ebb5f6e34 /src | |
| parent | e3e9a86088766a8750d4da302ff10245bcaec418 (diff) | |
| download | box64-2a9d863131229119c7882385e670c488aa88f342.tar.gz box64-2a9d863131229119c7882385e670c488aa88f342.zip | |
[BOX32][WRAPPER] Added ldiv 32bits wrapped function (now Undertale works with box32, probably other linux gamestudio games too)
Diffstat (limited to 'src')
| -rw-r--r-- | src/wrapped/wrappedlibc.c | 6 | ||||
| -rw-r--r-- | src/wrapped32/generated/functions_list.txt | 1 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.c | 2 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.h | 1 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc_private.h | 2 |
5 files changed, 8 insertions, 4 deletions
diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c index 041d4a3d..ae0cd0fa 100644 --- a/src/wrapped/wrappedlibc.c +++ b/src/wrapped/wrappedlibc.c @@ -2152,13 +2152,13 @@ EXPORT int32_t my_nftw(x64emu_t* emu, void* pathname, void* B, int32_t nopenfd, return f(pathname, findnftwFct(B), nopenfd, flags); } +#endif -EXPORT void* my_ldiv(x64emu_t* emu, void* p, int32_t num, int32_t den) +EXPORT void* my32_ldiv(x64emu_t* emu, void* p, int32_t num, int32_t den) { - *((ldiv_t*)p) = ldiv(num, den); + *((div_t*)p) = div(num, den); return p; } -#endif #ifndef NOALIGN EXPORT int32_t my_epoll_ctl(x64emu_t* emu, int32_t epfd, int32_t op, int32_t fd, void* event) diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index 2823caf8..d72fbf5f 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -927,6 +927,7 @@ #() LFXLuu -> LFXLuu #() LFXpLp -> LFXpLp #() pFEupp -> pFEupp +#() pEEpii -> pEEpii #() pFEpip -> pFEpip #() pEEppi -> pEEppi #() pFEppi -> pFEppi diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c index 80bec348..4f24519f 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -1018,6 +1018,7 @@ typedef uintptr_t (*LFXCii_t)(void*, uint8_t, int32_t, int32_t); typedef uintptr_t (*LFXLuu_t)(void*, uintptr_t, uint32_t, uint32_t); typedef uintptr_t (*LFXpLp_t)(void*, void*, uintptr_t, void*); typedef void* (*pFEupp_t)(x64emu_t*, uint32_t, void*, void*); +typedef void* (*pEEpii_t)(x64emu_t*, void*, int32_t, int32_t); typedef void* (*pFEpip_t)(x64emu_t*, void*, int32_t, void*); typedef void* (*pEEppi_t)(x64emu_t*, void*, void*, int32_t); typedef void* (*pFEppi_t)(x64emu_t*, void*, void*, int32_t); @@ -2667,6 +2668,7 @@ void LFXCii_32(x64emu_t *emu, uintptr_t fcn) { LFXCii_t fn = (LFXCii_t)fcn; R_EA void LFXLuu_32(x64emu_t *emu, uintptr_t fcn) { LFXLuu_t fn = (LFXLuu_t)fcn; R_EAX = to_ulong(fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(uint32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16))); } void LFXpLp_32(x64emu_t *emu, uintptr_t fcn) { LFXpLp_t fn = (LFXpLp_t)fcn; R_EAX = to_ulong(fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ulong(from_ptri(ulong_t, R_ESP + 12)), from_ptriv(R_ESP + 16))); } void pFEupp_32(x64emu_t *emu, uintptr_t fcn) { pFEupp_t fn = (pFEupp_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptri(uint32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12))); } +void pEEpii_32(x64emu_t *emu, uintptr_t fcn) { pEEpii_t fn = (pEEpii_t)fcn; errno = emu->libc_err; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12))); emu->libc_err = errno; } void pFEpip_32(x64emu_t *emu, uintptr_t fcn) { pFEpip_t fn = (pFEpip_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12))); } void pEEppi_32(x64emu_t *emu, uintptr_t fcn) { pEEppi_t fn = (pEEppi_t)fcn; errno = emu->libc_err; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12))); emu->libc_err = errno; } void pFEppi_32(x64emu_t *emu, uintptr_t fcn) { pFEppi_t fn = (pFEppi_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12))); } diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h index 6429fae3..a7175dc9 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -968,6 +968,7 @@ void LFXCii_32(x64emu_t *emu, uintptr_t fnc); void LFXLuu_32(x64emu_t *emu, uintptr_t fnc); void LFXpLp_32(x64emu_t *emu, uintptr_t fnc); void pFEupp_32(x64emu_t *emu, uintptr_t fnc); +void pEEpii_32(x64emu_t *emu, uintptr_t fnc); void pFEpip_32(x64emu_t *emu, uintptr_t fnc); void pEEppi_32(x64emu_t *emu, uintptr_t fnc); void pFEppi_32(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped32/wrappedlibc_private.h b/src/wrapped32/wrappedlibc_private.h index 2fefa65b..3e9dd212 100755 --- a/src/wrapped32/wrappedlibc_private.h +++ b/src/wrapped32/wrappedlibc_private.h @@ -994,7 +994,7 @@ GOW(ldexpl, DFDi) #else GOW2(ldexpl, KFKi, ldexp) #endif -//GOS(ldiv, pEEpii) //%% return a struct, so address of stuct is on the stack, as a shadow 1st element +GOS(ldiv, pEEpii) //%% return a struct, so address of stuct is on the stack, as a shadow 1st element //GOM(lfind, pEEpppLp) //%% //GO(lgetxattr, iEpppu) GOM(__libc_alloca_cutoff, iEEL) //%% |