diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-09-25 19:46:55 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-09-25 19:46:55 +0200 |
| commit | b85ebc73c9edae7109a65974a610ccf111f14537 (patch) | |
| tree | 428fb42c2fcf2e838edd34d16072ef7aab59e70a /src | |
| parent | 7d76fc49457ceb6e9b4fe1ce6e8f4400929ae4da (diff) | |
| download | box64-b85ebc73c9edae7109a65974a610ccf111f14537.tar.gz box64-b85ebc73c9edae7109a65974a610ccf111f14537.zip | |
[BOX32][WRAPPER] Improved 32bits wrapping for libfreetype (still not 100% ok)
Diffstat (limited to 'src')
| -rw-r--r-- | src/wrapped32/generated/functions_list.txt | 22 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrappedfreetypetypes32.h | 16 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.c | 16 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.h | 8 | ||||
| -rw-r--r-- | src/wrapped32/wrappedfreetype.c | 596 | ||||
| -rw-r--r-- | src/wrapped32/wrappedfreetype_private.h | 14 |
6 files changed, 614 insertions, 58 deletions
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index 8b017e29..bad10ad2 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -290,6 +290,7 @@ #() iFEip -> iFEip #() iFEup -> iFEup #() iFEpi -> iFEpi +#() iFEpu -> iFEpu #() iFEpL -> iFEpL #() iFEpp -> iFEpp #() iFEpV -> iFEpV @@ -319,7 +320,6 @@ #() iFpii -> iFpii #() iFpiu -> iFpiu #() iFpip -> iFpip -#() iFpui -> iFpui #() iFpuC -> iFpuC #() iFpuu -> iFpuu #() iFpuU -> iFpuU @@ -347,6 +347,7 @@ #() CFipp -> CFipp #() CFuUu -> CFuUu #() CFuff -> CFuff +#() uFEpL -> uFEpL #() uFilp -> uFilp #() uFipu -> uFipu #() uFuip -> uFuip @@ -505,6 +506,7 @@ #() iFEipp -> iFEipp #() iFEipV -> iFEipV #() iFEpip -> iFEpip +#() iFEpui -> iFEpui #() iFEpup -> iFEpup #() iFEpLi -> iFEpLi #() iFEppL -> iFEppL @@ -574,7 +576,6 @@ #() pFXLLp -> pFXLLp #() pFXppi -> pFXppi #() pFXppp -> pFXppp -#() iFpplBp_ -> iFpplB #() iFppbp_p -> iFppBp #() iFBp_pui -> iFBpui #() IFpBp_ii -> IFpBii @@ -686,6 +687,7 @@ #() iFEpLpp -> iFEpLpp #() iFEpLpV -> iFEpLpV #() iFEppiV -> iFEppiV +#() iFEpplp -> iFEpplp #() iFEpppi -> iFEpppi #() iFEpppp -> iFEpppp #() iFEXLpi -> iFEXLpi @@ -696,7 +698,6 @@ #() iFiLLLL -> iFiLLLL #() iFipLLi -> iFipLLi #() iFuiuup -> iFuiuup -#() iFplluu -> iFplluu #() iFpLuLi -> iFpLuLi #() iFpppip -> iFpppip #() iFpppup -> iFpppup @@ -794,6 +795,7 @@ #() iFEuppup -> iFEuppup #() iFEuppLp -> iFEuppLp #() iFEpiLpp -> iFEpiLpp +#() iFEplluu -> iFEplluu #() iFEpppup -> iFEpppup #() iFEXLilp -> iFEXLilp #() iFEXpiup -> iFEXpiup @@ -1027,6 +1029,20 @@ #() iFEpLvvpp -> iFEpLpp wrappedcrashhandler: wrappedfreetype: +- iFp: + - FT_Done_Face +- vFpp: + - FT_Outline_Get_CBox +- iFpu: + - FT_Render_Glyph +- uFpL: + - FT_Get_Char_Index +- iFpui: + - FT_Load_Glyph +- iFpplp: + - FT_New_Face +- iFplluu: + - FT_Set_Char_Size wrappedldlinux: - pFv: - ___tls_get_addr diff --git a/src/wrapped32/generated/wrappedfreetypetypes32.h b/src/wrapped32/generated/wrappedfreetypetypes32.h index cd3c56e1..21779425 100644 --- a/src/wrapped32/generated/wrappedfreetypetypes32.h +++ b/src/wrapped32/generated/wrappedfreetypetypes32.h @@ -11,7 +11,21 @@ #define ADDED_FUNCTIONS() #endif +typedef int32_t (*iFp_t)(void*); +typedef void (*vFpp_t)(void*, void*); +typedef int32_t (*iFpu_t)(void*, uint32_t); +typedef uint32_t (*uFpL_t)(void*, uintptr_t); +typedef int32_t (*iFpui_t)(void*, uint32_t, int32_t); +typedef int32_t (*iFpplp_t)(void*, void*, intptr_t, void*); +typedef int32_t (*iFplluu_t)(void*, intptr_t, intptr_t, uint32_t, uint32_t); -#define SUPER() ADDED_FUNCTIONS() +#define SUPER() ADDED_FUNCTIONS() \ + GO(FT_Done_Face, iFp_t) \ + GO(FT_Outline_Get_CBox, vFpp_t) \ + GO(FT_Render_Glyph, iFpu_t) \ + GO(FT_Get_Char_Index, uFpL_t) \ + GO(FT_Load_Glyph, iFpui_t) \ + GO(FT_New_Face, iFpplp_t) \ + GO(FT_Set_Char_Size, iFplluu_t) #endif // __wrappedfreetypeTYPES32_H_ diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c index 71c47bbb..19035415 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -380,6 +380,7 @@ typedef void (*vFXpp_t)(void*, void*, void*); typedef int32_t (*iFEip_t)(x64emu_t*, int32_t, void*); typedef int32_t (*iFEup_t)(x64emu_t*, uint32_t, void*); typedef int32_t (*iFEpi_t)(x64emu_t*, void*, int32_t); +typedef int32_t (*iFEpu_t)(x64emu_t*, void*, uint32_t); typedef int32_t (*iFEpL_t)(x64emu_t*, void*, uintptr_t); typedef int32_t (*iFEpp_t)(x64emu_t*, void*, void*); typedef int32_t (*iFEpV_t)(x64emu_t*, void*, void*); @@ -409,7 +410,6 @@ typedef int32_t (*iFfff_t)(float, float, float); typedef int32_t (*iFpii_t)(void*, int32_t, int32_t); typedef int32_t (*iFpiu_t)(void*, int32_t, uint32_t); typedef int32_t (*iFpip_t)(void*, int32_t, void*); -typedef int32_t (*iFpui_t)(void*, uint32_t, int32_t); typedef int32_t (*iFpuC_t)(void*, uint32_t, uint8_t); typedef int32_t (*iFpuu_t)(void*, uint32_t, uint32_t); typedef int32_t (*iFpuU_t)(void*, uint32_t, uint64_t); @@ -437,6 +437,7 @@ typedef int64_t (*IFiIi_t)(int32_t, int64_t, int32_t); typedef uint8_t (*CFipp_t)(int32_t, void*, void*); typedef uint8_t (*CFuUu_t)(uint32_t, uint64_t, uint32_t); typedef uint8_t (*CFuff_t)(uint32_t, float, float); +typedef uint32_t (*uFEpL_t)(x64emu_t*, void*, uintptr_t); typedef uint32_t (*uFilp_t)(int32_t, intptr_t, void*); typedef uint32_t (*uFipu_t)(int32_t, void*, uint32_t); typedef uint32_t (*uFuip_t)(uint32_t, int32_t, void*); @@ -595,6 +596,7 @@ typedef int32_t (*iFEiiN_t)(x64emu_t*, int32_t, int32_t, ...); typedef int32_t (*iFEipp_t)(x64emu_t*, int32_t, void*, void*); typedef int32_t (*iFEipV_t)(x64emu_t*, int32_t, void*, void*); typedef int32_t (*iFEpip_t)(x64emu_t*, void*, int32_t, void*); +typedef int32_t (*iFEpui_t)(x64emu_t*, void*, uint32_t, int32_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 (*iFEppL_t)(x64emu_t*, void*, void*, uintptr_t); @@ -664,7 +666,6 @@ typedef void* (*pFXiii_t)(void*, int32_t, int32_t, int32_t); typedef void* (*pFXLLp_t)(void*, uintptr_t, uintptr_t, void*); typedef void* (*pFXppi_t)(void*, void*, void*, int32_t); typedef void* (*pFXppp_t)(void*, void*, void*, void*); -typedef int32_t (*iFpplBp__t)(void*, void*, intptr_t, struct_p_t*); typedef int32_t (*iFppbp_p_t)(void*, void*, struct_p_t*, void*); typedef int32_t (*iFBp_pui_t)(struct_p_t*, void*, uint32_t, int32_t); typedef int64_t (*IFpBp_ii_t)(void*, struct_p_t*, int32_t, int32_t); @@ -776,6 +777,7 @@ 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 (*iFEppiV_t)(x64emu_t*, void*, void*, int32_t, void*); +typedef int32_t (*iFEpplp_t)(x64emu_t*, void*, void*, intptr_t, void*); typedef int32_t (*iFEpppi_t)(x64emu_t*, void*, void*, void*, int32_t); typedef int32_t (*iFEpppp_t)(x64emu_t*, void*, void*, void*, void*); typedef int32_t (*iFEXLpi_t)(x64emu_t*, void*, uintptr_t, void*, int32_t); @@ -786,7 +788,6 @@ typedef int32_t (*iFiiipp_t)(int32_t, int32_t, int32_t, void*, void*); typedef int32_t (*iFiLLLL_t)(int32_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); typedef int32_t (*iFipLLi_t)(int32_t, void*, uintptr_t, uintptr_t, int32_t); typedef int32_t (*iFuiuup_t)(uint32_t, int32_t, uint32_t, uint32_t, void*); -typedef int32_t (*iFplluu_t)(void*, intptr_t, intptr_t, uint32_t, uint32_t); typedef int32_t (*iFpLuLi_t)(void*, uintptr_t, uint32_t, uintptr_t, int32_t); typedef int32_t (*iFpppip_t)(void*, void*, void*, int32_t, void*); typedef int32_t (*iFpppup_t)(void*, void*, void*, uint32_t, void*); @@ -884,6 +885,7 @@ typedef void (*vFXLiiii_t)(void*, uintptr_t, int32_t, int32_t, int32_t, int32_t) typedef int32_t (*iFEuppup_t)(x64emu_t*, uint32_t, void*, void*, uint32_t, void*); typedef int32_t (*iFEuppLp_t)(x64emu_t*, uint32_t, void*, void*, uintptr_t, void*); typedef int32_t (*iFEpiLpp_t)(x64emu_t*, void*, int32_t, uintptr_t, void*, void*); +typedef int32_t (*iFEplluu_t)(x64emu_t*, void*, intptr_t, intptr_t, uint32_t, uint32_t); typedef int32_t (*iFEpppup_t)(x64emu_t*, void*, void*, void*, uint32_t, void*); typedef int32_t (*iFEXLilp_t)(x64emu_t*, void*, uintptr_t, int32_t, intptr_t, void*); typedef int32_t (*iFEXpiup_t)(x64emu_t*, void*, void*, int32_t, uint32_t, void*); @@ -1407,6 +1409,7 @@ void vFXpp_32(x64emu_t *emu, uintptr_t fcn) { vFXpp_t fn = (vFXpp_t)fcn; fn(getD void iFEip_32(x64emu_t *emu, uintptr_t fcn) { iFEip_t fn = (iFEip_t)fcn; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8)); } void iFEup_32(x64emu_t *emu, uintptr_t fcn) { iFEup_t fn = (iFEup_t)fcn; R_EAX = fn(emu, from_ptri(uint32_t, R_ESP + 4), from_ptriv(R_ESP + 8)); } void iFEpi_32(x64emu_t *emu, uintptr_t fcn) { iFEpi_t fn = (iFEpi_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8)); } +void iFEpu_32(x64emu_t *emu, uintptr_t fcn) { iFEpu_t fn = (iFEpu_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8)); } void iFEpL_32(x64emu_t *emu, uintptr_t fcn) { iFEpL_t fn = (iFEpL_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), to_ulong(from_ptri(ulong_t, R_ESP + 8))); } void iFEpp_32(x64emu_t *emu, uintptr_t fcn) { iFEpp_t fn = (iFEpp_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8)); } void iFEpV_32(x64emu_t *emu, uintptr_t fcn) { iFEpV_t fn = (iFEpV_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptrv(R_ESP + 8)); } @@ -1436,7 +1439,6 @@ void iFfff_32(x64emu_t *emu, uintptr_t fcn) { iFfff_t fn = (iFfff_t)fcn; R_EAX = void iFpii_32(x64emu_t *emu, uintptr_t fcn) { iFpii_t fn = (iFpii_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12)); } void iFpiu_32(x64emu_t *emu, uintptr_t fcn) { iFpiu_t fn = (iFpiu_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(uint32_t, R_ESP + 12)); } void iFpip_32(x64emu_t *emu, uintptr_t fcn) { iFpip_t fn = (iFpip_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12)); } -void iFpui_32(x64emu_t *emu, uintptr_t fcn) { iFpui_t fn = (iFpui_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12)); } void iFpuC_32(x64emu_t *emu, uintptr_t fcn) { iFpuC_t fn = (iFpuC_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptri(uint8_t, R_ESP + 12)); } void iFpuu_32(x64emu_t *emu, uintptr_t fcn) { iFpuu_t fn = (iFpuu_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptri(uint32_t, R_ESP + 12)); } void iFpuU_32(x64emu_t *emu, uintptr_t fcn) { iFpuU_t fn = (iFpuU_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptri(uint64_t, R_ESP + 12)); } @@ -1464,6 +1466,7 @@ void IFiIi_32(x64emu_t *emu, uintptr_t fcn) { IFiIi_t fn = (IFiIi_t)fcn; ui64_t void CFipp_32(x64emu_t *emu, uintptr_t fcn) { CFipp_t fn = (CFipp_t)fcn; R_EAX = (unsigned char)fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12)); } void CFuUu_32(x64emu_t *emu, uintptr_t fcn) { CFuUu_t fn = (CFuUu_t)fcn; R_EAX = (unsigned char)fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(uint64_t, R_ESP + 8), from_ptri(uint32_t, R_ESP + 16)); } void CFuff_32(x64emu_t *emu, uintptr_t fcn) { CFuff_t fn = (CFuff_t)fcn; R_EAX = (unsigned char)fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(float, R_ESP + 8), from_ptri(float, R_ESP + 12)); } +void uFEpL_32(x64emu_t *emu, uintptr_t fcn) { uFEpL_t fn = (uFEpL_t)fcn; R_EAX = (uint32_t)fn(emu, from_ptriv(R_ESP + 4), to_ulong(from_ptri(ulong_t, R_ESP + 8))); } void uFilp_32(x64emu_t *emu, uintptr_t fcn) { uFilp_t fn = (uFilp_t)fcn; R_EAX = (uint32_t)fn(from_ptri(int32_t, R_ESP + 4), to_long(from_ptri(long_t, R_ESP + 8)), from_ptriv(R_ESP + 12)); } void uFipu_32(x64emu_t *emu, uintptr_t fcn) { uFipu_t fn = (uFipu_t)fcn; R_EAX = (uint32_t)fn(from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(uint32_t, R_ESP + 12)); } void uFuip_32(x64emu_t *emu, uintptr_t fcn) { uFuip_t fn = (uFuip_t)fcn; R_EAX = (uint32_t)fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12)); } @@ -1622,6 +1625,7 @@ void iFEiiN_32(x64emu_t *emu, uintptr_t fcn) { iFEiiN_t fn = (iFEiiN_t)fcn; R_EA void iFEipp_32(x64emu_t *emu, uintptr_t fcn) { iFEipp_t fn = (iFEipp_t)fcn; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12)); } void iFEipV_32(x64emu_t *emu, uintptr_t fcn) { iFEipV_t fn = (iFEipV_t)fcn; R_EAX = fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptrv(R_ESP + 12)); } void iFEpip_32(x64emu_t *emu, uintptr_t fcn) { iFEpip_t fn = (iFEpip_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12)); } +void iFEpui_32(x64emu_t *emu, uintptr_t fcn) { iFEpui_t fn = (iFEpui_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(uint32_t, R_ESP + 8), from_ptri(int32_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 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))); } @@ -1691,7 +1695,6 @@ void pFXiii_32(x64emu_t *emu, uintptr_t fcn) { pFXiii_t fn = (pFXiii_t)fcn; R_EA void pFXLLp_32(x64emu_t *emu, uintptr_t fcn) { pFXLLp_t fn = (pFXLLp_t)fcn; R_EAX = to_ptrv(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_ptriv(R_ESP + 16))); } void pFXppi_32(x64emu_t *emu, uintptr_t fcn) { pFXppi_t fn = (pFXppi_t)fcn; R_EAX = to_ptrv(fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptri(int32_t, R_ESP + 16))); } void pFXppp_32(x64emu_t *emu, uintptr_t fcn) { pFXppp_t fn = (pFXppp_t)fcn; R_EAX = to_ptrv(fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16))); } -void iFpplBp__32(x64emu_t *emu, uintptr_t fcn) { iFpplBp__t fn = (iFpplBp__t)fcn; struct_p_t arg_16={0}; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), to_long(from_ptri(long_t, R_ESP + 12)), *(ptr_t*)(from_ptr((R_ESP + 16))) ? &arg_16 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 16)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 16))), &arg_16); } void iFppbp_p_32(x64emu_t *emu, uintptr_t fcn) { iFppbp_p_t fn = (iFppbp_p_t)fcn; struct_p_t arg_12={0}; from_struct_p(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); 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)); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); } void iFBp_pui_32(x64emu_t *emu, uintptr_t fcn) { iFBp_pui_t fn = (iFBp_pui_t)fcn; struct_p_t arg_4={0}; R_EAX = fn(*(ptr_t*)(from_ptr((R_ESP + 4))) ? &arg_4 : NULL, from_ptriv(R_ESP + 8), from_ptri(uint32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16)); if (*(ptr_t*)(from_ptr((R_ESP + 4)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 4))), &arg_4); } void IFpBp_ii_32(x64emu_t *emu, uintptr_t fcn) { IFpBp_ii_t fn = (IFpBp_ii_t)fcn; struct_p_t arg_8={0}; ui64_t r; r.i = fn(from_ptriv(R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, from_ptri(int32_t, R_ESP + 12), from_ptri(int32_t, R_ESP + 16)); R_EAX = r.d[0]; R_EDX = r.d[1]; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) to_struct_p(*(ptr_t*)(from_ptr((R_ESP + 8))), &arg_8); } @@ -1803,6 +1806,7 @@ void iFEpupV_32(x64emu_t *emu, uintptr_t fcn) { iFEpupV_t fn = (iFEpupV_t)fcn; R void iFEpLpp_32(x64emu_t *emu, uintptr_t fcn) { iFEpLpp_t fn = (iFEpLpp_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16)); } void iFEpLpV_32(x64emu_t *emu, uintptr_t fcn) { iFEpLpV_t fn = (iFEpLpV_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12), from_ptrv(R_ESP + 16)); } void iFEppiV_32(x64emu_t *emu, uintptr_t fcn) { iFEppiV_t fn = (iFEppiV_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptrv(R_ESP + 16)); } +void iFEpplp_32(x64emu_t *emu, uintptr_t fcn) { iFEpplp_t fn = (iFEpplp_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), to_long(from_ptri(long_t, R_ESP + 12)), from_ptriv(R_ESP + 16)); } void iFEpppi_32(x64emu_t *emu, uintptr_t fcn) { iFEpppi_t fn = (iFEpppi_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptri(int32_t, R_ESP + 16)); } void iFEpppp_32(x64emu_t *emu, uintptr_t fcn) { iFEpppp_t fn = (iFEpppp_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16)); } void iFEXLpi_32(x64emu_t *emu, uintptr_t fcn) { iFEXLpi_t fn = (iFEXLpi_t)fcn; R_EAX = fn(emu, getDisplay(from_ptriv(R_ESP + 4)), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12), from_ptri(int32_t, R_ESP + 16)); } @@ -1813,7 +1817,6 @@ void iFiiipp_32(x64emu_t *emu, uintptr_t fcn) { iFiiipp_t fn = (iFiiipp_t)fcn; R void iFiLLLL_32(x64emu_t *emu, uintptr_t fcn) { iFiLLLL_t fn = (iFiLLLL_t)fcn; R_EAX = fn(from_ptri(int32_t, 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)), to_ulong(from_ptri(ulong_t, R_ESP + 20))); } void iFipLLi_32(x64emu_t *emu, uintptr_t fcn) { iFipLLi_t fn = (iFipLLi_t)fcn; R_EAX = fn(from_ptri(int32_t, 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)), from_ptri(int32_t, R_ESP + 20)); } void iFuiuup_32(x64emu_t *emu, uintptr_t fcn) { iFuiuup_t fn = (iFuiuup_t)fcn; R_EAX = fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(uint32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptriv(R_ESP + 20)); } -void iFplluu_32(x64emu_t *emu, uintptr_t fcn) { iFplluu_t fn = (iFplluu_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), to_long(from_ptri(long_t, R_ESP + 8)), to_long(from_ptri(long_t, R_ESP + 12)), from_ptri(uint32_t, R_ESP + 16), from_ptri(uint32_t, R_ESP + 20)); } void iFpLuLi_32(x64emu_t *emu, uintptr_t fcn) { iFpLuLi_t fn = (iFpLuLi_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(uint32_t, R_ESP + 12), to_ulong(from_ptri(ulong_t, R_ESP + 16)), from_ptri(int32_t, R_ESP + 20)); } void iFpppip_32(x64emu_t *emu, uintptr_t fcn) { iFpppip_t fn = (iFpppip_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptri(int32_t, R_ESP + 16), from_ptriv(R_ESP + 20)); } void iFpppup_32(x64emu_t *emu, uintptr_t fcn) { iFpppup_t fn = (iFpppup_t)fcn; R_EAX = fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptriv(R_ESP + 20)); } @@ -1911,6 +1914,7 @@ void vFXLiiii_32(x64emu_t *emu, uintptr_t fcn) { vFXLiiii_t fn = (vFXLiiii_t)fcn void iFEuppup_32(x64emu_t *emu, uintptr_t fcn) { iFEuppup_t fn = (iFEuppup_t)fcn; R_EAX = fn(emu, from_ptri(uint32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptriv(R_ESP + 20)); } void iFEuppLp_32(x64emu_t *emu, uintptr_t fcn) { iFEuppLp_t fn = (iFEuppLp_t)fcn; R_EAX = fn(emu, from_ptri(uint32_t, R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), to_ulong(from_ptri(ulong_t, R_ESP + 16)), from_ptriv(R_ESP + 20)); } void iFEpiLpp_32(x64emu_t *emu, uintptr_t fcn) { iFEpiLpp_t fn = (iFEpiLpp_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), to_ulong(from_ptri(ulong_t, R_ESP + 12)), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20)); } +void iFEplluu_32(x64emu_t *emu, uintptr_t fcn) { iFEplluu_t fn = (iFEplluu_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), to_long(from_ptri(long_t, R_ESP + 8)), to_long(from_ptri(long_t, R_ESP + 12)), from_ptri(uint32_t, R_ESP + 16), from_ptri(uint32_t, R_ESP + 20)); } void iFEpppup_32(x64emu_t *emu, uintptr_t fcn) { iFEpppup_t fn = (iFEpppup_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptriv(R_ESP + 20)); } void iFEXLilp_32(x64emu_t *emu, uintptr_t fcn) { iFEXLilp_t fn = (iFEXLilp_t)fcn; R_EAX = fn(emu, getDisplay(from_ptriv(R_ESP + 4)), to_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12), to_long(from_ptri(long_t, R_ESP + 16)), from_ptriv(R_ESP + 20)); } void iFEXpiup_32(x64emu_t *emu, uintptr_t fcn) { iFEXpiup_t fn = (iFEXpiup_t)fcn; R_EAX = fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptriv(R_ESP + 20)); } diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h index 4e2a2610..dc1b4880 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -331,6 +331,7 @@ void vFXpp_32(x64emu_t *emu, uintptr_t fnc); void iFEip_32(x64emu_t *emu, uintptr_t fnc); void iFEup_32(x64emu_t *emu, uintptr_t fnc); void iFEpi_32(x64emu_t *emu, uintptr_t fnc); +void iFEpu_32(x64emu_t *emu, uintptr_t fnc); void iFEpL_32(x64emu_t *emu, uintptr_t fnc); void iFEpp_32(x64emu_t *emu, uintptr_t fnc); void iFEpV_32(x64emu_t *emu, uintptr_t fnc); @@ -360,7 +361,6 @@ void iFfff_32(x64emu_t *emu, uintptr_t fnc); void iFpii_32(x64emu_t *emu, uintptr_t fnc); void iFpiu_32(x64emu_t *emu, uintptr_t fnc); void iFpip_32(x64emu_t *emu, uintptr_t fnc); -void iFpui_32(x64emu_t *emu, uintptr_t fnc); void iFpuC_32(x64emu_t *emu, uintptr_t fnc); void iFpuu_32(x64emu_t *emu, uintptr_t fnc); void iFpuU_32(x64emu_t *emu, uintptr_t fnc); @@ -388,6 +388,7 @@ void IFiIi_32(x64emu_t *emu, uintptr_t fnc); void CFipp_32(x64emu_t *emu, uintptr_t fnc); void CFuUu_32(x64emu_t *emu, uintptr_t fnc); void CFuff_32(x64emu_t *emu, uintptr_t fnc); +void uFEpL_32(x64emu_t *emu, uintptr_t fnc); void uFilp_32(x64emu_t *emu, uintptr_t fnc); void uFipu_32(x64emu_t *emu, uintptr_t fnc); void uFuip_32(x64emu_t *emu, uintptr_t fnc); @@ -546,6 +547,7 @@ void iFEiiN_32(x64emu_t *emu, uintptr_t fnc); void iFEipp_32(x64emu_t *emu, uintptr_t fnc); void iFEipV_32(x64emu_t *emu, uintptr_t fnc); void iFEpip_32(x64emu_t *emu, uintptr_t fnc); +void iFEpui_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 iFEppL_32(x64emu_t *emu, uintptr_t fnc); @@ -615,7 +617,6 @@ void pFXiii_32(x64emu_t *emu, uintptr_t fnc); void pFXLLp_32(x64emu_t *emu, uintptr_t fnc); void pFXppi_32(x64emu_t *emu, uintptr_t fnc); void pFXppp_32(x64emu_t *emu, uintptr_t fnc); -void iFpplBp__32(x64emu_t *emu, uintptr_t fnc); void iFppbp_p_32(x64emu_t *emu, uintptr_t fnc); void iFBp_pui_32(x64emu_t *emu, uintptr_t fnc); void IFpBp_ii_32(x64emu_t *emu, uintptr_t fnc); @@ -727,6 +728,7 @@ void iFEpupV_32(x64emu_t *emu, uintptr_t fnc); void iFEpLpp_32(x64emu_t *emu, uintptr_t fnc); void iFEpLpV_32(x64emu_t *emu, uintptr_t fnc); void iFEppiV_32(x64emu_t *emu, uintptr_t fnc); +void iFEpplp_32(x64emu_t *emu, uintptr_t fnc); void iFEpppi_32(x64emu_t *emu, uintptr_t fnc); void iFEpppp_32(x64emu_t *emu, uintptr_t fnc); void iFEXLpi_32(x64emu_t *emu, uintptr_t fnc); @@ -737,7 +739,6 @@ void iFiiipp_32(x64emu_t *emu, uintptr_t fnc); void iFiLLLL_32(x64emu_t *emu, uintptr_t fnc); void iFipLLi_32(x64emu_t *emu, uintptr_t fnc); void iFuiuup_32(x64emu_t *emu, uintptr_t fnc); -void iFplluu_32(x64emu_t *emu, uintptr_t fnc); void iFpLuLi_32(x64emu_t *emu, uintptr_t fnc); void iFpppip_32(x64emu_t *emu, uintptr_t fnc); void iFpppup_32(x64emu_t *emu, uintptr_t fnc); @@ -835,6 +836,7 @@ void vFXLiiii_32(x64emu_t *emu, uintptr_t fnc); void iFEuppup_32(x64emu_t *emu, uintptr_t fnc); void iFEuppLp_32(x64emu_t *emu, uintptr_t fnc); void iFEpiLpp_32(x64emu_t *emu, uintptr_t fnc); +void iFEplluu_32(x64emu_t *emu, uintptr_t fnc); void iFEpppup_32(x64emu_t *emu, uintptr_t fnc); void iFEXLilp_32(x64emu_t *emu, uintptr_t fnc); void iFEXpiup_32(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped32/wrappedfreetype.c b/src/wrapped32/wrappedfreetype.c index df307770..acafc404 100644 --- a/src/wrapped32/wrappedfreetype.c +++ b/src/wrapped32/wrappedfreetype.c @@ -29,6 +29,8 @@ static const char* freetypeName = typedef void (*vFp_t)(void*); + +// 64bits FreeType structures typedef union FT_StreamDesc_s { long value; @@ -54,16 +56,16 @@ typedef struct FT_StreamRec_s 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; - + 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; @@ -79,21 +81,250 @@ typedef struct FT_ListRec_s void* head; void* tail; } FT_ListRec_t; + +typedef struct FT_Vector_s +{ + long x; + long y; +} FT_Vector_t; + +typedef struct FT_Glyph_Metrics_s +{ + long width; + long height; + long horiBearingX; + long horiBearingY; + long horiAdvance; + long vertBearingX; + long vertBearingY; + long vertAdvance; +} FT_Glyph_Metrics_t; + +typedef struct FT_Outline_s +{ + unsigned short n_contours; + unsigned short n_points; + FT_Vector_t* points; + unsigned char* tags; + unsigned short* contours; + int flags; +} FT_Outline_t; + +typedef struct FT_Bitmap_s +{ + unsigned int rows; + unsigned int width; + int pitch; + unsigned char* buffer; + unsigned short num_grays; + unsigned char pixel_mode; + unsigned char palette_mode; + void* palette; +} FT_Bitmap_t; + +typedef struct FT_GlyphSlotRec_s +{ + void* library; //FT_Library + void* face; //FT_Face + struct FT_GlyphSlotRec_s* next; + uint32_t glyph_index; + FT_Generic_t generic; + FT_Glyph_Metrics_t metrics; + long linearHoriAdvance; + long linearVertAdvance; + FT_Vector_t advance; + int format; + FT_Bitmap_t bitmap; + int bitmap_left; + int bitmap_top; + FT_Outline_t outline; + uint32_t num_subglyphs; + void* subglyphs; //FT_SubGlyph + void* control_data; + long control_len; + long lsb_delta; + long rsb_delta; + void* other; + void* internal; +} FT_GlyphSlotRec_t; + typedef struct FT_FaceRec_s { - signed long num_faces; - signed long face_index; - signed long face_flags; - signed long style_flags; - signed long num_glyphs; - char* family_name; - char* style_name; + signed long num_faces; + signed long face_index; + signed long face_flags; + signed long style_flags; + signed long num_glyphs; + char* family_name; + char* style_name; + int num_fixed_sizes; + void* available_sizes; + int num_charmaps; + void* charmaps; + FT_Generic_t generic; + FT_BBox_t bbox; + uint16_t units_per_EM; + int16_t ascender; + int16_t descender; + int16_t height; + int16_t max_advance_width; + int16_t max_advance_height; + int16_t underline_position; + int16_t underline_thickness; + FT_GlyphSlotRec_t* glyph; + void* size; + void* charmap; + /*@private begin */ + void* driver; + void* memory; + FT_StreamDesc_t* stream; + FT_ListRec_t sizes_list; + FT_Generic_t autohint; /* face-specific auto-hinter data */ + void* extensions; /* unused */ + void* internal; +} FT_FaceRec_t; + +typedef struct FT_MemoryRec_s +{ + void* user; + void* alloc; + void* free; + void* realloc; +} FT_MemoryRec_t; + +// 32bits FreeType structures +typedef union FT_StreamDesc_32_s +{ + long_t value; + ptr_t pointer; //void* +} FT_StreamDesc_32_t; + +typedef struct FT_StreamRec_32_s +{ + ptr_t base; //unsigned char* + ulong_t size; + ulong_t pos; + + FT_StreamDesc_32_t descriptor; + FT_StreamDesc_32_t pathname; + ptr_t read; //void* + ptr_t close; //void* + + ptr_t memory; //void* + ptr_t cursor; //unsigned char* + ptr_t limit; //unsigned char* + +} 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; + long_t xMax, yMax; +} FT_BBox_32_t; +typedef struct FT_Generic_32_s +{ + ptr_t data; //void* + ptr_t finalizer; //vFp_t +} FT_Generic_32_t; +typedef struct FT_ListRec_32_s +{ + ptr_t head; //void* + ptr_t tail; //void* +} FT_ListRec_32_t; + +typedef struct FT_Vector_32_s +{ + long_t x; + long_t y; +} FT_Vector_32_t; + +typedef struct FT_Glyph_Metrics_32_s +{ + long_t width; + long_t height; + long_t horiBearingX; + long_t horiBearingY; + long_t horiAdvance; + long_t vertBearingX; + long_t vertBearingY; + long_t vertAdvance; +} FT_Glyph_Metrics_32_t; + +typedef struct FT_Outline_32_s +{ + unsigned short n_contours; + unsigned short n_points; + ptr_t points; //FT_Vector_32_t* + ptr_t tags; //unsigned char* + ptr_t contours; //unsigned short* + int flags; +} FT_Outline_32_t; + +typedef struct FT_Bitmap_32_s +{ + unsigned int rows; + unsigned int width; + int pitch; + ptr_t buffer; //unsigned char* + unsigned short num_grays; + unsigned char pixel_mode; + unsigned char palette_mode; + ptr_t palette; //void* +} FT_Bitmap_32_t; + +typedef struct FT_GlyphSlotRec_32_s +{ + ptr_t library; //FT_Library + ptr_t face; //FT_Face + ptr_t next; //struct FT_GlyphSlotRec_s* + uint32_t glyph_index; + FT_Generic_32_t generic; //0x10 + FT_Glyph_Metrics_32_t metrics; //0x18 + long_t linearHoriAdvance; //0x38 + long_t linearVertAdvance; + FT_Vector_32_t advance; //0x40 + int format; + FT_Bitmap_32_t bitmap; //0x4c + int bitmap_left; + int bitmap_top; + FT_Outline_32_t outline; + uint32_t num_subglyphs; + ptr_t subglyphs; //FT_SubGlyph + ptr_t control_data; + long_t control_len; + long_t lsb_delta; + long_t rsb_delta; + ptr_t other; + ptr_t internal; +} FT_GlyphSlotRec_32_t; + +typedef struct FT_FaceRec_32_s +{ + long_t num_faces; + long_t face_index; + long_t face_flags; + long_t style_flags; + long_t num_glyphs; + ptr_t family_name; //char* + ptr_t style_name; //char* int num_fixed_sizes; - void* available_sizes; + ptr_t available_sizes; //void* int num_charmaps; - void* charmaps; - FT_Generic_t generic; - FT_BBox_t bbox; + ptr_t charmaps; //void* + FT_Generic_32_t generic; + FT_BBox_32_t bbox; uint16_t units_per_EM; int16_t ascender; int16_t descender; @@ -102,26 +333,243 @@ typedef struct FT_FaceRec_s int16_t max_advance_height; int16_t underline_position; int16_t underline_thickness; - void* glyph; - void* size; - void* charmap; + ptr_t glyph; //FT_GlyphSlotRec_t* + ptr_t size; //void* + ptr_t charmap; //void* /*@private begin */ - void* driver; - void* memory; - FT_StreamDesc_t* stream; - FT_ListRec_t sizes_list; - FT_Generic_t autohint; /* face-specific auto-hinter data */ - void* extensions; /* unused */ - void* internal; -} FT_FaceRec_t; + ptr_t driver; //void* + ptr_t memory; //void* + ptr_t stream; //FT_StreamDesc_t* + FT_ListRec_32_t sizes_list; + FT_Generic_32_t autohint; /* face-specific auto-hinter data */ + ptr_t extensions; /* unused */ //void* + ptr_t internal; //void* +} FT_FaceRec_32_t; -typedef struct FT_MemoryRec_s +typedef struct FT_MemoryRec_32_s { - void* user; - void* alloc; - void* free; - void* realloc; -} FT_MemoryRec_t; + ptr_t user; //void* + ptr_t alloc; //void* + ptr_t free; //void* + ptr_t realloc;//void* +} FT_MemoryRec_32_t; + +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; + + dst->library = to_ptrv(src->library); + dst->face = to_ptrv(src->face); + dst->next = to_ptrv(src->next); + dst->glyph_index = src->glyph_index; + dst->generic.data = to_ptrv(src->generic.data); + dst->generic.finalizer = to_ptrv(src->generic.finalizer); + dst->metrics.width = to_long(src->metrics.width); + dst->metrics.height = to_long(src->metrics.height); + dst->metrics.horiBearingX = to_long(src->metrics.horiBearingX); + dst->metrics.horiBearingY = to_long(src->metrics.horiBearingY); + dst->metrics.horiAdvance = to_long(src->metrics.horiAdvance); + dst->metrics.vertBearingX = to_long(src->metrics.vertBearingX); + dst->metrics.vertBearingY = to_long(src->metrics.vertBearingY); + dst->metrics.vertAdvance = to_long(src->metrics.vertAdvance); + dst->linearHoriAdvance = to_long(src->linearHoriAdvance); + dst->linearVertAdvance = to_long(src->linearVertAdvance); + dst->advance.x = to_long(src->advance.x); + dst->advance.y = to_long(src->advance.y); + dst->format = src->format; + dst->bitmap.rows = src->bitmap.rows; + dst->bitmap.width = src->bitmap.width; + dst->bitmap.pitch = src->bitmap.pitch; + dst->bitmap.buffer = to_ptrv(src->bitmap.buffer); + dst->bitmap.num_grays = src->bitmap.num_grays; + dst->bitmap.pixel_mode = src->bitmap.pixel_mode; + dst->bitmap.palette_mode = src->bitmap.palette_mode; + dst->bitmap.palette = to_ptrv(src->bitmap.palette); + dst->bitmap_left = src->bitmap_left; + dst->bitmap_top = src->bitmap_top; + dst->outline.n_contours = src->outline.n_contours; + for(int i=0; i<src->outline.n_points; ++i) { + ((FT_Vector_32_t*)src->outline.points)[i].x = to_long(src->outline.points[i].x); + ((FT_Vector_32_t*)src->outline.points)[i].y = to_long(src->outline.points[i].y); + } + dst->outline.n_points = src->outline.n_points; + dst->outline.points = to_ptrv(src->outline.points); + dst->outline.tags = to_ptrv(src->outline.tags); + dst->outline.contours = to_ptrv(src->outline.contours); + dst->outline.flags = src->outline.flags; + dst->num_subglyphs = src->num_subglyphs; + dst->subglyphs = to_ptrv(src->subglyphs); + dst->control_data = to_ptrv(src->control_data); + dst->control_len = to_long(src->control_len); + dst->lsb_delta = to_long(src->lsb_delta); + 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) +{ + if(!a) return; + FT_GlyphSlotRec_32_t* src = a; + FT_GlyphSlotRec_t* dst = a; + void* next = from_ptrv(src->next); + + dst->internal = from_ptrv(src->internal); + dst->other = from_ptrv(src->other); + dst->rsb_delta = from_long(src->rsb_delta); + dst->lsb_delta = from_long(src->lsb_delta); + dst->control_len = from_long(src->control_len); + dst->control_data = from_ptrv(src->control_data); + dst->subglyphs = from_ptrv(src->subglyphs); + dst->num_subglyphs = src->num_subglyphs; + dst->outline.flags = src->outline.flags; + dst->outline.contours = from_ptrv(src->outline.contours); + dst->outline.tags = from_ptrv(src->outline.tags); + dst->outline.points = from_ptrv(src->outline.points); + dst->outline.n_points = src->outline.n_points; + for(int i=dst->outline.n_points-1; i>=0; --i) { + dst->outline.points[i].y = from_long(((FT_Vector_32_t*)from_ptrv(src->outline.points))[i].y); + dst->outline.points[i].x = from_long(((FT_Vector_32_t*)from_ptrv(src->outline.points))[i].x); + } + dst->outline.n_contours = src->outline.n_contours; + dst->bitmap_top = src->bitmap_top; + dst->bitmap_left = src->bitmap_left; + dst->bitmap.palette = from_ptrv(src->bitmap.palette); + dst->bitmap.palette_mode = src->bitmap.palette_mode; + dst->bitmap.pixel_mode = src->bitmap.pixel_mode; + dst->bitmap.num_grays = src->bitmap.num_grays; + dst->bitmap.buffer = from_ptrv(src->bitmap.buffer); + dst->bitmap.pitch = src->bitmap.pitch; + dst->bitmap.width = src->bitmap.width; + dst->bitmap.rows = src->bitmap.rows; + dst->format = src->format; + dst->advance.y = from_long(src->advance.y); + dst->advance.x = from_long(src->advance.x); + dst->linearVertAdvance = from_long(src->linearVertAdvance); + dst->linearHoriAdvance = from_long(src->linearHoriAdvance); + dst->metrics.vertAdvance = from_long(src->metrics.vertAdvance); + dst->metrics.vertBearingY = from_long(src->metrics.vertBearingY); + dst->metrics.vertBearingX = from_long(src->metrics.vertBearingX); + dst->metrics.horiAdvance = from_long(src->metrics.horiAdvance); + dst->metrics.horiBearingY = from_long(src->metrics.horiBearingY); + dst->metrics.horiBearingX = from_long(src->metrics.horiBearingX); + dst->metrics.height = from_long(src->metrics.height); + dst->metrics.width = from_long(src->metrics.width); + dst->generic.finalizer = from_ptrv(src->generic.finalizer); + dst->generic.data = from_ptrv(src->generic.data); + dst->glyph_index = src->glyph_index; + dst->next = from_ptrv(src->next); // no shinking of the whole chain? + dst->face = from_ptrv(src->face); + dst->library = from_ptrv(src->library); + + inplace_FT_GlyphSlot_enlarge(next); +} + +// Convertion function +void inplace_FT_FaceRec_shrink(void* a) +{ + if(!a) return; + FT_FaceRec_t* src = a; + FT_FaceRec_32_t* dst = a; + void* glyphslot = src->glyph; + + dst->num_faces = to_long(src->num_faces); + dst->face_index = to_long(src->face_index); + dst->face_flags = to_long(src->face_flags); + dst->style_flags = to_long(src->style_flags); + dst->num_glyphs = to_long(src->num_glyphs); + dst->family_name = to_ptrv(src->family_name); + dst->style_name = to_ptrv(src->style_name); + dst->num_fixed_sizes = src->num_fixed_sizes; + dst->available_sizes = to_ptrv(src->available_sizes); + dst->num_charmaps = src->num_charmaps; + dst->charmaps = to_ptrv(src->charmaps); + dst->generic.data = to_ptrv(src->generic.data); + dst->generic.finalizer = to_ptrv(src->generic.finalizer); + dst->bbox.xMin = to_long(src->bbox.xMin); + dst->bbox.yMin = to_long(src->bbox.yMin); + dst->bbox.xMax = to_long(src->bbox.xMax); + dst->bbox.yMax = to_long(src->bbox.yMax); + dst->units_per_EM = src->units_per_EM; + dst->ascender = src->ascender; + dst->descender = src->descender; + dst->height = src->height; + dst->max_advance_width = src->max_advance_width; + dst->max_advance_height = src->max_advance_height; + dst->underline_position = src->underline_position; + dst->underline_thickness = src->underline_thickness; + dst->glyph = to_ptrv(src->glyph); + dst->size = to_ptrv(src->size); + dst->charmap = to_ptrv(src->charmap); + dst->driver = to_ptrv(src->driver); + dst->memory = to_ptrv(src->memory); + ((FT_StreamDesc_32_t*)src->stream)->value = to_long(src->stream->value); + ((FT_StreamDesc_32_t*)src->stream)->pointer = to_ptrv(src->stream->pointer); + dst->stream = to_ptrv(src->stream); + dst->sizes_list.head = to_ptrv(src->sizes_list.head); + dst->sizes_list.tail = to_ptrv(src->sizes_list.tail); + dst->autohint.data = to_ptrv(src->autohint.data); + dst->autohint.finalizer = to_ptrv(src->autohint.finalizer); + dst->extensions = to_ptrv(src->extensions); + dst->internal = to_ptrv(src->internal); + + inplace_FT_GlyphSlot_shrink(glyphslot); +} + +void inplace_FT_FaceRec_enlarge(void* a) +{ + if(!a) return; + FT_FaceRec_32_t* src = a; + FT_FaceRec_t* dst = a; + void* glyphslot = from_ptrv(src->glyph); + + dst->internal = from_ptrv(src->internal); + dst->extensions = from_ptrv(src->extensions); + dst->autohint.finalizer = from_ptrv(src->autohint.finalizer); + dst->autohint.data = from_ptrv(src->autohint.data); + dst->sizes_list.tail = from_ptrv(src->sizes_list.tail); + dst->sizes_list.head = from_ptrv(src->sizes_list.head); + dst->stream = from_ptrv(src->stream); + dst->stream->pointer = from_ptrv(((FT_StreamDesc_32_t*)dst->stream)->pointer); + dst->stream->value = from_long(((FT_StreamDesc_32_t*)dst->stream)->value); + dst->memory = from_ptrv(src->memory); + dst->driver = from_ptrv(src->driver); + dst->charmap = from_ptrv(src->charmap); + dst->size = from_ptrv(src->size); + dst->glyph = from_ptrv(src->glyph); + dst->underline_thickness = src->underline_thickness; + dst->underline_position = src->underline_position; + dst->max_advance_height = src->max_advance_height; + dst->max_advance_width = src->max_advance_width; + dst->height = src->height; + dst->descender = src->descender; + dst->ascender = src->ascender; + dst->units_per_EM = src->units_per_EM; + dst->bbox.yMax = from_long(src->bbox.yMax); + dst->bbox.xMax = from_long(src->bbox.xMax); + dst->bbox.yMin = from_long(src->bbox.yMin); + dst->bbox.xMin = from_long(src->bbox.xMin); + dst->generic.finalizer = from_ptrv(src->generic.finalizer); + dst->generic.data = from_ptrv(src->generic.data); + dst->charmaps = from_ptrv(src->charmaps); + dst->num_charmaps = src->num_charmaps; + dst->available_sizes = from_ptrv(src->available_sizes); + dst->num_fixed_sizes = src->num_fixed_sizes; + dst->style_name = from_ptrv(src->style_name); + dst->family_name = from_ptrv(src->family_name); + dst->num_glyphs = from_long(src->num_glyphs); + dst->style_flags = from_long(src->style_flags); + dst->face_flags = from_long(src->face_flags); + dst->face_index = from_long(src->face_index); + dst->num_faces = from_long(src->num_faces); + + inplace_FT_GlyphSlot_enlarge(glyphslot); +} #define ADDED_FUNCTIONS() \ @@ -434,7 +882,7 @@ typedef struct my_FT_Outline_Funcs_s signed long delta; } my_FT_Outline_Funcs_t; -//EXPORT int my_FT_Outline_Decompose(x64emu_t* emu, void* outline, my_FT_Outline_Funcs_t* tbl, void* data) +//EXPORT int my32_FT_Outline_Decompose(x64emu_t* emu, void* outline, my_FT_Outline_Funcs_t* tbl, void* data) //{ // my_FT_Outline_Funcs_t f = {0}; // if(tbl) { @@ -448,4 +896,76 @@ typedef struct my_FT_Outline_Funcs_s // return my->FT_Outline_Decompose(outline, tbl?(&f):tbl, data); //} +EXPORT int my32_FT_New_Face(x64emu_t* emu, void* lib, void* name, long index, ptr_t* face) +{ + FT_FaceRec_t* res = NULL; + int ret = my->FT_New_Face(lib, name, index, &res); + if(ret) return ret; + *face = to_ptrv(res); + inplace_FT_FaceRec_shrink(res); + return ret; +} + +EXPORT int my32_FT_Done_Face(x64emu_t* emu, void* face) +{ + inplace_FT_FaceRec_enlarge(face); + return my->FT_Done_Face(face); +} + +EXPORT int my32_FT_Set_Char_Size(x64emu_t* emu, void* face, long char_width, long char_height, uint32_t horz, uint32_t vert) +{ + inplace_FT_FaceRec_enlarge(face); + int ret = my->FT_Set_Char_Size(face, char_width, char_height, horz, vert); + inplace_FT_FaceRec_shrink(face); + return ret; +} + +EXPORT uint32_t my32_FT_Get_Char_Index(x64emu_t* emu, void* face, unsigned long code) +{ + inplace_FT_FaceRec_enlarge(face); + uint32_t ret = my->FT_Get_Char_Index(face, code); + inplace_FT_FaceRec_shrink(face); + return ret; +} + +EXPORT int my32_FT_Load_Glyph(x64emu_t* emu, void* face, uint32_t index, int flags) +{ + inplace_FT_FaceRec_enlarge(face); + int ret = my->FT_Load_Glyph(face, index, flags); + 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; + FT_Outline_t outline_l; + FT_Vector_t vector[n]; + outline_l.n_contours = outline->n_contours; + outline_l.n_points = outline->n_points; + outline_l.points = vector; + FT_Vector_32_t* vec = from_ptrv(outline->points); + for(int i=0; i<n; ++i) { + vector[i].x = from_long(vec[i].x); + vector[i].y = from_long(vec[i].y); + } + outline_l.tags = from_ptrv(outline->tags); + outline_l.contours = from_ptrv(outline->contours); + outline_l.flags = outline->flags; + FT_BBox_t res = {0}; + my->FT_Outline_Get_CBox(&outline_l, &res); + bbox->xMin = to_long(res.xMin); + bbox->yMin = to_long(res.yMin); + bbox->xMax = to_long(res.xMax); + bbox->yMax = to_long(res.yMax); +} + +EXPORT int my32_FT_Render_Glyph(x64emu_t* emu, FT_GlyphSlotRec_32_t* glyph, uint32_t mode) +{ + inplace_FT_GlyphSlot_enlarge(glyph); + int ret = my->FT_Render_Glyph(glyph, mode); + inplace_FT_GlyphSlot_shrink(glyph); + return ret; +} + #include "wrappedlib_init32.h" diff --git a/src/wrapped32/wrappedfreetype_private.h b/src/wrapped32/wrappedfreetype_private.h index baa5457a..0a367df4 100644 --- a/src/wrapped32/wrappedfreetype_private.h +++ b/src/wrapped32/wrappedfreetype_private.h @@ -20,7 +20,7 @@ //GO(FT_ClassicKern_Validate, GO(FT_Cos, lFl) GO(FT_DivFix, lFll) -//GO(FT_Done_Face, iFp) +GOM(FT_Done_Face, iFEp) //GO(FT_Done_FreeType, iFp) //GO(FT_Done_Glyph, vFp) //GO(FT_Done_Library, iFp) @@ -39,7 +39,7 @@ GO(FT_FloorFix, lFl) //GO(FT_Get_Advances, iFpuuip) //GO(FT_Get_BDF_Charset_ID, //GO(FT_Get_BDF_Property, -//GO(FT_Get_Char_Index, uFpL) +GOM(FT_Get_Char_Index, uFEpL) //GO(FT_Get_Charmap_Index, iFp) //GO(FT_Get_Color_Glyph_Layer, iFpupp) //GO(FT_Get_Color_Glyph_Paint, iFpuip) @@ -108,13 +108,13 @@ GO(FT_Init_FreeType, iFBp_) //GO(FT_List_Remove, //GO(FT_List_Up, vFpp) //GO(FT_Load_Char, iFpLi) -GO(FT_Load_Glyph, iFpui) +GOM(FT_Load_Glyph, iFEpui) //GO(FT_Load_Sfnt_Table, iFpLlpp) //GO(FT_Matrix_Invert, iFp) //GO(FT_Matrix_Multiply, vFpp) //GO(FT_MulDiv, lFlll) //GO(FT_MulFix, lFll) -GO(FT_New_Face, iFpplBp_) +GOM(FT_New_Face, iFEpplp) //GOM(FT_New_Library, iFEpp) //GO(FT_New_Memory_Face, iFppllp) //GO(FT_New_Size, iFpp) @@ -130,7 +130,7 @@ GO(FT_New_Face, iFpplBp_) //GO(FT_Outline_EmboldenXY, iFpll) //GO(FT_Outline_Get_BBox, iFpp) //GO(FT_Outline_Get_Bitmap, iFppp) -//GO(FT_Outline_Get_CBox, vFpp) +GOM(FT_Outline_Get_CBox, vFEpp) //GO(FT_Outline_GetInsideBorder, //GO(FT_Outline_Get_Orientation, uFp) //GO(FT_Outline_GetOutsideBorder, uFp) @@ -146,13 +146,13 @@ GO(FT_New_Face, iFpplBp_) //GO(FT_Reference_Face, iFp) //GO(FT_Reference_Library, //GO(FT_Remove_Module, iFpp) -//GO(FT_Render_Glyph, iFpu) +GOM(FT_Render_Glyph, iFEpu) //GO(FT_Request_Size, iFpp) //GO(FT_RoundFix, //GO(FT_Select_Charmap, iFpi) //GO(FT_Select_Size, iFpi) //GO(FT_Set_Charmap, iFpp) -GO(FT_Set_Char_Size, iFplluu) +GOM(FT_Set_Char_Size, iFEplluu) //GO(FT_Set_Debug_Hook, //GO(FT_Set_Default_Properties, vFp) //GO(FT_Set_MM_Blend_Coordinates, |