about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2022-03-05 17:54:08 +0100
committerptitSeb <sebastien.chev@gmail.com>2022-03-05 17:54:08 +0100
commitec3341e5d606601d084cb415aa4f4cde081b57da (patch)
tree40bbca5be9b208b4921d926363d8b1d0ede5ebeb /src
parenta63e840674222c6980fe683581b2f8b422441f3a (diff)
downloadbox64-ec3341e5d606601d084cb415aa4f4cde081b57da.tar.gz
box64-ec3341e5d606601d084cb415aa4f4cde081b57da.zip
Some work to have steam streaming working (for #247)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/main.c8
-rw-r--r--src/wrapped/generated/functions_list.txt5
-rw-r--r--src/wrapped/generated/wrappedlibx11types.h1
-rw-r--r--src/wrapped/generated/wrapper.c9
-rw-r--r--src/wrapped/generated/wrapper.h4
-rwxr-xr-xsrc/wrapped/wrappedlibx11.c261
-rwxr-xr-xsrc/wrapped/wrappedlibx11_private.h2
-rwxr-xr-xsrc/wrapped/wrappedlibxi_private.h12
8 files changed, 292 insertions, 10 deletions
diff --git a/src/main.c b/src/main.c
index 71b8d3e8..d344a1c9 100755
--- a/src/main.c
+++ b/src/main.c
@@ -1070,11 +1070,17 @@ int main(int argc, const char **argv, const char **env) {
         printf_log(LOG_INFO, "steam-runtime-check-requirements detected, faking All is good!\n");
         exit(0);    // exiting, not testing anything
     }
-    // special case for steam-runtime-check-requirements to fake 64bits suport
+    // special case for steamwebhelper
     if(strstr(prgname, "steamwebhelper")==prgname) {
         printf_log(LOG_INFO, "steamwebhelper, ignoring for now!\n");
         exit(0);    // exiting
     }
+    // special case for streaming_client to use emulated libSDL2
+    if(strstr(prgname, "streaming_client")==prgname) {
+        printf_log(LOG_INFO, "streaming_client detected, using emulated libSDL2!\n");
+        AddPath("libSDL2-2.0.so.0", &my_context->box64_emulated_libs, 0);
+        AddPath("libSDL2_ttf-2.0.so.0", &my_context->box64_emulated_libs, 0);
+    }
     // special case for zoom
     if(strstr(prgname, "zoom")==prgname) {
         printf_log(LOG_INFO, "Zoom detected, trying to use system libturbojpeg if possible\n");
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index 435c44db..d9d8a697 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -1372,6 +1372,7 @@
 #() iFpiiiii
 #() iFpiiiip
 #() iFpiiipp
+#() iFpiipip
 #() iFpiippu
 #() iFpiippp
 #() iFpiuuup
@@ -1584,6 +1585,7 @@
 #() iFpiuiipp
 #() iFpiupiii
 #() iFpiupppp
+#() iFpipipip
 #() iFpippLpp
 #() iFpippppW
 #() iFpippppp
@@ -1898,6 +1900,7 @@
 #() iFEppppppipp
 #() iFEppppppppp
 #() iFiiiiiiiiip
+#() iFpiipiiipip
 #() iFpuupiuiipp
 #() iFpddpippppp
 #() iFppuuiiiiii
@@ -1944,6 +1947,7 @@
 #() iFEpppipppppp
 #() iFEppppiiiiuu
 #() iFiiiiiiiiiip
+#() iFpiippiiipip
 #() iFppippipppip
 #() iFppppiiuuiiL
 #() uFEpLiupppLuV
@@ -3106,6 +3110,7 @@ wrappedlibx11:
   - XDestroyImage
   - XInitImage
 - pFp:
+  - XOpenDisplay
   - XSetErrorHandler
   - XSetIOErrorHandler
 - vFpp:
diff --git a/src/wrapped/generated/wrappedlibx11types.h b/src/wrapped/generated/wrappedlibx11types.h
index 97165666..957fdf17 100644
--- a/src/wrapped/generated/wrappedlibx11types.h
+++ b/src/wrapped/generated/wrappedlibx11types.h
@@ -29,6 +29,7 @@ typedef void* (*pFppiiuuuipii_t)(void*, void*, int64_t, int64_t, uint64_t, uint6
 #define SUPER() ADDED_FUNCTIONS() \
 	GO(XDestroyImage, iFp_t) \
 	GO(XInitImage, iFp_t) \
+	GO(XOpenDisplay, pFp_t) \
 	GO(XSetErrorHandler, pFp_t) \
 	GO(XSetIOErrorHandler, pFp_t) \
 	GO(_XDeqAsyncHandler, vFpp_t) \
diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c
index 0ab204a9..5ac6e503 100644
--- a/src/wrapped/generated/wrapper.c
+++ b/src/wrapped/generated/wrapper.c
@@ -1406,6 +1406,7 @@ typedef int64_t (*iFLppipp_t)(uintptr_t, void*, void*, int64_t, void*, void*);
 typedef int64_t (*iFpiiiii_t)(void*, int64_t, int64_t, int64_t, int64_t, int64_t);
 typedef int64_t (*iFpiiiip_t)(void*, int64_t, int64_t, int64_t, int64_t, void*);
 typedef int64_t (*iFpiiipp_t)(void*, int64_t, int64_t, int64_t, void*, void*);
+typedef int64_t (*iFpiipip_t)(void*, int64_t, int64_t, void*, int64_t, void*);
 typedef int64_t (*iFpiippu_t)(void*, int64_t, int64_t, void*, void*, uint64_t);
 typedef int64_t (*iFpiippp_t)(void*, int64_t, int64_t, void*, void*, void*);
 typedef int64_t (*iFpiuuup_t)(void*, int64_t, uint64_t, uint64_t, uint64_t, void*);
@@ -1618,6 +1619,7 @@ typedef int64_t (*iFpiipppp_t)(void*, int64_t, int64_t, void*, void*, void*, voi
 typedef int64_t (*iFpiuiipp_t)(void*, int64_t, uint64_t, int64_t, int64_t, void*, void*);
 typedef int64_t (*iFpiupiii_t)(void*, int64_t, uint64_t, void*, int64_t, int64_t, int64_t);
 typedef int64_t (*iFpiupppp_t)(void*, int64_t, uint64_t, void*, void*, void*, void*);
+typedef int64_t (*iFpipipip_t)(void*, int64_t, void*, int64_t, void*, int64_t, void*);
 typedef int64_t (*iFpippLpp_t)(void*, int64_t, void*, void*, uintptr_t, void*, void*);
 typedef int64_t (*iFpippppW_t)(void*, int64_t, void*, void*, void*, void*, uint16_t);
 typedef int64_t (*iFpippppp_t)(void*, int64_t, void*, void*, void*, void*, void*);
@@ -1932,6 +1934,7 @@ typedef int64_t (*iFEpupppLppL_t)(x64emu_t*, void*, uint64_t, void*, void*, void
 typedef int64_t (*iFEppppppipp_t)(x64emu_t*, void*, void*, void*, void*, void*, void*, int64_t, void*, void*);
 typedef int64_t (*iFEppppppppp_t)(x64emu_t*, void*, void*, void*, void*, void*, void*, void*, void*, void*);
 typedef int64_t (*iFiiiiiiiiip_t)(int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, void*);
+typedef int64_t (*iFpiipiiipip_t)(void*, int64_t, int64_t, void*, int64_t, int64_t, int64_t, void*, int64_t, void*);
 typedef int64_t (*iFpuupiuiipp_t)(void*, uint64_t, uint64_t, void*, int64_t, uint64_t, int64_t, int64_t, void*, void*);
 typedef int64_t (*iFpddpippppp_t)(void*, double, double, void*, int64_t, void*, void*, void*, void*, void*);
 typedef int64_t (*iFppuuiiiiii_t)(void*, void*, uint64_t, uint64_t, int64_t, int64_t, int64_t, int64_t, int64_t, int64_t);
@@ -1978,6 +1981,7 @@ typedef void (*vFppppppppppp_t)(void*, void*, void*, void*, void*, void*, void*,
 typedef int64_t (*iFEpppipppppp_t)(x64emu_t*, void*, void*, void*, int64_t, void*, void*, void*, void*, void*, void*);
 typedef int64_t (*iFEppppiiiiuu_t)(x64emu_t*, void*, void*, void*, void*, int64_t, int64_t, int64_t, int64_t, uint64_t, uint64_t);
 typedef int64_t (*iFiiiiiiiiiip_t)(int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, int64_t, void*);
+typedef int64_t (*iFpiippiiipip_t)(void*, int64_t, int64_t, void*, void*, int64_t, int64_t, int64_t, void*, int64_t, void*);
 typedef int64_t (*iFppippipppip_t)(void*, void*, int64_t, void*, void*, int64_t, void*, void*, void*, int64_t, void*);
 typedef int64_t (*iFppppiiuuiiL_t)(void*, void*, void*, void*, int64_t, int64_t, uint64_t, uint64_t, int64_t, int64_t, uintptr_t);
 typedef uint64_t (*uFEpLiupppLuV_t)(x64emu_t*, void*, uintptr_t, int64_t, uint64_t, void*, void*, void*, uintptr_t, uint64_t, void*);
@@ -3459,6 +3463,7 @@ void iFLppipp(x64emu_t *emu, uintptr_t fcn) { iFLppipp_t fn = (iFLppipp_t)fcn; R
 void iFpiiiii(x64emu_t *emu, uintptr_t fcn) { iFpiiiii_t fn = (iFpiiiii_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX, (int64_t)R_R8, (int64_t)R_R9); }
 void iFpiiiip(x64emu_t *emu, uintptr_t fcn) { iFpiiiip_t fn = (iFpiiiip_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX, (int64_t)R_R8, (void*)R_R9); }
 void iFpiiipp(x64emu_t *emu, uintptr_t fcn) { iFpiiipp_t fn = (iFpiiipp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX, (void*)R_R8, (void*)R_R9); }
+void iFpiipip(x64emu_t *emu, uintptr_t fcn) { iFpiipip_t fn = (iFpiipip_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, (void*)R_RCX, (int64_t)R_R8, (void*)R_R9); }
 void iFpiippu(x64emu_t *emu, uintptr_t fcn) { iFpiippu_t fn = (iFpiippu_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, (void*)R_RCX, (void*)R_R8, (uint64_t)R_R9); }
 void iFpiippp(x64emu_t *emu, uintptr_t fcn) { iFpiippp_t fn = (iFpiippp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9); }
 void iFpiuuup(x64emu_t *emu, uintptr_t fcn) { iFpiuuup_t fn = (iFpiuuup_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (uint64_t)R_RDX, (uint64_t)R_RCX, (uint64_t)R_R8, (void*)R_R9); }
@@ -3671,6 +3676,7 @@ void iFpiipppp(x64emu_t *emu, uintptr_t fcn) { iFpiipppp_t fn = (iFpiipppp_t)fcn
 void iFpiuiipp(x64emu_t *emu, uintptr_t fcn) { iFpiuiipp_t fn = (iFpiuiipp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (uint64_t)R_RDX, (int64_t)R_RCX, (int64_t)R_R8, (void*)R_R9, *(void**)(R_RSP + 8)); }
 void iFpiupiii(x64emu_t *emu, uintptr_t fcn) { iFpiupiii_t fn = (iFpiupiii_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (uint64_t)R_RDX, (void*)R_RCX, (int64_t)R_R8, (int64_t)R_R9, *(int64_t*)(R_RSP + 8)); }
 void iFpiupppp(x64emu_t *emu, uintptr_t fcn) { iFpiupppp_t fn = (iFpiupppp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (uint64_t)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8)); }
+void iFpipipip(x64emu_t *emu, uintptr_t fcn) { iFpipipip_t fn = (iFpipipip_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (int64_t)R_RCX, (void*)R_R8, (int64_t)R_R9, *(void**)(R_RSP + 8)); }
 void iFpippLpp(x64emu_t *emu, uintptr_t fcn) { iFpippLpp_t fn = (iFpippLpp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (uintptr_t)R_R8, (void*)R_R9, *(void**)(R_RSP + 8)); }
 void iFpippppW(x64emu_t *emu, uintptr_t fcn) { iFpippppW_t fn = (iFpippppW_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(uint16_t*)(R_RSP + 8)); }
 void iFpippppp(x64emu_t *emu, uintptr_t fcn) { iFpippppp_t fn = (iFpippppp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8)); }
@@ -3985,6 +3991,7 @@ void iFEpupppLppL(x64emu_t *emu, uintptr_t fcn) { iFEpupppLppL_t fn = (iFEpupppL
 void iFEppppppipp(x64emu_t *emu, uintptr_t fcn) { iFEppppppipp_t fn = (iFEppppppipp_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(int64_t*)(R_RSP + 8), *(void**)(R_RSP + 16), *(void**)(R_RSP + 24)); }
 void iFEppppppppp(x64emu_t *emu, uintptr_t fcn) { iFEppppppppp_t fn = (iFEppppppppp_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8), *(void**)(R_RSP + 16), *(void**)(R_RSP + 24)); }
 void iFiiiiiiiiip(x64emu_t *emu, uintptr_t fcn) { iFiiiiiiiiip_t fn = (iFiiiiiiiiip_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX, (int64_t)R_R8, (int64_t)R_R9, *(int64_t*)(R_RSP + 8), *(int64_t*)(R_RSP + 16), *(int64_t*)(R_RSP + 24), *(void**)(R_RSP + 32)); }
+void iFpiipiiipip(x64emu_t *emu, uintptr_t fcn) { iFpiipiiipip_t fn = (iFpiipiiipip_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, (void*)R_RCX, (int64_t)R_R8, (int64_t)R_R9, *(int64_t*)(R_RSP + 8), *(void**)(R_RSP + 16), *(int64_t*)(R_RSP + 24), *(void**)(R_RSP + 32)); }
 void iFpuupiuiipp(x64emu_t *emu, uintptr_t fcn) { iFpuupiuiipp_t fn = (iFpuupiuiipp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (uint64_t)R_RSI, (uint64_t)R_RDX, (void*)R_RCX, (int64_t)R_R8, (uint64_t)R_R9, *(int64_t*)(R_RSP + 8), *(int64_t*)(R_RSP + 16), *(void**)(R_RSP + 24), *(void**)(R_RSP + 32)); }
 void iFpddpippppp(x64emu_t *emu, uintptr_t fcn) { iFpddpippppp_t fn = (iFpddpippppp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, emu->xmm[0].d[0], emu->xmm[1].d[0], (void*)R_RSI, (int64_t)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8), *(void**)(R_RSP + 16)); }
 void iFppuuiiiiii(x64emu_t *emu, uintptr_t fcn) { iFppuuiiiiii_t fn = (iFppuuiiiiii_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (uint64_t)R_RDX, (uint64_t)R_RCX, (int64_t)R_R8, (int64_t)R_R9, *(int64_t*)(R_RSP + 8), *(int64_t*)(R_RSP + 16), *(int64_t*)(R_RSP + 24), *(int64_t*)(R_RSP + 32)); }
@@ -4031,6 +4038,7 @@ void vFppppppppppp(x64emu_t *emu, uintptr_t fcn) { vFppppppppppp_t fn = (vFppppp
 void iFEpppipppppp(x64emu_t *emu, uintptr_t fcn) { iFEpppipppppp_t fn = (iFEpppipppppp_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (int64_t)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8), *(void**)(R_RSP + 16), *(void**)(R_RSP + 24), *(void**)(R_RSP + 32)); }
 void iFEppppiiiiuu(x64emu_t *emu, uintptr_t fcn) { iFEppppiiiiuu_t fn = (iFEppppiiiiuu_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (int64_t)R_R8, (int64_t)R_R9, *(int64_t*)(R_RSP + 8), *(int64_t*)(R_RSP + 16), *(uint64_t*)(R_RSP + 24), *(uint64_t*)(R_RSP + 32)); }
 void iFiiiiiiiiiip(x64emu_t *emu, uintptr_t fcn) { iFiiiiiiiiiip_t fn = (iFiiiiiiiiiip_t)fcn; R_RAX=(int64_t)fn((int64_t)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX, (int64_t)R_R8, (int64_t)R_R9, *(int64_t*)(R_RSP + 8), *(int64_t*)(R_RSP + 16), *(int64_t*)(R_RSP + 24), *(int64_t*)(R_RSP + 32), *(void**)(R_RSP + 40)); }
+void iFpiippiiipip(x64emu_t *emu, uintptr_t fcn) { iFpiippiiipip_t fn = (iFpiippiiipip_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, (void*)R_RCX, (void*)R_R8, (int64_t)R_R9, *(int64_t*)(R_RSP + 8), *(int64_t*)(R_RSP + 16), *(void**)(R_RSP + 24), *(int64_t*)(R_RSP + 32), *(void**)(R_RSP + 40)); }
 void iFppippipppip(x64emu_t *emu, uintptr_t fcn) { iFppippipppip_t fn = (iFppippipppip_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (int64_t)R_RDX, (void*)R_RCX, (void*)R_R8, (int64_t)R_R9, *(void**)(R_RSP + 8), *(void**)(R_RSP + 16), *(void**)(R_RSP + 24), *(int64_t*)(R_RSP + 32), *(void**)(R_RSP + 40)); }
 void iFppppiiuuiiL(x64emu_t *emu, uintptr_t fcn) { iFppppiiuuiiL_t fn = (iFppppiiuuiiL_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (int64_t)R_R8, (int64_t)R_R9, *(uint64_t*)(R_RSP + 8), *(uint64_t*)(R_RSP + 16), *(int64_t*)(R_RSP + 24), *(int64_t*)(R_RSP + 32), *(uintptr_t*)(R_RSP + 40)); }
 void uFEpLiupppLuV(x64emu_t *emu, uintptr_t fcn) { uFEpLiupppLuV_t fn = (uFEpLiupppLuV_t)fcn; R_RAX=(uint64_t)fn(emu, (void*)R_RDI, (uintptr_t)R_RSI, (int64_t)R_RDX, (uint64_t)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8), *(uintptr_t*)(R_RSP + 16), *(uint64_t*)(R_RSP + 24), (void*)(R_RSP + 32)); }
@@ -5315,6 +5323,7 @@ int isSimpleWrapper(wrapper_t fun) {
 	if (fun == &iFpiiiii) return 1;
 	if (fun == &iFpiiiip) return 1;
 	if (fun == &iFpiiipp) return 1;
+	if (fun == &iFpiipip) return 1;
 	if (fun == &iFpiippu) return 1;
 	if (fun == &iFpiippp) return 1;
 	if (fun == &iFpiuuup) return 1;
diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h
index 2ee93023..5ec7c7ac 100644
--- a/src/wrapped/generated/wrapper.h
+++ b/src/wrapped/generated/wrapper.h
@@ -1405,6 +1405,7 @@ void iFLppipp(x64emu_t *emu, uintptr_t fnc);
 void iFpiiiii(x64emu_t *emu, uintptr_t fnc);
 void iFpiiiip(x64emu_t *emu, uintptr_t fnc);
 void iFpiiipp(x64emu_t *emu, uintptr_t fnc);
+void iFpiipip(x64emu_t *emu, uintptr_t fnc);
 void iFpiippu(x64emu_t *emu, uintptr_t fnc);
 void iFpiippp(x64emu_t *emu, uintptr_t fnc);
 void iFpiuuup(x64emu_t *emu, uintptr_t fnc);
@@ -1617,6 +1618,7 @@ void iFpiipppp(x64emu_t *emu, uintptr_t fnc);
 void iFpiuiipp(x64emu_t *emu, uintptr_t fnc);
 void iFpiupiii(x64emu_t *emu, uintptr_t fnc);
 void iFpiupppp(x64emu_t *emu, uintptr_t fnc);
+void iFpipipip(x64emu_t *emu, uintptr_t fnc);
 void iFpippLpp(x64emu_t *emu, uintptr_t fnc);
 void iFpippppW(x64emu_t *emu, uintptr_t fnc);
 void iFpippppp(x64emu_t *emu, uintptr_t fnc);
@@ -1931,6 +1933,7 @@ void iFEpupppLppL(x64emu_t *emu, uintptr_t fnc);
 void iFEppppppipp(x64emu_t *emu, uintptr_t fnc);
 void iFEppppppppp(x64emu_t *emu, uintptr_t fnc);
 void iFiiiiiiiiip(x64emu_t *emu, uintptr_t fnc);
+void iFpiipiiipip(x64emu_t *emu, uintptr_t fnc);
 void iFpuupiuiipp(x64emu_t *emu, uintptr_t fnc);
 void iFpddpippppp(x64emu_t *emu, uintptr_t fnc);
 void iFppuuiiiiii(x64emu_t *emu, uintptr_t fnc);
@@ -1977,6 +1980,7 @@ void vFppppppppppp(x64emu_t *emu, uintptr_t fnc);
 void iFEpppipppppp(x64emu_t *emu, uintptr_t fnc);
 void iFEppppiiiiuu(x64emu_t *emu, uintptr_t fnc);
 void iFiiiiiiiiiip(x64emu_t *emu, uintptr_t fnc);
+void iFpiippiiipip(x64emu_t *emu, uintptr_t fnc);
 void iFppippipppip(x64emu_t *emu, uintptr_t fnc);
 void iFppppiiuuiiL(x64emu_t *emu, uintptr_t fnc);
 void uFEpLiupppLuV(x64emu_t *emu, uintptr_t fnc);
diff --git a/src/wrapped/wrappedlibx11.c b/src/wrapped/wrappedlibx11.c
index 6f2fc1ee..6f9a87b1 100755
--- a/src/wrapped/wrappedlibx11.c
+++ b/src/wrapped/wrappedlibx11.c
@@ -79,14 +79,17 @@ typedef struct _XImage {
     ximage_t f;
 } XImage;
 
+typedef void (*vFp_t)(void*);
 typedef uint32_t (*uFv_t)(void);
 typedef int32_t (*iFpl_t)(void*, intptr_t);
 typedef uintptr_t (*LFpii_t)(void*, int32_t, int32_t);
 typedef int32_t (*iFpiiL_t)(void*, int32_t, int32_t, uintptr_t);
 typedef void* (*pFpiiuu_t)(void*, int32_t, int32_t, uint32_t, uint32_t);
 
-#define ADDED_FUNCTIONS() \
-    GO(XInitThreads, uFv_t)
+#define ADDED_FUNCTIONS()       \
+    GO(XInitThreads, uFv_t)     \
+    GO(XLockDisplay, vFp_t)     \
+    GO(XUnlockDisplay, vFp_t)
 
 #include "generated/wrappedlibx11types.h"
 
@@ -462,6 +465,50 @@ static void* reverse_XSynchronizeProcFct(library_t* lib, void* fct)
     return (void*)AddBridge(lib->priv.w.bridge, iFppp, fct, 0, NULL);
 }
 
+// XLockDisplay
+#define GO(A)   \
+static uintptr_t my_XLockDisplay_fct_##A = 0;                   \
+static void my_XLockDisplay_##A(void* dpy)                      \
+{                                                               \
+    RunFunction(my_context, my_XLockDisplay_fct_##A, 1, dpy);   \
+}
+SUPER()
+#undef GO
+static void* findXLockDisplayFct(void* fct)
+{
+    if(!fct) return fct;
+    if(GetNativeFnc((uintptr_t)fct))  return GetNativeFnc((uintptr_t)fct);
+    #define GO(A) if(my_XLockDisplay_fct_##A == (uintptr_t)fct) return my_XLockDisplay_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_XLockDisplay_fct_##A == 0) {my_XLockDisplay_fct_##A = (uintptr_t)fct; return my_XLockDisplay_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for libX11 XLockDisplay callback\n");
+    return NULL;
+}
+// XUnlockDisplay
+#define GO(A)   \
+static uintptr_t my_XUnlockDisplay_fct_##A = 0;                 \
+static void my_XUnlockDisplay_##A(void* dpy)                    \
+{                                                               \
+    RunFunction(my_context, my_XUnlockDisplay_fct_##A, 1, dpy); \
+}
+SUPER()
+#undef GO
+static void* findXUnlockDisplayFct(void* fct)
+{
+    if(!fct) return fct;
+    if(GetNativeFnc((uintptr_t)fct))  return GetNativeFnc((uintptr_t)fct);
+    #define GO(A) if(my_XUnlockDisplay_fct_##A == (uintptr_t)fct) return my_XUnlockDisplay_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_XUnlockDisplay_fct_##A == 0) {my_XUnlockDisplay_fct_##A = (uintptr_t)fct; return my_XUnlockDisplay_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for libX11 XUnlockDisplay callback\n");
+    return NULL;
+}
 #undef SUPER
 
 void* my_XCreateImage(x64emu_t* emu, void* disp, void* vis, uint32_t depth, int32_t fmt, int32_t off
@@ -798,6 +845,216 @@ EXPORT void* my_XSynchronize(x64emu_t* emu, void* display, int onoff)
     return reverse_XSynchronizeProcFct(lib, my->XSynchronize(display, onoff));
 }
 
+typedef unsigned long XID;
+struct my_XFreeFuncs {
+    void* atoms;
+    void* modifiermap;
+    void* key_bindings;
+    void* context_db;
+    void* defaultCCCs;
+    void* clientCmaps;
+    void* intensityMaps;
+    void* im_filters;
+    void* xkb;
+};
+
+struct my_XExten {
+        struct my_XExten *next;
+        void* codes;    // XExtCodes
+        void* create_GC;    // CreateGCType
+        void* copy_GC;  // CopyGCType
+        void* flush_GC; // FlushGCType
+        void* free_GC;  // FreeGCType
+        void* create_Font;  // CreateFontType
+        void* free_Font;    // FreeFontType
+        void* close_display;    // CloseDisplayType
+        void* error;    // ErrorType
+        void* error_string; // ErrorStringType
+        char *name;
+        void* error_values; // PrintErrorType
+        void* before_flush; // BeforeFlushType
+        struct my_XExten *next_flush;
+};
+
+struct my_XInternalAsync {
+    struct my_XInternalAsync *next;
+    int (*handler)(void*, void*, char*, int, void*);
+    void* data;
+};
+
+struct my_XLockPtrs {
+    void (*lock_display)(void* dpy);
+    void (*unlock_display)(void *dpy);
+};
+
+struct my_XConnectionInfo {
+    int fd;
+    void* read_callback;    // _XInternalConnectionProc
+    void* call_data;
+    void* *watch_data;
+    struct my_XConnectionInfo *next;
+};
+
+struct my_XConnWatchInfo {
+    void* fn;   // XConnectionWatchProc
+    void* client_data;
+    struct _XConnWatchInfo *next;
+};
+
+typedef struct my_XDisplay_s
+{
+        void *ext_data;
+        struct my_XFreeFuncs *free_funcs;
+        int fd;
+        int conn_checker;
+        int proto_major_version;
+        int proto_minor_version;
+        char *vendor;
+        XID resource_base;
+        XID resource_mask;
+        XID resource_id;
+        int resource_shift;
+        XID (*resource_alloc)(void*);
+        int byte_order;
+        int bitmap_unit;
+        int bitmap_pad;
+        int bitmap_bit_order;
+        int nformats;
+        void *pixmap_format;
+        int vnumber;
+        int release;
+        void *head, *tail;
+        int qlen;
+        unsigned long last_request_read;
+        unsigned long request;
+        char *last_req;
+        char *buffer;
+        char *bufptr;
+        char *bufmax;
+        unsigned max_request_size;
+        void* *db;
+        int (*synchandler)(void*);
+        char *display_name;
+        int default_screen;
+        int nscreens;
+        void *screens;
+        unsigned long motion_buffer;
+        volatile unsigned long flags;
+        int min_keycode;
+        int max_keycode;
+        void *keysyms;
+        void *modifiermap;
+        int keysyms_per_keycode;
+        char *xdefaults;
+        char *scratch_buffer;
+        unsigned long scratch_length;
+        int ext_number;
+        struct my_XExten *ext_procs;
+        int (*event_vec[128])(void *, void *, void *);
+        int (*wire_vec[128])(void *, void *, void *);
+        XID lock_meaning;
+        void* lock;
+        struct my_XInternalAsync *async_handlers;
+        unsigned long bigreq_size;
+        struct my_XLockPtrs *lock_fns;
+        void (*idlist_alloc)(void *, void *, int);
+        void* key_bindings;
+        XID cursor_font;
+        void* *atoms;
+        unsigned int mode_switch;
+        unsigned int num_lock;
+        void* context_db;
+        int (**error_vec)(void*, void*, void*);
+        struct {
+           void* defaultCCCs;
+           void* clientCmaps;
+           void* perVisualIntensityMaps;
+        } cms;
+        void* im_filters;
+        void* qfree;
+        unsigned long next_event_serial_num;
+        struct my_XExten *flushes;
+        struct my_XConnectionInfo *im_fd_info;
+        int im_fd_length;
+        struct my_XConnWatchInfo *conn_watchers;
+        int watcher_count;
+        void* filedes;
+        int (*savedsynchandler)(void *);
+        XID resource_max;
+        int xcmisc_opcode;
+        void* *xkb_info;
+        void* *trans_conn;
+        void* *xcb;
+        unsigned int next_cookie;
+        int (*generic_event_vec[128])(void*, void*, void*);
+        int (*generic_event_copy_vec[128])(void*, void*, void*);
+        void *cookiejar;
+        unsigned long last_request_read_upper32bit; // 64bits only
+        unsigned long request_upper32bit;   // 64bits only
+        void* error_threads;
+        void* exit_handler;
+        void* exit_handler_data;
+} my_XDisplay_t;
+
+EXPORT void* my_XOpenDisplay(x64emu_t* emu, void* d)
+{
+    library_t* lib = emu->context->x11lib;
+    x11_my_t *my = (x11_my_t *)lib->priv.w.p2;
+    void* ret = my->XOpenDisplay(d);
+    // Added automatic bridge because of thos macro from Xlibint.h
+    //#define LockDisplay(d)       if ((d)->lock_fns) (*(d)->lock_fns->lock_display)(d)
+    //#define UnlockDisplay(d)     if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)(d)
+
+    my_XDisplay_t* dpy = (my_XDisplay_t*)ret;
+    if(!ret)
+        return ret;
+
+    bridge_t* system = emu->context->system;
+
+    #define GO(A, W)\
+    if(dpy->A)      \
+        if(!CheckBridged(system, dpy->A)) \
+            AddAutomaticBridge(emu, system, W, dpy->A, 0); \
+
+    #define GO2(A, B, W) \
+    if(dpy->A && dpy->A->B)  \
+        if(!CheckBridged(system, dpy->A->B)) \
+            AddAutomaticBridge(emu, system, W, dpy->A->B, 0); \
+
+
+    GO2(free_funcs, atoms, vFp)
+    GO2(free_funcs, modifiermap, iFp)
+    GO2(free_funcs, key_bindings, vFp)
+    GO2(free_funcs, context_db, vFp)
+    GO2(free_funcs, defaultCCCs, vFp)
+    GO2(free_funcs, clientCmaps, vFp)
+    GO2(free_funcs, intensityMaps, vFp)
+    GO2(free_funcs, im_filters, vFp)
+    GO2(free_funcs, xkb, vFp)
+    GO(resource_alloc, LFp)
+    GO(synchandler, iFp)
+    //TODO: ext_procs?
+    //TODO: event_vec?
+    //TODO: wire_vec?
+    //TODO: async_handlers?
+    GO2(lock_fns, lock_display, vFp);
+    GO2(lock_fns, unlock_display, vFp);
+    GO(idlist_alloc, vFppi)
+    //TODO: error_vec?
+    //TODO: flushes
+    //TODO: im_fd_info?
+    //TODO: conn_watchers
+    GO(savedsynchandler, iFp)
+    //TODO: generic_event_vec?
+    //TODO: generic_event_copy_vec?
+
+
+    #undef GO
+    #undef GO2
+
+    return ret;
+}
+
 #define CUSTOM_INIT                 \
     box64->x11lib = lib;            \
     lib->priv.w.p2 = getX11My(lib); \
diff --git a/src/wrapped/wrappedlibx11_private.h b/src/wrapped/wrappedlibx11_private.h
index c65c416d..98f407c1 100755
--- a/src/wrapped/wrappedlibx11_private.h
+++ b/src/wrapped/wrappedlibx11_private.h
@@ -806,7 +806,7 @@ GO(XNoOp, iFp)
 // _XNoticePutBitmap
 GO(XOffsetRegion, iFpii)
 //GO(XOMOfOC
-GO(XOpenDisplay, pFp)
+GOM(XOpenDisplay, pFEp)
 GO(XOpenIM, pFpppp)
 // _XOpenLC
 //GO(XOpenOM
diff --git a/src/wrapped/wrappedlibxi_private.h b/src/wrapped/wrappedlibxi_private.h
index e1d5d1f0..c29920bd 100755
--- a/src/wrapped/wrappedlibxi_private.h
+++ b/src/wrapped/wrappedlibxi_private.h
@@ -45,12 +45,12 @@ GO(XIGetClientPointer, iFppp)
 //GO(XIGetFocus, 
 GO(XIGetProperty, iFpipllipppppp)
 GO(XIGetSelectedEvents, iFpppi)
-//GO(XIGrabButton, 
+GO(XIGrabButton, iFpiippiiipip)
 GO(XIGrabDevice, iFpipLpiiip)
 //GO(XIGrabEnter, 
 //GO(XIGrabFocusIn, 
-//GO(XIGrabKeycode, 
-//GO(XIGrabTouchBegin, 
+GO(XIGrabKeycode, iFpiipiiipip)
+GO(XIGrabTouchBegin, iFpipipip)
 //GO(XIListProperties, 
 GO(XIQueryDevice, pFpip)
 GO(XIQueryPointer, iFpipppppppppp)
@@ -59,12 +59,12 @@ GO(XISelectEvents, iFpppi)
 GO(XISetClientPointer, iFppi)
 //GO(XISetFocus, 
 //GO(XIUndefineCursor, 
-//GO(XIUngrabButton, 
+GO(XIUngrabButton, iFpiipip)
 GO(XIUngrabDevice, iFpiL)
 //GO(XIUngrabEnter, 
 //GO(XIUngrabFocusIn, 
-//GO(XIUngrabKeycode, 
-//GO(XIUngrabTouchBegin, 
+GO(XIUngrabKeycode, iFpiipip)
+GO(XIUngrabTouchBegin, iFpipip)
 //GO(XIWarpPointer, 
 //GO(XListDeviceProperties, 
 GO(XListInputDevices, pFpp)