diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-03-30 15:26:46 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-03-30 15:26:46 +0200 |
| commit | 171c213b3253e060d2fbbaa9952ea40cba1bbdac (patch) | |
| tree | f845496c129cbc007fca6f27efb0f3739239606d /src | |
| parent | c4dcb316cade38dbd7ca67b068dc27555d9e12aa (diff) | |
| download | box64-171c213b3253e060d2fbbaa9952ea40cba1bbdac.tar.gz box64-171c213b3253e060d2fbbaa9952ea40cba1bbdac.zip | |
Wraped some SDL2 printf functions
Diffstat (limited to 'src')
| -rw-r--r-- | src/wrapped/generated/functions_list.txt | 2 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.c | 4 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.h | 2 | ||||
| -rwxr-xr-x | src/wrapped/wrappedsdl2.c | 37 | ||||
| -rwxr-xr-x | src/wrapped/wrappedsdl2_private.h | 4 |
5 files changed, 21 insertions, 28 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt index 8fb69cca..2c65437e 100644 --- a/src/wrapped/generated/functions_list.txt +++ b/src/wrapped/generated/functions_list.txt @@ -618,6 +618,8 @@ #() iFEpipi #() iFEpipp #() iFEpipV +#() iFEpupp +#() iFEpupV #() iFEpLpp #() iFEpLpV #() iFEppii diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c index 021a999e..6b8cfe44 100644 --- a/src/wrapped/generated/wrapper.c +++ b/src/wrapped/generated/wrapper.c @@ -651,6 +651,8 @@ typedef int32_t (*iFEpiii_t)(x64emu_t*, void*, int32_t, int32_t, int32_t); typedef int32_t (*iFEpipi_t)(x64emu_t*, void*, int32_t, void*, int32_t); typedef int32_t (*iFEpipp_t)(x64emu_t*, void*, int32_t, void*, void*); typedef int32_t (*iFEpipV_t)(x64emu_t*, void*, int32_t, void*, void*); +typedef int32_t (*iFEpupp_t)(x64emu_t*, void*, uint32_t, void*, void*); +typedef int32_t (*iFEpupV_t)(x64emu_t*, void*, uint32_t, void*, void*); typedef int32_t (*iFEpLpp_t)(x64emu_t*, void*, uintptr_t, void*, void*); typedef int32_t (*iFEpLpV_t)(x64emu_t*, void*, uintptr_t, void*, void*); typedef int32_t (*iFEppii_t)(x64emu_t*, void*, void*, int32_t, int32_t); @@ -1744,6 +1746,8 @@ void iFEpiii(x64emu_t *emu, uintptr_t fcn) { iFEpiii_t fn = (iFEpiii_t)fcn; R_RA void iFEpipi(x64emu_t *emu, uintptr_t fcn) { iFEpipi_t fn = (iFEpipi_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (int32_t)R_RCX); } void iFEpipp(x64emu_t *emu, uintptr_t fcn) { iFEpipp_t fn = (iFEpipp_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)R_RCX); } void iFEpipV(x64emu_t *emu, uintptr_t fcn) { iFEpipV_t fn = (iFEpipV_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)(R_RSP + 8)); } +void iFEpupp(x64emu_t *emu, uintptr_t fcn) { iFEpupp_t fn = (iFEpupp_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (uint32_t)R_RSI, (void*)R_RDX, (void*)R_RCX); } +void iFEpupV(x64emu_t *emu, uintptr_t fcn) { iFEpupV_t fn = (iFEpupV_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (uint32_t)R_RSI, (void*)R_RDX, (void*)(R_RSP + 8)); } void iFEpLpp(x64emu_t *emu, uintptr_t fcn) { iFEpLpp_t fn = (iFEpLpp_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (uintptr_t)R_RSI, (void*)R_RDX, (void*)R_RCX); } void iFEpLpV(x64emu_t *emu, uintptr_t fcn) { iFEpLpV_t fn = (iFEpLpV_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (uintptr_t)R_RSI, (void*)R_RDX, (void*)(R_RSP + 8)); } void iFEppii(x64emu_t *emu, uintptr_t fcn) { iFEppii_t fn = (iFEppii_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX); } diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h index 8ffc0262..8fa86623 100644 --- a/src/wrapped/generated/wrapper.h +++ b/src/wrapped/generated/wrapper.h @@ -648,6 +648,8 @@ void iFEpiii(x64emu_t *emu, uintptr_t fnc); void iFEpipi(x64emu_t *emu, uintptr_t fnc); void iFEpipp(x64emu_t *emu, uintptr_t fnc); void iFEpipV(x64emu_t *emu, uintptr_t fnc); +void iFEpupp(x64emu_t *emu, uintptr_t fnc); +void iFEpupV(x64emu_t *emu, uintptr_t fnc); void iFEpLpp(x64emu_t *emu, uintptr_t fnc); void iFEpLpV(x64emu_t *emu, uintptr_t fnc); void iFEppii(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped/wrappedsdl2.c b/src/wrapped/wrappedsdl2.c index 97507a19..7bc32984 100755 --- a/src/wrapped/wrappedsdl2.c +++ b/src/wrapped/wrappedsdl2.c @@ -622,21 +622,12 @@ EXPORT void my2_SDL_LogSetOutputFunction(x64emu_t* emu, void* f, void* arg) my->SDL_LogSetOutputFunction(find_LogOutput_Fct(f), arg); } -//EXPORT int my2_SDL_vsnprintf(x64emu_t* emu, void* buff, uint32_t s, void * fmt, void * b, va_list V) -//{ -// #ifndef NOALIGN -// // need to align on arm -// myStackAlign(emu, (const char*)fmt, *(uint32_t**)b, emu->scratch); -// PREPARE_VALIST; -// void* f = vsnprintf; -// int r = ((iFpupp_t)f)(buff, s, fmt, VARARGS); -// return r; -// #else -// void* f = vsnprintf; -// int r = ((iFpupp_t)f)(buff, s, fmt, *(uint32_t**)b); -// return r; -// #endif -//} +EXPORT int my2_SDL_vsnprintf(x64emu_t* emu, void* buff, uint32_t s, void * fmt, x64_va_list_t b) +{ + CONVERT_VALIST(b) + int r = vsnprintf(buff, s, fmt, VARARGS); + return r; +} EXPORT void* my2_SDL_CreateThread(x64emu_t* emu, void* f, void* n, void* p) { @@ -647,17 +638,11 @@ EXPORT void* my2_SDL_CreateThread(x64emu_t* emu, void* f, void* n, void* p) return my->SDL_CreateThread(fnc, n, et); } -//EXPORT int my2_SDL_snprintf(x64emu_t* emu, void* buff, uint32_t s, void * fmt, void * b, va_list V) { -// #ifndef NOALIGN -// // need to align on arm -// myStackAlign(emu, (const char*)fmt, b, emu->scratch); -// PREPARE_VALIST; -// void* f = vsnprintf; -// return ((iFpupp_t)f)(buff, s, fmt, VARARGS); -// #else -// return vsnprintf((char*)buff, s, (char*)fmt, V); -// #endif -//} +EXPORT int my2_SDL_snprintf(x64emu_t* emu, void* buff, uint32_t s, void * fmt, uint64_t * b) { + myStackAlign(emu, (const char*)fmt, b, emu->scratch, R_EAX, 3); + PREPARE_VALIST; + return vsnprintf(buff, s, fmt, VARARGS); +} char EXPORT *my2_SDL_GetBasePath(x64emu_t* emu) { char* p = strdup(emu->context->fullpath); diff --git a/src/wrapped/wrappedsdl2_private.h b/src/wrapped/wrappedsdl2_private.h index e34c2f49..36154a30 100755 --- a/src/wrapped/wrappedsdl2_private.h +++ b/src/wrapped/wrappedsdl2_private.h @@ -593,7 +593,7 @@ GO(SDL_ShowSimpleMessageBox, iFuppp) GO(SDL_ShowWindow, vFp) GO(SDL_sin, dFd) GO(SDL_sinf, fFf) -//GOM(SDL_snprintf, iFEpupVV) +GOM(SDL_snprintf, iFEpupV) GO(SDL_SoftStretch, iFpppp) GO(SDL_sqrt, dFd) GO(SDL_sqrtf, fFf) @@ -649,7 +649,7 @@ GO(SDL_utf8strlcpy, uFppu) // SDL_utf8strlen GO(SDL_VideoInit, iFp) GO(SDL_VideoQuit, vFv) -//GOM(SDL_vsnprintf, iFEpupVV) +GOM(SDL_vsnprintf, iFEpupp) // SDL_vsscanf GO(SDL_Vulkan_CreateSurface, iFppp) GO(SDL_Vulkan_GetDrawableSize, vFppp) |