about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-10-08 19:44:20 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-10-08 19:44:20 +0200
commitc12f8fa2544dbcfb29416f39f784abefef276ccb (patch)
tree0aabd275027832647d282e061ce6827d72beae6e /src
parent7ae36b8667f9ff213c3461a3c7d49978d8d71e4d (diff)
downloadbox64-c12f8fa2544dbcfb29416f39f784abefef276ccb.tar.gz
box64-c12f8fa2544dbcfb29416f39f784abefef276ccb.zip
[BOX32] Fixed some X11 function so wine launch (and added BOX64_X11SYNC to help debug X11 programs)
Diffstat (limited to 'src')
-rw-r--r--src/core.c8
-rw-r--r--src/custommem.c11
-rw-r--r--src/include/debug.h1
-rw-r--r--src/libtools/my_x11_conv.c19
-rw-r--r--src/libtools/my_x11_conv.h3
-rw-r--r--src/mallochook.c58
-rw-r--r--src/wrapped/wrappedlibx11.c1
-rw-r--r--src/wrapped32/generated/functions_list.txt7
-rw-r--r--src/wrapped32/generated/wrappedlibx11types32.h5
-rw-r--r--src/wrapped32/generated/wrapper32.c4
-rw-r--r--src/wrapped32/generated/wrapper32.h2
-rw-r--r--src/wrapped32/wrappedlibx11.c24
-rw-r--r--src/wrapped32/wrappedlibx11_private.h6
13 files changed, 140 insertions, 9 deletions
diff --git a/src/core.c b/src/core.c
index 58acfd30..b95c3e37 100644
--- a/src/core.c
+++ b/src/core.c
@@ -56,6 +56,7 @@ int box64_cefdisablegpu = 0;
 int box64_cefdisablegpucompositor = 0;
 int box64_malloc_hack = 0;
 int box64_dynarec_test = 0;
+int box64_x11sync = 0;
 path_collection_t box64_addlibs = {0};
 int box64_maxcpu = 0;
 int box64_maxcpu_immutable = 0;
@@ -1225,6 +1226,13 @@ void LoadLogEnv()
         if(box64_ignoreint3)
             printf_log(LOG_INFO, "Will silently ignore INT3 in the code\n");
     }
+    p = getenv("BOX64_X11SYNC");
+    if(p) {
+        if(strlen(p)==1) {
+            if(p[0]>='0' && p[0]<='0'+1)
+                box64_x11sync = p[0]-'0';
+        }
+    }
     // grab pagesize
     box64_pagesize = sysconf(_SC_PAGESIZE);
     if(!box64_pagesize)
diff --git a/src/custommem.c b/src/custommem.c
index f7ddf6d9..524e5f25 100644
--- a/src/custommem.c
+++ b/src/custommem.c
@@ -75,7 +75,11 @@ typedef struct blocklist_s {
     void*               first;
 } blocklist_t;
 
+#ifdef BOX32
+#define MMAPSIZE (256*1024)      // allocate 256kb sized blocks
+#else
 #define MMAPSIZE (64*1024)      // allocate 64kb sized blocks
+#endif
 #define DYNMMAPSZ (2*1024*1024) // allocate 2Mb block for dynarec
 
 static int                 n_blocks = 0;       // number of blocks for custom malloc
@@ -400,7 +404,12 @@ blocklist_t* findBlock(uintptr_t addr)
     }
     return NULL;
 }
-
+#ifdef BOX32
+int isCustomAddr(void* p)
+{
+    return findBlock((uintptr_t)p)?1:0;
+}
+#endif
 #ifdef DYNAREC
 #define GET_PROT_WAIT(A, B) \
         uint32_t A;         \
diff --git a/src/include/debug.h b/src/include/debug.h
index 7264261d..a17e76a4 100644
--- a/src/include/debug.h
+++ b/src/include/debug.h
@@ -17,6 +17,7 @@ extern int box64_rdtsc;
 extern int box64_rdtsc_1ghz;
 extern uint8_t box64_rdtsc_shift;
 extern int box64_is32bits;
+extern int box64_x11sync;
 #ifdef DYNAREC
 extern int box64_dynarec_dump;
 extern int box64_dynarec_trace;
diff --git a/src/libtools/my_x11_conv.c b/src/libtools/my_x11_conv.c
index 7a7c1259..d0f961e2 100644
--- a/src/libtools/my_x11_conv.c
+++ b/src/libtools/my_x11_conv.c
@@ -965,3 +965,22 @@ void inplace_XFontStruct_enlarge(void* a)
     for(int i=dst->n_properties-1; i>=0;  --i)
         convert_XFontProp_to_64(dst->properties+i, properties_s+i);
 }
+
+void convert_XSetWindowAttributes_to_64(my_XSetWindowAttributes_t* dst, my_XSetWindowAttributes_32_t* src)
+{
+    dst->background_pixmap = from_ulong(src->background_pixmap);
+    dst->background_pixel = from_ulong(src->background_pixel);
+    dst->border_pixmap = from_ulong(src->border_pixmap);
+    dst->border_pixel = from_ulong(src->border_pixel);
+    dst->bit_gravity = src->bit_gravity;
+    dst->win_gravity = src->win_gravity;
+    dst->backing_store = from_ulong(src->backing_store);
+    dst->backing_planes = from_ulong(src->backing_planes);
+    dst->backing_pixel = src->backing_pixel;
+    dst->save_under = src->save_under;
+    dst->event_mask = from_long(src->event_mask);
+    dst->do_not_propagate_mask = from_long(src->do_not_propagate_mask);
+    dst->override_redirect = src->override_redirect;
+    dst->colormap = from_ulong(src->colormap);
+    dst->cursor = from_ulong(src->cursor);
+}
\ No newline at end of file
diff --git a/src/libtools/my_x11_conv.h b/src/libtools/my_x11_conv.h
index ccd9e497..10b8229b 100644
--- a/src/libtools/my_x11_conv.h
+++ b/src/libtools/my_x11_conv.h
@@ -49,4 +49,7 @@ void inplace_XFontProp_shrink(void* a);
 void inplace_XFontProp_enlarge(void* a);
 void inplace_XFontStruct_shrink(void* a);
 void inplace_XFontStruct_enlarge(void* a);
+
+void convert_XSetWindowAttributes_to_64(my_XSetWindowAttributes_t* dst, my_XSetWindowAttributes_32_t* src);
+
 #endif//MY_X11_CONV
\ No newline at end of file
diff --git a/src/mallochook.c b/src/mallochook.c
index c97a0183..d900d704 100644
--- a/src/mallochook.c
+++ b/src/mallochook.c
@@ -181,13 +181,69 @@ static int ispot(size_t l) {
 SUPER()
 #undef GO2
 #undef GO
-
+int isCustomAddr(void* p);
+#define SPACE32 (void*)0x100000000LL
+void* box32_calloc(size_t n, size_t s)
+{
+    void* ret = box_calloc(n, s);
+    if(ret<SPACE32) return ret;
+    box_free(ret);
+    return customCalloc32(n, s);
+}
+void* box32_malloc(size_t s)
+{
+    void* ret = box_malloc(s);
+    if(ret<SPACE32) return ret;
+    box_free(ret);
+    return customMalloc32(s);
+}
+void* box32_realloc(void* p, size_t s)
+{
+    if(isCustomAddr(p))
+        return customRealloc32(p, s);
+    void* ret = box_realloc(p, s);
+    if(ret<SPACE32) return ret;
+    void* newret = customMalloc32(s);
+    memcpy(newret, ret, s);
+    box_free(ret);
+    return newret;
+}
+void box32_free(void* p)
+{
+    if(isCustomAddr(p))
+        customFree32(p);
+    else
+        box_free(p);
+}
+void* box32_memalign(size_t align, size_t s)
+{
+    void* ret = box_memalign(align, s);
+    if(ret<SPACE32) return ret;
+    box_free(ret);
+    return customMemAligned32(align, s);
+}
+size_t box32_malloc_usable_size(void* p)
+{
+    if(isCustomAddr(p))
+        return customGetUsableSize(p);
+    else
+        return box_malloc_usable_size(p);
+}
+#ifdef BOX32
+#define actual_calloc(A, B)             box64_is32bits?box32_calloc(A, B):box_calloc(A, B)
+#define actual_malloc(A)                box64_is32bits?box32_malloc(A):box_malloc(A)
+#define actual_realloc(A, B)            box64_is32bits?box32_realloc(A, B):box_realloc(A, B)
+#define actual_free(A)                  box64_is32bits?box32_free(A):box_free(A)
+#define actual_memalign(A, B)           box64_is32bits?box32_memalign(A, B):box_memalign(A, B)
+#define actual_malloc_usable_size(A)    box64_is32bits?box32_malloc_usable_size(A):box_malloc_usable_size(A)
+#else
 #define actual_calloc(A, B)             box_calloc(A, B)
 #define actual_malloc(A)                box_malloc(A)
 #define actual_realloc(A, B)            box_realloc(A, B)
 #define actual_free(A)                  box_free(A)
 #define actual_memalign(A, B)           box_memalign(A, B)
 #define actual_malloc_usable_size(A)    box_malloc_usable_size(A)
+#endif
 
 // redefining all libc memory allocation routines
 EXPORT void* malloc(size_t l)
diff --git a/src/wrapped/wrappedlibx11.c b/src/wrapped/wrappedlibx11.c
index 3686265a..ed3ddc46 100644
--- a/src/wrapped/wrappedlibx11.c
+++ b/src/wrapped/wrappedlibx11.c
@@ -1555,6 +1555,7 @@ EXPORT void* my_XOpenDisplay(x64emu_t* emu, void* d)
     if(!ret)
         return ret;
 
+    if(box64_x11sync) my->XSynchronize(ret, 1);
     bridge_t* system = emu->context->system;
 
     #define GO(A, W)\
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt
index 7a0c8a40..3eeee705 100644
--- a/src/wrapped32/generated/functions_list.txt
+++ b/src/wrapped32/generated/functions_list.txt
@@ -863,7 +863,6 @@
 #() LFpLpriiiiiiiiilt_ -> LFpLpB
 #() iFXipBWWWWWWWWWuip_ -> iFXipB
 #() iFXLbLWWWcc_bLWWWcc_ -> iFXLBB
-#() iFXLLbLLLLiiiLLilliLL_ -> iFXLLB
 #() iFpruuipWCCp_buuipWCCp_i -> iFpBBi
 #() iFXpLbiLLLiiiiiiiLLiiLiiiiLic_ -> iFXpLB
 #() pFXLLbiLLLiiiiiiiLLiiLiiiiLic_ -> pFXLLB
@@ -979,6 +978,7 @@
 #() iFEXipp -> iFEXipp
 #() iFEXLip -> iFEXLip
 #() iFEXLlp -> iFEXLlp
+#() iFEXLLp -> iFEXLLp
 #() iFEXLpi -> iFEXLpi
 #() iFEXpLp -> iFEXpLp
 #() iFEXppu -> iFEXppu
@@ -1998,11 +1998,14 @@ wrappedlibx11:
   - XSetIOErrorHandler
 - pFX:
   - XGetModifierMapping
+- XFp:
+  - XOpenDisplay
 - vFXp:
   - XFreeEventData
 - iFpL:
   - XFilterEvent
 - iFXp:
+  - XFreeFont
   - XGetEventData
   - XNextEvent
   - XPeekEvent
@@ -2044,6 +2047,8 @@ wrappedlibx11:
   - XCheckTypedWindowEvent
 - iFXLlp:
   - XCheckWindowEvent
+- iFXLLp:
+  - XChangeWindowAttributes
 - iFXLpi:
   - XQueryColors
   - XSetWMProtocols
diff --git a/src/wrapped32/generated/wrappedlibx11types32.h b/src/wrapped32/generated/wrappedlibx11types32.h
index b5974d1b..5d4f92e3 100644
--- a/src/wrapped32/generated/wrappedlibx11types32.h
+++ b/src/wrapped32/generated/wrappedlibx11types32.h
@@ -16,6 +16,7 @@ typedef int32_t (*iFp_t)(void*);
 typedef int32_t (*iFX_t)(void*);
 typedef void* (*pFp_t)(void*);
 typedef void* (*pFX_t)(void*);
+typedef void* (*XFp_t)(void*);
 typedef void (*vFXp_t)(void*, void*);
 typedef int32_t (*iFpL_t)(void*, uintptr_t);
 typedef int32_t (*iFXp_t)(void*, void*);
@@ -35,6 +36,7 @@ typedef void* (*pFXip_t)(void*, int32_t, void*);
 typedef int32_t (*iFpLlp_t)(void*, uintptr_t, intptr_t, void*);
 typedef int32_t (*iFXLip_t)(void*, uintptr_t, int32_t, void*);
 typedef int32_t (*iFXLlp_t)(void*, uintptr_t, intptr_t, void*);
+typedef int32_t (*iFXLLp_t)(void*, uintptr_t, uintptr_t, void*);
 typedef int32_t (*iFXLpi_t)(void*, uintptr_t, void*, int32_t);
 typedef int32_t (*iFXppp_t)(void*, void*, void*, void*);
 typedef void* (*pFXlpp_t)(void*, intptr_t, void*, void*);
@@ -70,8 +72,10 @@ typedef uintptr_t (*LFXLiiuuuiupLp_t)(void*, uintptr_t, int32_t, int32_t, uint32
 	GO(XSetErrorHandler, pFp_t) \
 	GO(XSetIOErrorHandler, pFp_t) \
 	GO(XGetModifierMapping, pFX_t) \
+	GO(XOpenDisplay, XFp_t) \
 	GO(XFreeEventData, vFXp_t) \
 	GO(XFilterEvent, iFpL_t) \
+	GO(XFreeFont, iFXp_t) \
 	GO(XGetEventData, iFXp_t) \
 	GO(XNextEvent, iFXp_t) \
 	GO(XPeekEvent, iFXp_t) \
@@ -97,6 +101,7 @@ typedef uintptr_t (*LFXLiiuuuiupLp_t)(void*, uintptr_t, int32_t, int32_t, uint32
 	GO(XWindowEvent, iFpLlp_t) \
 	GO(XCheckTypedWindowEvent, iFXLip_t) \
 	GO(XCheckWindowEvent, iFXLlp_t) \
+	GO(XChangeWindowAttributes, iFXLLp_t) \
 	GO(XQueryColors, iFXLpi_t) \
 	GO(XSetWMProtocols, iFXLpi_t) \
 	GO(XCheckIfEvent, iFXppp_t) \
diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c
index 8d79bb7f..0a4dbe75 100644
--- a/src/wrapped32/generated/wrapper32.c
+++ b/src/wrapped32/generated/wrapper32.c
@@ -953,7 +953,6 @@ typedef int32_t (*iFXLbLLLLLLLLLL_L_t)(void*, uintptr_t, struct_LLLLLLLLLL_t*, u
 typedef uintptr_t (*LFpLpriiiiiiiiilt__t)(void*, uintptr_t, void*, struct_iiiiiiiiilt_t*);
 typedef int32_t (*iFXipBWWWWWWWWWuip__t)(void*, int32_t, void*, struct_WWWWWWWWWuip_t*);
 typedef int32_t (*iFXLbLWWWcc_bLWWWcc__t)(void*, uintptr_t, struct_LWWWcc_t*, struct_LWWWcc_t*);
-typedef int32_t (*iFXLLbLLLLiiiLLilliLL__t)(void*, uintptr_t, uintptr_t, struct_LLLLiiiLLilliLL_t*);
 typedef int32_t (*iFpruuipWCCp_buuipWCCp_i_t)(void*, struct_uuipWCCp_t*, struct_uuipWCCp_t*, int32_t);
 typedef int32_t (*iFXpLbiLLLiiiiiiiLLiiLiiiiLic__t)(void*, void*, uintptr_t, struct_iLLLiiiiiiiLLiiLiiiiLic_t*);
 typedef void* (*pFXLLbiLLLiiiiiiiLLiiLiiiiLic__t)(void*, uintptr_t, uintptr_t, struct_iLLLiiiiiiiLLiiLiiiiLic_t*);
@@ -1069,6 +1068,7 @@ typedef int32_t (*iFEpppp_t)(x64emu_t*, void*, void*, void*, void*);
 typedef int32_t (*iFEXipp_t)(x64emu_t*, void*, int32_t, void*, void*);
 typedef int32_t (*iFEXLip_t)(x64emu_t*, void*, uintptr_t, int32_t, void*);
 typedef int32_t (*iFEXLlp_t)(x64emu_t*, void*, uintptr_t, intptr_t, void*);
+typedef int32_t (*iFEXLLp_t)(x64emu_t*, void*, uintptr_t, uintptr_t, void*);
 typedef int32_t (*iFEXLpi_t)(x64emu_t*, void*, uintptr_t, void*, int32_t);
 typedef int32_t (*iFEXpLp_t)(x64emu_t*, void*, void*, uintptr_t, void*);
 typedef int32_t (*iFEXppu_t)(x64emu_t*, void*, void*, void*, uint32_t);
@@ -2436,7 +2436,6 @@ void iFXLbLLLLLLLLLL_L_32(x64emu_t *emu, uintptr_t fcn) { iFXLbLLLLLLLLLL_L_t fn
 void LFpLpriiiiiiiiilt__32(x64emu_t *emu, uintptr_t fcn) { LFpLpriiiiiiiiilt__t fn = (LFpLpriiiiiiiiilt__t)fcn; struct_iiiiiiiiilt_t arg_16={0}; if (*(ptr_t*)(from_ptr((R_ESP + 16)))) from_struct_iiiiiiiiilt(&arg_16, *(ptr_t*)(from_ptr((R_ESP + 16)))); R_EAX = to_ulong(fn(from_ptriv(R_ESP + 4), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12), *(ptr_t*)(from_ptr((R_ESP + 16))) ? &arg_16 : NULL)); }
 void iFXipBWWWWWWWWWuip__32(x64emu_t *emu, uintptr_t fcn) { iFXipBWWWWWWWWWuip__t fn = (iFXipBWWWWWWWWWuip__t)fcn; struct_WWWWWWWWWuip_t arg_16={0}; R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12), *(ptr_t*)(from_ptr((R_ESP + 16))) ? &arg_16 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 16)))) to_struct_WWWWWWWWWuip(*(ptr_t*)(from_ptr((R_ESP + 16))), &arg_16); }
 void iFXLbLWWWcc_bLWWWcc__32(x64emu_t *emu, uintptr_t fcn) { iFXLbLWWWcc_bLWWWcc__t fn = (iFXLbLWWWcc_bLWWWcc__t)fcn; struct_LWWWcc_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_LWWWcc(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); struct_LWWWcc_t arg_16={0}; if (*(ptr_t*)(from_ptr((R_ESP + 16)))) from_struct_LWWWcc(&arg_16, *(ptr_t*)(from_ptr((R_ESP + 16)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL, *(ptr_t*)(from_ptr((R_ESP + 16))) ? &arg_16 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_LWWWcc(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); if (*(ptr_t*)(from_ptr((R_ESP + 16)))) to_struct_LWWWcc(*(ptr_t*)(from_ptr((R_ESP + 16))), &arg_16); }
-void iFXLLbLLLLiiiLLilliLL__32(x64emu_t *emu, uintptr_t fcn) { iFXLLbLLLLiiiLLilliLL__t fn = (iFXLLbLLLLiiiLLilliLL__t)fcn; struct_LLLLiiiLLilliLL_t arg_16={0}; if (*(ptr_t*)(from_ptr((R_ESP + 16)))) from_struct_LLLLiiiLLilliLL(&arg_16, *(ptr_t*)(from_ptr((R_ESP + 16)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ulong(from_ptri(ulong_t, R_ESP + 12)), *(ptr_t*)(from_ptr((R_ESP + 16))) ? &arg_16 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 16)))) to_struct_LLLLiiiLLilliLL(*(ptr_t*)(from_ptr((R_ESP + 16))), &arg_16); }
 void iFpruuipWCCp_buuipWCCp_i_32(x64emu_t *emu, uintptr_t fcn) { iFpruuipWCCp_buuipWCCp_i_t fn = (iFpruuipWCCp_buuipWCCp_i_t)fcn; struct_uuipWCCp_t arg_8={0}; if (*(ptr_t*)(from_ptr((R_ESP + 8)))) from_struct_uuipWCCp(&arg_8, *(ptr_t*)(from_ptr((R_ESP + 8)))); struct_uuipWCCp_t arg_12={0}; if (*(ptr_t*)(from_ptr((R_ESP + 12)))) from_struct_uuipWCCp(&arg_12, *(ptr_t*)(from_ptr((R_ESP + 12)))); R_EAX = fn(from_ptriv(R_ESP + 4), *(ptr_t*)(from_ptr((R_ESP + 8))) ? &arg_8 : NULL, *(ptr_t*)(from_ptr((R_ESP + 12))) ? &arg_12 : NULL, from_ptri(int32_t, R_ESP + 16)); if (*(ptr_t*)(from_ptr((R_ESP + 12)))) to_struct_uuipWCCp(*(ptr_t*)(from_ptr((R_ESP + 12))), &arg_12); }
 void iFXpLbiLLLiiiiiiiLLiiLiiiiLic__32(x64emu_t *emu, uintptr_t fcn) { iFXpLbiLLLiiiiiiiLLiiLiiiiLic__t fn = (iFXpLbiLLLiiiiiiiLLiiLiiiiLic__t)fcn; struct_iLLLiiiiiiiLLiiLiiiiLic_t arg_16={0}; if (*(ptr_t*)(from_ptr((R_ESP + 16)))) from_struct_iLLLiiiiiiiLLiiLiiiiLic(&arg_16, *(ptr_t*)(from_ptr((R_ESP + 16)))); R_EAX = fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ulong(from_ptri(ulong_t, R_ESP + 12)), *(ptr_t*)(from_ptr((R_ESP + 16))) ? &arg_16 : NULL); if (*(ptr_t*)(from_ptr((R_ESP + 16)))) to_struct_iLLLiiiiiiiLLiiLiiiiLic(*(ptr_t*)(from_ptr((R_ESP + 16))), &arg_16); }
 void pFXLLbiLLLiiiiiiiLLiiLiiiiLic__32(x64emu_t *emu, uintptr_t fcn) { pFXLLbiLLLiiiiiiiLLiiLiiiiLic__t fn = (pFXLLbiLLLiiiiiiiLLiiLiiiiLic__t)fcn; struct_iLLLiiiiiiiLLiiLiiiiLic_t arg_16={0}; if (*(ptr_t*)(from_ptr((R_ESP + 16)))) from_struct_iLLLiiiiiiiLLiiLiiiiLic(&arg_16, *(ptr_t*)(from_ptr((R_ESP + 16)))); R_EAX = to_ptrv(fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ulong(from_ptri(ulong_t, R_ESP + 12)), *(ptr_t*)(from_ptr((R_ESP + 16))) ? &arg_16 : NULL)); if (*(ptr_t*)(from_ptr((R_ESP + 16)))) to_struct_iLLLiiiiiiiLLiiLiiiiLic(*(ptr_t*)(from_ptr((R_ESP + 16))), &arg_16); }
@@ -2552,6 +2551,7 @@ void iFEpppp_32(x64emu_t *emu, uintptr_t fcn) { iFEpppp_t fn = (iFEpppp_t)fcn; R
 void iFEXipp_32(x64emu_t *emu, uintptr_t fcn) { iFEXipp_t fn = (iFEXipp_t)fcn; R_EAX = 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 iFEXLip_32(x64emu_t *emu, uintptr_t fcn) { iFEXLip_t fn = (iFEXLip_t)fcn; R_EAX = fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(int32_t, R_ESP + 12), from_ptriv(R_ESP + 16)); }
 void iFEXLlp_32(x64emu_t *emu, uintptr_t fcn) { iFEXLlp_t fn = (iFEXLlp_t)fcn; R_EAX = fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_long(from_ptri(long_t, R_ESP + 12)), from_ptriv(R_ESP + 16)); }
+void iFEXLLp_32(x64emu_t *emu, uintptr_t fcn) { iFEXLLp_t fn = (iFEXLLp_t)fcn; R_EAX = fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ulong(from_ptri(ulong_t, R_ESP + 12)), from_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)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptriv(R_ESP + 12), from_ptri(int32_t, R_ESP + 16)); }
 void iFEXpLp_32(x64emu_t *emu, uintptr_t fcn) { iFEXpLp_t fn = (iFEXpLp_t)fcn; R_EAX = fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ulong(from_ptri(ulong_t, R_ESP + 12)), from_ptriv(R_ESP + 16)); }
 void iFEXppu_32(x64emu_t *emu, uintptr_t fcn) { iFEXppu_t fn = (iFEXppu_t)fcn; R_EAX = fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12), from_ptri(uint32_t, R_ESP + 16)); }
diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h
index 102e3b9f..9412ca8b 100644
--- a/src/wrapped32/generated/wrapper32.h
+++ b/src/wrapped32/generated/wrapper32.h
@@ -904,7 +904,6 @@ void iFXLbLLLLLLLLLL_L_32(x64emu_t *emu, uintptr_t fnc);
 void LFpLpriiiiiiiiilt__32(x64emu_t *emu, uintptr_t fnc);
 void iFXipBWWWWWWWWWuip__32(x64emu_t *emu, uintptr_t fnc);
 void iFXLbLWWWcc_bLWWWcc__32(x64emu_t *emu, uintptr_t fnc);
-void iFXLLbLLLLiiiLLilliLL__32(x64emu_t *emu, uintptr_t fnc);
 void iFpruuipWCCp_buuipWCCp_i_32(x64emu_t *emu, uintptr_t fnc);
 void iFXpLbiLLLiiiiiiiLLiiLiiiiLic__32(x64emu_t *emu, uintptr_t fnc);
 void pFXLLbiLLLiiiiiiiLLiiLiiiiLic__32(x64emu_t *emu, uintptr_t fnc);
@@ -1020,6 +1019,7 @@ void iFEpppp_32(x64emu_t *emu, uintptr_t fnc);
 void iFEXipp_32(x64emu_t *emu, uintptr_t fnc);
 void iFEXLip_32(x64emu_t *emu, uintptr_t fnc);
 void iFEXLlp_32(x64emu_t *emu, uintptr_t fnc);
+void iFEXLLp_32(x64emu_t *emu, uintptr_t fnc);
 void iFEXLpi_32(x64emu_t *emu, uintptr_t fnc);
 void iFEXpLp_32(x64emu_t *emu, uintptr_t fnc);
 void iFEXppu_32(x64emu_t *emu, uintptr_t fnc);
diff --git a/src/wrapped32/wrappedlibx11.c b/src/wrapped32/wrappedlibx11.c
index 818c21bd..7f333e94 100644
--- a/src/wrapped32/wrappedlibx11.c
+++ b/src/wrapped32/wrappedlibx11.c
@@ -1561,6 +1561,13 @@ EXPORT void* my32_XSynchronize(x64emu_t* emu, void* display, int onoff)
     return reverse_XSynchronizeProcFct(my_lib, my->XSynchronize(display, onoff));
 }
 
+EXPORT void* my32_XOpenDisplay(void* name)
+{
+    void* ret = my->XOpenDisplay(name);
+    if(ret && box64_x11sync) my->XSynchronize(ret, 1);
+    return ret;
+}
+
 EXPORT int my32_XCloseDisplay(x64emu_t* emu, void* dpy)
 {
     int ret = my->XCloseDisplay(dpy);
@@ -2027,6 +2034,23 @@ EXPORT int my32_XQueryColors(x64emu_t* emu, void* dpy, XID map, my_XColor_32_t*
     return ret;
 }
 
+EXPORT int my32_XFreeFont(x64emu_t* emu, void* dpy, void* f)
+{
+    inplace_XFontStruct_enlarge(f);
+    return my->XFreeFont(dpy, f);
+}
+
+EXPORT int my32_XChangeWindowAttributes(x64emu_t* emu, void* dpy, XID window, unsigned long mask, my_XSetWindowAttributes_32_t* attrs)
+{
+    my_XSetWindowAttributes_t attrs_l[32];
+    for(int i=0, j=0; i<32; ++i)
+        if(mask&(1<<i)) {
+            convert_XSetWindowAttributes_to_64(attrs_l+j, attrs+j);
+            ++j;
+        }
+    return my->XChangeWindowAttributes(dpy, window, mask, attrs_l);
+}
+
 #define CUSTOM_INIT                 \
     AddAutomaticBridge(lib->w.bridge, vFp_32, *(void**)dlsym(lib->w.lib, "_XLockMutex_fn"), 0, "_XLockMutex_fn"); \
     AddAutomaticBridge(lib->w.bridge, vFp_32, *(void**)dlsym(lib->w.lib, "_XUnlockMutex_fn"), 0, "_XUnlockMutex_fn"); \
diff --git a/src/wrapped32/wrappedlibx11_private.h b/src/wrapped32/wrappedlibx11_private.h
index fc0c7a17..43da3bf4 100644
--- a/src/wrapped32/wrappedlibx11_private.h
+++ b/src/wrapped32/wrappedlibx11_private.h
@@ -48,7 +48,7 @@ GO(XChangeKeyboardMapping, iFXiibL_i)
 GO(XChangePointerControl, iFXiiiii)
 GOM(XChangeProperty, iFEXLLLiipi)
 GO(XChangeSaveSet, iFXLi)
-GO(XChangeWindowAttributes, iFXLLbLLLLiiiLLilliLL_)
+GOM(XChangeWindowAttributes, iFEXLLp)
 GOM(XCheckIfEvent, iFEXppp)
 //GO(XCheckMaskEvent, iFplp)
 GOM(XCheckTypedEvent, iFEXip)
@@ -351,7 +351,7 @@ GO(_XFreeEventCookies, vFX)
 GOM(XFreeEventData, vFEXp)
 //GOM(_XFreeExtData, iFEp)
 GOM(XFreeExtensionList, iFEp)
-GO(XFreeFont, iFXp)
+GOM(XFreeFont, iFEXp)
 //GO(XFreeFontInfo, iFppi)
 //GO(XFreeFontNames, iFbp_)
 //GO(XFreeFontPath, iFbp_)
@@ -935,7 +935,7 @@ GO(XOffsetRegion, iFpii)
 //GO(_XomGetFontDataFromFontSet, 
 //GO(_XomInitConverter, 
 GO(XOMOfOC, pFp)
-GO(XOpenDisplay, XFp)
+GOM(XOpenDisplay, XFp)  //%noE
 GO(XOpenIM, pFXppp)
 //GO(_XOpenLC, 
 GO(XOpenOM, pFXppp)