about summary refs log tree commit diff stats
path: root/src/wrapped32/wrappedlibxcbres.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2024-12-16 14:42:36 +0100
committerptitSeb <sebastien.chev@gmail.com>2024-12-17 09:15:59 +0100
commit0882f910df3672e084a8fefa522e8dae4d248fe3 (patch)
tree9cc27f7bdee2a3d3335dbbaf0c0a787264f436c8 /src/wrapped32/wrappedlibxcbres.c
parentf65c22d329e0f2405e2b0f12bc349331b2e4d74b (diff)
downloadbox64-0882f910df3672e084a8fefa522e8dae4d248fe3.tar.gz
box64-0882f910df3672e084a8fefa522e8dae4d248fe3.zip
[BOX32][WRAPPING] Added 32bits wrapped libxcb-res and fixes some wrapped functions from libxcb
Diffstat (limited to 'src/wrapped32/wrappedlibxcbres.c')
-rw-r--r--src/wrapped32/wrappedlibxcbres.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/wrapped32/wrappedlibxcbres.c b/src/wrapped32/wrappedlibxcbres.c
new file mode 100644
index 00000000..fda4dae8
--- /dev/null
+++ b/src/wrapped32/wrappedlibxcbres.c
@@ -0,0 +1,83 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#define _GNU_SOURCE         /* See feature_test_macros(7) */
+#include <dlfcn.h>
+
+#include "wrappedlibs.h"
+
+#include "debug.h"
+#include "wrapper32.h"
+#include "bridge.h"
+#include "librarian/library_private.h"
+#include "x64emu.h"
+#include "callback.h"
+#include "librarian.h"
+#include "box32context.h"
+#include "emu/x64emu_private.h"
+#include "myalign32.h"
+#include "converter32.h"
+
+#ifdef ANDROID
+	static const char* libxcbresName = "libxcb-res.so";
+#else
+	static const char* libxcbresName = "libxcb-res.so.0";
+#endif
+
+#define LIBNAME libxcbres
+
+typedef struct my_xcb_XXX_iterator_s {
+    void*             data;
+    int               rem;
+    int               index;
+} my_xcb_XXX_iterator_t;
+
+typedef struct my_xcb_XXX_iterator_32_s {
+    ptr_t             data;
+    int               rem;
+    int               index;
+} my_xcb_XXX_iterator_32_t;
+
+typedef struct my_xcb_cookie_s {
+    uint32_t        data;
+} my_xcb_cookie_t;
+
+typedef my_xcb_cookie_t (*zFpup)(void*, uint32_t, void*);
+typedef my_xcb_XXX_iterator_t (*ZFp_t)(void*);
+
+#define ADDED_FUNCTIONS()       				\
+GO(xcb_res_query_client_ids, zFpup)           	\
+GO(xcb_res_query_client_ids_ids_iterator, ZFp_t)\
+
+#include "generated/wrappedlibxcbrestypes32.h"
+
+#include "wrappercallback32.h"
+
+#define SUPER(F, P, ...)           \
+    EXPORT void* my32_##F P        \
+    {                              \
+        (void)emu;                 \
+        *ret = my->F(__VA_ARGS__); \
+        return ret;                \
+    }
+
+SUPER(xcb_res_query_client_ids, (x64emu_t* emu, my_xcb_cookie_t* ret, void* c, uint32_t count, void* specs), c, count, specs)
+
+#undef SUPER
+
+#define SUPER(F)           		   												\
+    EXPORT void* my32_##F(x64emu_t* emu, my_xcb_XXX_iterator_32_t* ret, void* R)\
+    {                              												\
+        (void)emu;       														\
+		my_xcb_XXX_iterator_t ret_l = my->F(R);									\
+        ret->data = to_ptrv(ret_l.data); 										\
+        ret->rem = ret_l.rem; 													\
+        ret->index = ret_l.index; 												\
+        return ret;      														\
+    }
+
+SUPER(xcb_res_query_client_ids_ids_iterator)
+
+#undef SUPER
+
+#include "wrappedlib_init32.h"