diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-12-12 11:53:13 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-12-12 11:53:13 +0100 |
| commit | 2247b61ed3c67ecce0bf2bd9a9b3f41e769bb05e (patch) | |
| tree | 24c25d54ea7a9d74f4bb3fcab4497d08467a97a7 /src | |
| parent | 55d6971a23d43f3f80919b47bc54b46192a89040 (diff) | |
| download | box64-2247b61ed3c67ecce0bf2bd9a9b3f41e769bb05e.tar.gz box64-2247b61ed3c67ecce0bf2bd9a9b3f41e769bb05e.zip | |
[BOX32][WRAPPER] Added a few more 32bits wrapped function to libfontconfig
Diffstat (limited to 'src')
| -rw-r--r-- | src/wrapped32/generated/functions_list.txt | 13 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrappedfontconfigtypes32.h | 14 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.c | 2 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.h | 1 | ||||
| -rw-r--r-- | src/wrapped32/wrappedfontconfig.c | 127 | ||||
| -rw-r--r-- | src/wrapped32/wrappedfontconfig_private.h | 16 |
6 files changed, 130 insertions, 43 deletions
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index 520c1b21..e1e41e55 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -1354,6 +1354,7 @@ #() iFXLLLLbL_ -> iFXLLLLB #() iFXLbL_ipi -> iFXLBipi #() iFXbL_upip -> iFXBupip +#() pFEppibp_p -> pFEppiBp #() pEEppbL_Lp -> pEEppBLp #() iEEipuurLL_ -> iEEipuuB #() iFppbL_pbL_p -> iFppBpBp @@ -1665,10 +1666,22 @@ wrappedexpat: - uFpii: - XML_ParseBuffer wrappedfontconfig: +- vFp: + - FcFontSetDestroy +- pFp: + - FcCacheCopySet - uFpu: - FcFreeTypeCharIndex +- pFpp: +- pFpV: + - FcObjectSetBuild + - FcPatternBuild +- pFppp: + - FcFontList - iFppiUi: - FcPatternAdd +- pFppibp_p: + - FcFontSort wrappedfreetype: - vFp: - FT_Done_Glyph diff --git a/src/wrapped32/generated/wrappedfontconfigtypes32.h b/src/wrapped32/generated/wrappedfontconfigtypes32.h index f147d625..aea977d0 100644 --- a/src/wrapped32/generated/wrappedfontconfigtypes32.h +++ b/src/wrapped32/generated/wrappedfontconfigtypes32.h @@ -11,11 +11,23 @@ #define ADDED_FUNCTIONS() #endif +typedef void (*vFp_t)(void*); +typedef void* (*pFp_t)(void*); typedef uint32_t (*uFpu_t)(void*, uint32_t); +typedef void* (*pFpp_t)(void*, void*); +typedef void* (*pFpV_t)(void*, ...); +typedef void* (*pFppp_t)(void*, void*, void*); typedef int32_t (*iFppiUi_t)(void*, void*, int32_t, uint64_t, int32_t); +typedef void* (*pFppibp_p_t)(void*, void*, int32_t, struct_p_t*, void*); #define SUPER() ADDED_FUNCTIONS() \ + GO(FcFontSetDestroy, vFp_t) \ + GO(FcCacheCopySet, pFp_t) \ GO(FcFreeTypeCharIndex, uFpu_t) \ - GO(FcPatternAdd, iFppiUi_t) + GO(FcObjectSetBuild, pFpV_t) \ + GO(FcPatternBuild, pFpV_t) \ + GO(FcFontList, pFppp_t) \ + GO(FcPatternAdd, iFppiUi_t) \ + GO(FcFontSort, pFppibp_p_t) #endif // __wrappedfontconfigTYPES32_H_ diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c index 320f089a..7e9e53b9 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -1445,6 +1445,7 @@ typedef int32_t (*iFXLiiibL__t)(void*, uintptr_t, int32_t, int32_t, int32_t, str typedef int32_t (*iFXLLLLbL__t)(void*, uintptr_t, uintptr_t, uintptr_t, uintptr_t, struct_L_t*); typedef int32_t (*iFXLbL_ipi_t)(void*, uintptr_t, struct_L_t*, int32_t, void*, int32_t); typedef int32_t (*iFXbL_upip_t)(void*, struct_L_t*, uint32_t, void*, int32_t, void*); +typedef void* (*pFEppibp_p_t)(x64emu_t*, void*, void*, int32_t, struct_p_t*, void*); typedef void* (*pEEppbL_Lp_t)(x64emu_t*, void*, void*, struct_L_t*, uintptr_t, void*); typedef int32_t (*iEEipuurLL__t)(x64emu_t*, int32_t, void*, uint32_t, uint32_t, struct_LL_t*); typedef int32_t (*iFppbL_pbL_p_t)(void*, void*, struct_L_t*, void*, struct_L_t*, void*); @@ -3108,6 +3109,7 @@ void iFXLiiibL__32(x64emu_t *emu, uintptr_t fcn) { iFXLiiibL__t fn = (iFXLiiibL_ void iFXLLLLbL__32(x64emu_t *emu, uintptr_t fcn) { iFXLLLLbL__t fn = (iFXLLLLbL__t)fcn; struct_L_t arg_24={0}; if (*(ptr_t*)(from_ptr((R_ESP + 24)))) from_struct_L(&arg_24, *(ptr_t*)(from_ptr((R_ESP + 24)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ulong(from_ptri(ulong_t, R_ESP + 12)), from_ulong(from_ptri(ulong_t, R_ESP + 16)), from_ulong(from_ptri(ulong_t, R_ESP + 20)), *(ptr_t*)(from_ptr((R_ESP + 24))) ? &arg_24 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 24)))) to_struct_L(*(ptr_t*)(from_ptr((R_ESP + 24))), &arg_24); } void iFXLbL_ipi_32(x64emu_t *emu, uintptr_t fcn) { iFXLbL_ipi_t fn = (iFXLbL_ipi_t)fcn; struct_L_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_L(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL, from_ptri(int32_t, R_ESP + 16), from_ptriv(R_ESP + 20), from_ptri(int32_t, R_ESP + 24)); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_L(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } void iFXbL_upip_32(x64emu_t *emu, uintptr_t fcn) { iFXbL_upip_t fn = (iFXbL_upip_t)fcn; struct_L_t arg_8={0}; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) from_struct_L(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_ptri(uint32_t, R_ESP + 12), from_ptriv(R_ESP + 16), from_ptri(int32_t, R_ESP + 20), from_ptriv(R_ESP + 24)); if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_L(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); } +void pFEppibp_p_32(x64emu_t *emu, uintptr_t fcn) { pFEppibp_p_t fn = (pFEppibp_p_t)fcn; struct_p_t arg_16={0}; if (*(ptr_t*)(from_ptr((R_ESP + 16)))) from_struct_p(&arg_16, *(ptr_t*)(from_ptr((R_ESP + 16)))); R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), *(ptr_t*)(from_ptr((R_ESP + 16))) ? &arg_16 : NULL, from_ptriv(R_ESP + 20))); if (*(ptr_t*)(from_ptr((R_ESP + 16)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 16))), &arg_16); } void pEEppbL_Lp_32(x64emu_t *emu, uintptr_t fcn) { pEEppbL_Lp_t fn = (pEEppbL_Lp_t)fcn; errno = emu->libc_err; struct_L_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_L(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL, from_ulong(from_ptri(ulong_t, R_ESP + 16)), from_ptriv(R_ESP + 20))); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_L(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); emu->libc_err = errno; } void iEEipuurLL__32(x64emu_t *emu, uintptr_t fcn) { iEEipuurLL__t fn = (iEEipuurLL__t)fcn; errno = emu->libc_err; struct_LL_t arg_20={0}; if (*(ptr_t*)(from_ptr((R_ESP + 20)))) from_struct_LL(&arg_20, *(ptr_t*)(from_ptr((R_ESP + 20)))); R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(uint32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), *(ptr_t*)(from_ptr((R_ESP + 20))) ? &arg_20 : NULL); emu->libc_err = errno; } void iFppbL_pbL_p_32(x64emu_t *emu, uintptr_t fcn) { iFppbL_pbL_p_t fn = (iFppbL_pbL_p_t)fcn; struct_L_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_L(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); struct_L_t arg_20={0}; if (*(ptr_t*)(from_ptr((R_ESP + 20)))) from_struct_L(&arg_20, *(ptr_t*)(from_ptr((R_ESP + 20)))); R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL, from_ptriv(R_ESP + 16), *(ptr_t*)(from_ptr((R_ESP + 20))) ? &arg_20 : NULL, from_ptriv(R_ESP + 24)); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_L(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); if (*(ptr_t*)(from_ptr((R_ESP + 20)))) to_struct_L(*(ptr_t*)(from_ptr((R_ESP + 20))), &arg_20); } diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h index 1d0f6a1f..9ec451da 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -1395,6 +1395,7 @@ void iFXLiiibL__32(x64emu_t *emu, uintptr_t fnc); void iFXLLLLbL__32(x64emu_t *emu, uintptr_t fnc); void iFXLbL_ipi_32(x64emu_t *emu, uintptr_t fnc); void iFXbL_upip_32(x64emu_t *emu, uintptr_t fnc); +void pFEppibp_p_32(x64emu_t *emu, uintptr_t fnc); void pEEppbL_Lp_32(x64emu_t *emu, uintptr_t fnc); void iEEipuurLL__32(x64emu_t *emu, uintptr_t fnc); void iFppbL_pbL_p_32(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped32/wrappedfontconfig.c b/src/wrapped32/wrappedfontconfig.c index 6a103768..36c5b6fe 100644 --- a/src/wrapped32/wrappedfontconfig.c +++ b/src/wrapped32/wrappedfontconfig.c @@ -17,6 +17,7 @@ #include "box32context.h" #include "emu/x64emu_private.h" #include "myalign32.h" +#include "converter32.h" typedef struct FcValue_s { int type; @@ -156,45 +157,42 @@ typedef struct FcConfig_32_s { #define ADDED_INIT() \ my->FcPatternAdd_ = (void*)my->FcPatternAdd;\ -typedef int (*iFppSi_t)(void*, void*, FcValue_t, int); +typedef int (*iFppSi_t)(void*, void*, FcValue_t, int); +typedef void*(*pFpA_t)(void*, va_list); + +#define ADDED_FUNCTIONS() \ + GO(FcObjectSetVaBuild, pFpA_t); \ + GO(FcPatternVaBuild, pFpA_t); \ #include "generated/wrappedfontconfigtypes32.h" #include "wrappercallback32.h" -//EXPORT void* my_FcObjectSetVaBuild(x64emu_t* emu, void* first, x64_va_list_t V) -//{ -// #ifdef CONVERT_VALIST -// CONVERT_VALIST(V); -// #else -// CREATE_VALIST_FROM_VALIST(V, emu->scratch); -// #endif -// return my->FcObjectSetVaBuild(first, VARARGS); -//} -//EXPORT void* my_FcObjectSetBuild(x64emu_t* emu, void* first, uint64_t* b) -//{ -// if(!first) -// return my->FcObjectSetBuild(first, NULL); -// CREATE_VALIST_FROM_VAARG(b, emu->scratch, 1); -// return my->FcObjectSetVaBuild(first, VARARGS); -//} - -//EXPORT void* my_FcPatternVaBuild(x64emu_t* emu, void* pattern, x64_va_list_t V) -//{ -// #ifdef CONVERT_VALIST -// CONVERT_VALIST(V); -// #else -// CREATE_VALIST_FROM_VALIST(V, emu->scratch); -// #endif -// return my->FcPatternVaBuild(pattern, VARARGS); -//} -//EXPORT void* my_FcPatternBuild(x64emu_t* emu, void* pattern, uint64_t* b) -//{ -// if(!pattern) -// return my->FcPatternBuild(pattern, NULL); -// CREATE_VALIST_FROM_VAARG(b, emu->scratch, 1); -// return my->FcPatternVaBuild(pattern, VARARGS); -//} +EXPORT void* my32_FcObjectSetVaBuild(x64emu_t* emu, void* first, void* V) +{ + PREPARE_VALIST_32_(V); + return my->FcObjectSetVaBuild(first, VARARGS_32_(V)); +} +EXPORT void* my32_FcObjectSetBuild(x64emu_t* emu, void* first, uint64_t* b) +{ + if(!first) + return my->FcObjectSetBuild(first, NULL); + PREPARE_VALIST_32_(b); + return my->FcObjectSetVaBuild(first, VARARGS_32_(b)); +} + +EXPORT void* my32_FcPatternVaBuild(x64emu_t* emu, void* pattern, void* V) +{ + PREPARE_VALIST_32_(V); + return my->FcPatternVaBuild(pattern, VARARGS_32_(V)); +} +EXPORT void* my32_FcPatternBuild(x64emu_t* emu, void* pattern, uint64_t* b) +{ + if(!pattern) + return my->FcPatternBuild(pattern, NULL); + PREPARE_VALIST_32_(b); + return my->FcPatternVaBuild(pattern, VARARGS_32_(b)); +} typedef union fcvalue_32s { ptr_t p; @@ -235,6 +233,67 @@ EXPORT uint32_t my32_FcFreeTypeCharIndex(x64emu_t* emu, void* face, uint32_t u) return ret; } +typedef struct my_FcFontSet_s { + int nfont; + int sfont; + void** fonts; //FcPattern +} my_FcFontSet_t; +typedef struct my_FcFontSet_32_s { + int nfont; + int sfont; + ptr_t fonts; //FcPattern** +} my_FcFontSet_32_t; + +void* inplace_FcFontSet_shrink(void* set) +{ + if(!set) return set; + my_FcFontSet_t* src = set; + my_FcFontSet_32_t* dst = set; + + for(int i=0; i<src->nfont; ++i) { + ((ptr_t*)src->fonts)[i] = to_ptrv(src->fonts[i]); + } + dst->nfont = src->nfont; + dst->sfont = src->sfont; + dst->fonts = to_ptrv(src->fonts); + + return set; +} +void* inplace_FcFontSet_enlarge(void* set) +{ + my_FcFontSet_32_t* src = set; + my_FcFontSet_t* dst = set; + + dst->fonts = from_ptrv(src->fonts); + dst->sfont = src->sfont; + dst->nfont = src->nfont; + for(int i=src->nfont-1; i>=0; --i) { + dst->fonts[i] = from_ptrv(((ptr_t*)dst->fonts)[i]); + } + + return set; +} + +EXPORT void* my32_FcFontList(x64emu_t* emu, void* config, void* pattern, void* os) +{ + return inplace_FcFontSet_shrink(my->FcFontList(config, pattern, os)); +} + +EXPORT void* my32_FcFontSort(x64emu_t* emu, void* config, void* pattern, int trim, void* csp, int* result) +{ + return inplace_FcFontSet_shrink(my->FcFontSort(config, pattern, trim, csp, result)); +} + +EXPORT void* my32_FcCacheCopySet(x64emu_t* emu, void* cache) +{ + return inplace_FcFontSet_shrink(my->FcCacheCopySet(cache)); +} + +EXPORT void my32_FcFontSetDestroy(x64emu_t* emu, void* set) +{ + my->FcFontSetDestroy(inplace_FcFontSet_enlarge(set)); +} + #define NEEDED_LIBS "libexpat.so.1", "libfreetype.so.6" #include "wrappedlib_init32.h" diff --git a/src/wrapped32/wrappedfontconfig_private.h b/src/wrapped32/wrappedfontconfig_private.h index c18ada7a..2a001613 100644 --- a/src/wrapped32/wrappedfontconfig_private.h +++ b/src/wrapped32/wrappedfontconfig_private.h @@ -16,7 +16,7 @@ GO(FcBlanksAdd, iFpu) GO(FcBlanksCreate, pFv) GO(FcBlanksDestroy, vFp) GO(FcBlanksIsMember, iFpu) -GO(FcCacheCopySet, pFp) //GO(FcCacheCopySet, biibp__Fp) +GOM(FcCacheCopySet, pFEp) GO(FcCacheDir, pFp) GO(FcCacheNumFont, iFp) GO(FcCacheNumSubdir, iFp) @@ -79,18 +79,18 @@ GO(FcDirCacheValid, iFp) GO(FcFileIsDir, iFp) //GO(FcFileScan, iFbiibp__ppppi) GO(FcFini, vFv) -GO(FcFontList, pFppp) // need wrapping of returned FcFontSet? GO(FcFontList, biibp__Fppbiibp__) +GOM(FcFontList, pFEppp) GO(FcFontMatch, pFppp) GO(FcFontRenderPrepare, pFppp) //GO(FcFontSetAdd, iFbiibp__p) //GO(FcFontSetCreate, biibp__Fv) -GO(FcFontSetDestroy, vFp) //GO(FcFontSetDestroy, vFbiibp__) +GOM(FcFontSetDestroy, vFEp) //GO(FcFontSetList, biibp__Fpbbiibp___ipbiibp__) //GO(FcFontSetMatch, pFpbbiibp___ipp) //GO(FcFontSetPrint, vFbiibp__) //GO(FcFontSetSort, biibp__Fpbbiibp___ipibp_p) //GO(FcFontSetSortDestroy, vFbiibp__) -//GO(FcFontSort, biibp__Fppibp_p) +GOM(FcFontSort, pFEppibp_p) GOM(FcFreeTypeCharIndex, uFEpu) //GO(FcFreeTypeCharSet, //GO(FcFreeTypeCharSetAndSpacing, @@ -130,10 +130,10 @@ GO(FcNameUnparse, pFp) GO(FcNameUnregisterConstants, iFbppi_i) GO(FcNameUnregisterObjectTypes, iFbpi_i) GO(FcObjectSetAdd, iFpp) //GO(FcObjectSetAdd, iFbiibp__p) -//GOM(FcObjectSetBuild, biibp__FEpV) +GOM(FcObjectSetBuild, pFEpV) //GOM(FcObjectSetBuild, biibp__FEpV) GO(FcObjectSetCreate, pFv) //GO(FcObjectSetCreate, biibp__Fv) GO(FcObjectSetDestroy, vFp) //GO(FcObjectSetDestroy, vFbiibp__) -//GOM(FcObjectSetVaBuild, biibp__FEpp) +GOM(FcObjectSetVaBuild, pFEpp) //%% GOM(FcPatternAdd, iFppiUi) //%noE //need M for the iU that is a an FcValue GO(FcPatternAddBool, iFppi) GO(FcPatternAddCharSet, iFppp) @@ -144,7 +144,7 @@ GO(FcPatternAddLangSet, iFppp) GO(FcPatternAddMatrix, iFppp) GO(FcPatternAddString, iFppp) //GO(FcPatternAddWeak, iFppiLi) -//GOM(FcPatternBuild, pFEpV) +GOM(FcPatternBuild, pFEpV) GO(FcPatternCreate, pFv) GO(FcPatternDel, iFpp) GO(FcPatternDestroy, vFp) @@ -166,7 +166,7 @@ GO(FcPatternHash, uFp) GO(FcPatternPrint, vFp) GO(FcPatternReference, vFp) GO(FcPatternRemove, iFppi) -//GOM(FcPatternVaBuild, pFEpp) +GOM(FcPatternVaBuild, pFEpp) //%% GO(FcStrBasename, pFp) GO(FcStrCmp, iFpp) GO(FcStrCmpIgnoreCase, iFpp) |