about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-10-29 15:24:58 +0200
committerptitSeb <sebastien.chev@gmail.com>2022-10-29 15:24:58 +0200
commit73f813279a259a625cd7d5b8c6afa454f97ded6d (patch)
tree91ceb254246374384ce076bdc519a8adb48aa3db /src
parent0063cad60d2135f22b0abb104a5d9928ce2e1706 (diff)
downloadbox64-73f813279a259a625cd7d5b8c6afa454f97ded6d.tar.gz
box64-73f813279a259a625cd7d5b8c6afa454f97ded6d.zip
Fixed FT_Outline_Decompose wrapped function
Diffstat (limited to 'src')
-rwxr-xr-xsrc/main.c2
-rw-r--r--src/wrapped/generated/functions_list.txt2
-rw-r--r--src/wrapped/generated/wrappedfreetypetypes.h2
-rwxr-xr-xsrc/wrapped/wrappedfreetype.c119
-rwxr-xr-xsrc/wrapped/wrappedfreetype_private.h2
5 files changed, 125 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index ac7629f9..3afcdb72 100755
--- a/src/main.c
+++ b/src/main.c
@@ -1258,7 +1258,7 @@ int main(int argc, const char **argv, char **env) {
     // special case for steamwebhelper
     if(strstr(prgname, "steamwebhelper")==prgname) {
         printf_log(LOG_INFO, "steamwebhelper, ignoring for now!\n");
-        exit(0);    // exiting
+        //exit(0);    // exiting
     }
     // special case for streaming_client to use emulated libSDL2
     if(strstr(prgname, "streaming_client")==prgname) {
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index 19d86adb..682b0b98 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -2321,6 +2321,8 @@ wrappedfreebl3:
 wrappedfreetype:
 - iFpp:
   - FT_New_Library
+- iFppp:
+  - FT_Outline_Decompose
 - iFpplp:
   - FT_Open_Face
 - iFpuuLppp:
diff --git a/src/wrapped/generated/wrappedfreetypetypes.h b/src/wrapped/generated/wrappedfreetypetypes.h
index 19c04bf8..755b77d6 100644
--- a/src/wrapped/generated/wrappedfreetypetypes.h
+++ b/src/wrapped/generated/wrappedfreetypetypes.h
@@ -12,11 +12,13 @@
 #endif
 
 typedef int64_t (*iFpp_t)(void*, void*);
+typedef int64_t (*iFppp_t)(void*, void*, void*);
 typedef int64_t (*iFpplp_t)(void*, void*, intptr_t, void*);
 typedef int64_t (*iFpuuLppp_t)(void*, uint64_t, uint64_t, uintptr_t, void*, void*, void*);
 
 #define SUPER() ADDED_FUNCTIONS() \
 	GO(FT_New_Library, iFpp_t) \
+	GO(FT_Outline_Decompose, iFppp_t) \
 	GO(FT_Open_Face, iFpplp_t) \
 	GO(FTC_Manager_New, iFpuuLppp_t)
 
diff --git a/src/wrapped/wrappedfreetype.c b/src/wrapped/wrappedfreetype.c
index a74d3a97..aacad276 100755
--- a/src/wrapped/wrappedfreetype.c
+++ b/src/wrapped/wrappedfreetype.c
@@ -251,6 +251,101 @@ static void* find_FT_Realloc_Fct(void* fct)
     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)RunFunction(my_context, my_FT_Outline_MoveToFunc_fct_##A, 2, 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)RunFunction(my_context, my_FT_Outline_LineToFunc_fct_##A, 2, 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)RunFunction(my_context, my_FT_Outline_ConicToFunc_fct_##A, 3, 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)RunFunction(my_context, my_FT_Outline_CubicToFunc_fct_##A, 4, 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)   \
@@ -323,6 +418,30 @@ 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);
+}
+
 #define CUSTOM_INIT \
     getMy(lib);
 
diff --git a/src/wrapped/wrappedfreetype_private.h b/src/wrapped/wrappedfreetype_private.h
index 3ec21ec4..c7c854e7 100755
--- a/src/wrapped/wrappedfreetype_private.h
+++ b/src/wrapped/wrappedfreetype_private.h
@@ -115,7 +115,7 @@ GO(FT_OpenType_Free, vFpp)
 GO(FT_OpenType_Validate, iFpuppppp)
 GO(FT_Outline_Check, iFp)
 GO(FT_Outline_Copy, iFpp)
-GO(FT_Outline_Decompose, iFppp)
+GOM(FT_Outline_Decompose, iFEppp)
 GO(FT_Outline_Done, iFpp)
 //GO(FT_Outline_Done_Internal, 
 GO(FT_Outline_Embolden, iFpl)