about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2025-01-26 13:11:25 +0100
committerptitSeb <sebastien.chev@gmail.com>2025-01-26 13:11:25 +0100
commitba078c63a8ff957b0d36d71b1ce9f7f48b7978f1 (patch)
tree570eb4ec24c848b5ae04502100832fdf3a803393 /src
parenta54959a6e3b8905360e73d9ce8f2de4fa4212a67 (diff)
downloadbox64-ba078c63a8ff957b0d36d71b1ce9f7f48b7978f1.tar.gz
box64-ba078c63a8ff957b0d36d71b1ce9f7f48b7978f1.zip
[WRAPPER] Added a few more wrapped function (to emulate recent SDL2)
Diffstat (limited to 'src')
-rw-r--r--src/wrapped/generated/functions_list.txt2
-rw-r--r--src/wrapped/generated/wrappedxkbcommontypes.h4
-rw-r--r--src/wrapped/wrappedpulse_private.h1
-rw-r--r--src/wrapped/wrappedxkbcommon.c48
-rw-r--r--src/wrapped/wrappedxkbcommon_private.h4
5 files changed, 55 insertions, 4 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index ee262fed..b7c65af7 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -6191,6 +6191,8 @@ wrappedwaylandcursor:
 wrappedwaylandegl:
 wrappedxinerama:
 wrappedxkbcommon:
+- vFppp:
+  - xkb_keymap_key_for_each
 wrappedxkbcommonx11:
 wrappedxkbregistry:
 wrappedxml2:
diff --git a/src/wrapped/generated/wrappedxkbcommontypes.h b/src/wrapped/generated/wrappedxkbcommontypes.h
index c7a3470c..b18fb638 100644
--- a/src/wrapped/generated/wrappedxkbcommontypes.h
+++ b/src/wrapped/generated/wrappedxkbcommontypes.h
@@ -11,7 +11,9 @@
 #define ADDED_FUNCTIONS() 
 #endif
 
+typedef void (*vFppp_t)(void*, void*, void*);
 
-#define SUPER() ADDED_FUNCTIONS()
+#define SUPER() ADDED_FUNCTIONS() \
+	GO(xkb_keymap_key_for_each, vFppp_t)
 
 #endif // __wrappedxkbcommonTYPES_H_
diff --git a/src/wrapped/wrappedpulse_private.h b/src/wrapped/wrappedpulse_private.h
index aa739805..351d73ff 100644
--- a/src/wrapped/wrappedpulse_private.h
+++ b/src/wrapped/wrappedpulse_private.h
@@ -268,6 +268,7 @@ GO(pa_threaded_mainloop_get_retval, iFp)
 GO(pa_threaded_mainloop_in_thread, iFp)
 GO(pa_threaded_mainloop_lock, vFp)
 GO(pa_threaded_mainloop_new, pFv)
+GO(pa_threaded_mainloop_set_name, vFpp)
 GO(pa_threaded_mainloop_signal, vFpi)
 GO(pa_threaded_mainloop_start, iFp)
 GO(pa_threaded_mainloop_stop, vFp)
diff --git a/src/wrapped/wrappedxkbcommon.c b/src/wrapped/wrappedxkbcommon.c
index 5515e0b8..91ad8ac2 100644
--- a/src/wrapped/wrappedxkbcommon.c
+++ b/src/wrapped/wrappedxkbcommon.c
@@ -6,15 +6,61 @@
 
 #include "wrappedlibs.h"
 
+#include "debug.h"
 #include "wrapper.h"
 #include "bridge.h"
 #include "librarian/library_private.h"
 #include "x64emu.h"
+#include "emu/x64emu_private.h"
+#include "callback.h"
+#include "box64context.h"
+#include "librarian.h"
+#include "myalign.h"
 
 const char* xkbcommonName = "libxkbcommon.so.0";
 #define ALTNAME "libxkbcommon.so"
 
 #define LIBNAME xkbcommon
 
-#include "wrappedlib_init.h"
+#define ADDED_FUNCTIONS() \
+
+#include "generated/wrappedxkbcommontypes.h"
+
+#include "wrappercallback.h"
+
+#define SUPER() \
+GO(0)   \
+GO(1)   \
+GO(2)   \
+GO(3)   \
 
+//xkb_keymap_key_iter_t
+#define GO(A)                                                           \
+static uintptr_t my_xkb_keymap_key_iter_t_fct_##A = 0;                  \
+static void my_xkb_keymap_key_iter_t_##A(void* a, uint32_t b, void* c)  \
+{                                                                       \
+    RunFunctionFmt(my_xkb_keymap_key_iter_t_fct_##A, "pup", a, b, c);   \
+}
+SUPER()
+#undef GO
+static void* find_xkb_keymap_key_iter_t_Fct(void* fct)
+{
+    if(!fct) return fct;
+    if(GetNativeFnc((uintptr_t)fct))  return GetNativeFnc((uintptr_t)fct);
+    #define GO(A) if(my_xkb_keymap_key_iter_t_fct_##A == (uintptr_t)fct) return my_xkb_keymap_key_iter_t_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_xkb_keymap_key_iter_t_fct_##A == 0) {my_xkb_keymap_key_iter_t_fct_##A = (uintptr_t)fct; return my_xkb_keymap_key_iter_t_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for xkbcommon xkb_keymap_key_iter_t callback\n");
+    return NULL;
+}
+#undef SUPER
+
+EXPORT void my_xkb_keymap_key_for_each(x64emu_t* emu, void* keymap, void* f, void* data)
+{
+    my->xkb_keymap_key_for_each(keymap, find_xkb_keymap_key_iter_t_Fct(f), data);
+}
+
+#include "wrappedlib_init.h"
diff --git a/src/wrapped/wrappedxkbcommon_private.h b/src/wrapped/wrappedxkbcommon_private.h
index d06f296c..96e0ea39 100644
--- a/src/wrapped/wrappedxkbcommon_private.h
+++ b/src/wrapped/wrappedxkbcommon_private.h
@@ -5,7 +5,7 @@
 
 GO(xkb_compose_state_feed, iFpu)
 //GO(xkb_compose_state_get_compose_table, 
-//GO(xkb_compose_state_get_one_sym, 
+GO(xkb_compose_state_get_one_sym, uFp)
 GO(xkb_compose_state_get_status, iFp)
 GO(xkb_compose_state_get_utf8, iFppL)
 GO(xkb_compose_state_new, pFpi)
@@ -35,7 +35,7 @@ GO(xkb_context_set_user_data, vFpp)
 GO(xkb_context_unref, vFp)
 GO(xkb_keymap_get_as_string, pFpi)
 GO(xkb_keymap_key_by_name, uFpp)
-//GOM(xkb_keymap_key_for_each, vFEppp)
+GOM(xkb_keymap_key_for_each, vFEppp)
 GO(xkb_keymap_key_get_name, pFpu)
 GO(xkb_keymap_key_get_syms_by_level, iFpuuup)
 GO(xkb_keymap_key_repeats, iFpu)