about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-09-24 10:18:10 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-09-24 10:18:10 +0200
commit358e24ace5257852014be96223e2e9f5bf90f89a (patch)
tree47c33a36b50586e40f0880a6cf62e03bea5c35a9
parent7317472b5f62316e5817f9e89ae2ddf99862412d (diff)
downloadbox64-358e24ace5257852014be96223e2e9f5bf90f89a.tar.gz
box64-358e24ace5257852014be96223e2e9f5bf90f89a.zip
[BOX32][WRAPPER] Added 32bits empty libfreetype
-rw-r--r--CMakeLists.txt1
-rw-r--r--src/library_list_32.h1
-rw-r--r--src/wrapped32/generated/functions_list.txt3
-rw-r--r--src/wrapped32/generated/wrappedfreetypedefs32.h8
-rw-r--r--src/wrapped32/generated/wrappedfreetypetypes32.h17
-rw-r--r--src/wrapped32/generated/wrappedfreetypeundefs32.h8
-rw-r--r--src/wrapped32/generated/wrapper32.c4
-rw-r--r--src/wrapped32/generated/wrapper32.h2
-rw-r--r--src/wrapped32/wrappedfreetype.c451
-rw-r--r--src/wrapped32/wrappedfreetype_private.h211
10 files changed, 706 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9dbf554c..e931370b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -788,6 +788,7 @@ if(BOX32)
         "${BOX64_ROOT}/src/wrapped32/wrappedsdl1.c"
         "${BOX64_ROOT}/src/wrapped32/wrappedlibasound.c"
         "${BOX64_ROOT}/src/wrapped32/wrappedopenal.c"
+        "${BOX64_ROOT}/src/wrapped32/wrappedfreetype.c"
         "${BOX64_ROOT}/src/wrapped32/wrappedlibx11.c"
         "${BOX64_ROOT}/src/wrapped32/wrappedlibxfixes.c"
         "${BOX64_ROOT}/src/wrapped32/wrappedlibxrender.c"
diff --git a/src/library_list_32.h b/src/library_list_32.h
index 9e0a036a..8b2cf590 100644
--- a/src/library_list_32.h
+++ b/src/library_list_32.h
@@ -15,6 +15,7 @@ GO("libGLU.so.1", libglu)
 GO("libSDL-1.2.so.0", sdl1)
 GO("libasound.so.2", libasound)
 GO("libasound.so", libasound)
+GO("libfreetype.so.6", freetype)
 GO("libX11.so.6", libx11)
 GO("libXfixes.so.3", libxfixes)
 GO("libXrender.so.1", libxrender)
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt
index 0d4fd9d0..55b7693b 100644
--- a/src/wrapped32/generated/functions_list.txt
+++ b/src/wrapped32/generated/functions_list.txt
@@ -53,6 +53,7 @@
 #() dFp -> dFp
 #() lFi -> lFi
 #() lFu -> lFu
+#() lFl -> lFl
 #() lFp -> lFp
 #() lFS -> lFS
 #() LFv -> LFv
@@ -175,6 +176,7 @@
 #() dFLL -> dFLL
 #() lFES -> lFES
 #() lFui -> lFui
+#() lFll -> lFll
 #() lFpl -> lFpl
 #() LFpL -> LFpL
 #() LFpp -> LFpp
@@ -976,6 +978,7 @@
 #() iFEpvvpV -> iFEppV
 #() iFEpLvvpp -> iFEpLpp
 wrappedcrashhandler:
+wrappedfreetype:
 wrappedldlinux:
 - pFv:
   - ___tls_get_addr
diff --git a/src/wrapped32/generated/wrappedfreetypedefs32.h b/src/wrapped32/generated/wrappedfreetypedefs32.h
new file mode 100644
index 00000000..3aabf867
--- /dev/null
+++ b/src/wrapped32/generated/wrappedfreetypedefs32.h
@@ -0,0 +1,8 @@
+/******************************************************************
+ * File automatically generated by rebuild_wrappers_32.py (v0.0.1.1) *
+ ******************************************************************/
+#ifndef __wrappedfreetypeDEFS32_H_
+#define __wrappedfreetypeDEFS32_H_
+
+
+#endif // __wrappedfreetypeDEFS32_H_
diff --git a/src/wrapped32/generated/wrappedfreetypetypes32.h b/src/wrapped32/generated/wrappedfreetypetypes32.h
new file mode 100644
index 00000000..cd3c56e1
--- /dev/null
+++ b/src/wrapped32/generated/wrappedfreetypetypes32.h
@@ -0,0 +1,17 @@
+/******************************************************************
+ * File automatically generated by rebuild_wrappers_32.py (v0.0.1.1) *
+ ******************************************************************/
+#ifndef __wrappedfreetypeTYPES32_H_
+#define __wrappedfreetypeTYPES32_H_
+
+#ifndef LIBNAME
+#error You should only #include this file inside a wrapped*.c file
+#endif
+#ifndef ADDED_FUNCTIONS
+#define ADDED_FUNCTIONS() 
+#endif
+
+
+#define SUPER() ADDED_FUNCTIONS()
+
+#endif // __wrappedfreetypeTYPES32_H_
diff --git a/src/wrapped32/generated/wrappedfreetypeundefs32.h b/src/wrapped32/generated/wrappedfreetypeundefs32.h
new file mode 100644
index 00000000..f9454101
--- /dev/null
+++ b/src/wrapped32/generated/wrappedfreetypeundefs32.h
@@ -0,0 +1,8 @@
+/******************************************************************
+ * File automatically generated by rebuild_wrappers_32.py (v0.0.1.1) *
+ ******************************************************************/
+#ifndef __wrappedfreetypeUNDEFS32_H_
+#define __wrappedfreetypeUNDEFS32_H_
+
+
+#endif // __wrappedfreetypeUNDEFS32_H_
diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c
index 02987ce5..1c78b534 100644
--- a/src/wrapped32/generated/wrapper32.c
+++ b/src/wrapped32/generated/wrapper32.c
@@ -142,6 +142,7 @@ typedef double (*dFd_t)(double);
 typedef double (*dFp_t)(void*);
 typedef intptr_t (*lFi_t)(int32_t);
 typedef intptr_t (*lFu_t)(uint32_t);
+typedef intptr_t (*lFl_t)(intptr_t);
 typedef intptr_t (*lFp_t)(void*);
 typedef intptr_t (*lFS_t)(void*);
 typedef uintptr_t (*LFv_t)(void);
@@ -264,6 +265,7 @@ typedef double (*dFdp_t)(double, void*);
 typedef double (*dFLL_t)(uintptr_t, uintptr_t);
 typedef intptr_t (*lFES_t)(x64emu_t*, void*);
 typedef intptr_t (*lFui_t)(uint32_t, int32_t);
+typedef intptr_t (*lFll_t)(intptr_t, intptr_t);
 typedef intptr_t (*lFpl_t)(void*, intptr_t);
 typedef uintptr_t (*LFpL_t)(void*, uintptr_t);
 typedef uintptr_t (*LFpp_t)(void*, void*);
@@ -1119,6 +1121,7 @@ void dFd_32(x64emu_t *emu, uintptr_t fcn) { dFd_t fn = (dFd_t)fcn; double db = f
 void dFp_32(x64emu_t *emu, uintptr_t fcn) { dFp_t fn = (dFp_t)fcn; double db = fn(from_ptriv(R_ESP + 4)); fpu_do_push(emu); ST0val = db; }
 void lFi_32(x64emu_t *emu, uintptr_t fcn) { lFi_t fn = (lFi_t)fcn; R_EAX = to_long(fn(from_ptri(int32_t, R_ESP + 4))); }
 void lFu_32(x64emu_t *emu, uintptr_t fcn) { lFu_t fn = (lFu_t)fcn; R_EAX = to_long(fn(from_ptri(uint32_t, R_ESP + 4))); }
+void lFl_32(x64emu_t *emu, uintptr_t fcn) { lFl_t fn = (lFl_t)fcn; R_EAX = to_long(fn(to_long(from_ptri(long_t, R_ESP + 4)))); }
 void lFp_32(x64emu_t *emu, uintptr_t fcn) { lFp_t fn = (lFp_t)fcn; R_EAX = to_long(fn(from_ptriv(R_ESP + 4))); }
 void lFS_32(x64emu_t *emu, uintptr_t fcn) { lFS_t fn = (lFS_t)fcn; R_EAX = to_long(fn(io_convert32(from_ptriv(R_ESP + 4)))); }
 void LFv_32(x64emu_t *emu, uintptr_t fcn) { LFv_t fn = (LFv_t)fcn; R_EAX = to_ulong(fn()); }
@@ -1241,6 +1244,7 @@ void dFdp_32(x64emu_t *emu, uintptr_t fcn) { dFdp_t fn = (dFdp_t)fcn; double db
 void dFLL_32(x64emu_t *emu, uintptr_t fcn) { dFLL_t fn = (dFLL_t)fcn; double db = fn(to_ulong(from_ptri(ulong_t, R_ESP + 4)), to_ulong(from_ptri(ulong_t, R_ESP + 8))); fpu_do_push(emu); ST0val = db; }
 void lFES_32(x64emu_t *emu, uintptr_t fcn) { lFES_t fn = (lFES_t)fcn; R_EAX = to_long(fn(emu, io_convert32(from_ptriv(R_ESP + 4)))); }
 void lFui_32(x64emu_t *emu, uintptr_t fcn) { lFui_t fn = (lFui_t)fcn; R_EAX = to_long(fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8))); }
+void lFll_32(x64emu_t *emu, uintptr_t fcn) { lFll_t fn = (lFll_t)fcn; R_EAX = to_long(fn(to_long(from_ptri(long_t, R_ESP + 4)), to_long(from_ptri(long_t, R_ESP + 8)))); }
 void lFpl_32(x64emu_t *emu, uintptr_t fcn) { lFpl_t fn = (lFpl_t)fcn; R_EAX = to_long(fn(from_ptriv(R_ESP + 4), to_long(from_ptri(long_t, R_ESP + 8)))); }
 void LFpL_32(x64emu_t *emu, uintptr_t fcn) { LFpL_t fn = (LFpL_t)fcn; R_EAX = to_ulong(fn(from_ptriv(R_ESP + 4), to_ulong(from_ptri(ulong_t, R_ESP + 8)))); }
 void LFpp_32(x64emu_t *emu, uintptr_t fcn) { LFpp_t fn = (LFpp_t)fcn; R_EAX = to_ulong(fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8))); }
diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h
index 279fd693..97530d42 100644
--- a/src/wrapped32/generated/wrapper32.h
+++ b/src/wrapped32/generated/wrapper32.h
@@ -94,6 +94,7 @@ void dFd_32(x64emu_t *emu, uintptr_t fnc);
 void dFp_32(x64emu_t *emu, uintptr_t fnc);
 void lFi_32(x64emu_t *emu, uintptr_t fnc);
 void lFu_32(x64emu_t *emu, uintptr_t fnc);
+void lFl_32(x64emu_t *emu, uintptr_t fnc);
 void lFp_32(x64emu_t *emu, uintptr_t fnc);
 void lFS_32(x64emu_t *emu, uintptr_t fnc);
 void LFv_32(x64emu_t *emu, uintptr_t fnc);
@@ -216,6 +217,7 @@ void dFdp_32(x64emu_t *emu, uintptr_t fnc);
 void dFLL_32(x64emu_t *emu, uintptr_t fnc);
 void lFES_32(x64emu_t *emu, uintptr_t fnc);
 void lFui_32(x64emu_t *emu, uintptr_t fnc);
+void lFll_32(x64emu_t *emu, uintptr_t fnc);
 void lFpl_32(x64emu_t *emu, uintptr_t fnc);
 void LFpL_32(x64emu_t *emu, uintptr_t fnc);
 void LFpp_32(x64emu_t *emu, uintptr_t fnc);
diff --git a/src/wrapped32/wrappedfreetype.c b/src/wrapped32/wrappedfreetype.c
new file mode 100644
index 00000000..df307770
--- /dev/null
+++ b/src/wrapped32/wrappedfreetype.c
@@ -0,0 +1,451 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define _GNU_SOURCE         /* See feature_test_macros(7) */
+#include <dlfcn.h>
+
+#include "wrappedlibs.h"
+
+#include "debug.h"
+#include "wrapper32.h"
+#include "bridge.h"
+#include "librarian/library_private.h"
+#include "x64emu.h"
+#include "emu/x64emu_private.h"
+#include "callback.h"
+#include "librarian.h"
+#include "box32context.h"
+#include "emu/x64emu_private.h"
+#include "myalign32.h"
+
+static const char* freetypeName = 
+#ifdef ANDROID
+    "libfreetype.so"
+#else
+    "libfreetype.so.6"
+#endif
+    ;
+#define LIBNAME freetype
+
+typedef void  (*vFp_t)(void*);
+
+typedef union  FT_StreamDesc_s
+{
+    long   value;
+    void*  pointer;
+} FT_StreamDesc_t;
+
+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;
+    signed long     xMax, yMax;
+} FT_BBox_t;
+typedef struct  FT_Generic_s
+{
+    void*           data;
+    vFp_t           finalizer;
+} FT_Generic_t;
+typedef struct  FT_ListRec_s
+{
+  void*             head;
+  void*             tail;
+} FT_ListRec_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;
+    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;
+    void*           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;
+
+#define ADDED_FUNCTIONS()                   \
+
+#include "generated/wrappedfreetypetypes32.h"
+
+#include "wrappercallback32.h"
+
+// utility functions
+#define SUPER() \
+GO(0)   \
+GO(1)   \
+GO(2)   \
+GO(3)   \
+GO(4)
+
+// FT_Generic_Finalizer
+#define GO(A)   \
+static uintptr_t my_FT_Generic_Finalizer_fct_##A = 0;                         \
+static void my_FT_Generic_Finalizer_##A(void* object)                         \
+{                                                                             \
+    RunFunctionFmt(my_FT_Generic_Finalizer_fct_##A, "p", object);         \
+}
+SUPER()
+#undef GO
+static void* find_FT_Generic_Finalizer_Fct(void* fct)
+{
+    if(!fct) return NULL;
+    void* p;
+    if((p = GetNativeFnc((uintptr_t)fct))) return p;
+    #define GO(A) if(my_FT_Generic_Finalizer_fct_##A == (uintptr_t)fct) return my_FT_Generic_Finalizer_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_FT_Generic_Finalizer_fct_##A == 0) {my_FT_Generic_Finalizer_fct_##A = (uintptr_t)fct; return my_FT_Generic_Finalizer_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for libfreetype FT_Generic_Finalizer callback\n");
+    return NULL;
+}
+// FTC_Face_Requester
+#define GO(A)   \
+static uintptr_t my_FTC_Face_Requester_fct_##A = 0;                                                             \
+static int my_FTC_Face_Requester_##A(void* face_id, void* lib, void* req, void* aface)                          \
+{                                                                                                               \
+    int ret = (int)RunFunctionFmt(my_FTC_Face_Requester_fct_##A, "pppp", face_id, lib, req, aface);       \
+    if(aface && *(void**)aface) {                                                                               \
+        FT_FaceRec_t *f = *(FT_FaceRec_t**)aface;                                                               \
+        f->generic.finalizer = find_FT_Generic_Finalizer_Fct(f->generic.finalizer);                             \
+    }                                                                                                           \
+    return ret;                                                                                                 \
+}
+SUPER()
+#undef GO
+static void* find_FTC_Face_Requester_Fct(void* fct)
+{
+    if(!fct) return NULL;
+    void* p;
+    if((p = GetNativeFnc((uintptr_t)fct))) return p;
+    #define GO(A) if(my_FTC_Face_Requester_fct_##A == (uintptr_t)fct) return my_FTC_Face_Requester_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_FTC_Face_Requester_fct_##A == 0) {my_FTC_Face_Requester_fct_##A = (uintptr_t)fct; return my_FTC_Face_Requester_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for libfreetype FTC_Face_Requester callback\n");
+    return NULL;
+}
+// FT_Alloc
+#define GO(A)   \
+static uintptr_t my_FT_Alloc_fct_##A = 0;                                              \
+static void* my_FT_Alloc_##A(void* memory, long size)                                  \
+{                                                                                      \
+    return (void*)RunFunctionFmt(my_FT_Alloc_fct_##A, "pl", memory, size);        \
+}
+SUPER()
+#undef GO
+static void* find_FT_Alloc_Fct(void* fct)
+{
+    if(!fct) return NULL;
+    void* p;
+    if((p = GetNativeFnc((uintptr_t)fct))) return p;
+    #define GO(A) if(my_FT_Alloc_fct_##A == (uintptr_t)fct) return my_FT_Alloc_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_FT_Alloc_fct_##A == 0) {my_FT_Alloc_fct_##A = (uintptr_t)fct; return my_FT_Alloc_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for libfreetype FT_Alloc callback\n");
+    return NULL;
+}
+// FT_Free
+#define GO(A)   \
+static uintptr_t my_FT_Free_fct_##A = 0;                             \
+static void my_FT_Free_##A(void* memory, void* p)                    \
+{                                                                    \
+    RunFunctionFmt(my_FT_Free_fct_##A, "pp", memory, p);      \
+}
+SUPER()
+#undef GO
+static void* find_FT_Free_Fct(void* fct)
+{
+    if(!fct) return NULL;
+    void* p;
+    if((p = GetNativeFnc((uintptr_t)fct))) return p;
+    #define GO(A) if(my_FT_Free_fct_##A == (uintptr_t)fct) return my_FT_Free_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_FT_Free_fct_##A == 0) {my_FT_Free_fct_##A = (uintptr_t)fct; return my_FT_Free_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for libfreetype FT_Free callback\n");
+    return NULL;
+}
+// FT_Realloc
+#define GO(A)   \
+static uintptr_t my_FT_Realloc_fct_##A = 0;                                                        \
+static void* my_FT_Realloc_##A(void* memory, long cur, long size, void* p)                         \
+{                                                                                                  \
+    return (void*)RunFunctionFmt(my_FT_Realloc_fct_##A, "pllp", memory, cur, size, p);        \
+}
+SUPER()
+#undef GO
+static void* find_FT_Realloc_Fct(void* fct)
+{
+    if(!fct) return NULL;
+    void* p;
+    if((p = GetNativeFnc((uintptr_t)fct))) return p;
+    #define GO(A) if(my_FT_Realloc_fct_##A == (uintptr_t)fct) return my_FT_Realloc_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_FT_Realloc_fct_##A == 0) {my_FT_Realloc_fct_##A = (uintptr_t)fct; return my_FT_Realloc_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for libfreetype FT_Realloc callback\n");
+    return NULL;
+}
+// FT_Outline_MoveToFunc
+#define GO(A)   \
+static uintptr_t my_FT_Outline_MoveToFunc_fct_##A = 0;                                        \
+static int my_FT_Outline_MoveToFunc_##A(void* to, void* user)                                 \
+{                                                                                             \
+    return (int)RunFunctionFmt(my_FT_Outline_MoveToFunc_fct_##A, "pp", to, user);         \
+}
+SUPER()
+#undef GO
+static void* find_FT_Outline_MoveToFunc_Fct(void* fct)
+{
+    if(!fct) return NULL;
+    void* p;
+    if((p = GetNativeFnc((uintptr_t)fct))) return p;
+    #define GO(A) if(my_FT_Outline_MoveToFunc_fct_##A == (uintptr_t)fct) return my_FT_Outline_MoveToFunc_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_FT_Outline_MoveToFunc_fct_##A == 0) {my_FT_Outline_MoveToFunc_fct_##A = (uintptr_t)fct; return my_FT_Outline_MoveToFunc_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for libfreetype FT_Outline_MoveToFunc callback\n");
+    return NULL;
+}
+
+// FT_Outline_LineToFunc
+#define GO(A)   \
+static uintptr_t my_FT_Outline_LineToFunc_fct_##A = 0;                                        \
+static int my_FT_Outline_LineToFunc_##A(void* to, void* user)                                 \
+{                                                                                             \
+    return (int)RunFunctionFmt(my_FT_Outline_LineToFunc_fct_##A, "pp", to, user);         \
+}
+SUPER()
+#undef GO
+static void* find_FT_Outline_LineToFunc_Fct(void* fct)
+{
+    if(!fct) return NULL;
+    void* p;
+    if((p = GetNativeFnc((uintptr_t)fct))) return p;
+    #define GO(A) if(my_FT_Outline_LineToFunc_fct_##A == (uintptr_t)fct) return my_FT_Outline_LineToFunc_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_FT_Outline_LineToFunc_fct_##A == 0) {my_FT_Outline_LineToFunc_fct_##A = (uintptr_t)fct; return my_FT_Outline_LineToFunc_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for libfreetype FT_Outline_LineToFunc callback\n");
+    return NULL;
+}
+
+// FT_Outline_ConicToFunc
+#define GO(A)   \
+static uintptr_t my_FT_Outline_ConicToFunc_fct_##A = 0;                                              \
+static int my_FT_Outline_ConicToFunc_##A(void* ctl, void* to, void* user)                            \
+{                                                                                                    \
+    return (int)RunFunctionFmt(my_FT_Outline_ConicToFunc_fct_##A, "ppp", ctl, to, user);      \
+}
+SUPER()
+#undef GO
+static void* find_FT_Outline_ConicToFunc_Fct(void* fct)
+{
+    if(!fct) return NULL;
+    void* p;
+    if((p = GetNativeFnc((uintptr_t)fct))) return p;
+    #define GO(A) if(my_FT_Outline_ConicToFunc_fct_##A == (uintptr_t)fct) return my_FT_Outline_ConicToFunc_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_FT_Outline_ConicToFunc_fct_##A == 0) {my_FT_Outline_ConicToFunc_fct_##A = (uintptr_t)fct; return my_FT_Outline_ConicToFunc_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for libfreetype FT_Outline_ConicToFunc callback\n");
+    return NULL;
+}
+
+// FT_Outline_CubicToFunc
+#define GO(A)   \
+static uintptr_t my_FT_Outline_CubicToFunc_fct_##A = 0;                                                      \
+static int my_FT_Outline_CubicToFunc_##A(void* ctl1, void* ctl2, void* to, void* user)                       \
+{                                                                                                            \
+    return (int)RunFunctionFmt(my_FT_Outline_CubicToFunc_fct_##A, "pppp", ctl1, ctl2, to, user);      \
+}
+SUPER()
+#undef GO
+static void* find_FT_Outline_CubicToFunc_Fct(void* fct)
+{
+    if(!fct) return NULL;
+    void* p;
+    if((p = GetNativeFnc((uintptr_t)fct))) return p;
+    #define GO(A) if(my_FT_Outline_CubicToFunc_fct_##A == (uintptr_t)fct) return my_FT_Outline_CubicToFunc_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_FT_Outline_CubicToFunc_fct_##A == 0) {my_FT_Outline_CubicToFunc_fct_##A = (uintptr_t)fct; return my_FT_Outline_CubicToFunc_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for libfreetype FT_Outline_CubicToFunc callback\n");
+    return NULL;
+}
+
+// structures
+#define GO(A)   \
+static FT_MemoryRec_t my_FT_MemoryRec_struct_##A = {0}; \
+static FT_MemoryRec_t* my_FT_MemoryRec_ref_##A = NULL;
+SUPER()
+#undef GO
+static void wrap_FT_MemoryRec(FT_MemoryRec_t* dst, FT_MemoryRec_t* src) {
+    dst->user = src->user;
+    dst->alloc = find_FT_Alloc_Fct(src->alloc);
+    dst->free = find_FT_Free_Fct(src->free);
+    dst->realloc = find_FT_Realloc_Fct(src->realloc);
+}
+static FT_MemoryRec_t* find_FT_MemoryRec_Struct(FT_MemoryRec_t* s)
+{
+    if(!s)  return NULL;
+    #define GO(A) if(my_FT_MemoryRec_ref_##A == s) return &my_FT_MemoryRec_struct_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(!my_FT_MemoryRec_ref_##A) {wrap_FT_MemoryRec(&my_FT_MemoryRec_struct_##A, s); my_FT_MemoryRec_ref_##A = s; return &my_FT_MemoryRec_struct_##A;}
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for libfreetype Struct FT_MemoryRec wrapping\n");
+    return 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_closefunc = 0;
+//static void my_FT_Stream_CloseFunc(FT_StreamRec_t* stream)
+//{
+//    RunFunctionFmt(my_closefunc, "p", stream)     ;
+//}
+
+//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 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)
+//{
+//    (void)emu;
+//    return my->FTC_Manager_New(l, max_faces, max_sizes, max_bytes, find_FTC_Face_Requester_Fct(req), data, aman);
+//}
+
+//EXPORT int my_FT_New_Library(x64emu_t* emu, FT_MemoryRec_t* memory, void* p)
+//{
+//    return my->FT_New_Library(find_FT_MemoryRec_Struct(memory), p);
+//}
+
+typedef struct  my_FT_Outline_Funcs_s
+{
+    void*       move_to;
+    void*       line_to;
+    void*       conic_to;
+    void*       cubic_to;
+    int         shift;
+    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)
+//{
+//    my_FT_Outline_Funcs_t f = {0};
+//    if(tbl) {
+//        f.move_to = find_FT_Outline_MoveToFunc_Fct(tbl->move_to);
+//        f.line_to = find_FT_Outline_LineToFunc_Fct(tbl->line_to);
+//        f.conic_to = find_FT_Outline_ConicToFunc_Fct(tbl->conic_to);
+//        f.cubic_to = find_FT_Outline_CubicToFunc_Fct(tbl->cubic_to);
+//        f.shift = tbl->shift;
+//        f.delta = tbl->delta;
+//    }
+//    return my->FT_Outline_Decompose(outline, tbl?(&f):tbl, data);
+//}
+
+#include "wrappedlib_init32.h"
diff --git a/src/wrapped32/wrappedfreetype_private.h b/src/wrapped32/wrappedfreetype_private.h
new file mode 100644
index 00000000..9f1c031e
--- /dev/null
+++ b/src/wrapped32/wrappedfreetype_private.h
@@ -0,0 +1,211 @@
+#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
+#error meh!
+#endif
+
+//GO(FT_Activate_Size, iFp)
+//GO(FT_Add_Default_Modules, vFp)
+//GO(FT_Add_Module, 
+//GO(FT_Angle_Diff, lFll)
+//GO(FT_Atan2, lFll)
+//GO(FT_Attach_File, iFpp)
+//GO(FT_Attach_Stream, iFpp)
+//GO(FT_Bitmap_Convert, iFpppi)
+//GO(FT_Bitmap_Copy, iFppp)
+//GO(FT_Bitmap_Done, iFpp)
+//GO(FT_Bitmap_Embolden, iFppll)
+//GO(FT_Bitmap_Init, vFp)
+//GO(FT_Bitmap_New, vFp)
+//GO(FT_CeilFix, 
+//GO(FT_ClassicKern_Free, 
+//GO(FT_ClassicKern_Validate, 
+GO(FT_Cos, lFl)
+GO(FT_DivFix, lFll)
+//GO(FT_Done_Face, iFp)
+//GO(FT_Done_FreeType, iFp)
+//GO(FT_Done_Glyph, vFp)
+//GO(FT_Done_Library, iFp)
+//GO(FT_Done_MM_Var, iFpp)
+//GO(FT_Done_Size, iFp)
+//GO(FT_Face_CheckTrueTypePatents, 
+//GO(FT_Face_GetCharsOfVariant, 
+//GO(FT_Face_GetCharVariantIndex, uFpuu)
+//GO(FT_Face_GetCharVariantIsDefault, 
+//GO(FT_Face_GetVariantSelectors, 
+//GO(FT_Face_GetVariantsOfChar, 
+//GO(FT_Face_Properties, iFpup)
+//GO(FT_Face_SetUnpatentedHinting, 
+GO(FT_FloorFix, lFl)
+//GO(FT_Get_Advance, iFpiup)
+//GO(FT_Get_Advances, iFpuuip)
+//GO(FT_Get_BDF_Charset_ID, 
+//GO(FT_Get_BDF_Property, 
+//GO(FT_Get_Char_Index, uFpL)
+//GO(FT_Get_Charmap_Index, iFp)
+//GO(FT_Get_Color_Glyph_Layer, iFpupp)
+//GO(FT_Get_Color_Glyph_Paint, iFpuip)
+//GO(FT_Get_Color_Glyph_ClipBox, iFpup)
+//GO(FT_Get_Colorline_Stops, iFppp)
+//GO(FT_Get_CID_From_Glyph_Index, 
+//GO(FT_Get_CID_Is_Internally_CID_Keyed, 
+//GO(FT_Get_CID_Registry_Ordering_Supplement, 
+//GO(FT_Get_CMap_Format, 
+//GO(FT_Get_CMap_Language_ID, 
+//GO(FT_Get_First_Char, LFpp)
+//GO(FT_Get_Font_Format, pFp)
+//GO(FT_Get_FSType_Flags, WFp)
+//GO(FT_Get_Gasp, 
+//GO(FT_Get_Glyph, iFpp)
+//GO(FT_Get_Glyph_Name, iFpupu)
+//GO(FT_Get_Kerning, iFpuuup)
+//GO(FT_Get_MM_Blend_Coordinates, 
+//GO(FT_Get_MM_Var, iFpp)
+//GO(FT_Get_Module, pFpp)
+//GO(FT_Get_Multi_Master, 
+//GO(FT_Get_Name_Index, uFpp)
+//GO(FT_Get_Next_Char, LFpLp)
+//GO(FT_Get_Paint, iFppip)    // FT_OpaquePaint is a struct with "pi"
+//GO(FT_Get_Paint_Layers, iFppp)
+//GO(FT_Get_PFR_Advance, 
+//GO(FT_Get_PFR_Kerning, 
+//GO(FT_Get_PFR_Metrics, 
+//GO(FT_Get_Postscript_Name, pFp)
+//GO(FT_Get_PS_Font_Info, iFpp)
+//GO(FT_Get_PS_Font_Private, 
+//GO(FT_Get_PS_Font_Value, 
+//GO(FT_Get_Renderer, pFpu)
+//GO(FT_Get_Sfnt_LangTag, 
+//GO(FT_Get_Sfnt_Name, iFpip)
+//GO(FT_Get_Sfnt_Name_Count, uFp)
+//GO(FT_Get_Sfnt_Table, pFpi)
+//GO(FT_Get_SubGlyph_Info, iFpuppppp)
+//GO(FT_Get_Track_Kerning, iFplip)
+//GO(FT_Get_Transform, vFppp)
+//GO(FT_Get_TrueType_Engine_Type, uFp)
+//GO(FT_Get_Var_Blend_Coordinates, iFpup)
+//GO(FT_Get_Var_Design_Coordinates, 
+//GO(FT_Get_WinFNT_Header, iFpp)  // does FT_WinFNT_HeaderRec_ needs alignment?
+//GO(FT_Get_X11_Font_Format, pFp)
+//GO(FT_Glyph_Copy, iFpp)
+//GO(FT_Glyph_Get_CBox, vFpup)
+//GO(FT_GlyphSlot_Embolden, vFp)
+//GO(FT_GlyphSlot_Oblique, vFp)
+//GO(FT_GlyphSlot_Own_Bitmap, iFp)
+//GO(FT_Glyph_Stroke, iFppC)
+//GO(FT_Glyph_StrokeBorder, iFppCC)
+//GO(FT_Glyph_To_Bitmap, iFpupC)
+//GO(FT_Glyph_Transform, iFppp)
+//GO(FT_Gzip_Uncompress, 
+//GO(FT_Has_PS_Glyph_Names, 
+//GO(FT_Init_FreeType, iFp)
+//GO(FT_Library_SetLcdFilter, iFpu)
+//GO(FT_Library_SetLcdFilterWeights, iFpp)
+//GO(FT_Library_Version, vFpppp)
+//GO(FT_List_Add, 
+//GO(FT_List_Finalize, 
+//GO(FT_List_Find, pFpp)
+//GO(FT_List_Insert, 
+//GO(FT_List_Iterate, 
+//GO(FT_List_Remove, 
+//GO(FT_List_Up, vFpp)
+//GO(FT_Load_Char, iFpLi)
+//GO(FT_Load_Glyph, iFpui)
+//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, iFpplp)
+//GOM(FT_New_Library, iFEpp)
+//GO(FT_New_Memory_Face, iFppllp)
+//GO(FT_New_Size, iFpp)
+//GOM(FT_Open_Face, iFEpplp)
+//GO(FT_OpenType_Free, vFpp)
+//GO(FT_OpenType_Validate, iFpuppppp)
+//GO(FT_Outline_Check, iFp)
+//GO(FT_Outline_Copy, iFpp)
+//GOM(FT_Outline_Decompose, iFEppp)
+//GO(FT_Outline_Done, iFpp)
+//GO(FT_Outline_Done_Internal, 
+//GO(FT_Outline_Embolden, iFpl)
+//GO(FT_Outline_EmboldenXY, iFpll)
+//GO(FT_Outline_Get_BBox, iFpp)
+//GO(FT_Outline_Get_Bitmap, iFppp)
+//GO(FT_Outline_Get_CBox, vFpp)
+//GO(FT_Outline_GetInsideBorder, 
+//GO(FT_Outline_Get_Orientation, uFp)
+//GO(FT_Outline_GetOutsideBorder, uFp)
+//GO(FT_Outline_New, iFpuip)
+//GO(FT_Outline_New_Internal, 
+//GO(FT_Outline_Render, iFppp)
+//GO(FT_Outline_Reverse, vFp)
+//GO(FT_Outline_Transform, vFpp)
+//GO(FT_Outline_Translate, vFpll)
+//GO(FT_Palette_Select, iFpWp)
+//GO(FT_Property_Get, iFpppp)
+//GO(FT_Property_Set, iFpppp)
+//GO(FT_Reference_Face, iFp)
+//GO(FT_Reference_Library, 
+//GO(FT_Remove_Module, iFpp)
+//GO(FT_Render_Glyph, iFpu)
+//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)
+//GO(FT_Set_Debug_Hook, 
+//GO(FT_Set_Default_Properties, vFp)
+//GO(FT_Set_MM_Blend_Coordinates, 
+//GO(FT_Set_MM_Design_Coordinates, iFpup)
+//GO(FT_Set_Pixel_Sizes, iFpuu)
+//GO(FT_Set_Renderer, iFppup)
+//GO(FT_Set_Transform, vFppp)
+//GO(FT_Set_Var_Blend_Coordinates, 
+//GO(FT_Set_Var_Design_Coordinates, iFpup)
+//GO(FT_Sfnt_Table_Info, iFpupp)
+//GO(FT_Sin, lFl)
+//GO(FT_Stream_OpenBzip2, 
+//GO(FT_Stream_OpenGzip, 
+//GO(FT_Stream_OpenLZW, 
+//GO(FT_Stroker_BeginSubPath, iFppC)
+//GO(FT_Stroker_ConicTo, iFppp)
+//GO(FT_Stroker_CubicTo, iFpppp)
+//GO(FT_Stroker_Done, vFp)
+//GO(FT_Stroker_EndSubPath, iFp)
+//GO(FT_Stroker_Export, vFpp)
+//GO(FT_Stroker_ExportBorder, vFpup)
+//GO(FT_Stroker_GetBorderCounts, iFpupp)
+//GO(FT_Stroker_GetCounts, iFppp)
+//GO(FT_Stroker_LineTo, iFpp)
+//GO(FT_Stroker_New, iFpp)
+//GO(FT_Stroker_ParseOutline, iFppC)
+//GO(FT_Stroker_Rewind, vFp)
+//GO(FT_Stroker_Set, vFpluul)
+//GO(FT_Tan, lFl)
+//GO(FT_TrueTypeGX_Free, 
+//GO(FT_TrueTypeGX_Validate, 
+//GO(FT_Vector_From_Polar, vFpll)
+//GO(FT_Vector_Length, lFp)
+//GO(FT_Vector_Polarize, vFppp)
+//GO(FT_Vector_Rotate, vFpl)
+//GO(FT_Vector_Transform, vFpp)
+//GO(FT_Vector_Unit, vFpl)
+
+//GO(FTC_CMapCache_Lookup, uFppiu)
+//GO(FTC_CMapCache_New, iFpp)
+//GO(FTC_ImageCache_Lookup, iFppupp)
+//GO(FTC_ImageCache_LookupScaler, iFppLupp)
+//GO(FTC_ImageCache_New, iFpp)
+//GO(FTC_Manager_Done, vFp)
+//GO(FTC_Manager_LookupFace, iFppp)
+//GO(FTC_Manager_LookupSize, iFppp)
+//GOM(FTC_Manager_New, iFEpuuLppp)
+//GO(FTC_Manager_RemoveFaceID, vFpp)
+//GO(FTC_Manager_Reset, vFp)
+//GO(FTC_Node_Unref, vFpp)
+//GO(FTC_SBitCache_Lookup, iFppupp)
+//GO(FTC_SBitCache_LookupScaler, iFppLupp)
+//GO(FTC_SBitCache_New, iFpp)
+
+//GO(TT_New_Context, 
+//GO(TT_RunIns,