about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-03-18 15:04:39 +0100
committerptitSeb <sebastien.chev@gmail.com>2023-03-18 15:04:39 +0100
commit670c0678912c5c7c82f6b8191a9d5086b5cd9dc2 (patch)
tree3391b76fe18861e6cbf40d6162e077ef5a3ef132 /src
parent5ec4616614914c5e047b84dc0a74b63a35624fc4 (diff)
downloadbox64-670c0678912c5c7c82f6b8191a9d5086b5cd9dc2.tar.gz
box64-670c0678912c5c7c82f6b8191a9d5086b5cd9dc2.zip
Added some wrapped function to libatspi
Diffstat (limited to 'src')
-rw-r--r--src/wrapped/generated/functions_list.txt2
-rw-r--r--src/wrapped/generated/wrappedatspitypes.h4
-rwxr-xr-xsrc/wrapped/wrappedatspi.c78
-rwxr-xr-xsrc/wrapped/wrappedatspi_private.h34
4 files changed, 100 insertions, 18 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt
index 0c7cba16..fee84c04 100644
--- a/src/wrapped/generated/functions_list.txt
+++ b/src/wrapped/generated/functions_list.txt
@@ -2383,6 +2383,8 @@ wrappedatk:
 wrappedatkbridge:
 wrappedatomic:
 wrappedatspi:
+- pFppp:
+  - atspi_event_listener_new
 wrappedbz2:
 - iFp:
   - BZ2_bzCompressEnd
diff --git a/src/wrapped/generated/wrappedatspitypes.h b/src/wrapped/generated/wrappedatspitypes.h
index 7540f5e6..b03ecc14 100644
--- a/src/wrapped/generated/wrappedatspitypes.h
+++ b/src/wrapped/generated/wrappedatspitypes.h
@@ -11,7 +11,9 @@
 #define ADDED_FUNCTIONS() 
 #endif
 
+typedef void* (*pFppp_t)(void*, void*, void*);
 
-#define SUPER() ADDED_FUNCTIONS()
+#define SUPER() ADDED_FUNCTIONS() \
+	GO(atspi_event_listener_new, pFppp_t)
 
 #endif // __wrappedatspiTYPES_H_
diff --git a/src/wrapped/wrappedatspi.c b/src/wrapped/wrappedatspi.c
index 9bd6e5c2..dcf9aa1f 100755
--- a/src/wrapped/wrappedatspi.c
+++ b/src/wrapped/wrappedatspi.c
@@ -11,12 +11,90 @@
 #include "bridge.h"
 #include "librarian/library_private.h"
 #include "x64emu.h"
+#include "emu/x64emu_private.h"
+#include "callback.h"
+#include "librarian.h"
+#include "box64context.h"
+#include "emu/x64emu_private.h"
+#include "myalign.h"
+#include "gtkclass.h"
 
 const char* atspiName = "libatspi.so.0";
 #define LIBNAME atspi
 
+#define ADDED_FUNCTIONS()                   \
+
+#include "generated/wrappedatspitypes.h"
+
+#include "wrappercallback.h"
+
+#define SUPER() \
+GO(0)   \
+GO(1)   \
+GO(2)   \
+GO(3)   \
+GO(4)
+
+// GDestroyNotify ...
+#define GO(A)   \
+static uintptr_t my_GDestroyNotify_fct_##A = 0;                 \
+static void my_GDestroyNotify_##A(void* a)                      \
+{                                                               \
+    RunFunction(my_context, my_GDestroyNotify_fct_##A, 1, a);   \
+}
+SUPER()
+#undef GO
+static void* find_GDestroyNotify_Fct(void* fct)
+{
+    if(!fct) return fct;
+    if(GetNativeFnc((uintptr_t)fct))  return GetNativeFnc((uintptr_t)fct);
+    #define GO(A) if(my_GDestroyNotify_fct_##A == (uintptr_t)fct) return my_GDestroyNotify_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_GDestroyNotify_fct_##A == 0) {my_GDestroyNotify_fct_##A = (uintptr_t)fct; return my_GDestroyNotify_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for atspi GDestroyNotify callback\n");
+    return NULL;
+}
+// AtspiEventListenerCB ...
+#define GO(A)   \
+static uintptr_t my_AtspiEventListenerCB_fct_##A = 0;                   \
+static void my_AtspiEventListenerCB_##A(void* a, void* b)               \
+{                                                                       \
+    RunFunction(my_context, my_AtspiEventListenerCB_fct_##A, 2, a, b);  \
+}
+SUPER()
+#undef GO
+static void* find_AtspiEventListenerCB_Fct(void* fct)
+{
+    if(!fct) return fct;
+    if(GetNativeFnc((uintptr_t)fct))  return GetNativeFnc((uintptr_t)fct);
+    #define GO(A) if(my_AtspiEventListenerCB_fct_##A == (uintptr_t)fct) return my_AtspiEventListenerCB_##A;
+    SUPER()
+    #undef GO
+    #define GO(A) if(my_AtspiEventListenerCB_fct_##A == 0) {my_AtspiEventListenerCB_fct_##A = (uintptr_t)fct; return my_AtspiEventListenerCB_##A; }
+    SUPER()
+    #undef GO
+    printf_log(LOG_NONE, "Warning, no more slot for atspi AtspiEventListenerCB callback\n");
+    return NULL;
+}
+
+#undef SUPER
+
+EXPORT void* my_atspi_event_listener_new(x64emu_t* emu, void* f, void* data, void* d)
+{
+    return my->atspi_event_listener_new(find_AtspiEventListenerCB_Fct(f), data, find_GDestroyNotify_Fct(d));
+}
+
 #define PRE_INIT    \
     if(box64_nogtk) \
         return -1;
 
+#define CUSTOM_INIT \
+    getMy(lib);
+
+#define CUSTOM_FINI \
+    freeMy();
+
 #include "wrappedlib_init.h"
diff --git a/src/wrapped/wrappedatspi_private.h b/src/wrapped/wrappedatspi_private.h
index 42115eb2..439e49df 100755
--- a/src/wrapped/wrappedatspi_private.h
+++ b/src/wrapped/wrappedatspi_private.h
@@ -7,18 +7,18 @@
 //GO(atspi_accessible_get_accessible_id, 
 //GO(atspi_accessible_get_action, 
 //GO(atspi_accessible_get_action_iface, 
-//GO(atspi_accessible_get_application, 
+GO(atspi_accessible_get_application, pFpp)
 //GO(atspi_accessible_get_atspi_version, 
-//GO(atspi_accessible_get_attributes, 
+GO(atspi_accessible_get_attributes, pFpp)
 //GO(atspi_accessible_get_attributes_as_array, 
 //GO(_atspi_accessible_get_cache_mask, 
-//GO(atspi_accessible_get_child_at_index, 
-//GO(atspi_accessible_get_child_count, 
+GO(atspi_accessible_get_child_at_index, pFpip)
+GO(atspi_accessible_get_child_count, iFpp)
 //GO(atspi_accessible_get_collection, 
 //GO(atspi_accessible_get_collection_iface, 
 //GO(atspi_accessible_get_component, 
 //GO(atspi_accessible_get_component_iface, 
-//GO(atspi_accessible_get_description, 
+GO(atspi_accessible_get_description, pFpp)
 //GO(atspi_accessible_get_document, 
 //GO(atspi_accessible_get_document_iface, 
 //GO(atspi_accessible_get_editable_text, 
@@ -32,16 +32,16 @@
 //GO(atspi_accessible_get_index_in_parent, 
 //GO(atspi_accessible_get_interfaces, 
 //GO(atspi_accessible_get_localized_role_name, 
-//GO(atspi_accessible_get_name, 
+GO(atspi_accessible_get_name, pFpp)
 //GO(atspi_accessible_get_object_locale, 
 //GO(atspi_accessible_get_parent, 
-//GO(atspi_accessible_get_process_id, 
+GO(atspi_accessible_get_process_id, uFpp)
 //GO(atspi_accessible_get_relation_set, 
-//GO(atspi_accessible_get_role, 
-//GO(atspi_accessible_get_role_name, 
+GO(atspi_accessible_get_role, iFpp)
+GO(atspi_accessible_get_role_name, pFpp)
 //GO(atspi_accessible_get_selection, 
 //GO(atspi_accessible_get_selection_iface, 
-//GO(atspi_accessible_get_state_set, 
+GO(atspi_accessible_get_state_set, pFpp)
 //GO(atspi_accessible_get_table, 
 //GO(atspi_accessible_get_table_cell, 
 //GO(atspi_accessible_get_table_iface, 
@@ -158,14 +158,14 @@
 //GO(atspi_editable_text_paste_text, 
 //GO(atspi_editable_text_set_text_contents, 
 //GO(_atspi_error_quark, 
-//GO(atspi_event_get_type, 
-//GO(atspi_event_listener_deregister, 
+GO(atspi_event_get_type, LFv)
+GO(atspi_event_listener_deregister, iFppp)
 //GO(atspi_event_listener_deregister_from_callback, 
 //GO(atspi_event_listener_deregister_no_data, 
 //GO(atspi_event_listener_get_type, 
-//GO(atspi_event_listener_new, 
+GOM(atspi_event_listener_new, pFppp)
 //GO(atspi_event_listener_new_simple, 
-//GO(atspi_event_listener_register, 
+GO(atspi_event_listener_register, iFppp)
 //GO(atspi_event_listener_register_from_callback, 
 //GO(atspi_event_listener_register_from_callback_full, 
 //GO(atspi_event_listener_register_full, 
@@ -178,7 +178,7 @@
 //GO(atspi_generate_mouse_event, 
 //GO(atspi_get_a11y_bus, 
 //GO(_atspi_get_allow_sync, 
-//GO(atspi_get_desktop, 
+GO(atspi_get_desktop, pFi)
 //GO(atspi_get_desktop_count, 
 //GO(atspi_get_desktop_list, 
 //GO(_atspi_get_iface_num, 
@@ -202,7 +202,7 @@
 //GO(atspi_image_get_image_position, 
 //GO(atspi_image_get_image_size, 
 //GO(atspi_image_get_type, 
-//GO(atspi_init, 
+GO(atspi_init, iFv)
 //DATA(atspi_interface_accessible, 
 //DATA(atspi_interface_action, 
 //DATA(atspi_interface_application, 
@@ -288,7 +288,7 @@
 //GO(atspi_state_set_compare, 
 //GO(atspi_state_set_contains, 
 //GO(atspi_state_set_equals, 
-//GO(atspi_state_set_get_states, 
+GO(atspi_state_set_get_states, pFp)
 //GO(atspi_state_set_get_type, 
 //GO(atspi_state_set_is_empty, 
 //GO(atspi_state_set_new,