about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-12-04 11:28:43 +0100
committerptitSeb <sebastien.chev@gmail.com>2024-12-04 11:28:43 +0100
commit559040e2906dc6c317940222a70bb837f26cd39c (patch)
tree7cdac34f2e2306abe0d59c61a5ac96199ac29141 /src
parent59ba5b7f0e9784cfa1d7cb9d2a350f3c2f6d4dda (diff)
downloadbox64-559040e2906dc6c317940222a70bb837f26cd39c.tar.gz
box64-559040e2906dc6c317940222a70bb837f26cd39c.zip
[BOX32][WRAPPER] Added a few more X11 32bits wrapped functions
Diffstat (limited to 'src')
-rw-r--r--src/wrapped32/generated/functions_list.txt9
-rw-r--r--src/wrapped32/generated/wrappedlibx11types32.h7
-rw-r--r--src/wrapped32/generated/wrapper32.c4
-rw-r--r--src/wrapped32/generated/wrapper32.h2
-rw-r--r--src/wrapped32/wrappedlibx11.c51
-rw-r--r--src/wrapped32/wrappedlibx11_private.h10
6 files changed, 78 insertions, 5 deletions
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt
index 03e81b01..2823caf8 100644
--- a/src/wrapped32/generated/functions_list.txt
+++ b/src/wrapped32/generated/functions_list.txt
@@ -819,6 +819,7 @@
 #() iEEpLi -> iEEpLi
 #() iFEpLi -> iFEpLi
 #() iEEppi -> iEEppi
+#() iFEppi -> iFEppi
 #() iFEppu -> iFEppu
 #() iEEppL -> iEEppL
 #() iEEppp -> iEEppp
@@ -1170,6 +1171,7 @@
 #() pFEppip -> pFEppip
 #() pFEXipp -> pFEXipp
 #() pFEXlpp -> pFEXlpp
+#() pFEXpip -> pFEXpip
 #() pFEXppi -> pFEXppi
 #() pFuiupp -> pFuiupp
 #() pFpiiuu -> pFpiiuu
@@ -2220,6 +2222,7 @@ wrappedlibx11:
 - iFp:
   - XDestroyImage
   - XFreeExtensionList
+  - XFreeFontNames
   - XFreeModifiermap
   - XInitImage
   - XRefreshKeyboardMapping
@@ -2258,6 +2261,7 @@ wrappedlibx11:
   - XSynchronize
 - pFXL:
   - XGetWMHints
+  - XQueryFont
 - pFXp:
   - XListExtensions
   - XLoadQueryFont
@@ -2265,6 +2269,9 @@ wrappedlibx11:
   - XSetWMNormalHints
 - iFpip:
   - XStringListToTextProperty
+- iFppi:
+  - XFreeFontInfo
+  - XTextWidth16
 - iFXip:
   - XCheckTypedEvent
 - iFXlp:
@@ -2298,6 +2305,8 @@ wrappedlibx11:
   - XCreateColormap
 - pFXlpp:
   - XGetVisualInfo
+- pFXpip:
+  - XListFonts
 - iFXbpLiL_pp:
   - XmbTextPropertyToTextList
 - iFppipp:
diff --git a/src/wrapped32/generated/wrappedlibx11types32.h b/src/wrapped32/generated/wrappedlibx11types32.h
index ae0d36f1..e3bcafe0 100644
--- a/src/wrapped32/generated/wrappedlibx11types32.h
+++ b/src/wrapped32/generated/wrappedlibx11types32.h
@@ -30,6 +30,7 @@ typedef void* (*pFXL_t)(void*, uintptr_t);
 typedef void* (*pFXp_t)(void*, void*);
 typedef void (*vFXLp_t)(void*, uintptr_t, void*);
 typedef int32_t (*iFpip_t)(void*, int32_t, void*);
+typedef int32_t (*iFppi_t)(void*, void*, int32_t);
 typedef int32_t (*iFXip_t)(void*, int32_t, void*);
 typedef int32_t (*iFXlp_t)(void*, intptr_t, void*);
 typedef int32_t (*iFXLp_t)(void*, uintptr_t, void*);
@@ -43,6 +44,7 @@ typedef int32_t (*iFXLpp_t)(void*, uintptr_t, void*, void*);
 typedef int32_t (*iFXppp_t)(void*, void*, void*, void*);
 typedef uintptr_t (*LFXLpi_t)(void*, uintptr_t, void*, int32_t);
 typedef void* (*pFXlpp_t)(void*, intptr_t, void*, void*);
+typedef void* (*pFXpip_t)(void*, void*, int32_t, void*);
 typedef int32_t (*iFXbpLiL_pp_t)(void*, struct_pLiL_t*, void*, void*);
 typedef int32_t (*iFppipp_t)(void*, void*, int32_t, void*, void*);
 typedef int32_t (*iFXLilp_t)(void*, uintptr_t, int32_t, intptr_t, void*);
@@ -70,6 +72,7 @@ typedef uintptr_t (*LFXLiiuuuiupLp_t)(void*, uintptr_t, int32_t, int32_t, uint32
 	GO(XLockDisplay, vFX_t) \
 	GO(XDestroyImage, iFp_t) \
 	GO(XFreeExtensionList, iFp_t) \
+	GO(XFreeFontNames, iFp_t) \
 	GO(XFreeModifiermap, iFp_t) \
 	GO(XInitImage, iFp_t) \
 	GO(XRefreshKeyboardMapping, iFp_t) \
@@ -95,10 +98,13 @@ typedef uintptr_t (*LFXLiiuuuiupLp_t)(void*, uintptr_t, int32_t, int32_t, uint32
 	GO(XSetIMValues, pFpV_t) \
 	GO(XSynchronize, pFXi_t) \
 	GO(XGetWMHints, pFXL_t) \
+	GO(XQueryFont, pFXL_t) \
 	GO(XListExtensions, pFXp_t) \
 	GO(XLoadQueryFont, pFXp_t) \
 	GO(XSetWMNormalHints, vFXLp_t) \
 	GO(XStringListToTextProperty, iFpip_t) \
+	GO(XFreeFontInfo, iFppi_t) \
+	GO(XTextWidth16, iFppi_t) \
 	GO(XCheckTypedEvent, iFXip_t) \
 	GO(XMaskEvent, iFXlp_t) \
 	GO(XGetWindowAttributes, iFXLp_t) \
@@ -119,6 +125,7 @@ typedef uintptr_t (*LFXLiiuuuiupLp_t)(void*, uintptr_t, int32_t, int32_t, uint32
 	GO(XIfEvent, iFXppp_t) \
 	GO(XCreateColormap, LFXLpi_t) \
 	GO(XGetVisualInfo, pFXlpp_t) \
+	GO(XListFonts, pFXpip_t) \
 	GO(XmbTextPropertyToTextList, iFXbpLiL_pp_t) \
 	GO(XLookupString, iFppipp_t) \
 	GO(XSendEvent, iFXLilp_t) \
diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c
index 37c495c6..80bec348 100644
--- a/src/wrapped32/generated/wrapper32.c
+++ b/src/wrapped32/generated/wrapper32.c
@@ -910,6 +910,7 @@ typedef int32_t (*iFEpll_t)(x64emu_t*, void*, intptr_t, intptr_t);
 typedef int32_t (*iEEpLi_t)(x64emu_t*, void*, uintptr_t, int32_t);
 typedef int32_t (*iFEpLi_t)(x64emu_t*, void*, uintptr_t, int32_t);
 typedef int32_t (*iEEppi_t)(x64emu_t*, void*, void*, int32_t);
+typedef int32_t (*iFEppi_t)(x64emu_t*, void*, void*, int32_t);
 typedef int32_t (*iFEppu_t)(x64emu_t*, void*, void*, uint32_t);
 typedef int32_t (*iEEppL_t)(x64emu_t*, void*, void*, uintptr_t);
 typedef int32_t (*iEEppp_t)(x64emu_t*, void*, void*, void*);
@@ -1261,6 +1262,7 @@ typedef uintptr_t (*LFXpppi_t)(void*, void*, void*, void*, int32_t);
 typedef void* (*pFEppip_t)(x64emu_t*, void*, void*, int32_t, void*);
 typedef void* (*pFEXipp_t)(x64emu_t*, void*, int32_t, void*, void*);
 typedef void* (*pFEXlpp_t)(x64emu_t*, void*, intptr_t, void*, void*);
+typedef void* (*pFEXpip_t)(x64emu_t*, void*, void*, int32_t, void*);
 typedef void* (*pFEXppi_t)(x64emu_t*, void*, void*, void*, int32_t);
 typedef void* (*pFuiupp_t)(uint32_t, int32_t, uint32_t, void*, void*);
 typedef void* (*pFpiiuu_t)(void*, int32_t, int32_t, uint32_t, uint32_t);
@@ -2557,6 +2559,7 @@ void iFEpll_32(x64emu_t *emu, uintptr_t fcn) { iFEpll_t fn = (iFEpll_t)fcn; R_EA
 void iEEpLi_32(x64emu_t *emu, uintptr_t fcn) { iEEpLi_t fn = (iEEpLi_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12)); emu->libc_err = errno; }
 void iFEpLi_32(x64emu_t *emu, uintptr_t fcn) { iFEpLi_t fn = (iFEpLi_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12)); }
 void iEEppi_32(x64emu_t *emu, uintptr_t fcn) { iEEppi_t fn = (iEEppi_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12)); emu->libc_err = errno; }
+void iFEppi_32(x64emu_t *emu, uintptr_t fcn) { iFEppi_t fn = (iFEppi_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12)); }
 void iFEppu_32(x64emu_t *emu, uintptr_t fcn) { iFEppu_t fn = (iFEppu_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(uint32_t, R_ESP + 12)); }
 void iEEppL_32(x64emu_t *emu, uintptr_t fcn) { iEEppL_t fn = (iEEppL_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ulong(from_ptri(ulong_t, R_ESP + 12))); emu->libc_err = errno; }
 void iEEppp_32(x64emu_t *emu, uintptr_t fcn) { iEEppp_t fn = (iEEppp_t)fcn; errno = emu->libc_err; R_EAX = fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12)); emu->libc_err = errno; }
@@ -2908,6 +2911,7 @@ void LFXpppi_32(x64emu_t *emu, uintptr_t fcn) { LFXpppi_t fn = (LFXpppi_t)fcn; R
 void pFEppip_32(x64emu_t *emu, uintptr_t fcn) { pFEppip_t fn = (pFEppip_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16))); }
 void pFEXipp_32(x64emu_t *emu, uintptr_t fcn) { pFEXipp_t fn = (pFEXipp_t)fcn; R_EAX = to_ptrv(fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16))); }
 void pFEXlpp_32(x64emu_t *emu, uintptr_t fcn) { pFEXlpp_t fn = (pFEXlpp_t)fcn; R_EAX = to_ptrv(fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_long(from_ptri(long_t, R_ESP + 8)), from_ptriv(R_ESP + 12), from_ptriv(R_ESP + 16))); }
+void pFEXpip_32(x64emu_t *emu, uintptr_t fcn) { pFEXpip_t fn = (pFEXpip_t)fcn; R_EAX = to_ptrv(fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16))); }
 void pFEXppi_32(x64emu_t *emu, uintptr_t fcn) { pFEXppi_t fn = (pFEXppi_t)fcn; R_EAX = to_ptrv(fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptri(int32_t, R_ESP + 16))); }
 void pFuiupp_32(x64emu_t *emu, uintptr_t fcn) { pFuiupp_t fn = (pFuiupp_t)fcn; R_EAX = to_ptrv(fn(from_ptri(uint32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(uint32_t, R_ESP + 12), from_ptriv(R_ESP + 16), from_ptriv(R_ESP + 20))); }
 void pFpiiuu_32(x64emu_t *emu, uintptr_t fcn) { pFpiiuu_t fn = (pFpiiuu_t)fcn; R_EAX = to_ptrv(fn(from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12), from_ptri(uint32_t, R_ESP + 16), from_ptri(uint32_t, R_ESP + 20))); }
diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h
index 40314fd9..6429fae3 100644
--- a/src/wrapped32/generated/wrapper32.h
+++ b/src/wrapped32/generated/wrapper32.h
@@ -860,6 +860,7 @@ void iFEpll_32(x64emu_t *emu, uintptr_t fnc);
 void iEEpLi_32(x64emu_t *emu, uintptr_t fnc);
 void iFEpLi_32(x64emu_t *emu, uintptr_t fnc);
 void iEEppi_32(x64emu_t *emu, uintptr_t fnc);
+void iFEppi_32(x64emu_t *emu, uintptr_t fnc);
 void iFEppu_32(x64emu_t *emu, uintptr_t fnc);
 void iEEppL_32(x64emu_t *emu, uintptr_t fnc);
 void iEEppp_32(x64emu_t *emu, uintptr_t fnc);
@@ -1211,6 +1212,7 @@ void LFXpppi_32(x64emu_t *emu, uintptr_t fnc);
 void pFEppip_32(x64emu_t *emu, uintptr_t fnc);
 void pFEXipp_32(x64emu_t *emu, uintptr_t fnc);
 void pFEXlpp_32(x64emu_t *emu, uintptr_t fnc);
+void pFEXpip_32(x64emu_t *emu, uintptr_t fnc);
 void pFEXppi_32(x64emu_t *emu, uintptr_t fnc);
 void pFuiupp_32(x64emu_t *emu, uintptr_t fnc);
 void pFpiiuu_32(x64emu_t *emu, uintptr_t fnc);
diff --git a/src/wrapped32/wrappedlibx11.c b/src/wrapped32/wrappedlibx11.c
index 436743dc..c4031136 100644
--- a/src/wrapped32/wrappedlibx11.c
+++ b/src/wrapped32/wrappedlibx11.c
@@ -2092,6 +2092,31 @@ EXPORT void my32_XFreeStringList(x64emu_t* emu, ptr_t* list)
     my->XFreeStringList(list);
 }
 
+EXPORT void* my32_XListFonts(x64emu_t* emu, void* dpy, void* pat, int maxnames, int* count)
+{
+    void** ret = my->XListFonts(dpy, pat, maxnames, count);
+    if(ret && *count) {
+        for(int i=0; i<*count; ++i)
+            ((ptr_t*)ret)[i] = to_ptrv(ret[i]);
+    }
+    // put end marker, for expansion
+    if(ret)
+        ((ptr_t*)ret)[*count] = 0;
+    return ret;
+}
+
+EXPORT void my32_XFreeFontNames(x64emu_t* emu, ptr_t* list)
+{
+    // need to find size of list
+    int n = 0;
+    while(list[n]) ++n;
+    // inplace string list expand
+    for(int i=n-1; i>=0; --i)
+        ((void**)list)[i] = from_ptrv(list[i]);
+
+    my->XFreeFontNames(list);
+}
+
 EXPORT int my32_XFreeColors(x64emu_t* emu, void* dpy, XID map, ulong_t* pixels, int npixels, unsigned long planes)
 {
     unsigned long pixels_l[npixels];
@@ -2228,6 +2253,32 @@ EXPORT void* my32_XLoadQueryFont(x64emu_t* emu, void* dpy, void* name)
     return ret;
 }
 
+EXPORT void* my32_XQueryFont(x64emu_t* emu, void* dpy, size_t id)
+{
+    void* ret = my->XQueryFont(dpy, id);
+    inplace_XFontStruct_shrink(ret);
+    return ret;
+}
+
+EXPORT int my32_XFreeFontInfo(x64emu_t* emu, ptr_t* names, void* free_info, int count)
+{
+    inplace_XFontStruct_enlarge(free_info);
+    void** names_l = (void**)names;
+    if(names) {
+        for(int i=count-1; i>=0; --i)
+            ((void**)names)[i] = from_ptrv(names[i]);
+    }
+    return my->XFreeFontInfo(names_l, free_info, count);
+}
+
+EXPORT int my32_XTextWidth16(x64emu_t* emu, void* font, void* string, int count)
+{
+    inplace_XFontStruct_enlarge(font);
+    int ret = my->XTextWidth16(font, string, count);
+    inplace_XFontProp_shrink(font);
+    return ret;
+}
+
 EXPORT void my32_XLockDisplay(x64emu_t* emu, void* dpy)
 {
     my->XLockDisplay(dpy);
diff --git a/src/wrapped32/wrappedlibx11_private.h b/src/wrapped32/wrappedlibx11_private.h
index d94475c5..11bdb891 100644
--- a/src/wrapped32/wrappedlibx11_private.h
+++ b/src/wrapped32/wrappedlibx11_private.h
@@ -352,8 +352,8 @@ GOM(XFreeEventData, vFEXp)
 //GOM(_XFreeExtData, iFEp)
 GOM(XFreeExtensionList, iFEp)
 GOM(XFreeFont, iFEXp)
-//GO(XFreeFontInfo, iFppi)
-//GO(XFreeFontNames, iFbp_)
+GOM(XFreeFontInfo, iFEppi)
+GOM(XFreeFontNames, iFEp)
 //GO(XFreeFontPath, iFbp_)
 GO(XFreeFontSet, vFXp)
 GO(XFreeGC, iFXp)
@@ -864,7 +864,7 @@ DATA(_XlcPublicMethods, 4)
 //GO(_Xlcwctomb, 
 GO(XListDepths, pFXip)
 GOM(XListExtensions, pFEXp)//GOM(XListExtensions, bp_FEXp)
-//GO(XListFonts, bp_FXpip)
+GOM(XListFonts, pFEXpip)
 //GO(XListFontsWithInfo, pFppipp)
 //GO(XListHosts, biip_FXpp)
 //GO(XListInstalledColormaps, bL_FXLp)
@@ -969,7 +969,7 @@ GO(XQueryBestTile, iFXLuupp)
 GO(XQueryColor, iFXLbLWWWcc_)
 GOM(XQueryColors, iFEXLpi)
 GOM(XQueryExtension, iFEXpppp)
-//GOSM(XQueryFont, bpLuuuuuiuibLL_pppii_FEXL)
+GOM(XQueryFont, pFEXL)
 GO(XQueryKeymap, iFXp)
 GO(XQueryPointer, iFXLbL_bL_ppppp)
 GO(XQueryTextExtents, iFXLpipppp)
@@ -1138,7 +1138,7 @@ GOM(XTextExtents, iFEppipppp)
 //GO(_XTextHeight16, iFppi)
 //GO(XTextPropertyToStringList, iFbpLiL_bbp__p)
 //GO(XTextWidth, iFppi)
-//GO(XTextWidth16, iFppi)
+GOM(XTextWidth16, iFEppi)
 //DATAB(_Xthread_self_fn, 4)
 GO(XTranslateCoordinates, iFXLLiippBL_)
 //GO(_XTranslateKey,