From 874238f61eeefa52a2feda292882e0d0b0a200c3 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sun, 29 Sep 2024 21:10:54 +0200 Subject: [PATCH] [BOX32][WRAPPER] Added more SDL2 and freetype function, and fixed missing fonts in many games ([BOX64] also fixed some SDL2 signature on RWops) --- src/include/sdl2rwops.h | 1 + src/libtools/sdl2rwops.c | 65 ++- src/wrapped/generated/functions_list.txt | 4 +- src/wrapped/generated/wrappedsdl2types.h | 6 +- src/wrapped/generated/wrapper.c | 4 +- src/wrapped/generated/wrapper.h | 2 +- src/wrapped/wrappedsdl2.c | 10 +- src/wrapped/wrappedsdl2_private.h | 4 +- src/wrapped32/generated/functions_list.txt | 20 + .../generated/wrappedfreetypetypes32.h | 2 + src/wrapped32/generated/wrappedsdl2types32.h | 15 +- src/wrapped32/generated/wrapper32.c | 10 + src/wrapped32/generated/wrapper32.h | 5 + src/wrapped32/wrappedfreetype.c | 428 +++++++++++++++--- src/wrapped32/wrappedfreetype_private.h | 4 +- src/wrapped32/wrappedsdl2.c | 59 +++ src/wrapped32/wrappedsdl2_private.h | 17 +- 17 files changed, 550 insertions(+), 106 deletions(-) diff --git a/src/include/sdl2rwops.h b/src/include/sdl2rwops.h index c66c47870..72ead1c36 100644 --- a/src/include/sdl2rwops.h +++ b/src/include/sdl2rwops.h @@ -25,6 +25,7 @@ void RWNativeEnd2(SDL2_RWops_t* ops); // put emulated int isRWops(SDL2_RWops_t* ops); // 1 if ops seems to be a valid RWops, 0 if not int64_t RWNativeSeek2(SDL2_RWops_t *ops, int64_t offset, int32_t whence); +int64_t RWNativeSize2(SDL2_RWops_t *ops); size_t RWNativeRead2(SDL2_RWops_t* ops, void* ptr, size_t size, size_t maxnum); size_t RWNativeWrite2(SDL2_RWops_t *ops, const void *ptr, size_t size, size_t num); int32_t RWNativeClose2(SDL2_RWops_t* ops); diff --git a/src/libtools/sdl2rwops.c b/src/libtools/sdl2rwops.c index d7d2f34cd..54d1ee1a3 100644 --- a/src/libtools/sdl2rwops.c +++ b/src/libtools/sdl2rwops.c @@ -55,6 +55,12 @@ typedef struct SDL2_RWops_s { SDL2_RWops_t *orig; sdl2_freerw custom_free; } my; + #ifdef BOX32 + struct { + my_SDL2_RWops_32_t *orig; + sdl2_freerw custom_free; + } my32; + #endif } hidden; } SDL2_RWops_t; @@ -87,7 +93,7 @@ EXPORT int64_t my2_native_size(SDL2_RWops_t *context) #ifdef BOX32 if(box64_is32bits) { inplace_SDL2_RWops_to_64(context); - int ret = context->hidden.my.orig->size(context->hidden.my.orig); + int64_t ret = context->hidden.my.orig->size(context->hidden.my.orig); inplace_SDL2_RWops_to_32(context); return ret; } @@ -99,7 +105,7 @@ EXPORT int64_t my2_native_seek(SDL2_RWops_t *context, int64_t offset, int32_t wh #ifdef BOX32 if(box64_is32bits) { inplace_SDL2_RWops_to_64(context); - int ret = context->hidden.my.orig->seek(context->hidden.my.orig, offset, whence); + int64_t ret = context->hidden.my.orig->seek(context->hidden.my.orig, offset, whence); inplace_SDL2_RWops_to_32(context); return ret; } @@ -111,7 +117,7 @@ EXPORT size_t my2_native_read(SDL2_RWops_t *context, void *ptr, size_t size, siz #ifdef BOX32 if(box64_is32bits) { inplace_SDL2_RWops_to_64(context); - int ret = context->hidden.my.orig->read(context->hidden.my.orig, ptr, size, maxnum); + size_t ret = context->hidden.my.orig->read(context->hidden.my.orig, ptr, size, maxnum); inplace_SDL2_RWops_to_32(context); return ret; } @@ -123,7 +129,7 @@ EXPORT size_t my2_native_write(SDL2_RWops_t *context, const void *ptr, size_t si #ifdef BOX32 if(box64_is32bits) { inplace_SDL2_RWops_to_64(context); - int ret = context->hidden.my.orig->write(context->hidden.my.orig, ptr, size, num); + size_t ret = context->hidden.my.orig->write(context->hidden.my.orig, ptr, size, num); inplace_SDL2_RWops_to_32(context); return ret; } @@ -143,23 +149,68 @@ EXPORT int32_t my2_native_close(SDL2_RWops_t *context) } EXPORT int64_t my2_emulated_size(SDL2_RWops_t *context) { + #ifdef BOX32 + if(box64_is32bits) { + if(GetNativeFnc(context->hidden.my32.orig->size) == my2_native_size) + return my2_native_size(context->hidden.my.orig); + uintptr_t f = context->hidden.my32.orig->size; + int64_t ret = (int64_t)RunFunctionFmt(f, "p", context->hidden.my32.orig); + return ret; + } + #endif return (int64_t)RunFunctionFmt((uintptr_t)context->hidden.my.orig->size, "p", context->hidden.my.orig); } EXPORT int64_t my2_emulated_seek(SDL2_RWops_t *context, int64_t offset, int32_t whence) { + #ifdef BOX32 + if(box64_is32bits) { + if(GetNativeFnc(context->hidden.my32.orig->seek) == my2_native_seek) + return my2_native_seek(context->hidden.my.orig, offset, whence); + uintptr_t f = context->hidden.my32.orig->seek; + int64_t ret = (int64_t)RunFunctionFmt(f, "pIi", context->hidden.my32.orig, offset, whence); + return ret; + } + #endif return (int64_t)RunFunctionFmt((uintptr_t)context->hidden.my.orig->seek, "pIi", context->hidden.my.orig, offset, whence); } EXPORT size_t my2_emulated_read(SDL2_RWops_t *context, void *ptr, size_t size, size_t maxnum) { + #ifdef BOX32 + if(box64_is32bits) { + if(GetNativeFnc(context->hidden.my32.orig->read) == my2_native_read) + return my2_native_read(context->hidden.my.orig, ptr, size, maxnum); + uintptr_t f = context->hidden.my32.orig->read; + size_t ret = (size_t)RunFunctionFmt(f, "ppLL", context->hidden.my32.orig, ptr, size, maxnum); + return ret; + } + #endif return (size_t)RunFunctionFmt((uintptr_t)context->hidden.my.orig->read, "ppLL", context->hidden.my.orig, ptr, size, maxnum); } EXPORT size_t my2_emulated_write(SDL2_RWops_t *context, const void *ptr, size_t size, size_t num) { + #ifdef BOX32 + if(box64_is32bits) { + if(GetNativeFnc(context->hidden.my32.orig->write) == my2_native_write) + return my2_native_write(context->hidden.my.orig, ptr, size, num); + uintptr_t f = context->hidden.my32.orig->write; + size_t ret = (size_t)RunFunctionFmt(f, "ppLL", context->hidden.my32.orig, ptr, size, num); + return ret; + } + #endif return (size_t)RunFunctionFmt((uintptr_t)context->hidden.my.orig->write, "ppLL", context->hidden.my.orig, ptr, size, num); } EXPORT int32_t my2_emulated_close(SDL2_RWops_t *context) { - int ret = (int32_t)RunFunctionFmt((uintptr_t)context->hidden.my.orig->close, "p", context->hidden.my.orig); + int ret = 0; + #ifdef BOX32 + if(box64_is32bits) { + if(GetNativeFnc(context->hidden.my32.orig->close) == my2_native_close) + return my2_native_close(context->hidden.my.orig); + uintptr_t f = context->hidden.my32.orig->close; + ret = (size_t)RunFunctionFmt(f, "p", context->hidden.my32.orig); + } else + #endif + ret = (int32_t)RunFunctionFmt((uintptr_t)context->hidden.my.orig->close, "p", context->hidden.my.orig); context->hidden.my.custom_free(context); return ret; } @@ -276,6 +327,10 @@ int64_t RWNativeSeek2(SDL2_RWops_t *ops, int64_t offset, int32_t whence) { return ops->seek(ops, offset, whence); } +int64_t RWNativeSize2(SDL2_RWops_t *ops) +{ + return ops->size(ops); +} size_t RWNativeRead2(SDL2_RWops_t* ops, void* ptr, size_t size, size_t maxnum) { return ops->read(ops, ptr, size, maxnum); diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt index b3db228dd..ff4cf1382 100644 --- a/src/wrapped/generated/functions_list.txt +++ b/src/wrapped/generated/functions_list.txt @@ -1710,7 +1710,6 @@ #() uFEippp #() uFEpipp #() uFEpupp -#() uFEppuu #() uFEpppp #() uFEpppV #() uFiuuuu @@ -1754,6 +1753,7 @@ #() lFppLpL #() lFppLpp #() LFELppu +#() LFEppLL #() LFEpppp #() LFLpppL #() LFpuipp @@ -5577,7 +5577,7 @@ wrappedsdl2: - SDL_vsnprintf - iFpLpV: - SDL_snprintf -- uFppuu: +- LFppLL: - SDL_RWread - SDL_RWwrite - vFGpppp: diff --git a/src/wrapped/generated/wrappedsdl2types.h b/src/wrapped/generated/wrappedsdl2types.h index 4f2ef49fe..104f6bcd1 100644 --- a/src/wrapped/generated/wrappedsdl2types.h +++ b/src/wrapped/generated/wrappedsdl2types.h @@ -44,7 +44,7 @@ typedef void* (*pFppp_t)(void*, void*, void*); typedef void (*vFpuup_t)(void*, uint32_t, uint32_t, void*); typedef int32_t (*iFpLpp_t)(void*, uintptr_t, void*, void*); typedef int32_t (*iFpLpV_t)(void*, uintptr_t, void*, ...); -typedef uint32_t (*uFppuu_t)(void*, void*, uint32_t, uint32_t); +typedef uintptr_t (*LFppLL_t)(void*, void*, uintptr_t, uintptr_t); typedef void (*vFGpppp_t)(SDL_JoystickGUID, void*, void*, void*, void*); typedef uint32_t (*uFpippi_t)(void*, int32_t, void*, void*, int32_t); typedef void* (*pFpippp_t)(void*, int32_t, void*, void*, void*); @@ -127,8 +127,8 @@ typedef void* (*pFpippp_t)(void*, int32_t, void*, void*, void*); GO(SDL_qsort, vFpuup_t) \ GO(SDL_vsnprintf, iFpLpp_t) \ GO(SDL_snprintf, iFpLpV_t) \ - GO(SDL_RWread, uFppuu_t) \ - GO(SDL_RWwrite, uFppuu_t) \ + GO(SDL_RWread, LFppLL_t) \ + GO(SDL_RWwrite, LFppLL_t) \ GO(SDL_GetJoystickGUIDInfo, vFGpppp_t) \ GO(SDL_OpenAudioDevice, uFpippi_t) \ GO(SDL_LoadWAV_RW, pFpippp_t) diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c index 9f2f0b6be..cf8627752 100644 --- a/src/wrapped/generated/wrapper.c +++ b/src/wrapped/generated/wrapper.c @@ -1739,7 +1739,6 @@ typedef int64_t (*IFppIII_t)(void*, void*, int64_t, int64_t, int64_t); typedef uint32_t (*uFEippp_t)(x64emu_t*, int32_t, void*, void*, void*); typedef uint32_t (*uFEpipp_t)(x64emu_t*, void*, int32_t, void*, void*); typedef uint32_t (*uFEpupp_t)(x64emu_t*, void*, uint32_t, void*, void*); -typedef uint32_t (*uFEppuu_t)(x64emu_t*, void*, void*, uint32_t, uint32_t); typedef uint32_t (*uFEpppp_t)(x64emu_t*, void*, void*, void*, void*); typedef uint32_t (*uFEpppV_t)(x64emu_t*, void*, void*, void*, void*); typedef uint32_t (*uFiuuuu_t)(int32_t, uint32_t, uint32_t, uint32_t, uint32_t); @@ -1783,6 +1782,7 @@ typedef intptr_t (*lFppupp_t)(void*, void*, uint32_t, void*, void*); typedef intptr_t (*lFppLpL_t)(void*, void*, uintptr_t, void*, uintptr_t); typedef intptr_t (*lFppLpp_t)(void*, void*, uintptr_t, void*, void*); typedef uintptr_t (*LFELppu_t)(x64emu_t*, uintptr_t, void*, void*, uint32_t); +typedef uintptr_t (*LFEppLL_t)(x64emu_t*, void*, void*, uintptr_t, uintptr_t); typedef uintptr_t (*LFEpppp_t)(x64emu_t*, void*, void*, void*, void*); typedef uintptr_t (*LFLpppL_t)(uintptr_t, void*, void*, void*, uintptr_t); typedef uintptr_t (*LFpuipp_t)(void*, uint32_t, int32_t, void*, void*); @@ -4973,7 +4973,6 @@ void IFppIII(x64emu_t *emu, uintptr_t fcn) { IFppIII_t fn = (IFppIII_t)fcn; R_RA void uFEippp(x64emu_t *emu, uintptr_t fcn) { uFEippp_t fn = (uFEippp_t)fcn; R_RAX=(uint32_t)fn(emu, (int32_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX); } void uFEpipp(x64emu_t *emu, uintptr_t fcn) { uFEpipp_t fn = (uFEpipp_t)fcn; R_RAX=(uint32_t)fn(emu, (void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)R_RCX); } void uFEpupp(x64emu_t *emu, uintptr_t fcn) { uFEpupp_t fn = (uFEpupp_t)fcn; R_RAX=(uint32_t)fn(emu, (void*)R_RDI, (uint32_t)R_RSI, (void*)R_RDX, (void*)R_RCX); } -void uFEppuu(x64emu_t *emu, uintptr_t fcn) { uFEppuu_t fn = (uFEppuu_t)fcn; R_RAX=(uint32_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (uint32_t)R_RDX, (uint32_t)R_RCX); } void uFEpppp(x64emu_t *emu, uintptr_t fcn) { uFEpppp_t fn = (uFEpppp_t)fcn; R_RAX=(uint32_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX); } void uFEpppV(x64emu_t *emu, uintptr_t fcn) { uFEpppV_t fn = (uFEpppV_t)fcn; R_RAX=(uint32_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)(R_RSP + 8)); } void uFiuuuu(x64emu_t *emu, uintptr_t fcn) { uFiuuuu_t fn = (uFiuuuu_t)fcn; R_RAX=(uint32_t)fn((int32_t)R_RDI, (uint32_t)R_RSI, (uint32_t)R_RDX, (uint32_t)R_RCX, (uint32_t)R_R8); } @@ -5017,6 +5016,7 @@ void lFppupp(x64emu_t *emu, uintptr_t fcn) { lFppupp_t fn = (lFppupp_t)fcn; R_RA void lFppLpL(x64emu_t *emu, uintptr_t fcn) { lFppLpL_t fn = (lFppLpL_t)fcn; R_RAX=(intptr_t)fn((void*)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (void*)R_RCX, (uintptr_t)R_R8); } void lFppLpp(x64emu_t *emu, uintptr_t fcn) { lFppLpp_t fn = (lFppLpp_t)fcn; R_RAX=(intptr_t)fn((void*)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (void*)R_RCX, (void*)R_R8); } void LFELppu(x64emu_t *emu, uintptr_t fcn) { LFELppu_t fn = (LFELppu_t)fcn; R_RAX=(uintptr_t)fn(emu, (uintptr_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (uint32_t)R_RCX); } +void LFEppLL(x64emu_t *emu, uintptr_t fcn) { LFEppLL_t fn = (LFEppLL_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (uintptr_t)R_RCX); } void LFEpppp(x64emu_t *emu, uintptr_t fcn) { LFEpppp_t fn = (LFEpppp_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX); } void LFLpppL(x64emu_t *emu, uintptr_t fcn) { LFLpppL_t fn = (LFLpppL_t)fcn; R_RAX=(uintptr_t)fn((uintptr_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (uintptr_t)R_R8); } void LFpuipp(x64emu_t *emu, uintptr_t fcn) { LFpuipp_t fn = (LFpuipp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint32_t)R_RSI, (int32_t)R_RDX, (void*)R_RCX, (void*)R_R8); } diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h index 9b603b1e9..4179f4d88 100644 --- a/src/wrapped/generated/wrapper.h +++ b/src/wrapped/generated/wrapper.h @@ -1747,7 +1747,6 @@ void IFppIII(x64emu_t *emu, uintptr_t fnc); void uFEippp(x64emu_t *emu, uintptr_t fnc); void uFEpipp(x64emu_t *emu, uintptr_t fnc); void uFEpupp(x64emu_t *emu, uintptr_t fnc); -void uFEppuu(x64emu_t *emu, uintptr_t fnc); void uFEpppp(x64emu_t *emu, uintptr_t fnc); void uFEpppV(x64emu_t *emu, uintptr_t fnc); void uFiuuuu(x64emu_t *emu, uintptr_t fnc); @@ -1791,6 +1790,7 @@ void lFppupp(x64emu_t *emu, uintptr_t fnc); void lFppLpL(x64emu_t *emu, uintptr_t fnc); void lFppLpp(x64emu_t *emu, uintptr_t fnc); void LFELppu(x64emu_t *emu, uintptr_t fnc); +void LFEppLL(x64emu_t *emu, uintptr_t fnc); void LFEpppp(x64emu_t *emu, uintptr_t fnc); void LFLpppL(x64emu_t *emu, uintptr_t fnc); void LFpuipp(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped/wrappedsdl2.c b/src/wrapped/wrappedsdl2.c index a59ec93ac..9bdeb3c00 100644 --- a/src/wrapped/wrappedsdl2.c +++ b/src/wrapped/wrappedsdl2.c @@ -412,7 +412,7 @@ EXPORT void *my2_SDL_RWFromMem(x64emu_t* emu, void* a, int b) return AddNativeRW2(emu, (SDL2_RWops_t*)r); } -EXPORT int64_t my2_SDL_RWseek(x64emu_t* emu, void* a, int64_t offset, int64_t whence) +EXPORT int64_t my2_SDL_RWseek(x64emu_t* emu, void* a, int64_t offset, int whence) { //sdl2_my_t *my = (sdl2_my_t *)emu->context->sdl2lib->priv.w.p2; SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); @@ -427,17 +427,17 @@ EXPORT int64_t my2_SDL_RWtell(x64emu_t* emu, void* a) RWNativeEnd2(rw); return ret; } -EXPORT uint64_t my2_SDL_RWread(x64emu_t* emu, void* a, void* ptr, uint64_t size, uint64_t maxnum) +EXPORT size_t my2_SDL_RWread(x64emu_t* emu, void* a, void* ptr, size_t size, size_t maxnum) { SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); - uint64_t ret = RWNativeRead2(rw, ptr, size, maxnum); + size_t ret = RWNativeRead2(rw, ptr, size, maxnum); RWNativeEnd2(rw); return ret; } -EXPORT uint64_t my2_SDL_RWwrite(x64emu_t* emu, void* a, const void* ptr, uint64_t size, uint64_t maxnum) +EXPORT size_t my2_SDL_RWwrite(x64emu_t* emu, void* a, const void* ptr, size_t size, size_t maxnum) { SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); - uint64_t ret = RWNativeWrite2(rw, ptr, size, maxnum); + size_t ret = RWNativeWrite2(rw, ptr, size, maxnum); RWNativeEnd2(rw); return ret; } diff --git a/src/wrapped/wrappedsdl2_private.h b/src/wrapped/wrappedsdl2_private.h index fd700a466..c62df3580 100644 --- a/src/wrapped/wrappedsdl2_private.h +++ b/src/wrapped/wrappedsdl2_private.h @@ -731,8 +731,8 @@ GOM(SDL_WriteU8, uFEpu) GOM(SDL_RWseek, IFEpIi) GOM(SDL_RWtell, IFEp) -GOM(SDL_RWread, uFEppuu) -GOM(SDL_RWwrite, uFEppuu) +GOM(SDL_RWread, LFEppLL) +GOM(SDL_RWwrite, LFEppLL) GOM(SDL_RWclose, iFEp) GO2(SDL_mutexP, iFp, SDL_LockMutex) diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index 37cbfa69d..864e6ba6d 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -151,6 +151,7 @@ #() iFXi -> iFXi #() iFXL -> iFXL #() iFXp -> iFXp +#() IFEp -> IFEp #() IFII -> IFII #() CFip -> CFip #() CFCi -> CFCi @@ -533,6 +534,7 @@ #() iFEpuu -> iFEpuu #() iFEpup -> iFEpup #() iFEpLi -> iFEpLi +#() iFEppu -> iFEppu #() iFEppL -> iFEppL #() iFEppp -> iFEppp #() iFEppV -> iFEppV @@ -569,6 +571,7 @@ #() iFXLii -> iFXLii #() iFXpip -> iFXpip #() iFXppp -> iFXppp +#() IFEpIi -> IFEpIi #() CFuuff -> CFuuff #() uFEpii -> uFEpii #() uFuuuu -> uFuuuu @@ -742,6 +745,7 @@ #() uFpLLLS -> uFpLLLS #() UFuiCiu -> UFuiCiu #() lFpuipC -> lFpuipC +#() LFEppLL -> LFEppLL #() LFpLppa -> LFpLppa #() LFXLuuu -> LFXLuuu #() LFXLpuu -> LFXLpuu @@ -988,6 +992,7 @@ #() iFXLiuiiLLL -> iFXLiuiiLLL #() iFXLLiiuuii -> iFXLLiiuuii #() uFuulpiuiuf -> uFuulpiuiuf +#() pFEuiiiuuuu -> pFEuiiiuuuu #() pFEXLiiuuLi -> pFEXLiiuuLi #() vFEXLpppippp -> vFEXLpppippp #() vFiiiiiiiiii -> vFiiiiiiiiii @@ -1105,6 +1110,7 @@ wrappedfreetype: - iFpp: - FT_Get_PS_Font_Info - FT_Request_Size + - FT_Set_Charmap - uFpL: - FT_Get_Char_Index - LFpp: @@ -1127,6 +1133,7 @@ wrappedfreetype: - FT_Get_Glyph_Name - iFpplp: - FT_New_Face + - FT_Open_Face - iFpuuup: - FT_Get_Kerning - iFplluu: @@ -1670,6 +1677,10 @@ wrappedsdl2: - iFp: - SDL_PollEvent - SDL_PushEvent + - SDL_RWclose +- IFp: + - SDL_RWsize + - SDL_RWtell - pFv: - SDL_GetBasePath - pFp: @@ -1696,8 +1707,12 @@ wrappedsdl2: - SDL_notreal - pFpp: - SDL_RWFromFile +- iFppu: + - SDL_FillRect - iFppV: - SDL_sscanf +- IFpIi: + - SDL_RWseek - pFpii: - SDL_CreateColorCursor - pFppp: @@ -1706,10 +1721,15 @@ wrappedsdl2: - SDL_vsnprintf - iFpLpV: - SDL_snprintf +- LFppLL: + - SDL_RWread + - SDL_RWwrite - uFpippi: - SDL_OpenAudioDevice - pFpiiiiu: - SDL_CreateRGBSurfaceWithFormatFrom +- pFuiiiuuuu: + - SDL_CreateRGBSurface % JFEi -> pFEpi wrappedtcmallocminimal: - pFp: diff --git a/src/wrapped32/generated/wrappedfreetypetypes32.h b/src/wrapped32/generated/wrappedfreetypetypes32.h index 363e3d726..7a4b4b493 100644 --- a/src/wrapped32/generated/wrappedfreetypetypes32.h +++ b/src/wrapped32/generated/wrappedfreetypetypes32.h @@ -46,6 +46,7 @@ typedef int32_t (*iFppllp_t)(void*, void*, intptr_t, intptr_t, void*); GO(FT_Render_Glyph, iFpu_t) \ GO(FT_Get_PS_Font_Info, iFpp_t) \ GO(FT_Request_Size, iFpp_t) \ + GO(FT_Set_Charmap, iFpp_t) \ GO(FT_Get_Char_Index, uFpL_t) \ GO(FT_Get_First_Char, LFpp_t) \ GO(FT_Get_Sfnt_Table, pFpi_t) \ @@ -57,6 +58,7 @@ typedef int32_t (*iFppllp_t)(void*, void*, intptr_t, intptr_t, void*); GO(FT_Get_Next_Char, LFpLp_t) \ GO(FT_Get_Glyph_Name, iFpupu_t) \ GO(FT_New_Face, iFpplp_t) \ + GO(FT_Open_Face, iFpplp_t) \ GO(FT_Get_Kerning, iFpuuup_t) \ GO(FT_Set_Char_Size, iFplluu_t) \ GO(FT_Load_Sfnt_Table, iFpLlpp_t) \ diff --git a/src/wrapped32/generated/wrappedsdl2types32.h b/src/wrapped32/generated/wrappedsdl2types32.h index badbbc81d..62213d84a 100644 --- a/src/wrapped32/generated/wrappedsdl2types32.h +++ b/src/wrapped32/generated/wrappedsdl2types32.h @@ -13,6 +13,7 @@ typedef void (*vFp_t)(void*); typedef int32_t (*iFp_t)(void*); +typedef int64_t (*IFp_t)(void*); typedef void* (*pFv_t)(void); typedef void* (*pFp_t)(void*); typedef SDL2_GUID_t (*JFi_t)(int32_t); @@ -23,18 +24,25 @@ typedef int32_t (*iFpi_t)(void*, int32_t); typedef int32_t (*iFpp_t)(void*, void*); typedef void* (*pFpi_t)(void*, int32_t); typedef void* (*pFpp_t)(void*, void*); +typedef int32_t (*iFppu_t)(void*, void*, uint32_t); typedef int32_t (*iFppV_t)(void*, void*, ...); +typedef int64_t (*IFpIi_t)(void*, int64_t, int32_t); typedef void* (*pFpii_t)(void*, int32_t, int32_t); typedef void* (*pFppp_t)(void*, void*, void*); typedef int32_t (*iFpLpp_t)(void*, uintptr_t, void*, void*); typedef int32_t (*iFpLpV_t)(void*, uintptr_t, void*, ...); +typedef uintptr_t (*LFppLL_t)(void*, void*, uintptr_t, uintptr_t); typedef uint32_t (*uFpippi_t)(void*, int32_t, void*, void*, int32_t); typedef void* (*pFpiiiiu_t)(void*, int32_t, int32_t, int32_t, int32_t, uint32_t); +typedef void* (*pFuiiiuuuu_t)(uint32_t, int32_t, int32_t, int32_t, uint32_t, uint32_t, uint32_t, uint32_t); #define SUPER() ADDED_FUNCTIONS() \ GO(SDL_FreeSurface, vFp_t) \ GO(SDL_PollEvent, iFp_t) \ GO(SDL_PushEvent, iFp_t) \ + GO(SDL_RWclose, iFp_t) \ + GO(SDL_RWsize, IFp_t) \ + GO(SDL_RWtell, IFp_t) \ GO(SDL_GetBasePath, pFv_t) \ GO(SDL_GL_GetProcAddress, pFp_t) \ GO(SDL_JoystickGetDeviceGUID, JFi_t) \ @@ -51,12 +59,17 @@ typedef void* (*pFpiiiiu_t)(void*, int32_t, int32_t, int32_t, int32_t, uint32_t) GO(SDL_LoadBMP_RW, pFpi_t) \ GO(SDL_notreal, pFpi_t) \ GO(SDL_RWFromFile, pFpp_t) \ + GO(SDL_FillRect, iFppu_t) \ GO(SDL_sscanf, iFppV_t) \ + GO(SDL_RWseek, IFpIi_t) \ GO(SDL_CreateColorCursor, pFpii_t) \ GO(SDL_CreateThread, pFppp_t) \ GO(SDL_vsnprintf, iFpLpp_t) \ GO(SDL_snprintf, iFpLpV_t) \ + GO(SDL_RWread, LFppLL_t) \ + GO(SDL_RWwrite, LFppLL_t) \ GO(SDL_OpenAudioDevice, uFpippi_t) \ - GO(SDL_CreateRGBSurfaceWithFormatFrom, pFpiiiiu_t) + GO(SDL_CreateRGBSurfaceWithFormatFrom, pFpiiiiu_t) \ + GO(SDL_CreateRGBSurface, pFuiiiuuuu_t) #endif // __wrappedsdl2TYPES32_H_ diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c index f34dce59b..6e2594ad6 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -241,6 +241,7 @@ typedef int32_t (*iFSp_t)(void*, void*); typedef int32_t (*iFXi_t)(void*, int32_t); typedef int32_t (*iFXL_t)(void*, uintptr_t); typedef int32_t (*iFXp_t)(void*, void*); +typedef int64_t (*IFEp_t)(x64emu_t*, void*); typedef int64_t (*IFII_t)(int64_t, int64_t); typedef uint8_t (*CFip_t)(int32_t, void*); typedef uint8_t (*CFCi_t)(uint8_t, int32_t); @@ -623,6 +624,7 @@ typedef int32_t (*iFEpui_t)(x64emu_t*, void*, uint32_t, int32_t); typedef int32_t (*iFEpuu_t)(x64emu_t*, void*, uint32_t, uint32_t); typedef int32_t (*iFEpup_t)(x64emu_t*, void*, uint32_t, void*); typedef int32_t (*iFEpLi_t)(x64emu_t*, void*, uintptr_t, int32_t); +typedef int32_t (*iFEppu_t)(x64emu_t*, void*, void*, uint32_t); typedef int32_t (*iFEppL_t)(x64emu_t*, void*, void*, uintptr_t); typedef int32_t (*iFEppp_t)(x64emu_t*, void*, void*, void*); typedef int32_t (*iFEppV_t)(x64emu_t*, void*, void*, void*); @@ -659,6 +661,7 @@ typedef int32_t (*iFXipp_t)(void*, int32_t, void*, void*); typedef int32_t (*iFXLii_t)(void*, uintptr_t, int32_t, int32_t); typedef int32_t (*iFXpip_t)(void*, void*, int32_t, void*); typedef int32_t (*iFXppp_t)(void*, void*, void*, void*); +typedef int64_t (*IFEpIi_t)(x64emu_t*, void*, int64_t, int32_t); typedef uint8_t (*CFuuff_t)(uint32_t, uint32_t, float, float); typedef uint32_t (*uFEpii_t)(x64emu_t*, void*, int32_t, int32_t); typedef uint32_t (*uFuuuu_t)(uint32_t, uint32_t, uint32_t, uint32_t); @@ -832,6 +835,7 @@ typedef int64_t (*IFXpIII_t)(void*, void*, int64_t, int64_t, int64_t); typedef uint32_t (*uFpLLLS_t)(void*, uintptr_t, uintptr_t, uintptr_t, void*); typedef uint64_t (*UFuiCiu_t)(uint32_t, int32_t, uint8_t, int32_t, uint32_t); typedef intptr_t (*lFpuipC_t)(void*, uint32_t, int32_t, void*, uint8_t); +typedef uintptr_t (*LFEppLL_t)(x64emu_t*, void*, void*, uintptr_t, uintptr_t); typedef uintptr_t (*LFpLppa_t)(void*, uintptr_t, void*, void*, void*); typedef uintptr_t (*LFXLuuu_t)(void*, uintptr_t, uint32_t, uint32_t, uint32_t); typedef uintptr_t (*LFXLpuu_t)(void*, uintptr_t, void*, uint32_t, uint32_t); @@ -1078,6 +1082,7 @@ typedef int32_t (*iFdddpppppp_t)(double, double, double, void*, void*, void*, vo typedef int32_t (*iFXLiuiiLLL_t)(void*, uintptr_t, int32_t, uint32_t, int32_t, int32_t, uintptr_t, uintptr_t, uintptr_t); typedef int32_t (*iFXLLiiuuii_t)(void*, uintptr_t, uintptr_t, int32_t, int32_t, uint32_t, uint32_t, int32_t, int32_t); typedef uint32_t (*uFuulpiuiuf_t)(uint32_t, uint32_t, intptr_t, void*, int32_t, uint32_t, int32_t, uint32_t, float); +typedef void* (*pFEuiiiuuuu_t)(x64emu_t*, uint32_t, int32_t, int32_t, int32_t, uint32_t, uint32_t, uint32_t, uint32_t); typedef void* (*pFEXLiiuuLi_t)(x64emu_t*, void*, uintptr_t, int32_t, int32_t, uint32_t, uint32_t, uintptr_t, int32_t); typedef void (*vFEXLpppippp_t)(x64emu_t*, void*, uintptr_t, void*, void*, void*, int32_t, void*, void*, void*); typedef void (*vFiiiiiiiiii_t)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); @@ -1317,6 +1322,7 @@ void iFSp_32(x64emu_t *emu, uintptr_t fcn) { iFSp_t fn = (iFSp_t)fcn; R_EAX = fn void iFXi_32(x64emu_t *emu, uintptr_t fcn) { iFXi_t fn = (iFXi_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptri(int32_t, R_ESP + 8)); } void iFXL_32(x64emu_t *emu, uintptr_t fcn) { iFXL_t fn = (iFXL_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), to_ulong(from_ptri(ulong_t, R_ESP + 8))); } void iFXp_32(x64emu_t *emu, uintptr_t fcn) { iFXp_t fn = (iFXp_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8)); } +void IFEp_32(x64emu_t *emu, uintptr_t fcn) { IFEp_t fn = (IFEp_t)fcn; ui64_t r; r.i = fn(emu, from_ptriv(R_ESP + 4)); R_EAX = r.d[0]; R_EDX = r.d[1]; } void IFII_32(x64emu_t *emu, uintptr_t fcn) { IFII_t fn = (IFII_t)fcn; ui64_t r; r.i = fn(from_ptri(int64_t, R_ESP + 4), from_ptri(int64_t, R_ESP + 12)); R_EAX = r.d[0]; R_EDX = r.d[1]; } void CFip_32(x64emu_t *emu, uintptr_t fcn) { CFip_t fn = (CFip_t)fcn; R_EAX = (unsigned char)fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8)); } void CFCi_32(x64emu_t *emu, uintptr_t fcn) { CFCi_t fn = (CFCi_t)fcn; R_EAX = (unsigned char)fn(from_ptri(uint8_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8)); } @@ -1699,6 +1705,7 @@ void iFEpui_32(x64emu_t *emu, uintptr_t fcn) { iFEpui_t fn = (iFEpui_t)fcn; R_EA void iFEpuu_32(x64emu_t *emu, uintptr_t fcn) { iFEpuu_t fn = (iFEpuu_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptri(uint32_t, R_ESP + 12)); } void iFEpup_32(x64emu_t *emu, uintptr_t fcn) { iFEpup_t fn = (iFEpup_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptriv(R_ESP + 12)); } void iFEpLi_32(x64emu_t *emu, uintptr_t fcn) { iFEpLi_t fn = (iFEpLi_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12)); } +void iFEppu_32(x64emu_t *emu, uintptr_t fcn) { iFEppu_t fn = (iFEppu_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(uint32_t, R_ESP + 12)); } void iFEppL_32(x64emu_t *emu, uintptr_t fcn) { iFEppL_t fn = (iFEppL_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), to_ulong(from_ptri(ulong_t, R_ESP + 12))); } void iFEppp_32(x64emu_t *emu, uintptr_t fcn) { iFEppp_t fn = (iFEppp_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12)); } void iFEppV_32(x64emu_t *emu, uintptr_t fcn) { iFEppV_t fn = (iFEppV_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptrv(R_ESP + 12)); } @@ -1735,6 +1742,7 @@ void iFXipp_32(x64emu_t *emu, uintptr_t fcn) { iFXipp_t fn = (iFXipp_t)fcn; R_EA void iFXLii_32(x64emu_t *emu, uintptr_t fcn) { iFXLii_t fn = (iFXLii_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16)); } void iFXpip_32(x64emu_t *emu, uintptr_t fcn) { iFXpip_t fn = (iFXpip_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16)); } void iFXppp_32(x64emu_t *emu, uintptr_t fcn) { iFXppp_t fn = (iFXppp_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16)); } +void IFEpIi_32(x64emu_t *emu, uintptr_t fcn) { IFEpIi_t fn = (IFEpIi_t)fcn; ui64_t r; r.i = fn(emu, from_ptriv(R_ESP + 4), from_ptri(int64_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 16)); R_EAX = r.d[0]; R_EDX = r.d[1]; } void CFuuff_32(x64emu_t *emu, uintptr_t fcn) { CFuuff_t fn = (CFuuff_t)fcn; R_EAX = (unsigned char)fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptri(float, R_ESP + 12), from_ptri(float, R_ESP + 16)); } void uFEpii_32(x64emu_t *emu, uintptr_t fcn) { uFEpii_t fn = (uFEpii_t)fcn; R_EAX = (uint32_t)fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12)); } void uFuuuu_32(x64emu_t *emu, uintptr_t fcn) { uFuuuu_t fn = (uFuuuu_t)fcn; R_EAX = (uint32_t)fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptri(uint32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16)); } @@ -1908,6 +1916,7 @@ void IFXpIII_32(x64emu_t *emu, uintptr_t fcn) { IFXpIII_t fn = (IFXpIII_t)fcn; u void uFpLLLS_32(x64emu_t *emu, uintptr_t fcn) { uFpLLLS_t fn = (uFpLLLS_t)fcn; R_EAX = (uint32_t)fn(from_ptriv(R_ESP + 4), to_ulong(from_ptri(ulong_t, R_ESP + 8)), to_ulong(from_ptri(ulong_t, R_ESP + 12)), to_ulong(from_ptri(ulong_t, R_ESP + 16)), io_convert32(from_ptriv(R_ESP + 20))); } void UFuiCiu_32(x64emu_t *emu, uintptr_t fcn) { UFuiCiu_t fn = (UFuiCiu_t)fcn; ui64_t r; r.u = (uint64_t)fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(uint8_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptri(uint32_t, R_ESP + 20)); R_EAX = r.d[0]; R_EDX = r.d[1]; } void lFpuipC_32(x64emu_t *emu, uintptr_t fcn) { lFpuipC_t fn = (lFpuipC_t)fcn; R_EAX = to_long(fn(from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16), from_ptri(uint8_t, R_ESP + 20))); } +void LFEppLL_32(x64emu_t *emu, uintptr_t fcn) { LFEppLL_t fn = (LFEppLL_t)fcn; R_EAX = to_ulong(fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), to_ulong(from_ptri(ulong_t, R_ESP + 12)), to_ulong(from_ptri(ulong_t, R_ESP + 16)))); } void LFpLppa_32(x64emu_t *emu, uintptr_t fcn) { LFpLppa_t fn = (LFpLppa_t)fcn; R_EAX = to_ulong(fn(from_ptriv(R_ESP + 4), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16), from_locale(from_ptri(ptr_t, R_ESP + 20)))); } void LFXLuuu_32(x64emu_t *emu, uintptr_t fcn) { LFXLuuu_t fn = (LFXLuuu_t)fcn; R_EAX = to_ulong(fn(getDisplay(from_ptriv(R_ESP + 4)), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(uint32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptri(uint32_t, R_ESP + 20))); } void LFXLpuu_32(x64emu_t *emu, uintptr_t fcn) { LFXLpuu_t fn = (LFXLpuu_t)fcn; R_EAX = to_ulong(fn(getDisplay(from_ptriv(R_ESP + 4)), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptri(uint32_t, R_ESP + 20))); } @@ -2154,6 +2163,7 @@ void iFdddpppppp_32(x64emu_t *emu, uintptr_t fcn) { iFdddpppppp_t fn = (iFdddppp void iFXLiuiiLLL_32(x64emu_t *emu, uintptr_t fcn) { iFXLiuiiLLL_t fn = (iFXLiuiiLLL_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptri(int32_t, R_ESP + 20), from_ptri(int32_t, R_ESP + 24), to_ulong(from_ptri(ulong_t, R_ESP + 28)), to_ulong(from_ptri(ulong_t, R_ESP + 32)), to_ulong(from_ptri(ulong_t, R_ESP + 36))); } void iFXLLiiuuii_32(x64emu_t *emu, uintptr_t fcn) { iFXLLiiuuii_t fn = (iFXLLiiuuii_t)fcn; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), to_ulong(from_ptri(ulong_t, R_ESP + 8)), to_ulong(from_ptri(ulong_t, R_ESP + 12)), from_ptri(int32_t, R_ESP + 16), from_ptri(int32_t, R_ESP + 20), from_ptri(uint32_t, R_ESP + 24), from_ptri(uint32_t, R_ESP + 28), from_ptri(int32_t, R_ESP + 32), from_ptri(int32_t, R_ESP + 36)); } void uFuulpiuiuf_32(x64emu_t *emu, uintptr_t fcn) { uFuulpiuiuf_t fn = (uFuulpiuiuf_t)fcn; R_EAX = (uint32_t)fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), to_long(from_ptri(long_t, R_ESP + 12)), from_ptriv(R_ESP + 16), from_ptri(int32_t, R_ESP + 20), from_ptri(uint32_t, R_ESP + 24), from_ptri(int32_t, R_ESP + 28), from_ptri(uint32_t, R_ESP + 32), from_ptri(float, R_ESP + 36)); } +void pFEuiiiuuuu_32(x64emu_t *emu, uintptr_t fcn) { pFEuiiiuuuu_t fn = (pFEuiiiuuuu_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptri(uint32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptri(uint32_t, R_ESP + 20), from_ptri(uint32_t, R_ESP + 24), from_ptri(uint32_t, R_ESP + 28), from_ptri(uint32_t, R_ESP + 32))); } void pFEXLiiuuLi_32(x64emu_t *emu, uintptr_t fcn) { pFEXLiiuuLi_t fn = (pFEXLiiuuLi_t)fcn; R_EAX = to_ptrv(fn(emu, getDisplay(from_ptriv(R_ESP + 4)), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptri(uint32_t, R_ESP + 20), from_ptri(uint32_t, R_ESP + 24), to_ulong(from_ptri(ulong_t, R_ESP + 28)), from_ptri(int32_t, R_ESP + 32))); } void vFEXLpppippp_32(x64emu_t *emu, uintptr_t fcn) { vFEXLpppippp_t fn = (vFEXLpppippp_t)fcn; fn(emu, getDisplay(from_ptriv(R_ESP + 4)), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20), from_ptri(int32_t, R_ESP + 24), from_ptriv(R_ESP + 28), from_ptriv(R_ESP + 32), from_ptriv(R_ESP + 36)); } void vFiiiiiiiiii_32(x64emu_t *emu, uintptr_t fcn) { vFiiiiiiiiii_t fn = (vFiiiiiiiiii_t)fcn; fn(from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptri(int32_t, R_ESP + 20), from_ptri(int32_t, R_ESP + 24), from_ptri(int32_t, R_ESP + 28), from_ptri(int32_t, R_ESP + 32), from_ptri(int32_t, R_ESP + 36), from_ptri(int32_t, R_ESP + 40)); } diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h index 05dafa24f..0c7697011 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -192,6 +192,7 @@ void iFSp_32(x64emu_t *emu, uintptr_t fnc); void iFXi_32(x64emu_t *emu, uintptr_t fnc); void iFXL_32(x64emu_t *emu, uintptr_t fnc); void iFXp_32(x64emu_t *emu, uintptr_t fnc); +void IFEp_32(x64emu_t *emu, uintptr_t fnc); void IFII_32(x64emu_t *emu, uintptr_t fnc); void CFip_32(x64emu_t *emu, uintptr_t fnc); void CFCi_32(x64emu_t *emu, uintptr_t fnc); @@ -574,6 +575,7 @@ void iFEpui_32(x64emu_t *emu, uintptr_t fnc); void iFEpuu_32(x64emu_t *emu, uintptr_t fnc); void iFEpup_32(x64emu_t *emu, uintptr_t fnc); void iFEpLi_32(x64emu_t *emu, uintptr_t fnc); +void iFEppu_32(x64emu_t *emu, uintptr_t fnc); void iFEppL_32(x64emu_t *emu, uintptr_t fnc); void iFEppp_32(x64emu_t *emu, uintptr_t fnc); void iFEppV_32(x64emu_t *emu, uintptr_t fnc); @@ -610,6 +612,7 @@ void iFXipp_32(x64emu_t *emu, uintptr_t fnc); void iFXLii_32(x64emu_t *emu, uintptr_t fnc); void iFXpip_32(x64emu_t *emu, uintptr_t fnc); void iFXppp_32(x64emu_t *emu, uintptr_t fnc); +void IFEpIi_32(x64emu_t *emu, uintptr_t fnc); void CFuuff_32(x64emu_t *emu, uintptr_t fnc); void uFEpii_32(x64emu_t *emu, uintptr_t fnc); void uFuuuu_32(x64emu_t *emu, uintptr_t fnc); @@ -783,6 +786,7 @@ void IFXpIII_32(x64emu_t *emu, uintptr_t fnc); void uFpLLLS_32(x64emu_t *emu, uintptr_t fnc); void UFuiCiu_32(x64emu_t *emu, uintptr_t fnc); void lFpuipC_32(x64emu_t *emu, uintptr_t fnc); +void LFEppLL_32(x64emu_t *emu, uintptr_t fnc); void LFpLppa_32(x64emu_t *emu, uintptr_t fnc); void LFXLuuu_32(x64emu_t *emu, uintptr_t fnc); void LFXLpuu_32(x64emu_t *emu, uintptr_t fnc); @@ -1029,6 +1033,7 @@ void iFdddpppppp_32(x64emu_t *emu, uintptr_t fnc); void iFXLiuiiLLL_32(x64emu_t *emu, uintptr_t fnc); void iFXLLiiuuii_32(x64emu_t *emu, uintptr_t fnc); void uFuulpiuiuf_32(x64emu_t *emu, uintptr_t fnc); +void pFEuiiiuuuu_32(x64emu_t *emu, uintptr_t fnc); void pFEXLiiuuLi_32(x64emu_t *emu, uintptr_t fnc); void vFEXLpppippp_32(x64emu_t *emu, uintptr_t fnc); void vFiiiiiiiiii_32(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped32/wrappedfreetype.c b/src/wrapped32/wrappedfreetype.c index df091d9c8..cd6a513c6 100644 --- a/src/wrapped32/wrappedfreetype.c +++ b/src/wrapped32/wrappedfreetype.c @@ -42,30 +42,15 @@ typedef struct FT_StreamRec_s unsigned char* base; unsigned long size; unsigned long pos; - FT_StreamDesc_t descriptor; FT_StreamDesc_t pathname; void* read; void* close; - void* memory; unsigned char* cursor; unsigned char* limit; - } FT_StreamRec_t; -typedef struct FT_Open_Args_s -{ - uint32_t flags; - const uint8_t* memory_base; - intptr_t memory_size; - char* pathname; - FT_StreamRec_t* stream; - void* driver; - int32_t num_params; - void* params; -} FT_Open_Args_t; - typedef struct FT_BBox_s { signed long xMin, yMin; @@ -157,6 +142,34 @@ typedef struct FT_GlyphSlotRec_s void* internal; } FT_GlyphSlotRec_t; +typedef struct FT_CharMapRec_s +{ + void* face; //FT_FaceRec_t* + int encoding; + uint16_t platform_id; + uint16_t encoding_id; +} FT_CharMapRec_t; + +typedef struct FT_Size_Metrics_s +{ + uint16_t x_ppem; + uint16_t y_ppem; + long x_scale; + long y_scale; + long ascender; + long descender; + long height; + long max_advance; +} FT_Size_Metrics_t; + +typedef struct FT_SizeRec_s +{ + void* face; //FT_FaceRec_t* + FT_Generic_t generic; + FT_Size_Metrics_t metrics; + void* internal; //FT_Size_Internal +} FT_SizeRec_t; + typedef struct FT_FaceRec_s { signed long num_faces; @@ -169,7 +182,7 @@ typedef struct FT_FaceRec_s int num_fixed_sizes; FT_Bitmap_Size_t* available_sizes; int num_charmaps; - void* charmaps; + FT_CharMapRec_t** charmaps; FT_Generic_t generic; FT_BBox_t bbox; uint16_t units_per_EM; @@ -181,8 +194,8 @@ typedef struct FT_FaceRec_s int16_t underline_position; int16_t underline_thickness; FT_GlyphSlotRec_t* glyph; - void* size; - void* charmap; + FT_SizeRec_t* size; + void* charmap; //FT_CharMapRec_t* /*@private begin */ void* driver; void* memory; @@ -250,6 +263,24 @@ typedef struct FT_Size_RequestRec_s uint32_t vertResolution; } FT_Size_RequestRec_t; +typedef struct FT_Parameter_s +{ + unsigned long tag; + void* data; +} FT_Parameter_t; + +typedef struct FT_Open_Args_s +{ + uint32_t flags; + uint8_t* memory_base; + long memory_size; + char* pathname; + FT_StreamRec_t* stream; + void* driver; //FT_ModuleRec + int num_params; + FT_Parameter_t* params; +} FT_Open_Args_t; + // 32bits FreeType structures typedef union FT_StreamDesc_32_s { @@ -274,18 +305,6 @@ typedef struct FT_StreamRec_32_s } FT_StreamRec_32_t; -typedef struct FT_Open_Args_32_s -{ - uint32_t flags; - ptr_t memory_base; //const uint8_t* - long_t memory_size; //intptr_t - ptr_t pathname; //char* - ptr_t stream; //FT_StreamRec_t* - ptr_t driver; //void* - int32_t num_params; - ptr_t params; //void* -} FT_Open_Args_32_t; - typedef struct FT_BBox_32_s { long_t xMin, yMin; @@ -377,6 +396,34 @@ typedef struct FT_GlyphSlotRec_32_s ptr_t internal; } FT_GlyphSlotRec_32_t; +typedef struct FT_CharMapRec_32_s +{ + ptr_t face; //FT_FaceRec_t* + int encoding; + uint16_t platform_id; + uint16_t encoding_id; +} FT_CharMapRec_32_t; + +typedef struct FT_Size_Metrics_32_s +{ + uint16_t x_ppem; + uint16_t y_ppem; + long_t x_scale; + long_t y_scale; + long_t ascender; + long_t descender; + long_t height; + long_t max_advance; +} FT_Size_Metrics_32_t; + +typedef struct FT_SizeRec_32_s +{ + ptr_t face; //FT_FaceRec_t* + FT_Generic_32_t generic; + FT_Size_Metrics_32_t metrics; + ptr_t internal; //FT_Size_Internal +} FT_SizeRec_32_t; + typedef struct FT_FaceRec_32_s { long_t num_faces; @@ -389,7 +436,7 @@ typedef struct FT_FaceRec_32_s int num_fixed_sizes; ptr_t available_sizes; //FT_Bitmap_32_t* //0x20 int num_charmaps; - ptr_t charmaps; //void* + ptr_t charmaps; //FT_CharMapRec_32_t** FT_Generic_32_t generic; //0x28 FT_BBox_32_t bbox; //0x30 uint16_t units_per_EM; //0x40 @@ -401,7 +448,7 @@ typedef struct FT_FaceRec_32_s int16_t underline_position; int16_t underline_thickness; ptr_t glyph; //FT_GlyphSlotRec_t* //0x50 - ptr_t size; //void* + ptr_t size; //FT_SizeRec_32_t* ptr_t charmap; //void* /*@private begin */ ptr_t driver; //void* //0x5c @@ -470,13 +517,65 @@ typedef struct FT_Size_RequestRec_32_s uint32_t vertResolution; } FT_Size_RequestRec_32_t; +typedef struct FT_Parameter_32_s +{ + ulong_t tag; + ptr_t data; //void* +} FT_Parameter_32_t; -void inplace_FT_GlyphSlot_shrink(void* a) +typedef struct FT_Open_Args_32_s { - if(!a) return; - FT_GlyphSlotRec_t* src = a; - FT_GlyphSlotRec_32_t* dst = a; - void* next = src->next; + uint32_t flags; + ptr_t memory_base; //uint8_t* + long_t memory_size; + ptr_t pathname; //char* + ptr_t stream; //FT_StreamRec_t* + ptr_t driver; //FT_ModuleRec + int num_params; + ptr_t params; //FT_Parameter_t* +} FT_Open_Args_32_t; + +void convert_FT_StreamRec_to_32(void* d, void* s) +{ + FT_StreamRec_t* src = s; + FT_StreamRec_32_t* dst = d; + + dst-> base = to_ptrv(src->base); + dst-> size = to_ulong(src->size); + dst-> pos = to_ulong(src->pos); + dst-> descriptor.value = to_long(src->descriptor.value); + dst-> descriptor.pointer = to_ptrv(src->descriptor.pointer); + dst-> pathname.value = to_long(src->pathname.value); + dst-> pathname.pointer = to_ptrv(src->pathname.pointer); + dst-> read = to_ptrv(src->read); + dst-> close = to_ptrv(src->close); + dst-> memory = to_ptrv(src->memory); + dst-> cursor = to_ptrv(src->cursor); + dst-> limit = to_ptrv(src->limit); +} +void convert_FT_StreamRec_to_64(void* d, void* s) +{ + FT_StreamRec_32_t* src = s; + FT_StreamRec_t* dst = d; + + dst-> limit = from_ptrv(src->limit); + dst-> cursor = from_ptrv(src->cursor); + dst-> memory = from_ptrv(src->memory); + dst-> close = from_ptrv(src->close); + dst-> read = from_ptrv(src->read); + dst-> pathname.pointer = from_ptrv(src->pathname.pointer); + dst-> pathname.value = from_long(src->pathname.value); + dst-> descriptor.pointer = from_ptrv(src->descriptor.pointer); + dst-> descriptor.value = from_long(src->descriptor.value); + dst-> pos = from_ulong(src->pos); + dst-> size = from_ulong(src->size); + dst-> base = from_ptrv(src->base); +} + +void convert_FT_GlyphSlot_to_32(void* d, void* s) +{ + FT_GlyphSlotRec_t* src = s; + FT_GlyphSlotRec_32_t* dst = d; dst->library = to_ptrv(src->library); dst->face = to_ptrv(src->face); @@ -525,16 +624,12 @@ void inplace_FT_GlyphSlot_shrink(void* a) dst->rsb_delta = to_long(src->rsb_delta); dst->other = to_ptrv(src->other); dst->internal = to_ptrv(src->internal); - - inplace_FT_GlyphSlot_shrink(next); } -void inplace_FT_GlyphSlot_enlarge(void* a) +void convert_FT_GlyphSlot_to_64(void* d, void* s) { - if(!a) return; - FT_GlyphSlotRec_32_t* src = a; - FT_GlyphSlotRec_t* dst = a; - void* next = from_ptrv(src->next); + FT_GlyphSlotRec_32_t* src = s; + FT_GlyphSlotRec_t* dst = d; dst->internal = from_ptrv(src->internal); dst->other = from_ptrv(src->other); @@ -583,10 +678,117 @@ void inplace_FT_GlyphSlot_enlarge(void* a) dst->next = from_ptrv(src->next); // no shinking of the whole chain? dst->face = from_ptrv(src->face); dst->library = from_ptrv(src->library); +} + +void inplace_FT_GlyphSlot_shrink(void* a) +{ + if(!a) return; + FT_GlyphSlotRec_t* src = a; + FT_GlyphSlotRec_32_t* dst = a; + void* next = src->next; + + convert_FT_GlyphSlot_to_32(dst, src); + + inplace_FT_GlyphSlot_shrink(next); +} + +void inplace_FT_GlyphSlot_enlarge(void* a) +{ + if(!a) return; + FT_GlyphSlotRec_32_t* src = a; + FT_GlyphSlotRec_t* dst = a; + void* next = from_ptrv(src->next); + + convert_FT_GlyphSlot_to_64(dst, src); inplace_FT_GlyphSlot_enlarge(next); } +void convert_FT_CharMapRec_to_32(void* d, void* s) +{ + FT_CharMapRec_t* src = s; + FT_CharMapRec_32_t* dst = d; + + dst->face = to_ptrv(src->face); + dst->encoding = src->encoding; + dst->platform_id = src->platform_id; + dst->encoding_id = src->encoding_id; +} +void convert_FT_CharMapRec_to_64(void* d, void* s) +{ + FT_CharMapRec_32_t* src = s; + FT_CharMapRec_t* dst = d; + + dst->encoding_id = src->encoding_id; + dst->platform_id = src->platform_id; + dst->encoding = src->encoding; + dst->face = from_ptrv(src->face); +} + +void inplace_FT_CharMapRec_shrink(void* a) +{ + if(!a) return; + + convert_FT_CharMapRec_to_32(a, a); +} +void inplace_FT_CharMapRec_enlarge(void* a) +{ + if(!a) return; + + convert_FT_CharMapRec_to_64(a, a); +} + +void convert_FT_SizeRec_to_32(void* d, void* s) +{ + FT_SizeRec_t* src = s; + FT_SizeRec_32_t* dst = d; + + dst->face = to_ptrv(src->face); + dst->generic.data = to_ptrv(src->generic.data); + dst->generic.finalizer = to_ptrv(src->generic.finalizer); + dst->metrics.x_ppem = src->metrics.x_ppem; + dst->metrics.y_ppem = src->metrics.y_ppem; + dst->metrics.x_scale = to_long(src->metrics.x_scale); + dst->metrics.y_scale = to_long(src->metrics.y_scale); + dst->metrics.ascender = to_long(src->metrics.ascender); + dst->metrics.descender = to_long(src->metrics.descender); + dst->metrics.height = to_long(src->metrics.height); + dst->metrics.max_advance = to_long(src->metrics.max_advance); + dst->internal = to_ptrv(src->internal); +} +void convert_FT_SizeRec_to_64(void* d, void* s) +{ + FT_SizeRec_32_t* src = s; + FT_SizeRec_t* dst = d; + + dst->internal = from_ptrv(src->internal); + dst->metrics.max_advance = from_long(src->metrics.max_advance); + dst->metrics.height = from_long(src->metrics.height); + dst->metrics.descender = from_long(src->metrics.descender); + dst->metrics.ascender = from_long(src->metrics.ascender); + dst->metrics.y_scale = from_long(src->metrics.y_scale); + dst->metrics.x_scale = from_long(src->metrics.x_scale); + dst->metrics.y_ppem = src->metrics.y_ppem; + dst->metrics.x_ppem = src->metrics.x_ppem; + dst->generic.finalizer = from_ptrv(src->generic.finalizer); + dst->generic.data = from_ptrv(src->generic.data); + dst->face = from_ptrv(src->face); +} + +void inplace_FT_SizeRec_shrink(void* a) +{ + if(!a) return; + + convert_FT_SizeRec_to_32(a, a); +} +void inplace_FT_SizeRec_enlarge(void* a) +{ + if(!a) return; + + convert_FT_SizeRec_to_64(a, a); +} + + // Convertion function void inplace_FT_FaceRec_shrink(void* a) { @@ -614,6 +816,11 @@ void inplace_FT_FaceRec_shrink(void* a) } dst->num_fixed_sizes = src->num_fixed_sizes; dst->available_sizes = to_ptrv(src->available_sizes); + //convert charmaps content then pointers array + for(int i=0; inum_charmaps; ++i) + inplace_FT_CharMapRec_shrink(src->charmaps[i]); + for(int i=0; inum_charmaps; ++i) + ((ptr_t*)src->charmaps)[i] = to_ptrv(src->charmaps[i]); dst->num_charmaps = src->num_charmaps; dst->charmaps = to_ptrv(src->charmaps); dst->generic.data = to_ptrv(src->generic.data); @@ -630,6 +837,7 @@ void inplace_FT_FaceRec_shrink(void* a) dst->max_advance_height = src->max_advance_height; dst->underline_position = src->underline_position; dst->underline_thickness = src->underline_thickness; + inplace_FT_SizeRec_shrink(src->size); dst->glyph = to_ptrv(src->glyph); dst->size = to_ptrv(src->size); dst->charmap = to_ptrv(src->charmap); @@ -668,6 +876,7 @@ void inplace_FT_FaceRec_enlarge(void* a) dst->driver = from_ptrv(src->driver); dst->charmap = from_ptrv(src->charmap); dst->size = from_ptrv(src->size); + inplace_FT_SizeRec_enlarge(dst->size); dst->glyph = from_ptrv(src->glyph); dst->underline_thickness = src->underline_thickness; dst->underline_position = src->underline_position; @@ -685,6 +894,11 @@ void inplace_FT_FaceRec_enlarge(void* a) dst->generic.data = from_ptrv(src->generic.data); dst->charmaps = from_ptrv(src->charmaps); dst->num_charmaps = src->num_charmaps; + //convert charmaps pointer array then content + for(int i=dst->num_charmaps-1; i>=0; --i) + dst->charmaps[i] = from_ptrv(((ptr_t*)dst->charmaps)[i]); + for(int i=dst->num_charmaps-1; i>=0; --i) + inplace_FT_CharMapRec_enlarge(dst->charmaps[i]); dst->available_sizes = from_ptrv(src->available_sizes); dst->num_fixed_sizes = src->num_fixed_sizes; { @@ -1025,37 +1239,84 @@ static FT_MemoryRec_t* find_FT_MemoryRec_Struct(FT_MemoryRec_t* s) #undef SUPER -//static uintptr_t my_iofunc = 0; -//static unsigned long my_FT_Stream_IoFunc(FT_StreamRec_t* stream, unsigned long offset, unsigned char* buffer, unsigned long count ) -//{ -// return (unsigned long)RunFunctionFmt(my_iofunc, "pLpL", stream, offset, buffer, count) ; -//} +static uintptr_t my_iofunc = 0; +static unsigned long my_FT_Stream_IoFunc(FT_StreamRec_t* stream, unsigned long offset, unsigned char* buffer, unsigned long count ) +{ + static FT_StreamRec_32_t stream_s; + convert_FT_StreamRec_to_32(&stream_s, stream); + unsigned char* buffer_s = buffer; + if((uintptr_t)buffer_s>=0x100000000LL) { + buffer_s = malloc(count); + memcpy(buffer_s, buffer, count); + } + unsigned long ret = (unsigned long)RunFunctionFmt(my_iofunc, "pLpL", &stream_s, offset, buffer_s, count); + convert_FT_StreamRec_to_64(stream, &stream_s); + if(buffer_s!=buffer) { + memcpy(buffer, buffer_s, count); + free(buffer_s); + } + return ret; +} -//static uintptr_t my_closefunc = 0; -//static void my_FT_Stream_CloseFunc(FT_StreamRec_t* stream) -//{ -// RunFunctionFmt(my_closefunc, "p", stream) ; -//} +static uintptr_t my_closefunc = 0; +static void my_FT_Stream_CloseFunc(FT_StreamRec_t* stream) +{ + static FT_StreamRec_32_t stream_s; + convert_FT_StreamRec_to_32(&stream_s, stream); + RunFunctionFmt(my_closefunc, "p", &stream_s); + convert_FT_StreamRec_to_64(stream, &stream_s); +} -//EXPORT int my_FT_Open_Face(x64emu_t* emu, void* library, FT_Open_Args_t* args, long face_index, void* aface) -//{ -// (void)emu; -// int wrapstream = (args->flags&0x02)?1:0; -// if(wrapstream) { -// my_iofunc = (uintptr_t)args->stream->read; -// if(my_iofunc) -// args->stream->read = my_FT_Stream_IoFunc; -// my_closefunc = (uintptr_t)args->stream->close; -// if(my_closefunc) -// args->stream->close = my_FT_Stream_CloseFunc; -// } -// int ret = my->FT_Open_Face(library, args, face_index, aface); -// /*if(wrapstream) { -// args->stream->read = (void*)my_iofunc; -// args->stream->close = (void*)my_closefunc; -// }*/ -// return ret; -//} +EXPORT int my32_FT_Open_Face(x64emu_t* emu, void* library, FT_Open_Args_32_t* args, long face_index, ptr_t* aface) +{ + (void)emu; + void* aface_l = NULL; + FT_Open_Args_t args_l = {0}; + // keep streams alive and in low memory, as they are living until FT_Face_Done is done. A better way would be to dynamicaly allocate it + // and free when done, but needs to detect when stream is actualy allocated on box side... + static FT_StreamRec_t streams[16] = {0}; + static int streams_idx = 0; + FT_StreamRec_t *stream = &streams[streams_idx]; + streams_idx = (streams_idx+1)&15; + FT_Parameter_t params[50]; + args_l.flags = args->flags; + args_l.memory_base = from_ptrv(args->memory_base); + args_l.memory_size = from_long(args->memory_size); + args_l.pathname = from_ptrv(args->pathname); + args_l.stream = args->stream?stream:NULL; + if(args->stream) + convert_FT_StreamRec_to_64(stream, from_ptrv(args->stream)); + args_l.driver = from_ptrv(args->driver); + args_l.num_params = args->num_params; + args_l.params = args->params?params:NULL; + for(int i=0; args_l.num_params; ++i) { + params[i].tag = from_ulong(((FT_Parameter_32_t*)from_ptrv(args->params))[i].tag); + params[i].data = from_ptrv(((FT_Parameter_32_t*)from_ptrv(args->params))[i].data); + } + int wrapstream = (args->flags&0x02)?1:0; + if(wrapstream) { + my_iofunc = (uintptr_t)args_l.stream->read; + if(my_iofunc) { + args_l.stream->read = GetNativeFnc(my_iofunc); + if(!args_l.stream->read) + args_l.stream->read = my_FT_Stream_IoFunc; + } + my_closefunc = (uintptr_t)args_l.stream->close; + if(my_closefunc) { + args_l.stream->close = GetNativeFnc(my_closefunc); + if(!args_l.stream->close) + args_l.stream->close = my_FT_Stream_CloseFunc; + } + } + int ret = my->FT_Open_Face(library, &args_l, face_index, &aface_l); + /*if(wrapstream) { + args->stream->read = (void*)my_iofunc; + args->stream->close = (void*)my_closefunc; + }*/ + *aface = to_ptrv(aface_l); + inplace_FT_FaceRec_shrink(aface_l); + return ret; +} //EXPORT int my_FTC_Manager_New(x64emu_t* emu, void* l, uint32_t max_faces, uint32_t max_sizes, uintptr_t max_bytes, void* req, void* data, void* aman) //{ @@ -1298,6 +1559,15 @@ EXPORT int my32_FT_Load_Glyph(x64emu_t* emu, void* face, uint32_t index, int fla return ret; } +EXPORT int my32_FT_Set_Charmap(x64emu_t* emu, void* face, void* charmap) +{ + // do not enlarge charmap, as it's already part of the face and so is expanded already + inplace_FT_FaceRec_enlarge(face); + int ret = my->FT_Set_Charmap(face, charmap); + inplace_FT_FaceRec_shrink(face); + return ret; +} + EXPORT void my32_FT_Outline_Get_CBox(x64emu_t* emu, FT_Outline_32_t* outline, FT_BBox_32_t* bbox) { int n = outline->n_points; @@ -1324,9 +1594,17 @@ EXPORT void my32_FT_Outline_Get_CBox(x64emu_t* emu, FT_Outline_32_t* outline, FT EXPORT int my32_FT_Render_Glyph(x64emu_t* emu, FT_GlyphSlotRec_32_t* glyph, uint32_t mode) { - inplace_FT_GlyphSlot_enlarge(glyph); + #if 1 + void* face = from_ptrv(glyph->face); + inplace_FT_FaceRec_enlarge(face); int ret = my->FT_Render_Glyph(glyph, mode); - inplace_FT_GlyphSlot_shrink(glyph); + inplace_FT_FaceRec_shrink(face); + #else + FT_GlyphSlotRec_t slot = {0}; + convert_FT_GlyphSlot_to_64(&slot, glyph); + int ret = my->FT_Render_Glyph(&slot, mode); + convert_FT_GlyphSlot_to_32(glyph, &slot); + #endif return ret; } diff --git a/src/wrapped32/wrappedfreetype_private.h b/src/wrapped32/wrappedfreetype_private.h index 683fb531d..622d17713 100644 --- a/src/wrapped32/wrappedfreetype_private.h +++ b/src/wrapped32/wrappedfreetype_private.h @@ -120,7 +120,7 @@ GOM(FT_New_Face, iFEpplp) //GOM(FT_New_Library, iFEpp) GOM(FT_New_Memory_Face, iFEppllp) //GO(FT_New_Size, iFpp) -//GOM(FT_Open_Face, iFEpplp) +GOM(FT_Open_Face, iFEpplp) //GO(FT_OpenType_Free, vFpp) //GO(FT_OpenType_Validate, iFpuppppp) //GO(FT_Outline_Check, iFp) @@ -153,7 +153,7 @@ GOM(FT_Request_Size, iFEpp) //GO(FT_RoundFix, GOM(FT_Select_Charmap, iFEpi) GOM(FT_Select_Size, iFEpi) -//GO(FT_Set_Charmap, iFpp) +GOM(FT_Set_Charmap, iFEpp) GOM(FT_Set_Char_Size, iFEplluu) //GO(FT_Set_Debug_Hook, //GO(FT_Set_Default_Properties, vFp) diff --git a/src/wrapped32/wrappedsdl2.c b/src/wrapped32/wrappedsdl2.c index 6b5d9b15d..3e4b7b366 100644 --- a/src/wrapped32/wrappedsdl2.c +++ b/src/wrapped32/wrappedsdl2.c @@ -302,6 +302,13 @@ EXPORT void* my32_2_SDL_CreateRGBSurfaceWithFormatFrom(x64emu_t* emu, void* pixe return p; } +EXPORT void* my32_2_SDL_CreateRGBSurface(x64emu_t* emu, uint32_t flags, int width, int height, int depth, uint32_t Rmask, uint32_t Gmask, uint32_t Bmask, uint32_t Amask) +{ + void* p = my->SDL_CreateRGBSurface(flags, width, height, depth, Rmask, Gmask, Bmask, Amask); + inplace_SDL2_Surface_to_32(p); + return p; +} + EXPORT void my32_2_SDL_SetWindowIcon(x64emu_t* emu, void* window, void* icon) { inplace_SDL2_Surface_to_64(icon); @@ -317,6 +324,14 @@ EXPORT void* my32_2_SDL_CreateColorCursor(void* s, int x, int y) return ret; } +EXPORT int my32_2_SDL_FillRect(x64emu_t* emu, void* s, void* rect, uint32_t color) +{ + inplace_SDL2_Surface_to_64(s); + int ret = my->SDL_FillRect(s, rect, color); + inplace_SDL2_Surface_to_32(s); + return ret; +} + EXPORT void my32_2_SDL_FreeSurface(x64emu_t* emu, void* surface) { inplace_SDL2_Surface_to_64(surface); @@ -376,6 +391,50 @@ EXPORT void *my32_2_SDL_LoadBMP_RW(x64emu_t* emu, void* a, int b) return r; } +EXPORT int64_t my32_2_SDL_RWseek(x64emu_t* emu, void* a, int64_t offset, int whence) +{ + //sdl2_my_t *my = (sdl2_my_t *)emu->context->sdl2lib->priv.w.p2; + SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); + int64_t ret = RWNativeSeek2(rw, offset, whence); + RWNativeEnd2(rw); + return ret; +} +EXPORT int64_t my32_2_SDL_RWtell(x64emu_t* emu, void* a) +{ + SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); + int64_t ret = RWNativeSeek2(rw, 0, 1); //1 == RW_SEEK_CUR + RWNativeEnd2(rw); + return ret; +} +EXPORT int64_t my32_2_SDL_RWsize(x64emu_t* emu, void* a) +{ + SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); + int64_t ret = RWNativeSize2(rw); //1 == RW_SEEK_CUR + RWNativeEnd2(rw); + return ret; +} +EXPORT uint64_t my32_2_SDL_RWread(x64emu_t* emu, void* a, void* ptr, uint64_t size, uint64_t maxnum) +{ + SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); + uint64_t ret = RWNativeRead2(rw, ptr, size, maxnum); + RWNativeEnd2(rw); + return ret; +} +EXPORT uint64_t my32_2_SDL_RWwrite(x64emu_t* emu, void* a, const void* ptr, uint64_t size, uint64_t maxnum) +{ + SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); + uint64_t ret = RWNativeWrite2(rw, ptr, size, maxnum); + RWNativeEnd2(rw); + return ret; +} +EXPORT int my32_2_SDL_RWclose(x64emu_t* emu, void* a) +{ + //sdl2_my_t *my = (sdl2_my_t *)emu->context->sdl2lib->priv.w.p2; + SDL2_RWops_t *rw = RWNativeStart2(emu, (SDL2_RWops_t*)a); + return RWNativeClose2(rw); +} + + #define ALTMY my32_2_ #define CUSTOM_INIT \ diff --git a/src/wrapped32/wrappedsdl2_private.h b/src/wrapped32/wrappedsdl2_private.h index 33c08739b..1304d05ac 100644 --- a/src/wrapped32/wrappedsdl2_private.h +++ b/src/wrapped32/wrappedsdl2_private.h @@ -70,7 +70,7 @@ GOM(SDL_CreateColorCursor, pFpii) //%noE // GO(SDL_CreateCursor, pFppiiii) GO(SDL_CreateMutex, pFv) GO(SDL_CreateRenderer, pFpiu) -// GO(SDL_CreateRGBSurface, pFuiiiuuuu) +GOM(SDL_CreateRGBSurface, pFEuiiiuuuu) // GO(SDL_CreateRGBSurfaceFrom, pFpiiiiuuuu) // GO(SDL_CreateRGBSurfaceWithFormat, pFuiiiu) GOM(SDL_CreateRGBSurfaceWithFormatFrom, pFEpiiiiu) @@ -108,7 +108,7 @@ GO(SDL_DisableScreenSaver, vFv) // GO(SDL_expf, fFf) // GO(SDL_fabs, dFd) // GO(SDL_fabsf, fFf) -// GO(SDL_FillRect, iFppu) +GOM(SDL_FillRect, iFEppu) // GO(SDL_FillRects, iFppiu) // SDL_FilterEvents // GO(SDL_floor, dFd) @@ -589,7 +589,7 @@ GO(SDL_SetClipboardText, iFp) // GO(SDL_SetColorKey, iFpiu) GO(SDL_SetCursor, vFp) GO(SDL_setenv, iFppi) -// GO(SDL_SetError, iFppppp) // it use ..., so putarbitrary 4 args +GO(SDL_SetError, iFppppp) // it use ..., so putarbitrary 4 args // GOM(SDL_SetEventFilter, vFEpp) GO(SDL_SetHint, uFpp) // GO(SDL_SetHintWithPriority, uFppu) @@ -729,11 +729,12 @@ GO(SDL_WasInit, uFu) // GOM(SDL_WriteLE64, uFEpU) // GOM(SDL_WriteU8, uFEpu) -// GOM(SDL_RWseek, IFEpIi) -// GOM(SDL_RWtell, IFEp) -// GOM(SDL_RWread, uFEppuu) -// GOM(SDL_RWwrite, uFEppuu) -// GOM(SDL_RWclose, iFEp) +GOM(SDL_RWseek, IFEpIi) +GOM(SDL_RWtell, IFEp) +GOM(SDL_RWsize, IFEp) +GOM(SDL_RWread, LFEppLL) +GOM(SDL_RWwrite, LFEppLL) +GOM(SDL_RWclose, iFEp) // GO2(SDL_mutexP, iFp, SDL_LockMutex) // GO2(SDL_mutexV, iFp, SDL_UnlockMutex)