about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-09-23 15:12:24 +0200
committerptitSeb <sebastien.chev@gmail.com>2024-09-23 15:12:24 +0200
commit9271684e5a9f356056a6038f652ec1c15ed16ed2 (patch)
treee907481be1cdbb4da2e45c4a6ea39c85aa60705c /src
parent929d462d051f688d26e25cdcd8730f80fa0bb0d8 (diff)
downloadbox64-9271684e5a9f356056a6038f652ec1c15ed16ed2.tar.gz
box64-9271684e5a9f356056a6038f652ec1c15ed16ed2.zip
[BOX32][WRAPPER] One more 32bits wrapped libX11 function
Diffstat (limited to 'src')
-rw-r--r--src/wrapped32/generated/functions_list.txt3
-rw-r--r--src/wrapped32/generated/wrappedlibx11types32.h2
-rw-r--r--src/wrapped32/generated/wrapper32.c2
-rw-r--r--src/wrapped32/generated/wrapper32.h1
-rw-r--r--src/wrapped32/wrappedlibx11.c15
-rw-r--r--src/wrapped32/wrappedlibx11_private.h2
6 files changed, 24 insertions, 1 deletions
diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt
index dcc50379..25cf3ae9 100644
--- a/src/wrapped32/generated/functions_list.txt
+++ b/src/wrapped32/generated/functions_list.txt
@@ -120,6 +120,7 @@
 #() iFEp -> iFEp
 #() iFEh -> iFEh
 #() iFEO -> iFEO
+#() iFEX -> iFEX
 #() iFii -> iFii
 #() iFiI -> iFiI
 #() iFiu -> iFiu
@@ -1320,6 +1321,8 @@ wrappedlibx11:
   - XDestroyImage
   - XInitImage
   - _XInitImageFuncPtrs
+- iFX:
+  - XCloseDisplay
 - pFp:
   - XOpenDisplay
 - iFXp:
diff --git a/src/wrapped32/generated/wrappedlibx11types32.h b/src/wrapped32/generated/wrappedlibx11types32.h
index 3f0ae230..bb91baa0 100644
--- a/src/wrapped32/generated/wrappedlibx11types32.h
+++ b/src/wrapped32/generated/wrappedlibx11types32.h
@@ -12,6 +12,7 @@
 #endif
 
 typedef int32_t (*iFp_t)(void*);
+typedef int32_t (*iFX_t)(void*);
 typedef void* (*pFp_t)(void*);
 typedef int32_t (*iFXp_t)(void*, void*);
 typedef void* (*pFpV_t)(void*, ...);
@@ -31,6 +32,7 @@ typedef uintptr_t (*LFXLiiuuuiupLp_t)(void*, uintptr_t, int32_t, int32_t, uint32
 	GO(XDestroyImage, iFp_t) \
 	GO(XInitImage, iFp_t) \
 	GO(_XInitImageFuncPtrs, iFp_t) \
+	GO(XCloseDisplay, iFX_t) \
 	GO(XOpenDisplay, pFp_t) \
 	GO(XNextEvent, iFXp_t) \
 	GO(XCreateIC, pFpV_t) \
diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c
index fc30ef22..93887fe9 100644
--- a/src/wrapped32/generated/wrapper32.c
+++ b/src/wrapped32/generated/wrapper32.c
@@ -209,6 +209,7 @@ typedef int32_t (*iFEL_t)(x64emu_t*, uintptr_t);
 typedef int32_t (*iFEp_t)(x64emu_t*, void*);
 typedef int32_t (*iFEh_t)(x64emu_t*, uintptr_t);
 typedef int32_t (*iFEO_t)(x64emu_t*, int32_t);
+typedef int32_t (*iFEX_t)(x64emu_t*, void*);
 typedef int32_t (*iFii_t)(int32_t, int32_t);
 typedef int32_t (*iFiI_t)(int32_t, int64_t);
 typedef int32_t (*iFiu_t)(int32_t, uint32_t);
@@ -1169,6 +1170,7 @@ void iFEL_32(x64emu_t *emu, uintptr_t fcn) { iFEL_t fn = (iFEL_t)fcn; R_EAX = fn
 void iFEp_32(x64emu_t *emu, uintptr_t fcn) { iFEp_t fn = (iFEp_t)fcn; R_EAX = fn(emu, from_ptriv(R_ESP + 4)); }
 void iFEh_32(x64emu_t *emu, uintptr_t fcn) { iFEh_t fn = (iFEh_t)fcn; R_EAX = fn(emu, from_hash(from_ptri(ptr_t, R_ESP + 4))); }
 void iFEO_32(x64emu_t *emu, uintptr_t fcn) { iFEO_t fn = (iFEO_t)fcn; R_EAX = fn(emu, of_convert32(from_ptri(int32_t, R_ESP + 4))); }
+void iFEX_32(x64emu_t *emu, uintptr_t fcn) { iFEX_t fn = (iFEX_t)fcn; R_EAX = fn(emu, getDisplay(from_ptriv(R_ESP + 4))); }
 void iFii_32(x64emu_t *emu, uintptr_t fcn) { iFii_t fn = (iFii_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8)); }
 void iFiI_32(x64emu_t *emu, uintptr_t fcn) { iFiI_t fn = (iFiI_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(int64_t, R_ESP + 8)); }
 void iFiu_32(x64emu_t *emu, uintptr_t fcn) { iFiu_t fn = (iFiu_t)fcn; R_EAX = fn(from_ptri(int32_t, R_ESP + 4), from_ptri(uint32_t, R_ESP + 8)); }
diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h
index 741a42c5..389e2c6c 100644
--- a/src/wrapped32/generated/wrapper32.h
+++ b/src/wrapped32/generated/wrapper32.h
@@ -161,6 +161,7 @@ void iFEL_32(x64emu_t *emu, uintptr_t fnc);
 void iFEp_32(x64emu_t *emu, uintptr_t fnc);
 void iFEh_32(x64emu_t *emu, uintptr_t fnc);
 void iFEO_32(x64emu_t *emu, uintptr_t fnc);
+void iFEX_32(x64emu_t *emu, uintptr_t fnc);
 void iFii_32(x64emu_t *emu, uintptr_t fnc);
 void iFiI_32(x64emu_t *emu, uintptr_t fnc);
 void iFiu_32(x64emu_t *emu, uintptr_t fnc);
diff --git a/src/wrapped32/wrappedlibx11.c b/src/wrapped32/wrappedlibx11.c
index 964727b6..eeb8e0fd 100644
--- a/src/wrapped32/wrappedlibx11.c
+++ b/src/wrapped32/wrappedlibx11.c
@@ -1674,6 +1674,21 @@ EXPORT void* my32_XOpenDisplay(x64emu_t* emu, void* d)
     return ret;
 }
 
+EXPORT int my32_XCloseDisplay(x64emu_t* emu, void* dpy)
+{
+    int ret = my->XCloseDisplay(dpy);
+    if(ret)
+        for(int i=0; i<N_DISPLAY; ++i) {
+            // crude free of ressources... not perfect
+            if(my32_Displays_64[i]==dpy) {
+                my32_Displays_64[i] = NULL;
+                return ret;
+            }
+        }
+    return ret;
+}
+
+
 EXPORT XID my32_XCreateWindow(x64emu_t* emu, void* d, XID Window, int x, int y, uint32_t width, uint32_t height, uint32_t border_width, int depth, uint32_t cl, void* visual,  unsigned long mask, my_XSetWindowAttributes_32_t* attr)
 {
     my_XSetWindowAttributes_t attrib;
diff --git a/src/wrapped32/wrappedlibx11_private.h b/src/wrapped32/wrappedlibx11_private.h
index 0eb67cec..199ac87a 100644
--- a/src/wrapped32/wrappedlibx11_private.h
+++ b/src/wrapped32/wrappedlibx11_private.h
@@ -59,7 +59,7 @@ GOM(XCheckTypedEvent, iFEXip)
 //GO(XClearArea, iFpLiiuui)
 //GO(XClearWindow, iFpL)
 //GO(XClipBox, iFpp)
-//GO(XCloseDisplay, iFp)
+GOM(XCloseDisplay, iFEX)
 //GO(XCloseIM, iFp)
 //GO(_XCloseLC, 
 //GO(XCloseOM, iFp)