Skip to content

Commit

Permalink
Added some libnm and libgio2 wrapped functions
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitSeb committed Jun 19, 2022
1 parent c33683c commit 432e09c
Show file tree
Hide file tree
Showing 7 changed files with 157 additions and 54 deletions.
13 changes: 13 additions & 0 deletions src/wrapped/generated/functions_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@
#() pFiIIi
#() pFipii
#() pFipip
#() pFipup
#() pFippi
#() pFippu
#() pFuiii
Expand Down Expand Up @@ -1604,6 +1605,7 @@
#() iFEpplppi
#() iFEpppiiu
#() iFEpppppp
#() iFiiiiiii
#() iFiiiiiip
#() iFpiiiiii
#() iFpiiiiip
Expand Down Expand Up @@ -1712,6 +1714,7 @@
#() vFEppipppp
#() vFEpppuipV
#() vFEpppppuu
#() vFEppppppp
#() vFiiiiuuip
#() vFilipufip
#() vFuiiiiiii
Expand Down Expand Up @@ -3137,6 +3140,16 @@ wrappedlibncursesw:
- iFpiipV:
- mvwprintw
wrappedlibnm:
- vFpppp:
- nm_device_disconnect_async
- nm_device_wifi_request_scan_async
- nm_remote_connection_delete_async
- vFpippp:
- nm_remote_connection_commit_changes_async
- vFppppp:
- nm_remote_connection_get_secrets_async
- vFppppppp:
- nm_client_add_and_activate_connection_async
wrappedlibogg:
wrappedlibpanel:
wrappedlibpthread:
Expand Down
12 changes: 11 additions & 1 deletion src/wrapped/generated/wrappedlibnmtypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,17 @@
#define ADDED_FUNCTIONS()
#endif

typedef void (*vFpppp_t)(void*, void*, void*, void*);
typedef void (*vFpippp_t)(void*, int32_t, void*, void*, void*);
typedef void (*vFppppp_t)(void*, void*, void*, void*, void*);
typedef void (*vFppppppp_t)(void*, void*, void*, void*, void*, void*, void*);

#define SUPER() ADDED_FUNCTIONS()
#define SUPER() ADDED_FUNCTIONS() \
GO(nm_device_disconnect_async, vFpppp_t) \
GO(nm_device_wifi_request_scan_async, vFpppp_t) \
GO(nm_remote_connection_delete_async, vFpppp_t) \
GO(nm_remote_connection_commit_changes_async, vFpippp_t) \
GO(nm_remote_connection_get_secrets_async, vFppppp_t) \
GO(nm_client_add_and_activate_connection_async, vFppppppp_t)

#endif // __wrappedlibnmTYPES_H_
6 changes: 6 additions & 0 deletions src/wrapped/generated/wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,7 @@ typedef void* (*pFiipp_t)(int32_t, int32_t, void*, void*);
typedef void* (*pFiIIi_t)(int32_t, int64_t, int64_t, int32_t);
typedef void* (*pFipii_t)(int32_t, void*, int32_t, int32_t);
typedef void* (*pFipip_t)(int32_t, void*, int32_t, void*);
typedef void* (*pFipup_t)(int32_t, void*, uint32_t, void*);
typedef void* (*pFippi_t)(int32_t, void*, void*, int32_t);
typedef void* (*pFippu_t)(int32_t, void*, void*, uint32_t);
typedef void* (*pFuiii_t)(uint32_t, int32_t, int32_t, int32_t);
Expand Down Expand Up @@ -1676,6 +1677,7 @@ typedef int32_t (*iFEppuppp_t)(x86emu_t*, void*, void*, uint32_t, void*, void*,
typedef int32_t (*iFEpplppi_t)(x86emu_t*, void*, void*, intptr_t, void*, void*, int32_t);
typedef int32_t (*iFEpppiiu_t)(x86emu_t*, void*, void*, void*, int32_t, int32_t, uint32_t);
typedef int32_t (*iFEpppppp_t)(x86emu_t*, void*, void*, void*, void*, void*, void*);
typedef int32_t (*iFiiiiiii_t)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t);
typedef int32_t (*iFiiiiiip_t)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, void*);
typedef int32_t (*iFpiiiiii_t)(void*, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t);
typedef int32_t (*iFpiiiiip_t)(void*, int32_t, int32_t, int32_t, int32_t, int32_t, void*);
Expand Down Expand Up @@ -1784,6 +1786,7 @@ typedef void (*vFEuuuuppp_t)(x86emu_t*, uint32_t, uint32_t, uint32_t, uint32_t,
typedef void (*vFEppipppp_t)(x86emu_t*, void*, void*, int32_t, void*, void*, void*, void*);
typedef void (*vFEpppuipV_t)(x86emu_t*, void*, void*, void*, uint32_t, int32_t, void*, void*);
typedef void (*vFEpppppuu_t)(x86emu_t*, void*, void*, void*, void*, void*, uint32_t, uint32_t);
typedef void (*vFEppppppp_t)(x86emu_t*, void*, void*, void*, void*, void*, void*, void*);
typedef void (*vFiiiiuuip_t)(int32_t, int32_t, int32_t, int32_t, uint32_t, uint32_t, int32_t, void*);
typedef void (*vFilipufip_t)(int32_t, intptr_t, int32_t, void*, uint32_t, float, int32_t, void*);
typedef void (*vFuiiiiiii_t)(uint32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t);
Expand Down Expand Up @@ -3105,6 +3108,7 @@ void pFiipp(x86emu_t *emu, uintptr_t fcn) { pFiipp_t fn = (pFiipp_t)fcn; R_EAX=(
void pFiIIi(x86emu_t *emu, uintptr_t fcn) { pFiIIi_t fn = (pFiIIi_t)fcn; R_EAX=(uintptr_t)fn(*(int32_t*)(R_ESP + 4), *(int64_t*)(R_ESP + 8), *(int64_t*)(R_ESP + 16), *(int32_t*)(R_ESP + 24)); }
void pFipii(x86emu_t *emu, uintptr_t fcn) { pFipii_t fn = (pFipii_t)fcn; R_EAX=(uintptr_t)fn(*(int32_t*)(R_ESP + 4), *(void**)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16)); }
void pFipip(x86emu_t *emu, uintptr_t fcn) { pFipip_t fn = (pFipip_t)fcn; R_EAX=(uintptr_t)fn(*(int32_t*)(R_ESP + 4), *(void**)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(void**)(R_ESP + 16)); }
void pFipup(x86emu_t *emu, uintptr_t fcn) { pFipup_t fn = (pFipup_t)fcn; R_EAX=(uintptr_t)fn(*(int32_t*)(R_ESP + 4), *(void**)(R_ESP + 8), *(uint32_t*)(R_ESP + 12), *(void**)(R_ESP + 16)); }
void pFippi(x86emu_t *emu, uintptr_t fcn) { pFippi_t fn = (pFippi_t)fcn; R_EAX=(uintptr_t)fn(*(int32_t*)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(int32_t*)(R_ESP + 16)); }
void pFippu(x86emu_t *emu, uintptr_t fcn) { pFippu_t fn = (pFippu_t)fcn; R_EAX=(uintptr_t)fn(*(int32_t*)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(uint32_t*)(R_ESP + 16)); }
void pFuiii(x86emu_t *emu, uintptr_t fcn) { pFuiii_t fn = (pFuiii_t)fcn; R_EAX=(uintptr_t)fn(*(uint32_t*)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16)); }
Expand Down Expand Up @@ -3828,6 +3832,7 @@ void iFEppuppp(x86emu_t *emu, uintptr_t fcn) { iFEppuppp_t fn = (iFEppuppp_t)fcn
void iFEpplppi(x86emu_t *emu, uintptr_t fcn) { iFEpplppi_t fn = (iFEpplppi_t)fcn; R_EAX=fn(emu, *(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(intptr_t*)(R_ESP + 12), *(void**)(R_ESP + 16), *(void**)(R_ESP + 20), *(int32_t*)(R_ESP + 24)); }
void iFEpppiiu(x86emu_t *emu, uintptr_t fcn) { iFEpppiiu_t fn = (iFEpppiiu_t)fcn; R_EAX=fn(emu, *(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(uint32_t*)(R_ESP + 24)); }
void iFEpppppp(x86emu_t *emu, uintptr_t fcn) { iFEpppppp_t fn = (iFEpppppp_t)fcn; R_EAX=fn(emu, *(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(void**)(R_ESP + 16), *(void**)(R_ESP + 20), *(void**)(R_ESP + 24)); }
void iFiiiiiii(x86emu_t *emu, uintptr_t fcn) { iFiiiiiii_t fn = (iFiiiiiii_t)fcn; R_EAX=fn(*(int32_t*)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(int32_t*)(R_ESP + 24), *(int32_t*)(R_ESP + 28)); }
void iFiiiiiip(x86emu_t *emu, uintptr_t fcn) { iFiiiiiip_t fn = (iFiiiiiip_t)fcn; R_EAX=fn(*(int32_t*)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(int32_t*)(R_ESP + 24), *(void**)(R_ESP + 28)); }
void iFpiiiiii(x86emu_t *emu, uintptr_t fcn) { iFpiiiiii_t fn = (iFpiiiiii_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(int32_t*)(R_ESP + 24), *(int32_t*)(R_ESP + 28)); }
void iFpiiiiip(x86emu_t *emu, uintptr_t fcn) { iFpiiiiip_t fn = (iFpiiiiip_t)fcn; R_EAX=fn(*(void**)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(int32_t*)(R_ESP + 24), *(void**)(R_ESP + 28)); }
Expand Down Expand Up @@ -3936,6 +3941,7 @@ void vFEuuuuppp(x86emu_t *emu, uintptr_t fcn) { vFEuuuuppp_t fn = (vFEuuuuppp_t)
void vFEppipppp(x86emu_t *emu, uintptr_t fcn) { vFEppipppp_t fn = (vFEppipppp_t)fcn; fn(emu, *(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(void**)(R_ESP + 16), *(void**)(R_ESP + 20), *(void**)(R_ESP + 24), *(void**)(R_ESP + 28)); }
void vFEpppuipV(x86emu_t *emu, uintptr_t fcn) { vFEpppuipV_t fn = (vFEpppuipV_t)fcn; fn(emu, *(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(uint32_t*)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(void**)(R_ESP + 24), (void*)(R_ESP + 28)); }
void vFEpppppuu(x86emu_t *emu, uintptr_t fcn) { vFEpppppuu_t fn = (vFEpppppuu_t)fcn; fn(emu, *(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(void**)(R_ESP + 16), *(void**)(R_ESP + 20), *(uint32_t*)(R_ESP + 24), *(uint32_t*)(R_ESP + 28)); }
void vFEppppppp(x86emu_t *emu, uintptr_t fcn) { vFEppppppp_t fn = (vFEppppppp_t)fcn; fn(emu, *(void**)(R_ESP + 4), *(void**)(R_ESP + 8), *(void**)(R_ESP + 12), *(void**)(R_ESP + 16), *(void**)(R_ESP + 20), *(void**)(R_ESP + 24), *(void**)(R_ESP + 28)); }
void vFiiiiuuip(x86emu_t *emu, uintptr_t fcn) { vFiiiiuuip_t fn = (vFiiiiuuip_t)fcn; fn(*(int32_t*)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(uint32_t*)(R_ESP + 20), *(uint32_t*)(R_ESP + 24), *(int32_t*)(R_ESP + 28), *(void**)(R_ESP + 32)); }
void vFilipufip(x86emu_t *emu, uintptr_t fcn) { vFilipufip_t fn = (vFilipufip_t)fcn; fn(*(int32_t*)(R_ESP + 4), *(intptr_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(void**)(R_ESP + 16), *(uint32_t*)(R_ESP + 20), *(float*)(R_ESP + 24), *(int32_t*)(R_ESP + 28), *(void**)(R_ESP + 32)); }
void vFuiiiiiii(x86emu_t *emu, uintptr_t fcn) { vFuiiiiiii_t fn = (vFuiiiiiii_t)fcn; fn(*(uint32_t*)(R_ESP + 4), *(int32_t*)(R_ESP + 8), *(int32_t*)(R_ESP + 12), *(int32_t*)(R_ESP + 16), *(int32_t*)(R_ESP + 20), *(int32_t*)(R_ESP + 24), *(int32_t*)(R_ESP + 28), *(int32_t*)(R_ESP + 32)); }
Expand Down
3 changes: 3 additions & 0 deletions src/wrapped/generated/wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ void pFiipp(x86emu_t *emu, uintptr_t fnc);
void pFiIIi(x86emu_t *emu, uintptr_t fnc);
void pFipii(x86emu_t *emu, uintptr_t fnc);
void pFipip(x86emu_t *emu, uintptr_t fnc);
void pFipup(x86emu_t *emu, uintptr_t fnc);
void pFippi(x86emu_t *emu, uintptr_t fnc);
void pFippu(x86emu_t *emu, uintptr_t fnc);
void pFuiii(x86emu_t *emu, uintptr_t fnc);
Expand Down Expand Up @@ -1636,6 +1637,7 @@ void iFEppuppp(x86emu_t *emu, uintptr_t fnc);
void iFEpplppi(x86emu_t *emu, uintptr_t fnc);
void iFEpppiiu(x86emu_t *emu, uintptr_t fnc);
void iFEpppppp(x86emu_t *emu, uintptr_t fnc);
void iFiiiiiii(x86emu_t *emu, uintptr_t fnc);
void iFiiiiiip(x86emu_t *emu, uintptr_t fnc);
void iFpiiiiii(x86emu_t *emu, uintptr_t fnc);
void iFpiiiiip(x86emu_t *emu, uintptr_t fnc);
Expand Down Expand Up @@ -1744,6 +1746,7 @@ void vFEuuuuppp(x86emu_t *emu, uintptr_t fnc);
void vFEppipppp(x86emu_t *emu, uintptr_t fnc);
void vFEpppuipV(x86emu_t *emu, uintptr_t fnc);
void vFEpppppuu(x86emu_t *emu, uintptr_t fnc);
void vFEppppppp(x86emu_t *emu, uintptr_t fnc);
void vFiiiiuuip(x86emu_t *emu, uintptr_t fnc);
void vFilipufip(x86emu_t *emu, uintptr_t fnc);
void vFuiiiiiii(x86emu_t *emu, uintptr_t fnc);
Expand Down
12 changes: 6 additions & 6 deletions src/wrapped/wrappedgio2_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ GO(g_dbus_connection_unregister_subtree, iFpu)
//GO(g_dbus_error_get_type,
//GO(g_dbus_error_is_remote_error,
//GO(g_dbus_error_new_for_dbus_error,
//GO(g_dbus_error_quark,
GO(g_dbus_error_quark, uFv)
//GO(g_dbus_error_register_error,
//GO(g_dbus_error_register_error_domain,
//GO(g_dbus_error_set_dbus_error,
Expand All @@ -352,7 +352,7 @@ GO(g_dbus_generate_guid, pFv)
GO(g_dbus_gvalue_to_gvariant, pFpp)
GO(g_dbus_gvariant_to_gvalue, vFpp)
//GO(g_dbus_interface_dup_object,
//GO(g_dbus_interface_get_info,
GO(g_dbus_interface_get_info, pFp)
//GO(g_dbus_interface_get_object,
//GO(g_dbus_interface_get_type,
GO(g_dbus_interface_info_cache_build, vFp)
Expand All @@ -365,7 +365,7 @@ GO(g_dbus_interface_info_lookup_signal, pFpp)
GO(g_dbus_interface_info_ref, pFp)
GO(g_dbus_interface_info_unref, vFp)
//GO(g_dbus_interface_set_object,
//GO(g_dbus_interface_skeleton_export,
GO(g_dbus_interface_skeleton_export, iFpppp)
//GO(g_dbus_interface_skeleton_flags_get_type,
//GO(g_dbus_interface_skeleton_flush,
//GO(g_dbus_interface_skeleton_get_connection,
Expand All @@ -374,7 +374,7 @@ GO(g_dbus_interface_info_unref, vFp)
//GO(g_dbus_interface_skeleton_get_info,
//GO(g_dbus_interface_skeleton_get_object_path,
//GO(g_dbus_interface_skeleton_get_properties,
//GO(g_dbus_interface_skeleton_get_type,
GO(g_dbus_interface_skeleton_get_type, pFv)
//GO(g_dbus_interface_skeleton_get_vtable,
//GO(g_dbus_interface_skeleton_has_connection,
//GO(g_dbus_interface_skeleton_set_flags,
Expand Down Expand Up @@ -491,7 +491,7 @@ GOM(g_dbus_object_manager_client_new_for_bus_sync, pFEiippppppp)
GO(g_dbus_object_manager_get_object, pFpp)
GO(g_dbus_object_manager_get_object_path, pFp)
GO(g_dbus_object_manager_get_objects, pFp)
//GO(g_dbus_object_manager_get_type,
GO(g_dbus_object_manager_get_type, pFv)
//GO(g_dbus_object_manager_server_export,
//GO(g_dbus_object_manager_server_export_uniquely,
//GO(g_dbus_object_manager_server_get_connection,
Expand All @@ -501,7 +501,7 @@ GO(g_dbus_object_manager_get_objects, pFp)
//GO(g_dbus_object_manager_server_set_connection,
//GO(g_dbus_object_manager_server_unexport,
//GO(g_dbus_object_proxy_get_connection,
//GO(g_dbus_object_proxy_get_type,
GO(g_dbus_object_proxy_get_type, pFv)
//GO(g_dbus_object_proxy_new,
//GO(g_dbus_object_skeleton_add_interface,
//GO(g_dbus_object_skeleton_flush,
Expand Down
71 changes: 71 additions & 0 deletions src/wrapped/wrappedlibnm.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,81 @@
#include "bridge.h"
#include "librarian/library_private.h"
#include "x86emu.h"
#include "callback.h"

const char* libnmName = "libnm.so.0";
#define LIBNAME libnm

#define ADDED_FUNCTIONS() \

#include "generated/wrappedlibnmtypes.h"

#include "wrappercallback.h"

// utility functions
#define SUPER() \
GO(0) \
GO(1) \
GO(2) \
GO(3) \
GO(4)

// GAsyncReadyCallback
#define GO(A) \
static uintptr_t my_GAsyncReadyCallback_fct_##A = 0; \
static void my_GAsyncReadyCallback_##A(void* a, void* b, void* c) \
{ \
RunFunction(my_context, my_GAsyncReadyCallback_fct_##A, 3, a, b, c);\
}
SUPER()
#undef GO
static void* findGAsyncReadyCallbackFct(void* fct)
{
if(!fct) return NULL;
void* p;
if((p = GetNativeFnc((uintptr_t)fct))) return p;
#define GO(A) if(my_GAsyncReadyCallback_fct_##A == (uintptr_t)fct) return my_GAsyncReadyCallback_##A;
SUPER()
#undef GO
#define GO(A) if(my_GAsyncReadyCallback_fct_##A == 0) {my_GAsyncReadyCallback_fct_##A = (uintptr_t)fct; return my_GAsyncReadyCallback_##A; }
SUPER()
#undef GO
printf_log(LOG_NONE, "Warning, no more slot for libnm GAsyncReadyCallback callback\n");
return NULL;
}

#undef SUPER

EXPORT void my_nm_remote_connection_commit_changes_async(x86emu_t* emu, void* connection, int save, void* cancellable, void* cb, void* data)
{
my->nm_remote_connection_commit_changes_async(connection, save, cancellable, findGAsyncReadyCallbackFct(cb), data);
}

EXPORT void my_nm_remote_connection_get_secrets_async(x86emu_t* emu, void* connection, void* name, void* cancellable, void* cb, void* data)
{
my->nm_remote_connection_get_secrets_async(connection, name, cancellable, findGAsyncReadyCallbackFct(cb), data);
}

EXPORT void my_nm_remote_connection_delete_async(x86emu_t* emu, void* connection, void* cancellable, void* cb, void* data)
{
my->nm_remote_connection_delete_async(connection, cancellable, findGAsyncReadyCallbackFct(cb), data);
}

EXPORT void my_nm_client_add_and_activate_connection_async(x86emu_t* emu, void* client, void* partial, void* device, void* spec, void* cancellable, void* cb, void* data)
{
my->nm_client_add_and_activate_connection_async(client, partial, device, spec, cancellable, findGAsyncReadyCallbackFct(cb), data);
}

EXPORT void my_nm_device_disconnect_async(x86emu_t* emu, void* device, void* cancellable, void* cb, void* data)
{
my->nm_device_disconnect_async(device, cancellable, findGAsyncReadyCallbackFct(cb), data);
}

EXPORT void my_nm_device_wifi_request_scan_async(x86emu_t* emu, void* device, void* cancellable, void* cb, void* data)
{
my->nm_device_wifi_request_scan_async(device, cancellable, findGAsyncReadyCallbackFct(cb), data);
}

#define PRE_INIT \
if(box86_nogtk) \
return -1;
Expand Down
Loading

0 comments on commit 432e09c

Please sign in to comment.