diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-03-12 22:47:55 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-03-12 22:47:55 +0100 |
| commit | c257075df09627775f5c1b46238954dee36e4940 (patch) | |
| tree | 0544ca35ef60f5dcd248d25706b87071e1dc0e72 /src | |
| parent | b1fa994d8258f1f17852ecc96709386f557e1b8b (diff) | |
| download | box64-c257075df09627775f5c1b46238954dee36e4940.tar.gz box64-c257075df09627775f5c1b46238954dee36e4940.zip | |
Added wrapped libpulse and libpulsesimple
Diffstat (limited to 'src')
| -rwxr-xr-x | src/library_list.h | 4 | ||||
| -rw-r--r-- | src/wrapped/generated/functions_list.txt | 28 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.c | 56 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.h | 28 | ||||
| -rwxr-xr-x | src/wrapped/wrappedpulse.c | 1511 | ||||
| -rwxr-xr-x | src/wrapped/wrappedpulse_private.h | 288 | ||||
| -rwxr-xr-x | src/wrapped/wrappedpulsesimple.c | 33 | ||||
| -rwxr-xr-x | src/wrapped/wrappedpulsesimple_private.h | 11 |
8 files changed, 1957 insertions, 2 deletions
diff --git a/src/library_list.h b/src/library_list.h index 9774cc10..2238f024 100755 --- a/src/library_list.h +++ b/src/library_list.h @@ -81,8 +81,8 @@ GO("openal.so", openal) //GO("libutil.so.1", util) //GO("libuuid.so.1", libuuid) //GO("libresolv.so.2", libresolv) -//GO("libpulse-simple.so.0", pulsesimple) -//GO("libpulse.so.0", pulse) +GO("libpulse-simple.so.0", pulsesimple) +GO("libpulse.so.0", pulse) //GO("libsndfile.so.1", libsndfile) //GO("libgtk-x11-2.0.so.0", gtkx112) //GO("libgdk-x11-2.0.so.0", gdkx112) diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt index 3b61e9b0..ff5ce13b 100644 --- a/src/wrapped/generated/functions_list.txt +++ b/src/wrapped/generated/functions_list.txt @@ -27,13 +27,16 @@ #() uFv #() uFi #() uFu +#() uFd #() uFp #() UFv +#() UFp #() UFV #() fFi #() fFf #() fFp #() dFi +#() dFu #() dFd #() dFp #() lFE @@ -108,11 +111,14 @@ #() uFui #() uFuu #() uFup +#() uFUp #() uFpi #() uFpu #() uFpU #() uFpp #() UFEp +#() UFUp +#() UFpp #() fFif #() fFfi #() fFff @@ -137,6 +143,7 @@ #() pFpi #() pFpC #() pFpu +#() pFpU #() pFpL #() pFpp #() pFpV @@ -191,6 +198,7 @@ #() iFEWW #() iFEup #() iFEpi +#() iFEpL #() iFEpp #() iFEpV #() iFESp @@ -204,6 +212,7 @@ #() iFuup #() iFuff #() iFfff +#() iFLip #() iFLpp #() iFpii #() iFpiu @@ -280,13 +289,18 @@ #() pFpiL #() pFpip #() pFpCC +#() pFpui #() pFpuu #() pFpuL #() pFpup #() pFpUp +#() pFplp +#() pFpLu #() pFpLL +#() pFpLp #() pFppi #() pFppu +#() pFppf #() pFppL #() pFppp #() pFpOM @@ -412,6 +426,7 @@ #() LFpuuu #() LFpLLp #() LFppii +#() pFEipp #() pFEupp #() pFEpii #() pFEpip @@ -507,6 +522,7 @@ #() vFpuipp #() vFpddii #() vFppiii +#() vFppiip #() vFppWui #() vFpppii #() vFppppi @@ -516,8 +532,10 @@ #() iFEpipp #() iFEpipV #() iFEpLpp +#() iFEppip #() iFEppiV #() iFEpppp +#() iFEpppV #() iFiiupp #() iFipiii #() iFipppi @@ -556,9 +574,13 @@ #() LFppppp #() pFEpiii #() pFEpipL +#() pFEpipp +#() pFEpupp +#() pFEpppp #() pFuiiiu #() pFuiipp #() pFpiiuu +#() pFpiipp #() pFpCuup #() pFpCppp #() pFpuiii @@ -657,6 +679,10 @@ #() UFpippup #() LFSpLiip #() pFEpippp +#() pFEpuipp +#() pFEpuupp +#() pFEpuppp +#() pFEppppp #() pFiCiiCi #() pFpiiiiu #() pFpippip @@ -707,6 +733,7 @@ #() vFppiiipi #() vFpppiiii #() vFppppipi +#() iFEppLpIi #() iFEpppiiu #() iFEpppppp #() iFiiiiiip @@ -813,6 +840,7 @@ #() pFpCuWCCuuu #() pFpuuwwWWww #() pFppiiuuuLL +#() pFppipppppp #() vFiiiiiiiiiu #() vFuiiiiiiiii #() vFuiiiiiiuup diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c index 05da770b..9b61c3ed 100644 --- a/src/wrapped/generated/wrapper.c +++ b/src/wrapped/generated/wrapper.c @@ -60,13 +60,16 @@ typedef uint16_t (*WFp_t)(void*); typedef uint32_t (*uFv_t)(void); typedef uint32_t (*uFi_t)(int32_t); typedef uint32_t (*uFu_t)(uint32_t); +typedef uint32_t (*uFd_t)(double); typedef uint32_t (*uFp_t)(void*); typedef uint64_t (*UFv_t)(void); +typedef uint64_t (*UFp_t)(void*); typedef uint64_t (*UFV_t)(void*); typedef float (*fFi_t)(int32_t); typedef float (*fFf_t)(float); typedef float (*fFp_t)(void*); typedef double (*dFi_t)(int32_t); +typedef double (*dFu_t)(uint32_t); typedef double (*dFd_t)(double); typedef double (*dFp_t)(void*); typedef intptr_t (*lFE_t)(x64emu_t*); @@ -141,11 +144,14 @@ typedef uint32_t (*uFiu_t)(int32_t, uint32_t); typedef uint32_t (*uFui_t)(uint32_t, int32_t); typedef uint32_t (*uFuu_t)(uint32_t, uint32_t); typedef uint32_t (*uFup_t)(uint32_t, void*); +typedef uint32_t (*uFUp_t)(uint64_t, void*); typedef uint32_t (*uFpi_t)(void*, int32_t); typedef uint32_t (*uFpu_t)(void*, uint32_t); typedef uint32_t (*uFpU_t)(void*, uint64_t); typedef uint32_t (*uFpp_t)(void*, void*); typedef uint64_t (*UFEp_t)(x64emu_t*, void*); +typedef uint64_t (*UFUp_t)(uint64_t, void*); +typedef uint64_t (*UFpp_t)(void*, void*); typedef float (*fFif_t)(int32_t, float); typedef float (*fFfi_t)(float, int32_t); typedef float (*fFff_t)(float, float); @@ -170,6 +176,7 @@ typedef void* (*pFLL_t)(uintptr_t, uintptr_t); typedef void* (*pFpi_t)(void*, int32_t); typedef void* (*pFpC_t)(void*, uint8_t); typedef void* (*pFpu_t)(void*, uint32_t); +typedef void* (*pFpU_t)(void*, uint64_t); typedef void* (*pFpL_t)(void*, uintptr_t); typedef void* (*pFpp_t)(void*, void*); typedef void* (*pFpV_t)(void*, void*); @@ -224,6 +231,7 @@ typedef int32_t (*iFEip_t)(x64emu_t*, int32_t, void*); typedef int32_t (*iFEWW_t)(x64emu_t*, uint16_t, uint16_t); typedef int32_t (*iFEup_t)(x64emu_t*, uint32_t, void*); typedef int32_t (*iFEpi_t)(x64emu_t*, void*, int32_t); +typedef int32_t (*iFEpL_t)(x64emu_t*, void*, uintptr_t); typedef int32_t (*iFEpp_t)(x64emu_t*, void*, void*); typedef int32_t (*iFEpV_t)(x64emu_t*, void*, void*); typedef int32_t (*iFESp_t)(x64emu_t*, void*, void*); @@ -237,6 +245,7 @@ typedef int32_t (*iFipp_t)(int32_t, void*, void*); typedef int32_t (*iFuup_t)(uint32_t, uint32_t, void*); typedef int32_t (*iFuff_t)(uint32_t, float, float); typedef int32_t (*iFfff_t)(float, float, float); +typedef int32_t (*iFLip_t)(uintptr_t, int32_t, void*); typedef int32_t (*iFLpp_t)(uintptr_t, void*, void*); typedef int32_t (*iFpii_t)(void*, int32_t, int32_t); typedef int32_t (*iFpiu_t)(void*, int32_t, uint32_t); @@ -313,13 +322,18 @@ typedef void* (*pFpiu_t)(void*, int32_t, uint32_t); typedef void* (*pFpiL_t)(void*, int32_t, uintptr_t); typedef void* (*pFpip_t)(void*, int32_t, void*); typedef void* (*pFpCC_t)(void*, uint8_t, uint8_t); +typedef void* (*pFpui_t)(void*, uint32_t, int32_t); typedef void* (*pFpuu_t)(void*, uint32_t, uint32_t); typedef void* (*pFpuL_t)(void*, uint32_t, uintptr_t); typedef void* (*pFpup_t)(void*, uint32_t, void*); typedef void* (*pFpUp_t)(void*, uint64_t, void*); +typedef void* (*pFplp_t)(void*, intptr_t, void*); +typedef void* (*pFpLu_t)(void*, uintptr_t, uint32_t); typedef void* (*pFpLL_t)(void*, uintptr_t, uintptr_t); +typedef void* (*pFpLp_t)(void*, uintptr_t, void*); typedef void* (*pFppi_t)(void*, void*, int32_t); typedef void* (*pFppu_t)(void*, void*, uint32_t); +typedef void* (*pFppf_t)(void*, void*, float); typedef void* (*pFppL_t)(void*, void*, uintptr_t); typedef void* (*pFppp_t)(void*, void*, void*); typedef void* (*pFpOM_t)(void*, int32_t, ...); @@ -445,6 +459,7 @@ typedef intptr_t (*lFipLl_t)(int32_t, void*, uintptr_t, intptr_t); typedef uintptr_t (*LFpuuu_t)(void*, uint32_t, uint32_t, uint32_t); typedef uintptr_t (*LFpLLp_t)(void*, uintptr_t, uintptr_t, void*); typedef uintptr_t (*LFppii_t)(void*, void*, int32_t, int32_t); +typedef void* (*pFEipp_t)(x64emu_t*, int32_t, void*, void*); typedef void* (*pFEupp_t)(x64emu_t*, uint32_t, void*, void*); typedef void* (*pFEpii_t)(x64emu_t*, void*, int32_t, int32_t); typedef void* (*pFEpip_t)(x64emu_t*, void*, int32_t, void*); @@ -540,6 +555,7 @@ typedef void (*vFpipii_t)(void*, int32_t, void*, int32_t, int32_t); typedef void (*vFpuipp_t)(void*, uint32_t, int32_t, void*, void*); typedef void (*vFpddii_t)(void*, double, double, int32_t, int32_t); typedef void (*vFppiii_t)(void*, void*, int32_t, int32_t, int32_t); +typedef void (*vFppiip_t)(void*, void*, int32_t, int32_t, void*); typedef void (*vFppWui_t)(void*, void*, uint16_t, uint32_t, int32_t); typedef void (*vFpppii_t)(void*, void*, void*, int32_t, int32_t); typedef void (*vFppppi_t)(void*, void*, void*, void*, int32_t); @@ -549,8 +565,10 @@ typedef int32_t (*iFEpipi_t)(x64emu_t*, void*, int32_t, void*, int32_t); typedef int32_t (*iFEpipp_t)(x64emu_t*, void*, int32_t, void*, void*); typedef int32_t (*iFEpipV_t)(x64emu_t*, void*, int32_t, void*, void*); typedef int32_t (*iFEpLpp_t)(x64emu_t*, void*, uintptr_t, void*, void*); +typedef int32_t (*iFEppip_t)(x64emu_t*, void*, void*, int32_t, void*); typedef int32_t (*iFEppiV_t)(x64emu_t*, void*, void*, int32_t, void*); typedef int32_t (*iFEpppp_t)(x64emu_t*, void*, void*, void*, void*); +typedef int32_t (*iFEpppV_t)(x64emu_t*, void*, void*, void*, void*); typedef int32_t (*iFiiupp_t)(int32_t, int32_t, uint32_t, void*, void*); typedef int32_t (*iFipiii_t)(int32_t, void*, int32_t, int32_t, int32_t); typedef int32_t (*iFipppi_t)(int32_t, void*, void*, void*, int32_t); @@ -589,9 +607,13 @@ typedef uintptr_t (*LFpLLLp_t)(void*, uintptr_t, uintptr_t, uintptr_t, void*); typedef uintptr_t (*LFppppp_t)(void*, void*, void*, void*, void*); typedef void* (*pFEpiii_t)(x64emu_t*, void*, int32_t, int32_t, int32_t); typedef void* (*pFEpipL_t)(x64emu_t*, void*, int32_t, void*, uintptr_t); +typedef void* (*pFEpipp_t)(x64emu_t*, void*, int32_t, void*, void*); +typedef void* (*pFEpupp_t)(x64emu_t*, void*, uint32_t, void*, void*); +typedef void* (*pFEpppp_t)(x64emu_t*, void*, void*, void*, void*); typedef void* (*pFuiiiu_t)(uint32_t, int32_t, int32_t, int32_t, uint32_t); typedef void* (*pFuiipp_t)(uint32_t, int32_t, int32_t, void*, void*); typedef void* (*pFpiiuu_t)(void*, int32_t, int32_t, uint32_t, uint32_t); +typedef void* (*pFpiipp_t)(void*, int32_t, int32_t, void*, void*); typedef void* (*pFpCuup_t)(void*, uint8_t, uint32_t, uint32_t, void*); typedef void* (*pFpCppp_t)(void*, uint8_t, void*, void*, void*); typedef void* (*pFpuiii_t)(void*, uint32_t, int32_t, int32_t, int32_t); @@ -690,6 +712,10 @@ typedef uint32_t (*uFpippup_t)(void*, int32_t, void*, void*, uint32_t, void*); typedef uint64_t (*UFpippup_t)(void*, int32_t, void*, void*, uint32_t, void*); typedef uintptr_t (*LFSpLiip_t)(void*, void*, uintptr_t, int32_t, int32_t, void*); typedef void* (*pFEpippp_t)(x64emu_t*, void*, int32_t, void*, void*, void*); +typedef void* (*pFEpuipp_t)(x64emu_t*, void*, uint32_t, int32_t, void*, void*); +typedef void* (*pFEpuupp_t)(x64emu_t*, void*, uint32_t, uint32_t, void*, void*); +typedef void* (*pFEpuppp_t)(x64emu_t*, void*, uint32_t, void*, void*, void*); +typedef void* (*pFEppppp_t)(x64emu_t*, void*, void*, void*, void*, void*); typedef void* (*pFiCiiCi_t)(int32_t, uint8_t, int32_t, int32_t, uint8_t, int32_t); typedef void* (*pFpiiiiu_t)(void*, int32_t, int32_t, int32_t, int32_t, uint32_t); typedef void* (*pFpippip_t)(void*, int32_t, void*, void*, int32_t, void*); @@ -740,6 +766,7 @@ typedef void (*vFpddiidd_t)(void*, double, double, int32_t, int32_t, double, dou typedef void (*vFppiiipi_t)(void*, void*, int32_t, int32_t, int32_t, void*, int32_t); typedef void (*vFpppiiii_t)(void*, void*, void*, int32_t, int32_t, int32_t, int32_t); typedef void (*vFppppipi_t)(void*, void*, void*, void*, int32_t, void*, int32_t); +typedef int32_t (*iFEppLpIi_t)(x64emu_t*, void*, void*, uintptr_t, void*, int64_t, int32_t); typedef int32_t (*iFEpppiiu_t)(x64emu_t*, void*, void*, void*, int32_t, int32_t, uint32_t); typedef int32_t (*iFEpppppp_t)(x64emu_t*, void*, void*, void*, void*, void*, void*); typedef int32_t (*iFiiiiiip_t)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, void*); @@ -846,6 +873,7 @@ typedef void* (*pFpiiiiuuuu_t)(void*, int32_t, int32_t, int32_t, int32_t, uint32 typedef void* (*pFpCuWCCuuu_t)(void*, uint8_t, uint32_t, uint16_t, uint8_t, uint8_t, uint32_t, uint32_t, uint32_t); typedef void* (*pFpuuwwWWww_t)(void*, uint32_t, uint32_t, int16_t, int16_t, uint16_t, uint16_t, int16_t, int16_t); typedef void* (*pFppiiuuuLL_t)(void*, void*, int32_t, int32_t, uint32_t, uint32_t, uint32_t, uintptr_t, uintptr_t); +typedef void* (*pFppipppppp_t)(void*, void*, int32_t, void*, void*, void*, void*, void*, void*); typedef void (*vFiiiiiiiiiu_t)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint32_t); typedef void (*vFuiiiiiiiii_t)(uint32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); typedef void (*vFuiiiiiiuup_t)(uint32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, uint32_t, uint32_t, void*); @@ -958,13 +986,16 @@ void WFp(x64emu_t *emu, uintptr_t fcn) { WFp_t fn = (WFp_t)fcn; R_RAX=(unsigned void uFv(x64emu_t *emu, uintptr_t fcn) { uFv_t fn = (uFv_t)fcn; R_RAX=(uint32_t)fn(); } void uFi(x64emu_t *emu, uintptr_t fcn) { uFi_t fn = (uFi_t)fcn; R_RAX=(uint32_t)fn((int32_t)R_RDI); } void uFu(x64emu_t *emu, uintptr_t fcn) { uFu_t fn = (uFu_t)fcn; R_RAX=(uint32_t)fn((uint32_t)R_RDI); } +void uFd(x64emu_t *emu, uintptr_t fcn) { uFd_t fn = (uFd_t)fcn; R_RAX=(uint32_t)fn(emu->xmm[0].d[0]); } void uFp(x64emu_t *emu, uintptr_t fcn) { uFp_t fn = (uFp_t)fcn; R_RAX=(uint32_t)fn((void*)R_RDI); } void UFv(x64emu_t *emu, uintptr_t fcn) { UFv_t fn = (UFv_t)fcn; R_RAX=fn(); } +void UFp(x64emu_t *emu, uintptr_t fcn) { UFp_t fn = (UFp_t)fcn; R_RAX=fn((void*)R_RDI); } void UFV(x64emu_t *emu, uintptr_t fcn) { UFV_t fn = (UFV_t)fcn; R_RAX=fn((void*)(R_RSP + 8)); } void fFi(x64emu_t *emu, uintptr_t fcn) { fFi_t fn = (fFi_t)fcn; emu->xmm[0].f[0]=fn((int32_t)R_RDI); } void fFf(x64emu_t *emu, uintptr_t fcn) { fFf_t fn = (fFf_t)fcn; emu->xmm[0].f[0]=fn(emu->xmm[0].f[0]); } void fFp(x64emu_t *emu, uintptr_t fcn) { fFp_t fn = (fFp_t)fcn; emu->xmm[0].f[0]=fn((void*)R_RDI); } void dFi(x64emu_t *emu, uintptr_t fcn) { dFi_t fn = (dFi_t)fcn; emu->xmm[0].d[0]=fn((int32_t)R_RDI); } +void dFu(x64emu_t *emu, uintptr_t fcn) { dFu_t fn = (dFu_t)fcn; emu->xmm[0].d[0]=fn((uint32_t)R_RDI); } void dFd(x64emu_t *emu, uintptr_t fcn) { dFd_t fn = (dFd_t)fcn; emu->xmm[0].d[0]=fn(emu->xmm[0].d[0]); } void dFp(x64emu_t *emu, uintptr_t fcn) { dFp_t fn = (dFp_t)fcn; emu->xmm[0].d[0]=fn((void*)R_RDI); } void lFE(x64emu_t *emu, uintptr_t fcn) { lFE_t fn = (lFE_t)fcn; R_RAX=(intptr_t)fn(emu); } @@ -1039,11 +1070,14 @@ void uFiu(x64emu_t *emu, uintptr_t fcn) { uFiu_t fn = (uFiu_t)fcn; R_RAX=(uint32 void uFui(x64emu_t *emu, uintptr_t fcn) { uFui_t fn = (uFui_t)fcn; R_RAX=(uint32_t)fn((uint32_t)R_RDI, (int32_t)R_RSI); } void uFuu(x64emu_t *emu, uintptr_t fcn) { uFuu_t fn = (uFuu_t)fcn; R_RAX=(uint32_t)fn((uint32_t)R_RDI, (uint32_t)R_RSI); } void uFup(x64emu_t *emu, uintptr_t fcn) { uFup_t fn = (uFup_t)fcn; R_RAX=(uint32_t)fn((uint32_t)R_RDI, (void*)R_RSI); } +void uFUp(x64emu_t *emu, uintptr_t fcn) { uFUp_t fn = (uFUp_t)fcn; R_RAX=(uint32_t)fn((uint64_t)R_RDI, (void*)R_RSI); } void uFpi(x64emu_t *emu, uintptr_t fcn) { uFpi_t fn = (uFpi_t)fcn; R_RAX=(uint32_t)fn((void*)R_RDI, (int32_t)R_RSI); } void uFpu(x64emu_t *emu, uintptr_t fcn) { uFpu_t fn = (uFpu_t)fcn; R_RAX=(uint32_t)fn((void*)R_RDI, (uint32_t)R_RSI); } void uFpU(x64emu_t *emu, uintptr_t fcn) { uFpU_t fn = (uFpU_t)fcn; R_RAX=(uint32_t)fn((void*)R_RDI, (uint64_t)R_RSI); } void uFpp(x64emu_t *emu, uintptr_t fcn) { uFpp_t fn = (uFpp_t)fcn; R_RAX=(uint32_t)fn((void*)R_RDI, (void*)R_RSI); } void UFEp(x64emu_t *emu, uintptr_t fcn) { UFEp_t fn = (UFEp_t)fcn; R_RAX=fn(emu, (void*)R_RDI); } +void UFUp(x64emu_t *emu, uintptr_t fcn) { UFUp_t fn = (UFUp_t)fcn; R_RAX=fn((uint64_t)R_RDI, (void*)R_RSI); } +void UFpp(x64emu_t *emu, uintptr_t fcn) { UFpp_t fn = (UFpp_t)fcn; R_RAX=fn((void*)R_RDI, (void*)R_RSI); } void fFif(x64emu_t *emu, uintptr_t fcn) { fFif_t fn = (fFif_t)fcn; emu->xmm[0].f[0]=fn((int32_t)R_RDI, emu->xmm[0].f[0]); } void fFfi(x64emu_t *emu, uintptr_t fcn) { fFfi_t fn = (fFfi_t)fcn; emu->xmm[0].f[0]=fn(emu->xmm[0].f[0], (int32_t)R_RDI); } void fFff(x64emu_t *emu, uintptr_t fcn) { fFff_t fn = (fFff_t)fcn; emu->xmm[0].f[0]=fn(emu->xmm[0].f[0], emu->xmm[1].f[0]); } @@ -1068,6 +1102,7 @@ void pFLL(x64emu_t *emu, uintptr_t fcn) { pFLL_t fn = (pFLL_t)fcn; R_RAX=(uintpt void pFpi(x64emu_t *emu, uintptr_t fcn) { pFpi_t fn = (pFpi_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (int32_t)R_RSI); } void pFpC(x64emu_t *emu, uintptr_t fcn) { pFpC_t fn = (pFpC_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint8_t)R_RSI); } void pFpu(x64emu_t *emu, uintptr_t fcn) { pFpu_t fn = (pFpu_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint32_t)R_RSI); } +void pFpU(x64emu_t *emu, uintptr_t fcn) { pFpU_t fn = (pFpU_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint64_t)R_RSI); } void pFpL(x64emu_t *emu, uintptr_t fcn) { pFpL_t fn = (pFpL_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uintptr_t)R_RSI); } void pFpp(x64emu_t *emu, uintptr_t fcn) { pFpp_t fn = (pFpp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI); } void pFpV(x64emu_t *emu, uintptr_t fcn) { pFpV_t fn = (pFpV_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)(R_RSP + 8)); } @@ -1122,6 +1157,7 @@ void iFEip(x64emu_t *emu, uintptr_t fcn) { iFEip_t fn = (iFEip_t)fcn; R_RAX=fn(e void iFEWW(x64emu_t *emu, uintptr_t fcn) { iFEWW_t fn = (iFEWW_t)fcn; R_RAX=fn(emu, (uint16_t)R_RDI, (uint16_t)R_RSI); } void iFEup(x64emu_t *emu, uintptr_t fcn) { iFEup_t fn = (iFEup_t)fcn; R_RAX=fn(emu, (uint32_t)R_RDI, (void*)R_RSI); } void iFEpi(x64emu_t *emu, uintptr_t fcn) { iFEpi_t fn = (iFEpi_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (int32_t)R_RSI); } +void iFEpL(x64emu_t *emu, uintptr_t fcn) { iFEpL_t fn = (iFEpL_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (uintptr_t)R_RSI); } void iFEpp(x64emu_t *emu, uintptr_t fcn) { iFEpp_t fn = (iFEpp_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (void*)R_RSI); } void iFEpV(x64emu_t *emu, uintptr_t fcn) { iFEpV_t fn = (iFEpV_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (void*)(R_RSP + 8)); } void iFESp(x64emu_t *emu, uintptr_t fcn) { iFESp_t fn = (iFESp_t)fcn; R_RAX=fn(emu, io_convert((void*)R_RDI), (void*)R_RSI); } @@ -1135,6 +1171,7 @@ void iFipp(x64emu_t *emu, uintptr_t fcn) { iFipp_t fn = (iFipp_t)fcn; R_RAX=fn(( void iFuup(x64emu_t *emu, uintptr_t fcn) { iFuup_t fn = (iFuup_t)fcn; R_RAX=fn((uint32_t)R_RDI, (uint32_t)R_RSI, (void*)R_RDX); } void iFuff(x64emu_t *emu, uintptr_t fcn) { iFuff_t fn = (iFuff_t)fcn; R_RAX=fn((uint32_t)R_RDI, emu->xmm[0].f[0], emu->xmm[1].f[0]); } void iFfff(x64emu_t *emu, uintptr_t fcn) { iFfff_t fn = (iFfff_t)fcn; R_RAX=fn(emu->xmm[0].f[0], emu->xmm[1].f[0], emu->xmm[2].f[0]); } +void iFLip(x64emu_t *emu, uintptr_t fcn) { iFLip_t fn = (iFLip_t)fcn; R_RAX=fn((uintptr_t)R_RDI, (int32_t)R_RSI, (void*)R_RDX); } void iFLpp(x64emu_t *emu, uintptr_t fcn) { iFLpp_t fn = (iFLpp_t)fcn; R_RAX=fn((uintptr_t)R_RDI, (void*)R_RSI, (void*)R_RDX); } void iFpii(x64emu_t *emu, uintptr_t fcn) { iFpii_t fn = (iFpii_t)fcn; R_RAX=fn((void*)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX); } void iFpiu(x64emu_t *emu, uintptr_t fcn) { iFpiu_t fn = (iFpiu_t)fcn; R_RAX=fn((void*)R_RDI, (int32_t)R_RSI, (uint32_t)R_RDX); } @@ -1211,13 +1248,18 @@ void pFpiu(x64emu_t *emu, uintptr_t fcn) { pFpiu_t fn = (pFpiu_t)fcn; R_RAX=(uin void pFpiL(x64emu_t *emu, uintptr_t fcn) { pFpiL_t fn = (pFpiL_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (int32_t)R_RSI, (uintptr_t)R_RDX); } void pFpip(x64emu_t *emu, uintptr_t fcn) { pFpip_t fn = (pFpip_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX); } void pFpCC(x64emu_t *emu, uintptr_t fcn) { pFpCC_t fn = (pFpCC_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint8_t)R_RSI, (uint8_t)R_RDX); } +void pFpui(x64emu_t *emu, uintptr_t fcn) { pFpui_t fn = (pFpui_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint32_t)R_RSI, (int32_t)R_RDX); } void pFpuu(x64emu_t *emu, uintptr_t fcn) { pFpuu_t fn = (pFpuu_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint32_t)R_RSI, (uint32_t)R_RDX); } void pFpuL(x64emu_t *emu, uintptr_t fcn) { pFpuL_t fn = (pFpuL_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint32_t)R_RSI, (uintptr_t)R_RDX); } void pFpup(x64emu_t *emu, uintptr_t fcn) { pFpup_t fn = (pFpup_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint32_t)R_RSI, (void*)R_RDX); } void pFpUp(x64emu_t *emu, uintptr_t fcn) { pFpUp_t fn = (pFpUp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint64_t)R_RSI, (void*)R_RDX); } +void pFplp(x64emu_t *emu, uintptr_t fcn) { pFplp_t fn = (pFplp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (intptr_t)R_RSI, (void*)R_RDX); } +void pFpLu(x64emu_t *emu, uintptr_t fcn) { pFpLu_t fn = (pFpLu_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uintptr_t)R_RSI, (uint32_t)R_RDX); } void pFpLL(x64emu_t *emu, uintptr_t fcn) { pFpLL_t fn = (pFpLL_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uintptr_t)R_RSI, (uintptr_t)R_RDX); } +void pFpLp(x64emu_t *emu, uintptr_t fcn) { pFpLp_t fn = (pFpLp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uintptr_t)R_RSI, (void*)R_RDX); } void pFppi(x64emu_t *emu, uintptr_t fcn) { pFppi_t fn = (pFppi_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX); } void pFppu(x64emu_t *emu, uintptr_t fcn) { pFppu_t fn = (pFppu_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (uint32_t)R_RDX); } +void pFppf(x64emu_t *emu, uintptr_t fcn) { pFppf_t fn = (pFppf_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, emu->xmm[0].f[0]); } void pFppL(x64emu_t *emu, uintptr_t fcn) { pFppL_t fn = (pFppL_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX); } void pFppp(x64emu_t *emu, uintptr_t fcn) { pFppp_t fn = (pFppp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX); } void pFpOM(x64emu_t *emu, uintptr_t fcn) { pFpOM_t fn = (pFpOM_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, of_convert((int32_t)R_RSI), (void*)R_RDX, (void*)R_RCX); } @@ -1343,6 +1385,7 @@ void lFipLl(x64emu_t *emu, uintptr_t fcn) { lFipLl_t fn = (lFipLl_t)fcn; R_RAX=( void LFpuuu(x64emu_t *emu, uintptr_t fcn) { LFpuuu_t fn = (LFpuuu_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint32_t)R_RSI, (uint32_t)R_RDX, (uint32_t)R_RCX); } void LFpLLp(x64emu_t *emu, uintptr_t fcn) { LFpLLp_t fn = (LFpLLp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uintptr_t)R_RSI, (uintptr_t)R_RDX, (void*)R_RCX); } void LFppii(x64emu_t *emu, uintptr_t fcn) { LFppii_t fn = (LFppii_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX); } +void pFEipp(x64emu_t *emu, uintptr_t fcn) { pFEipp_t fn = (pFEipp_t)fcn; R_RAX=(uintptr_t)fn(emu, (int32_t)R_RDI, (void*)R_RSI, (void*)R_RDX); } void pFEupp(x64emu_t *emu, uintptr_t fcn) { pFEupp_t fn = (pFEupp_t)fcn; R_RAX=(uintptr_t)fn(emu, (uint32_t)R_RDI, (void*)R_RSI, (void*)R_RDX); } void pFEpii(x64emu_t *emu, uintptr_t fcn) { pFEpii_t fn = (pFEpii_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX); } void pFEpip(x64emu_t *emu, uintptr_t fcn) { pFEpip_t fn = (pFEpip_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX); } @@ -1438,6 +1481,7 @@ void vFpipii(x64emu_t *emu, uintptr_t fcn) { vFpipii_t fn = (vFpipii_t)fcn; fn(( void vFpuipp(x64emu_t *emu, uintptr_t fcn) { vFpuipp_t fn = (vFpuipp_t)fcn; fn((void*)R_RDI, (uint32_t)R_RSI, (int32_t)R_RDX, (void*)R_RCX, (void*)R_R8); } void vFpddii(x64emu_t *emu, uintptr_t fcn) { vFpddii_t fn = (vFpddii_t)fcn; fn((void*)R_RDI, emu->xmm[0].d[0], emu->xmm[1].d[0], (int32_t)R_RSI, (int32_t)R_RDX); } void vFppiii(x64emu_t *emu, uintptr_t fcn) { vFppiii_t fn = (vFppiii_t)fcn; fn((void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (int32_t)R_R8); } +void vFppiip(x64emu_t *emu, uintptr_t fcn) { vFppiip_t fn = (vFppiip_t)fcn; fn((void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (void*)R_R8); } void vFppWui(x64emu_t *emu, uintptr_t fcn) { vFppWui_t fn = (vFppWui_t)fcn; fn((void*)R_RDI, (void*)R_RSI, (uint16_t)R_RDX, (uint32_t)R_RCX, (int32_t)R_R8); } void vFpppii(x64emu_t *emu, uintptr_t fcn) { vFpppii_t fn = (vFpppii_t)fcn; fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (int32_t)R_RCX, (int32_t)R_R8); } void vFppppi(x64emu_t *emu, uintptr_t fcn) { vFppppi_t fn = (vFppppi_t)fcn; fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (int32_t)R_R8); } @@ -1447,8 +1491,10 @@ void iFEpipi(x64emu_t *emu, uintptr_t fcn) { iFEpipi_t fn = (iFEpipi_t)fcn; R_RA void iFEpipp(x64emu_t *emu, uintptr_t fcn) { iFEpipp_t fn = (iFEpipp_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)R_RCX); } void iFEpipV(x64emu_t *emu, uintptr_t fcn) { iFEpipV_t fn = (iFEpipV_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)(R_RSP + 8)); } void iFEpLpp(x64emu_t *emu, uintptr_t fcn) { iFEpLpp_t fn = (iFEpLpp_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (uintptr_t)R_RSI, (void*)R_RDX, (void*)R_RCX); } +void iFEppip(x64emu_t *emu, uintptr_t fcn) { iFEppip_t fn = (iFEppip_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (void*)R_RCX); } void iFEppiV(x64emu_t *emu, uintptr_t fcn) { iFEppiV_t fn = (iFEppiV_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (void*)(R_RSP + 8)); } void iFEpppp(x64emu_t *emu, uintptr_t fcn) { iFEpppp_t fn = (iFEpppp_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX); } +void iFEpppV(x64emu_t *emu, uintptr_t fcn) { iFEpppV_t fn = (iFEpppV_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)(R_RSP + 8)); } void iFiiupp(x64emu_t *emu, uintptr_t fcn) { iFiiupp_t fn = (iFiiupp_t)fcn; R_RAX=fn((int32_t)R_RDI, (int32_t)R_RSI, (uint32_t)R_RDX, (void*)R_RCX, (void*)R_R8); } void iFipiii(x64emu_t *emu, uintptr_t fcn) { iFipiii_t fn = (iFipiii_t)fcn; R_RAX=fn((int32_t)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (int32_t)R_R8); } void iFipppi(x64emu_t *emu, uintptr_t fcn) { iFipppi_t fn = (iFipppi_t)fcn; R_RAX=fn((int32_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (int32_t)R_R8); } @@ -1487,9 +1533,13 @@ void LFpLLLp(x64emu_t *emu, uintptr_t fcn) { LFpLLLp_t fn = (LFpLLLp_t)fcn; R_RA void LFppppp(x64emu_t *emu, uintptr_t fcn) { LFppppp_t fn = (LFppppp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8); } void pFEpiii(x64emu_t *emu, uintptr_t fcn) { pFEpiii_t fn = (pFEpiii_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX); } void pFEpipL(x64emu_t *emu, uintptr_t fcn) { pFEpipL_t fn = (pFEpipL_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (uintptr_t)R_RCX); } +void pFEpipp(x64emu_t *emu, uintptr_t fcn) { pFEpipp_t fn = (pFEpipp_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)R_RCX); } +void pFEpupp(x64emu_t *emu, uintptr_t fcn) { pFEpupp_t fn = (pFEpupp_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (uint32_t)R_RSI, (void*)R_RDX, (void*)R_RCX); } +void pFEpppp(x64emu_t *emu, uintptr_t fcn) { pFEpppp_t fn = (pFEpppp_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX); } void pFuiiiu(x64emu_t *emu, uintptr_t fcn) { pFuiiiu_t fn = (pFuiiiu_t)fcn; R_RAX=(uintptr_t)fn((uint32_t)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (uint32_t)R_R8); } void pFuiipp(x64emu_t *emu, uintptr_t fcn) { pFuiipp_t fn = (pFuiipp_t)fcn; R_RAX=(uintptr_t)fn((uint32_t)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (void*)R_RCX, (void*)R_R8); } void pFpiiuu(x64emu_t *emu, uintptr_t fcn) { pFpiiuu_t fn = (pFpiiuu_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (uint32_t)R_RCX, (uint32_t)R_R8); } +void pFpiipp(x64emu_t *emu, uintptr_t fcn) { pFpiipp_t fn = (pFpiipp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (void*)R_RCX, (void*)R_R8); } void pFpCuup(x64emu_t *emu, uintptr_t fcn) { pFpCuup_t fn = (pFpCuup_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint8_t)R_RSI, (uint32_t)R_RDX, (uint32_t)R_RCX, (void*)R_R8); } void pFpCppp(x64emu_t *emu, uintptr_t fcn) { pFpCppp_t fn = (pFpCppp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint8_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8); } void pFpuiii(x64emu_t *emu, uintptr_t fcn) { pFpuiii_t fn = (pFpuiii_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint32_t)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (int32_t)R_R8); } @@ -1588,6 +1638,10 @@ void uFpippup(x64emu_t *emu, uintptr_t fcn) { uFpippup_t fn = (uFpippup_t)fcn; R void UFpippup(x64emu_t *emu, uintptr_t fcn) { UFpippup_t fn = (UFpippup_t)fcn; R_RAX=fn((void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (uint32_t)R_R8, (void*)R_R9); } void LFSpLiip(x64emu_t *emu, uintptr_t fcn) { LFSpLiip_t fn = (LFSpLiip_t)fcn; R_RAX=(uintptr_t)fn(io_convert((void*)R_RDI), (void*)R_RSI, (uintptr_t)R_RDX, (int32_t)R_RCX, (int32_t)R_R8, (void*)R_R9); } void pFEpippp(x64emu_t *emu, uintptr_t fcn) { pFEpippp_t fn = (pFEpippp_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8); } +void pFEpuipp(x64emu_t *emu, uintptr_t fcn) { pFEpuipp_t fn = (pFEpuipp_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (uint32_t)R_RSI, (int32_t)R_RDX, (void*)R_RCX, (void*)R_R8); } +void pFEpuupp(x64emu_t *emu, uintptr_t fcn) { pFEpuupp_t fn = (pFEpuupp_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (uint32_t)R_RSI, (uint32_t)R_RDX, (void*)R_RCX, (void*)R_R8); } +void pFEpuppp(x64emu_t *emu, uintptr_t fcn) { pFEpuppp_t fn = (pFEpuppp_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (uint32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8); } +void pFEppppp(x64emu_t *emu, uintptr_t fcn) { pFEppppp_t fn = (pFEppppp_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8); } void pFiCiiCi(x64emu_t *emu, uintptr_t fcn) { pFiCiiCi_t fn = (pFiCiiCi_t)fcn; R_RAX=(uintptr_t)fn((int32_t)R_RDI, (uint8_t)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (uint8_t)R_R8, (int32_t)R_R9); } void pFpiiiiu(x64emu_t *emu, uintptr_t fcn) { pFpiiiiu_t fn = (pFpiiiiu_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (int32_t)R_R8, (uint32_t)R_R9); } void pFpippip(x64emu_t *emu, uintptr_t fcn) { pFpippip_t fn = (pFpippip_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (int32_t)R_R8, (void*)R_R9); } @@ -1638,6 +1692,7 @@ void vFpddiidd(x64emu_t *emu, uintptr_t fcn) { vFpddiidd_t fn = (vFpddiidd_t)fcn void vFppiiipi(x64emu_t *emu, uintptr_t fcn) { vFppiiipi_t fn = (vFppiiipi_t)fcn; fn((void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (int32_t)R_R8, (void*)R_R9, *(int32_t*)(R_RSP + 8)); } void vFpppiiii(x64emu_t *emu, uintptr_t fcn) { vFpppiiii_t fn = (vFpppiiii_t)fcn; fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (int32_t)R_RCX, (int32_t)R_R8, (int32_t)R_R9, *(int32_t*)(R_RSP + 8)); } void vFppppipi(x64emu_t *emu, uintptr_t fcn) { vFppppipi_t fn = (vFppppipi_t)fcn; fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (int32_t)R_R8, (void*)R_R9, *(int32_t*)(R_RSP + 8)); } +void iFEppLpIi(x64emu_t *emu, uintptr_t fcn) { iFEppLpIi_t fn = (iFEppLpIi_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (void*)R_RCX, (int64_t)R_R8, (int32_t)R_R9); } void iFEpppiiu(x64emu_t *emu, uintptr_t fcn) { iFEpppiiu_t fn = (iFEpppiiu_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (int32_t)R_RCX, (int32_t)R_R8, (uint32_t)R_R9); } void iFEpppppp(x64emu_t *emu, uintptr_t fcn) { iFEpppppp_t fn = (iFEpppppp_t)fcn; R_RAX=fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9); } void iFiiiiiip(x64emu_t *emu, uintptr_t fcn) { iFiiiiiip_t fn = (iFiiiiiip_t)fcn; R_RAX=fn((int32_t)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (int32_t)R_R8, (int32_t)R_R9, *(void**)(R_RSP + 8)); } @@ -1744,6 +1799,7 @@ void pFpiiiiuuuu(x64emu_t *emu, uintptr_t fcn) { pFpiiiiuuuu_t fn = (pFpiiiiuuuu void pFpCuWCCuuu(x64emu_t *emu, uintptr_t fcn) { pFpCuWCCuuu_t fn = (pFpCuWCCuuu_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint8_t)R_RSI, (uint32_t)R_RDX, (uint16_t)R_RCX, (uint8_t)R_R8, (uint8_t)R_R9, *(uint32_t*)(R_RSP + 8), *(uint32_t*)(R_RSP + 16), *(uint32_t*)(R_RSP + 24)); } void pFpuuwwWWww(x64emu_t *emu, uintptr_t fcn) { pFpuuwwWWww_t fn = (pFpuuwwWWww_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uint32_t)R_RSI, (uint32_t)R_RDX, (int16_t)R_RCX, (int16_t)R_R8, (uint16_t)R_R9, *(uint16_t*)(R_RSP + 8), *(int16_t*)(R_RSP + 16), *(int16_t*)(R_RSP + 24)); } void pFppiiuuuLL(x64emu_t *emu, uintptr_t fcn) { pFppiiuuuLL_t fn = (pFppiiuuuLL_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (uint32_t)R_R8, (uint32_t)R_R9, *(uint32_t*)(R_RSP + 8), *(uintptr_t*)(R_RSP + 16), *(uintptr_t*)(R_RSP + 24)); } +void pFppipppppp(x64emu_t *emu, uintptr_t fcn) { pFppipppppp_t fn = (pFppipppppp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8), *(void**)(R_RSP + 16), *(void**)(R_RSP + 24)); } void vFiiiiiiiiiu(x64emu_t *emu, uintptr_t fcn) { vFiiiiiiiiiu_t fn = (vFiiiiiiiiiu_t)fcn; fn((int32_t)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (int32_t)R_R8, (int32_t)R_R9, *(int32_t*)(R_RSP + 8), *(int32_t*)(R_RSP + 16), *(int32_t*)(R_RSP + 24), *(uint32_t*)(R_RSP + 32)); } void vFuiiiiiiiii(x64emu_t *emu, uintptr_t fcn) { vFuiiiiiiiii_t fn = (vFuiiiiiiiii_t)fcn; fn((uint32_t)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (int32_t)R_R8, (int32_t)R_R9, *(int32_t*)(R_RSP + 8), *(int32_t*)(R_RSP + 16), *(int32_t*)(R_RSP + 24), *(int32_t*)(R_RSP + 32)); } void vFuiiiiiiuup(x64emu_t *emu, uintptr_t fcn) { vFuiiiiiiuup_t fn = (vFuiiiiiiuup_t)fcn; fn((uint32_t)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (int32_t)R_R8, (int32_t)R_R9, *(int32_t*)(R_RSP + 8), *(uint32_t*)(R_RSP + 16), *(uint32_t*)(R_RSP + 24), *(void**)(R_RSP + 32)); } diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h index 0573918b..00cb0cb1 100644 --- a/src/wrapped/generated/wrapper.h +++ b/src/wrapped/generated/wrapper.h @@ -57,13 +57,16 @@ void WFp(x64emu_t *emu, uintptr_t fnc); void uFv(x64emu_t *emu, uintptr_t fnc); void uFi(x64emu_t *emu, uintptr_t fnc); void uFu(x64emu_t *emu, uintptr_t fnc); +void uFd(x64emu_t *emu, uintptr_t fnc); void uFp(x64emu_t *emu, uintptr_t fnc); void UFv(x64emu_t *emu, uintptr_t fnc); +void UFp(x64emu_t *emu, uintptr_t fnc); void UFV(x64emu_t *emu, uintptr_t fnc); void fFi(x64emu_t *emu, uintptr_t fnc); void fFf(x64emu_t *emu, uintptr_t fnc); void fFp(x64emu_t *emu, uintptr_t fnc); void dFi(x64emu_t *emu, uintptr_t fnc); +void dFu(x64emu_t *emu, uintptr_t fnc); void dFd(x64emu_t *emu, uintptr_t fnc); void dFp(x64emu_t *emu, uintptr_t fnc); void lFE(x64emu_t *emu, uintptr_t fnc); @@ -138,11 +141,14 @@ void uFiu(x64emu_t *emu, uintptr_t fnc); void uFui(x64emu_t *emu, uintptr_t fnc); void uFuu(x64emu_t *emu, uintptr_t fnc); void uFup(x64emu_t *emu, uintptr_t fnc); +void uFUp(x64emu_t *emu, uintptr_t fnc); void uFpi(x64emu_t *emu, uintptr_t fnc); void uFpu(x64emu_t *emu, uintptr_t fnc); void uFpU(x64emu_t *emu, uintptr_t fnc); void uFpp(x64emu_t *emu, uintptr_t fnc); void UFEp(x64emu_t *emu, uintptr_t fnc); +void UFUp(x64emu_t *emu, uintptr_t fnc); +void UFpp(x64emu_t *emu, uintptr_t fnc); void fFif(x64emu_t *emu, uintptr_t fnc); void fFfi(x64emu_t *emu, uintptr_t fnc); void fFff(x64emu_t *emu, uintptr_t fnc); @@ -167,6 +173,7 @@ void pFLL(x64emu_t *emu, uintptr_t fnc); void pFpi(x64emu_t *emu, uintptr_t fnc); void pFpC(x64emu_t *emu, uintptr_t fnc); void pFpu(x64emu_t *emu, uintptr_t fnc); +void pFpU(x64emu_t *emu, uintptr_t fnc); void pFpL(x64emu_t *emu, uintptr_t fnc); void pFpp(x64emu_t *emu, uintptr_t fnc); void pFpV(x64emu_t *emu, uintptr_t fnc); @@ -221,6 +228,7 @@ void iFEip(x64emu_t *emu, uintptr_t fnc); void iFEWW(x64emu_t *emu, uintptr_t fnc); void iFEup(x64emu_t *emu, uintptr_t fnc); void iFEpi(x64emu_t *emu, uintptr_t fnc); +void iFEpL(x64emu_t *emu, uintptr_t fnc); void iFEpp(x64emu_t *emu, uintptr_t fnc); void iFEpV(x64emu_t *emu, uintptr_t fnc); void iFESp(x64emu_t *emu, uintptr_t fnc); @@ -234,6 +242,7 @@ void iFipp(x64emu_t *emu, uintptr_t fnc); void iFuup(x64emu_t *emu, uintptr_t fnc); void iFuff(x64emu_t *emu, uintptr_t fnc); void iFfff(x64emu_t *emu, uintptr_t fnc); +void iFLip(x64emu_t *emu, uintptr_t fnc); void iFLpp(x64emu_t *emu, uintptr_t fnc); void iFpii(x64emu_t *emu, uintptr_t fnc); void iFpiu(x64emu_t *emu, uintptr_t fnc); @@ -310,13 +319,18 @@ void pFpiu(x64emu_t *emu, uintptr_t fnc); void pFpiL(x64emu_t *emu, uintptr_t fnc); void pFpip(x64emu_t *emu, uintptr_t fnc); void pFpCC(x64emu_t *emu, uintptr_t fnc); +void pFpui(x64emu_t *emu, uintptr_t fnc); void pFpuu(x64emu_t *emu, uintptr_t fnc); void pFpuL(x64emu_t *emu, uintptr_t fnc); void pFpup(x64emu_t *emu, uintptr_t fnc); void pFpUp(x64emu_t *emu, uintptr_t fnc); +void pFplp(x64emu_t *emu, uintptr_t fnc); +void pFpLu(x64emu_t *emu, uintptr_t fnc); void pFpLL(x64emu_t *emu, uintptr_t fnc); +void pFpLp(x64emu_t *emu, uintptr_t fnc); void pFppi(x64emu_t *emu, uintptr_t fnc); void pFppu(x64emu_t *emu, uintptr_t fnc); +void pFppf(x64emu_t *emu, uintptr_t fnc); void pFppL(x64emu_t *emu, uintptr_t fnc); void pFppp(x64emu_t *emu, uintptr_t fnc); void pFpOM(x64emu_t *emu, uintptr_t fnc); @@ -442,6 +456,7 @@ void lFipLl(x64emu_t *emu, uintptr_t fnc); void LFpuuu(x64emu_t *emu, uintptr_t fnc); void LFpLLp(x64emu_t *emu, uintptr_t fnc); void LFppii(x64emu_t *emu, uintptr_t fnc); +void pFEipp(x64emu_t *emu, uintptr_t fnc); void pFEupp(x64emu_t *emu, uintptr_t fnc); void pFEpii(x64emu_t *emu, uintptr_t fnc); void pFEpip(x64emu_t *emu, uintptr_t fnc); @@ -537,6 +552,7 @@ void vFpipii(x64emu_t *emu, uintptr_t fnc); void vFpuipp(x64emu_t *emu, uintptr_t fnc); void vFpddii(x64emu_t *emu, uintptr_t fnc); void vFppiii(x64emu_t *emu, uintptr_t fnc); +void vFppiip(x64emu_t *emu, uintptr_t fnc); void vFppWui(x64emu_t *emu, uintptr_t fnc); void vFpppii(x64emu_t *emu, uintptr_t fnc); void vFppppi(x64emu_t *emu, uintptr_t fnc); @@ -546,8 +562,10 @@ void iFEpipi(x64emu_t *emu, uintptr_t fnc); void iFEpipp(x64emu_t *emu, uintptr_t fnc); void iFEpipV(x64emu_t *emu, uintptr_t fnc); void iFEpLpp(x64emu_t *emu, uintptr_t fnc); +void iFEppip(x64emu_t *emu, uintptr_t fnc); void iFEppiV(x64emu_t *emu, uintptr_t fnc); void iFEpppp(x64emu_t *emu, uintptr_t fnc); +void iFEpppV(x64emu_t *emu, uintptr_t fnc); void iFiiupp(x64emu_t *emu, uintptr_t fnc); void iFipiii(x64emu_t *emu, uintptr_t fnc); void iFipppi(x64emu_t *emu, uintptr_t fnc); @@ -586,9 +604,13 @@ void LFpLLLp(x64emu_t *emu, uintptr_t fnc); void LFppppp(x64emu_t *emu, uintptr_t fnc); void pFEpiii(x64emu_t *emu, uintptr_t fnc); void pFEpipL(x64emu_t *emu, uintptr_t fnc); +void pFEpipp(x64emu_t *emu, uintptr_t fnc); +void pFEpupp(x64emu_t *emu, uintptr_t fnc); +void pFEpppp(x64emu_t *emu, uintptr_t fnc); void pFuiiiu(x64emu_t *emu, uintptr_t fnc); void pFuiipp(x64emu_t *emu, uintptr_t fnc); void pFpiiuu(x64emu_t *emu, uintptr_t fnc); +void pFpiipp(x64emu_t *emu, uintptr_t fnc); void pFpCuup(x64emu_t *emu, uintptr_t fnc); void pFpCppp(x64emu_t *emu, uintptr_t fnc); void pFpuiii(x64emu_t *emu, uintptr_t fnc); @@ -687,6 +709,10 @@ void uFpippup(x64emu_t *emu, uintptr_t fnc); void UFpippup(x64emu_t *emu, uintptr_t fnc); void LFSpLiip(x64emu_t *emu, uintptr_t fnc); void pFEpippp(x64emu_t *emu, uintptr_t fnc); +void pFEpuipp(x64emu_t *emu, uintptr_t fnc); +void pFEpuupp(x64emu_t *emu, uintptr_t fnc); +void pFEpuppp(x64emu_t *emu, uintptr_t fnc); +void pFEppppp(x64emu_t *emu, uintptr_t fnc); void pFiCiiCi(x64emu_t *emu, uintptr_t fnc); void pFpiiiiu(x64emu_t *emu, uintptr_t fnc); void pFpippip(x64emu_t *emu, uintptr_t fnc); @@ -737,6 +763,7 @@ void vFpddiidd(x64emu_t *emu, uintptr_t fnc); void vFppiiipi(x64emu_t *emu, uintptr_t fnc); void vFpppiiii(x64emu_t *emu, uintptr_t fnc); void vFppppipi(x64emu_t *emu, uintptr_t fnc); +void iFEppLpIi(x64emu_t *emu, uintptr_t fnc); void iFEpppiiu(x64emu_t *emu, uintptr_t fnc); void iFEpppppp(x64emu_t *emu, uintptr_t fnc); void iFiiiiiip(x64emu_t *emu, uintptr_t fnc); @@ -843,6 +870,7 @@ void pFpiiiiuuuu(x64emu_t *emu, uintptr_t fnc); void pFpCuWCCuuu(x64emu_t *emu, uintptr_t fnc); void pFpuuwwWWww(x64emu_t *emu, uintptr_t fnc); void pFppiiuuuLL(x64emu_t *emu, uintptr_t fnc); +void pFppipppppp(x64emu_t *emu, uintptr_t fnc); void vFiiiiiiiiiu(x64emu_t *emu, uintptr_t fnc); void vFuiiiiiiiii(x64emu_t *emu, uintptr_t fnc); void vFuiiiiiiuup(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped/wrappedpulse.c b/src/wrapped/wrappedpulse.c new file mode 100755 index 00000000..81fb38c7 --- /dev/null +++ b/src/wrapped/wrappedpulse.c @@ -0,0 +1,1511 @@ +#define _GNU_SOURCE /* See feature_test_macros(7) */ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <dlfcn.h> + +#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* pulseName = "libpulse.so.0"; +#define LIBNAME pulse + +typedef struct my_pa_mainloop_api_s { + void* data; + void* io_new; + void* io_enable; + void* io_free; + void* io_set_destroy; + void* time_new; + void* time_restart; + void* time_free; + void* time_set_destroy; + void* defer_new; + void* defer_enable; + void* defer_free; + void* defer_set_destroy; + void* quit; +} my_pa_mainloop_api_t; + +typedef void (*vFp_t)(void*); +typedef void* (*pFp_t)(void*); +typedef int (*iFp_t)(void*); +typedef void (*vFpi_t)(void*, int32_t); +typedef void* (*pFpp_t)(void*, void*); +typedef void (*vFpp_t)(void*, void*); +typedef int (*iFppp_t)(void*, void*, void*); +typedef void* (*pFipp_t)(int32_t, void*, void*); +typedef void* (*pFppp_t)(void*, void*, void*); +typedef void (*vFppp_t)(void*, void*, void*); +typedef void* (*pFpipp_t)(void*, int32_t, void*, void*); +typedef int (*iFppip_t)(void*, void*, int, void*); +typedef void* (*pFpppp_t)(void*, void*, void*, void*); +typedef void* (*pFpupp_t)(void*, uint32_t, void*, void*); +typedef void* (*pFpiipp_t)(void*, int32_t, int32_t, void*, void*); +typedef void* (*pFppppp_t)(void*, void*, void*, void*, void*); +typedef void* (*pFpippp_t)(void*, int32_t, void*, void*, void*); +typedef void* (*pFpuipp_t)(void*, uint32_t, int, void*, void*); +typedef void* (*pFpuppp_t)(void*, uint32_t, void*, void*, void*); +typedef void* (*pFpuupp_t)(void*, uint32_t, uint32_t, void*, void*); +typedef int (*iFppLpIi_t)(void*, void*, size_t, void*, int64_t, int32_t); + +#if 0 +#ifdef NOALIGN +typedef void (*vFipippV_t)(int, void*, int, void*, void*, va_list); +#else +typedef void (*vFipippV_t)(int, void*, int, void*, void*, void*); +#endif + GO(pa_log_level_meta, vFipippV_t) +#endif + +#define SUPER() \ + GO(pa_mainloop_free, vFp_t) \ + GO(pa_mainloop_get_api, pFp_t) \ + GO(pa_threaded_mainloop_free, vFp_t) \ + GO(pa_threaded_mainloop_get_api, pFp_t) \ + GO(pa_signal_init, iFp_t) \ + GO(pa_signal_new, pFipp_t) \ + GO(pa_signal_set_destroy, vFpp_t) \ + GO(pa_context_new, pFpp_t) \ + GO(pa_context_new_with_proplist, pFppp_t) \ + GO(pa_context_get_state, iFp_t) \ + GO(pa_context_exit_daemon, pFppp_t) \ + GO(pa_context_set_state_callback, vFppp_t) \ + GO(pa_context_set_default_sink, pFpppp_t) \ + GO(pa_context_set_default_source, pFpppp_t) \ + GO(pa_context_move_sink_input_by_index, pFpuupp_t) \ + GO(pa_context_get_module_info_list, pFppp_t) \ + GO(pa_context_get_client_info_list, pFppp_t) \ + GO(pa_context_get_server_info, pFppp_t) \ + GO(pa_context_get_sink_input_info, pFpupp_t)\ + GO(pa_context_get_sink_input_info_list, pFppp_t) \ + GO(pa_context_get_sink_info_list, pFppp_t) \ + GO(pa_context_get_sink_info_by_name, pFpppp_t) \ + GO(pa_context_set_sink_input_mute, pFpuipp_t) \ + GO(pa_context_set_sink_input_volume, pFpuppp_t) \ + GO(pa_context_get_source_info_list, pFppp_t)\ + GO(pa_context_get_source_info_by_index, pFpupp_t) \ + GO(pa_context_get_sink_info_by_index, pFpupp_t) \ + GO(pa_context_set_sink_volume_by_index, pFpuppp_t) \ + GO(pa_context_set_source_volume_by_index, pFpuppp_t)\ + GO(pa_context_set_source_mute_by_index, pFpuipp_t) \ + GO(pa_context_unload_module, pFpupp_t) \ + GO(pa_context_load_module, pFppppp_t) \ + GO(pa_context_connect, iFppip_t) \ + GO(pa_context_subscribe, pFpupp_t) \ + GO(pa_context_set_subscribe_callback, vFppp_t) \ + GO(pa_context_drain, pFppp_t) \ + GO(pa_context_proplist_remove, pFpppp_t) \ + GO(pa_context_proplist_update, pFpippp_t) \ + GO(pa_context_set_event_callback, vFppp_t) \ + GO(pa_context_set_name, pFpppp_t) \ + GO(pa_context_set_source_volume_by_name, pFppppp_t) \ + GO(pa_context_get_source_info_by_name, pFpppp_t) \ + GO(pa_stream_get_state, iFp_t) \ + GO(pa_stream_drain, pFppp_t) \ + GO(pa_stream_flush, pFppp_t) \ + GO(pa_stream_set_latency_update_callback, vFppp_t) \ + GO(pa_stream_set_read_callback, vFppp_t) \ + GO(pa_stream_set_state_callback, vFppp_t) \ + GO(pa_stream_write, iFppLpIi_t) \ + GO(pa_stream_update_timing_info, pFppp_t) \ + GO(pa_stream_prebuf, pFppp_t) \ + GO(pa_stream_proplist_remove, pFpppp_t) \ + GO(pa_stream_proplist_update, pFpippp_t) \ + GO(pa_stream_set_buffer_attr, pFpppp_t) \ + GO(pa_stream_set_buffer_attr_callback, vFppp_t) \ + GO(pa_stream_set_event_callback, vFppp_t) \ + GO(pa_stream_set_moved_callback, vFppp_t) \ + GO(pa_stream_set_name, pFpppp_t) \ + GO(pa_stream_set_overflow_callback, vFppp_t)\ + GO(pa_stream_set_started_callback, vFppp_t) \ + GO(pa_stream_set_suspended_callback, vFppp_t) \ + GO(pa_stream_set_underflow_callback, vFppp_t) \ + GO(pa_stream_set_write_callback, vFppp_t) \ + GO(pa_stream_trigger, pFppp_t) \ + GO(pa_stream_update_sample_rate, pFpupp_t) \ + GO(pa_stream_cork, pFpipp_t) \ + GO(pa_proplist_setf, iFppp_t) \ + GO(pa_mainloop_set_poll_func, vFppp_t) + + +typedef struct pulse_my_s { + // functions + #define GO(A, B) B A; + SUPER() + #undef GO +} pulse_my_t; + +void* getPulseMy(library_t* lib) +{ + pulse_my_t* my = (pulse_my_t*)calloc(1, sizeof(pulse_my_t)); + #define GO(A, W) my->A = (W)dlsym(lib->priv.w.lib, #A); + SUPER() + #undef GO + + return my; +} +#undef SUPER + +void freePulseMy(void* lib) +{ + //pulse_my_t *my = (pulse_my_t *)lib; + +} + +// TODO: change that static for a map ptr2ptr? +static my_pa_mainloop_api_t my_mainloop_api = {0}; +static my_pa_mainloop_api_t my_mainloop_native = {0}; +static int mainloop_inited = 0; +static my_pa_mainloop_api_t* my_mainloop_ref = NULL; +static my_pa_mainloop_api_t* my_mainloop_orig = NULL; + + +// utility functions +#define SUPER() \ +GO(0) \ +GO(1) \ +GO(2) \ +GO(3) \ +GO(4) \ +GO(5) \ +GO(6) \ +GO(7) \ +GO(8) \ +GO(9) \ +GO(10) \ +GO(11) \ +GO(12) \ +GO(13) \ +GO(14) \ +GO(15) \ + + +#define GO(A) \ +static uintptr_t my_free_fct_##A = 0; \ +static void my_free_##A(void* data) \ +{ \ + RunFunction(my_context, my_free_fct_##A, 1, data);\ +} +SUPER() +#undef GO +static void* findFreeFct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_free_fct_##A == (uintptr_t)fct) return my_free_##A; + SUPER() + #undef GO + #define GO(A) if(my_free_fct_##A == 0) {my_free_fct_##A = (uintptr_t)fct; return my_free_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio free callback\n"); + return NULL; +} + +#define GO(A) \ +static uintptr_t my_free_api_fct_##A = 0; \ +static void my_free_api_##A(my_pa_mainloop_api_t* api, void* p, void* data) \ +{ \ + RunFunction(my_context, my_free_api_fct_##A, 3, api, p, data);\ +} +SUPER() +#undef GO +static void* findFreeAPIFct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_free_api_fct_##A == (uintptr_t)fct) return my_free_api_##A; + SUPER() + #undef GO + #define GO(A) if(my_free_api_fct_##A == 0) {my_free_api_fct_##A = (uintptr_t)fct; return my_free_api_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio free api callback\n"); + return NULL; +} + +#define GO(A) \ +static uintptr_t my_io_event_fct_##A = 0; \ +static void my_io_event_##A(my_pa_mainloop_api_t* api, void* e, int fd, int events, void* data) \ +{ \ + if(api==my_mainloop_orig) api=my_mainloop_ref; \ + RunFunction(my_context, my_io_event_fct_##A, 5, api, e, fd, events, data); \ +} +SUPER() +#undef GO +static void* findIOEventFct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_io_event_fct_##A == (uintptr_t)fct) return my_io_event_##A; + SUPER() + #undef GO + #define GO(A) if(my_io_event_fct_##A == 0) {my_io_event_fct_##A = (uintptr_t)fct; return my_io_event_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio io_event api callback\n"); + return NULL; +} + +#define GO(A) \ +static uintptr_t my_time_event_fct_##A = 0; \ +static void my_time_event_##A(my_pa_mainloop_api_t* api, void* e, void* tv, void* data) \ +{ \ + if(api==my_mainloop_orig) api=my_mainloop_ref; \ + RunFunction(my_context, my_time_event_fct_##A, 4, api, e, tv, data); \ +} +SUPER() +#undef GO +static void* findTimeEventFct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + if(!fct) return NULL; + #define GO(A) if(my_time_event_fct_##A == (uintptr_t)fct) return my_time_event_##A; + SUPER() + #undef GO + #define GO(A) if(my_time_event_fct_##A == 0) {my_time_event_fct_##A = (uintptr_t)fct; return my_time_event_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio time_event api callback\n"); + return NULL; +} + +#define GO(A) \ +static uintptr_t my_defer_event_fct_##A = 0; \ +static void my_defer_event_##A(my_pa_mainloop_api_t* api, void* e, void* data) \ +{ \ + if(api==my_mainloop_orig) api=my_mainloop_ref; \ + RunFunction(my_context, my_defer_event_fct_##A, 3, api, e, data); \ +} +SUPER() +#undef GO +static void* findDeferEventFct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + if(!fct) return NULL; + #define GO(A) if(my_defer_event_fct_##A == (uintptr_t)fct) return my_defer_event_##A; + SUPER() + #undef GO + #define GO(A) if(my_defer_event_fct_##A == 0) {my_defer_event_fct_##A = (uintptr_t)fct; return my_defer_event_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio defer_event api callback\n"); + return NULL; +} +// poll +#define GO(A) \ +static uintptr_t my_poll_fct_##A = 0; \ +static int my_poll_##A(void* ufds, unsigned long nfds, int timeout, void* data) \ +{ \ + return (int)RunFunction(my_context, my_poll_fct_##A, 4, ufds, nfds, timeout, data); \ +} +SUPER() +#undef GO +static void* find_poll_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_poll_fct_##A == (uintptr_t)fct) return my_poll_##A; + SUPER() + #undef GO + #define GO(A) if(my_poll_fct_##A == 0) {my_poll_fct_##A = (uintptr_t)fct; return my_poll_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio poll callback\n"); + return NULL; +} +// signal +#define GO(A) \ +static uintptr_t my_signal_fct_##A = 0; \ +static void my_signal_##A(my_pa_mainloop_api_t* api, void* e, int sig, void *data) \ +{ \ + if(api==my_mainloop_orig) api=my_mainloop_ref; \ + RunFunction(my_context, my_signal_fct_##A, 4, api, e, sig, data); \ +} +SUPER() +#undef GO +static void* find_signal_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_signal_fct_##A == (uintptr_t)fct) return my_signal_##A; + SUPER() + #undef GO + #define GO(A) if(my_signal_fct_##A == 0) {my_signal_fct_##A = (uintptr_t)fct; return my_signal_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio signal callback\n"); + return NULL; +} +// signal_destroy +#define GO(A) \ +static uintptr_t my_signal_destroy_fct_##A = 0; \ +static void my_signal_destroy_##A(my_pa_mainloop_api_t* api, void* e, void *data) \ +{ \ + if(api==my_mainloop_orig) api=my_mainloop_ref; \ + RunFunction(my_context, my_signal_destroy_fct_##A, 3, api, e, data); \ +} +SUPER() +#undef GO +static void* find_signal_destroy_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_signal_destroy_fct_##A == (uintptr_t)fct) return my_signal_destroy_##A; + SUPER() + #undef GO + #define GO(A) if(my_signal_destroy_fct_##A == 0) {my_signal_destroy_fct_##A = (uintptr_t)fct; return my_signal_destroy_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio signal_destroy callback\n"); + return NULL; +} + +// prefork +#define GO(A) \ +static uintptr_t my_prefork_fct_##A = 0; \ +static void my_prefork_##A() \ +{ \ + RunFunction(my_context, my_prefork_fct_##A, 0); \ +} +SUPER() +#undef GO +static void* find_prefork_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_prefork_fct_##A == (uintptr_t)fct) return my_prefork_##A; + SUPER() + #undef GO + #define GO(A) if(my_prefork_fct_##A == 0) {my_prefork_fct_##A = (uintptr_t)fct; return my_prefork_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio prefork callback\n"); + return NULL; +} +// postfork +#define GO(A) \ +static uintptr_t my_postfork_fct_##A = 0; \ +static void my_postfork_##A() \ +{ \ + RunFunction(my_context, my_postfork_fct_##A, 0);\ +} +SUPER() +#undef GO +static void* find_postfork_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_postfork_fct_##A == (uintptr_t)fct) return my_postfork_##A; + SUPER() + #undef GO + #define GO(A) if(my_postfork_fct_##A == 0) {my_postfork_fct_##A = (uintptr_t)fct; return my_postfork_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio postfork callback\n"); + return NULL; +} +// atfork +#define GO(A) \ +static uintptr_t my_atfork_fct_##A = 0; \ +static void my_atfork_##A() \ +{ \ + RunFunction(my_context, my_atfork_fct_##A, 0); \ +} +SUPER() +#undef GO +static void* find_atfork_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_atfork_fct_##A == (uintptr_t)fct) return my_atfork_##A; + SUPER() + #undef GO + #define GO(A) if(my_atfork_fct_##A == 0) {my_atfork_fct_##A = (uintptr_t)fct; return my_atfork_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio atfork callback\n"); + return NULL; +} + +// state_context +#define GO(A) \ +static uintptr_t my_state_context_fct_##A = 0; \ +static void my_state_context_##A(void* context, void* data) \ +{ \ + RunFunction(my_context, my_state_context_fct_##A, 2, context, data); \ +} +SUPER() +#undef GO +static void* find_state_context_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_state_context_fct_##A == (uintptr_t)fct) return my_state_context_##A; + SUPER() + #undef GO + #define GO(A) if(my_state_context_fct_##A == 0) {my_state_context_fct_##A = (uintptr_t)fct; return my_state_context_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio state_context callback\n"); + return NULL; +} +// notify_context +#define GO(A) \ +static uintptr_t my_notify_context_fct_##A = 0; \ +static void my_notify_context_##A(void* context, void* data) \ +{ \ + RunFunction(my_context, my_notify_context_fct_##A, 2, context, data); \ +} +SUPER() +#undef GO +static void* find_notify_context_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_notify_context_fct_##A == (uintptr_t)fct) return my_notify_context_##A; + SUPER() + #undef GO + #define GO(A) if(my_notify_context_fct_##A == 0) {my_notify_context_fct_##A = (uintptr_t)fct; return my_notify_context_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio notify_context callback\n"); + return NULL; +} +// success_context +#define GO(A) \ +static uintptr_t my_success_context_fct_##A = 0; \ +static void my_success_context_##A(void* context, int success, void* data) \ +{ \ + RunFunction(my_context, my_success_context_fct_##A, 3, context, success, data); \ +} +SUPER() +#undef GO +static void* find_success_context_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_success_context_fct_##A == (uintptr_t)fct) return my_success_context_##A; + SUPER() + #undef GO + #define GO(A) if(my_success_context_fct_##A == 0) {my_success_context_fct_##A = (uintptr_t)fct; return my_success_context_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio success_context callback\n"); + return NULL; +} +// event_context +#define GO(A) \ +static uintptr_t my_event_context_fct_##A = 0; \ +static void my_event_context_##A(void* context, void* name, void* p, void* data) \ +{ \ + RunFunction(my_context, my_event_context_fct_##A, 4, context, name, p, data); \ +} +SUPER() +#undef GO +static void* find_event_context_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_event_context_fct_##A == (uintptr_t)fct) return my_event_context_##A; + SUPER() + #undef GO + #define GO(A) if(my_event_context_fct_##A == 0) {my_event_context_fct_##A = (uintptr_t)fct; return my_event_context_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio event_context callback\n"); + return NULL; +} +// module_info +#define GO(A) \ +static uintptr_t my_module_info_fct_##A = 0; \ +static void my_module_info_##A(void* context, void* i, int eol, void* data) \ +{ \ + RunFunction(my_context, my_module_info_fct_##A, 4, context, i, eol, data); \ +} +SUPER() +#undef GO +static void* find_module_info_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_module_info_fct_##A == (uintptr_t)fct) return my_module_info_##A; + SUPER() + #undef GO + #define GO(A) if(my_module_info_fct_##A == 0) {my_module_info_fct_##A = (uintptr_t)fct; return my_module_info_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio module_info callback\n"); + return NULL; +} +// server_info +#define GO(A) \ +static uintptr_t my_server_info_fct_##A = 0; \ +static void my_server_info_##A(void* context, void* i, void* data) \ +{ \ + RunFunction(my_context, my_server_info_fct_##A, 3, context, i, data); \ +} +SUPER() +#undef GO +static void* find_server_info_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_server_info_fct_##A == (uintptr_t)fct) return my_server_info_##A; + SUPER() + #undef GO + #define GO(A) if(my_server_info_fct_##A == 0) {my_server_info_fct_##A = (uintptr_t)fct; return my_server_info_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio server_info callback\n"); + return NULL; +} +// client_info +#define GO(A) \ +static uintptr_t my_client_info_fct_##A = 0; \ +static void my_client_info_##A(void* context, void* i, int eol, void* data) \ +{ \ + RunFunction(my_context, my_client_info_fct_##A, 4, context, i, eol, data); \ +} +SUPER() +#undef GO +static void* find_client_info_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_client_info_fct_##A == (uintptr_t)fct) return my_client_info_##A; + SUPER() + #undef GO + #define GO(A) if(my_client_info_fct_##A == 0) {my_client_info_fct_##A = (uintptr_t)fct; return my_client_info_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio client_info callback\n"); + return NULL; +} +// context_index +#define GO(A) \ +static uintptr_t my_context_index_fct_##A = 0; \ +static void my_context_index_##A(void* context, uint32_t idx, void* data) \ +{ \ + RunFunction(my_context, my_context_index_fct_##A, 3, context, idx, data); \ +} +SUPER() +#undef GO +static void* find_context_index_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_context_index_fct_##A == (uintptr_t)fct) return my_context_index_##A; + SUPER() + #undef GO + #define GO(A) if(my_context_index_fct_##A == 0) {my_context_index_fct_##A = (uintptr_t)fct; return my_context_index_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio context_index callback\n"); + return NULL; +} +// subscribe_context +#define GO(A) \ +static uintptr_t my_subscribe_context_fct_##A = 0; \ +static void my_subscribe_context_##A(void* context, int evt, uint32_t idx, void* data) \ +{ \ + RunFunction(my_context, my_subscribe_context_fct_##A, 4, context, evt, idx, data); \ +} +SUPER() +#undef GO +static void* find_subscribe_context_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_subscribe_context_fct_##A == (uintptr_t)fct) return my_subscribe_context_##A; + SUPER() + #undef GO + #define GO(A) if(my_subscribe_context_fct_##A == 0) {my_subscribe_context_fct_##A = (uintptr_t)fct; return my_subscribe_context_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio subscribe_context callback\n"); + return NULL; +} + +// stream_state +#define GO(A) \ +static uintptr_t my_stream_state_fct_##A = 0; \ +static void my_stream_state_##A(void* s, void* data) \ +{ \ + RunFunction(my_context, my_stream_state_fct_##A, 2, s, data); \ +} +SUPER() +#undef GO +static void* find_stream_state_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_stream_state_fct_##A == (uintptr_t)fct) return my_stream_state_##A; + SUPER() + #undef GO + #define GO(A) if(my_stream_state_fct_##A == 0) {my_stream_state_fct_##A = (uintptr_t)fct; return my_stream_state_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio stream_state callback\n"); + return NULL; +} +// stream_success +#define GO(A) \ +static uintptr_t my_stream_success_fct_##A = 0; \ +static void my_stream_success_##A(void* s, int success, void* data) \ +{ \ + RunFunction(my_context, my_stream_success_fct_##A, 3, s, success, data); \ +} +SUPER() +#undef GO +static void* find_stream_success_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_stream_success_fct_##A == (uintptr_t)fct) return my_stream_success_##A; + SUPER() + #undef GO + #define GO(A) if(my_stream_success_fct_##A == 0) {my_stream_success_fct_##A = (uintptr_t)fct; return my_stream_success_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio stream_success callback\n"); + return NULL; +} +// stream_notify +#define GO(A) \ +static uintptr_t my_stream_notify_fct_##A = 0; \ +static void my_stream_notify_##A(void* s, void* data) \ +{ \ + RunFunction(my_context, my_stream_notify_fct_##A, 2, s, data); \ +} +SUPER() +#undef GO +static void* find_stream_notify_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_stream_notify_fct_##A == (uintptr_t)fct) return my_stream_notify_##A; + SUPER() + #undef GO + #define GO(A) if(my_stream_notify_fct_##A == 0) {my_stream_notify_fct_##A = (uintptr_t)fct; return my_stream_notify_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio stream_notify callback\n"); + return NULL; +} +// stream_event +#define GO(A) \ +static uintptr_t my_stream_event_fct_##A = 0; \ +static void my_stream_event_##A(void* s, void* name, void* pl, void* data) \ +{ \ + RunFunction(my_context, my_stream_event_fct_##A, 4, s, name, pl, data); \ +} +SUPER() +#undef GO +static void* find_stream_event_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_stream_event_fct_##A == (uintptr_t)fct) return my_stream_event_##A; + SUPER() + #undef GO + #define GO(A) if(my_stream_event_fct_##A == 0) {my_stream_event_fct_##A = (uintptr_t)fct; return my_stream_event_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio stream_event callback\n"); + return NULL; +} +// stream_request +#define GO(A) \ +static uintptr_t my_stream_request_fct_##A = 0; \ +static void my_stream_request_##A(void* s, size_t nbytes, void* data) \ +{ \ + RunFunction(my_context, my_stream_request_fct_##A, 3, s, nbytes, data); \ +} +SUPER() +#undef GO +static void* find_stream_request_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_stream_request_fct_##A == (uintptr_t)fct) return my_stream_request_##A; + SUPER() + #undef GO + #define GO(A) if(my_stream_request_fct_##A == 0) {my_stream_request_fct_##A = (uintptr_t)fct; return my_stream_request_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for pulse audio stream_request callback\n"); + return NULL; +} + +#undef SUPER + + +// Mainloop functions +// but first, all cb from the pa_mainloop_api (serioulsy, how many callback and callback inside callback there is in pulse audio?!!!) + +// Native version of the mailoop_api. Called from x64 space + +static void* native_io_new(void* api, int fd, int events, void* cb, void *data) +{ + if(api==my_mainloop_ref) api=my_mainloop_orig; // need native version + // need to wrap the callback! + void* c = findIOEventFct(cb); + return ((pFpiipp_t)my_mainloop_native.io_new)(api, fd, events, c, data); +} +static void native_io_enable(void* e, int events) +{ + return ((vFpi_t)my_mainloop_native.io_enable)(e, events); +} +static void native_io_free(void* e) +{ + return ((vFp_t)my_mainloop_native.io_free)(e); +} +static void native_io_set_destroy(void* e, void* cb) +{ + // need to wrap the callback! + void* c = findFreeAPIFct(cb); + return ((vFpp_t)my_mainloop_native.io_set_destroy)(e, c); +} + +static void* native_time_new(void* api, void* tv, void* cb, void* data) +{ + if(api==my_mainloop_ref) api=my_mainloop_orig; // need native version + // need to wrap the callback! + void* c = findTimeEventFct(cb); + return ((pFpppp_t)my_mainloop_native.time_new)(api, tv, c, data); +} +static void native_time_restart(void* e, void* tv) +{ + return ((vFpp_t)my_mainloop_native.time_restart)(e, tv); +} +static void native_time_free(void* e) +{ + return ((vFp_t)my_mainloop_native.time_free)(e); +} +static void native_time_set_destroy(void* e, void* cb) +{ + // need to wrap the callback! + void* c = findFreeAPIFct(cb); + return ((vFpp_t)my_mainloop_native.time_set_destroy)(e, c); +} + +static void* native_defer_new(void* api, void* cb, void* data) +{ + if(api==my_mainloop_ref) api=my_mainloop_orig; // need native version + // need to wrap the callback! + void* c = findDeferEventFct(cb); + return ((pFppp_t)my_mainloop_native.defer_new)(api, c, data); +} +static void native_defer_enable(void* e, int b) +{ + return ((vFpi_t)my_mainloop_native.defer_enable)(e, b); +} +static void native_defer_free(void* e) +{ + return ((vFp_t)my_mainloop_native.defer_free)(e); +} +static void native_defer_set_destroy(void* e, void* cb) +{ + // need to wrap the callback! + void* c = findFreeAPIFct(cb); + return ((vFpp_t)my_mainloop_native.defer_set_destroy)(e, c); +} + +static void native_quit(void* api, int retval) +{ + if(api==my_mainloop_ref) api=my_mainloop_orig; // need native version + return ((vFpi_t)my_mainloop_native.quit)(api, retval); +} + +// Emulated version. Called from native space (meh, crossing stuff are hard to follow) +static void* my_io_new(void* api, int fd, int events, void* cb, void *userdata) +{ + uintptr_t b = (uintptr_t)cb; + //pulse_my_t* my = (pulse_my_t*)my_context->pulse->priv.w.p2; + + void* fnc = GetNativeFnc((uintptr_t)my_mainloop_ref->io_new); + if(fnc) { + if(fnc==native_io_new) fnc=my_mainloop_native.io_new; + if(api==my_mainloop_ref) api=my_mainloop_orig; // need native version + return ((pFpiipp_t)fnc)(api, fd, events, cb, userdata); + } + + bridge_t* bridge = my_context->pulse->priv.w.bridge; + if(cb) + b = AddCheckBridge(bridge, vFppiip, cb, 0, NULL); + if(api==my_mainloop_orig) api=my_mainloop_ref; // need emulated version + return (void*)RunFunction(my_context, (uintptr_t)my_mainloop_ref->io_new, 5, api, fd, events, b, userdata); +} +static void my_io_enable(void* e, int events) +{ + void* fnc = GetNativeFnc((uintptr_t)my_mainloop_ref->io_enable); + if(fnc==native_io_enable) fnc=my_mainloop_native.io_enable; + if(fnc) + return ((vFpi_t)fnc)(e, events); + + RunFunction(my_context, (uintptr_t)my_mainloop_ref->io_enable, 2, e, events); +} +static void my_io_free(void* e) +{ + void* fnc = GetNativeFnc((uintptr_t)my_mainloop_ref->io_free); + if(fnc==native_io_free) fnc=my_mainloop_native.io_free; + if(fnc) + return ((vFp_t)fnc)(e); + + RunFunction(my_context, (uintptr_t)my_mainloop_ref->io_free, 1, e); +} +static void my_io_set_destroy(void* e, void* cb) +{ + void* fnc = GetNativeFnc((uintptr_t)my_mainloop_ref->io_set_destroy); + if(fnc==native_io_set_destroy) fnc=my_mainloop_native.io_set_destroy; + if(fnc) + return ((vFpp_t)fnc)(e, cb); + + bridge_t* bridge = my_context->pulse->priv.w.bridge; + uintptr_t b = 0; + if(cb) { + b = CheckBridged(bridge, cb); + if(!b) + b = AddBridge(bridge, vFppp, cb, 0, NULL); + } + RunFunction(my_context, (uintptr_t)my_mainloop_ref->io_set_destroy, 2, e, b); +} + +static void* my_time_new(void* api, void* tv, void* cb, void* data) +{ + uintptr_t b = (uintptr_t)cb; + //pulse_my_t* my = (pulse_my_t*)my_context->pulse->priv.w.p2; + + void* fnc = GetNativeFnc((uintptr_t)my_mainloop_ref->time_new); + if(fnc) { + if(fnc==native_time_new) fnc=my_mainloop_native.time_new; + if(api==my_mainloop_ref) api=my_mainloop_orig; // need native version + return ((pFpppp_t)fnc)(api, tv, (void*)b, data); + } + + // need to bridge the callback! + bridge_t* bridge = my_context->pulse->priv.w.bridge; + if(cb) + b = AddCheckBridge(bridge, vFpppp, cb, 0, NULL); + if(api==my_mainloop_orig) api=my_mainloop_ref; // need emulated version + return (void*)RunFunction(my_context, (uintptr_t)my_mainloop_ref->time_new, 4, api, tv, b, data); +} +static void my_time_restart(void* e, void* tv) +{ + void* fnc = GetNativeFnc((uintptr_t)my_mainloop_ref->time_restart); + if(fnc==native_time_restart) fnc=my_mainloop_native.time_restart; + if(fnc) + return ((vFpp_t)fnc)(e, tv); + + RunFunction(my_context, (uintptr_t)my_mainloop_ref->time_restart, 2, e, tv); +} +static void my_time_free(void* e) +{ + void* fnc = GetNativeFnc((uintptr_t)my_mainloop_ref->time_free); + if(fnc==native_time_free) fnc=my_mainloop_native.time_free; + if(fnc) + return ((vFp_t)fnc)(e); + + RunFunction(my_context, (uintptr_t)my_mainloop_ref->time_free, 1, e); +} +static void my_time_set_destroy(void* e, void* cb) +{ + void* fnc = GetNativeFnc((uintptr_t)my_mainloop_ref->time_set_destroy); + if(fnc==native_time_set_destroy) fnc=my_mainloop_native.time_set_destroy; + if(fnc) + return ((vFpp_t)fnc)(e, cb); + + bridge_t* bridge = my_context->pulse->priv.w.bridge; + uintptr_t b = 0; + if(cb) + b = AddCheckBridge(bridge, vFppp, cb, 0, NULL); + RunFunction(my_context, (uintptr_t)my_mainloop_ref->time_set_destroy, 2, e, b); +} + +static void* my_defer_new(void* api, void* cb, void* data) +{ + uintptr_t b = (uintptr_t)cb; + //pulse_my_t* my = (pulse_my_t*)my_context->pulse->priv.w.p2; + + void* fnc = GetNativeFnc((uintptr_t)my_mainloop_ref->defer_new); + if(fnc) { + if(api==my_mainloop_ref) api=my_mainloop_orig; // need native version + if(fnc==native_defer_new) fnc=my_mainloop_native.defer_new; + return ((pFppp_t)fnc)(api, cb, data); + } + + // need to bridge the callback! + bridge_t* bridge = my_context->pulse->priv.w.bridge; + if(cb) { + b = CheckBridged(bridge, cb); + if(!b) + b = AddBridge(bridge, vFppp, cb, 0, NULL); + } + if(api==my_mainloop_orig) api=my_mainloop_ref; // need emulated version + return (void*)RunFunction(my_context, (uintptr_t)my_mainloop_ref->defer_new, 3, api, b, data); +} +static void my_defer_enable(void* e, int b) +{ + void* fnc = GetNativeFnc((uintptr_t)my_mainloop_ref->defer_enable); + if(fnc==native_defer_enable) fnc=my_mainloop_native.defer_enable; + if(fnc) + return ((vFpi_t)fnc)(e, b); + + RunFunction(my_context, (uintptr_t)my_mainloop_ref->defer_enable, 2, e, b); +} +static void my_defer_free(void* e) +{ + void* fnc = GetNativeFnc((uintptr_t)my_mainloop_ref->defer_free); + if(fnc==native_defer_free) fnc=my_mainloop_native.defer_free; + if(fnc) + return ((vFp_t)fnc)(e); + + RunFunction(my_context, (uintptr_t)my_mainloop_ref->defer_free, 1, e); +} +static void my_defer_set_destroy(void* e, void* cb) +{ + void* fnc = GetNativeFnc((uintptr_t)my_mainloop_ref->defer_set_destroy); + if(fnc==native_defer_set_destroy) fnc=my_mainloop_native.defer_set_destroy; + if(fnc) + return ((vFpp_t)fnc)(e, cb); + + bridge_t* bridge = my_context->pulse->priv.w.bridge; + uintptr_t b = 0; + if(cb) + b = AddCheckBridge(bridge, vFppp, cb, 0, NULL); + RunFunction(my_context, (uintptr_t)my_mainloop_ref->defer_set_destroy, 2, e, b); +} + +static void my_quit(void* api, int retval) +{ + void* fnc = GetNativeFnc((uintptr_t)my_mainloop_ref->quit); + if(fnc) { + if(fnc==native_quit) fnc=my_mainloop_native.quit; + if(api==my_mainloop_ref) api=my_mainloop_orig; // need native version + return ((vFpi_t)fnc)(api, retval); + } + + if(api==my_mainloop_orig) api=my_mainloop_ref; // need emulated version + RunFunction(my_context, (uintptr_t)my_mainloop_ref->quit, 2, api, retval); +} + +static void bridgeMainloopAPI(bridge_t* bridge, my_pa_mainloop_api_t* api) +{ + if(!api) { + return; + } + #define GO(A, W) my_mainloop_native.A = api->A; if(api->A) {my_mainloop_api.A = (void*)AddCheckBridge(bridge, W, native_##A, 0, NULL); api->A=my_##A;} else my_mainloop_api.A = NULL + GO(io_new, pFpiipp); + GO(io_enable, vFpi); + GO(io_free, vFp); + GO(io_set_destroy, vFpp); + GO(time_new, pFpppp); + GO(time_restart, vFpp); + GO(time_free, vFp); + GO(time_set_destroy, vFpp); + GO(defer_new, pFppp); + GO(defer_enable, vFpi); + GO(defer_free, vFp); + GO(defer_set_destroy, vFpp); + GO(quit, vFpi); + #undef GO + my_mainloop_api.data = api->data; + my_mainloop_orig = api; + my_mainloop_ref = &my_mainloop_api; + return; +} +/*static my_pa_mainloop_api_t* backMainloopAPI(my_pa_mainloop_api_t* mainloop) +{ + if(my_mainloop_ref!=mainloop) { + printf_log(LOG_NONE, "Warning, Pulse mainloop_api is not expected value\n"); + return mainloop; + } + return my_mainloop_orig; +}*/ + +// mainloop_api: all the functions are wrapped, with custom function used... +// and a copy is sent to the emulated software. copy use wrapped function +// only one mainloop can be active at a given time! +EXPORT void my_pa_mainloop_free(x64emu_t* emu, void* mainloop) +{ + library_t* lib = emu->context->pulse; + pulse_my_t* my = lib->priv.w.p2; + my->pa_mainloop_free(mainloop); + mainloop_inited = 0; + /*my_mainloop_ref =*/ my_mainloop_orig = NULL; +} +EXPORT void* my_pa_mainloop_get_api(x64emu_t* emu, void* mainloop) +{ + library_t* lib = emu->context->pulse; + pulse_my_t* my = lib->priv.w.p2; + my_pa_mainloop_api_t* api = my->pa_mainloop_get_api(mainloop); + bridgeMainloopAPI(lib->priv.w.bridge, api); + return my_mainloop_ref; +} + +EXPORT void my_pa_threaded_mainloop_free(x64emu_t* emu, void* mainloop) +{ + library_t* lib = emu->context->pulse; + pulse_my_t* my = lib->priv.w.p2; + my->pa_threaded_mainloop_free(mainloop); + mainloop_inited = 0; + /*my_mainloop_ref =*/ my_mainloop_orig = NULL; +} +EXPORT void* my_pa_threaded_mainloop_get_api(x64emu_t* emu, void* mainloop) +{ + library_t* lib = emu->context->pulse; + pulse_my_t* my = lib->priv.w.p2; + my_pa_mainloop_api_t* api = my->pa_threaded_mainloop_get_api(mainloop); + bridgeMainloopAPI(lib->priv.w.bridge, api); + return my_mainloop_ref; +} + +// Context functions +EXPORT void* my_pa_context_new(x64emu_t* emu, my_pa_mainloop_api_t* mainloop, void* name) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + if(mainloop==my_mainloop_ref) mainloop=my_mainloop_orig; // need native version + return my->pa_context_new(mainloop, name); +} + +EXPORT void* my_pa_context_new_with_proplist(x64emu_t* emu, my_pa_mainloop_api_t* mainloop, void* name, void* proplist) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + if(mainloop==my_mainloop_ref) mainloop=my_mainloop_orig; // need native version + return my->pa_context_new_with_proplist(mainloop, name, proplist); +} + +EXPORT int my_pa_signal_init(x64emu_t* emu, my_pa_mainloop_api_t* mainloop) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + if(mainloop==my_mainloop_ref) mainloop=my_mainloop_orig; // need native version + return my->pa_signal_init(mainloop); +} + +EXPORT void* my_pa_signal_new(x64emu_t* emu, int sig, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_signal_new(sig, find_signal_Fct(cb), data); +} + +EXPORT void my_pa_signal_set_destroy(x64emu_t* emu, void* e, void* cb) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_signal_set_destroy(e, find_signal_destroy_Fct(cb)); +} + +typedef struct my_pa_spawn_api_s { + void* prefork; + void* postfork; + void* atfork; +} my_pa_spawn_api_t; + +EXPORT int my_pa_context_connect(x64emu_t* emu, void* context, void* server, int flags, my_pa_spawn_api_t* api) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + if(!api) { + return my->pa_context_connect(context, server, flags, api); + } + static my_pa_spawn_api_t a = {0}; + #define GO(A) a.A = find_##A##_Fct(api->A) + GO(prefork); + GO(postfork); + GO(atfork); + #undef GO + return my->pa_context_connect(context, server, flags, &a); +} + +EXPORT void my_pa_context_set_state_callback(x64emu_t* emu, void* context, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + my->pa_context_set_state_callback(context, find_state_context_Fct(cb), data); +} + +EXPORT void my_pa_context_set_default_sink(x64emu_t* emu, void* context, void* name, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + my->pa_context_set_default_sink(context, name, find_success_context_Fct(cb), data); +} + +EXPORT void my_pa_context_set_default_source(x64emu_t* emu, void* context, void* name, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + my->pa_context_set_default_source(context, name, find_success_context_Fct(cb), data); +} + +EXPORT void* my_pa_context_move_sink_input_by_index(x64emu_t* emu, void* context, uint32_t idx, uint32_t sink_idx, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_move_sink_input_by_index(context, idx, sink_idx, find_success_context_Fct(cb), data); +} + +EXPORT void* my_pa_context_get_module_info_list(x64emu_t* emu, void* context, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_get_module_info_list(context, find_module_info_Fct(cb), data); +} + +EXPORT void* my_pa_context_get_server_info(x64emu_t* emu, void* context, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_get_server_info(context, find_server_info_Fct(cb), data); +} + +EXPORT void* my_pa_context_get_client_info_list(x64emu_t* emu, void* context, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_get_client_info_list(context, find_client_info_Fct(cb), data); +} + +EXPORT void* my_pa_context_get_sink_input_info(x64emu_t* emu, void* context, uint32_t idx, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_get_sink_input_info(context, idx, find_module_info_Fct(cb), data); +} +EXPORT void* my_pa_context_get_sink_input_info_list(x64emu_t* emu, void* context, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_get_sink_input_info_list(context, find_module_info_Fct(cb), data); +} + +EXPORT void* my_pa_context_get_sink_info_list(x64emu_t* emu, void* context, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_get_sink_info_list(context, find_module_info_Fct(cb), data); +} + +EXPORT void* my_pa_context_get_sink_info_by_name(x64emu_t* emu, void* context, void* name, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_get_sink_info_by_name(context, name, find_module_info_Fct(cb), data); +} + +EXPORT void* my_pa_context_get_source_info_list(x64emu_t* emu, void* context, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_get_source_info_list(context, find_module_info_Fct(cb), data); +} + +EXPORT void my_pa_context_set_sink_input_mute(x64emu_t* emu, void* context, uint32_t idx, int mute, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + my->pa_context_set_sink_input_mute(context, idx, mute, find_success_context_Fct(cb), data); +} + +EXPORT void my_pa_context_set_sink_input_volume(x64emu_t* emu, void* context, uint32_t idx, void* volume, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + my->pa_context_set_sink_input_volume(context, idx, volume, find_success_context_Fct(cb), data); +} + +EXPORT void* my_pa_context_get_sink_info_by_index(x64emu_t* emu, void* context, uint32_t idx, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_get_sink_info_by_index(context, idx, find_module_info_Fct(cb), data); +} + +EXPORT void* my_pa_context_get_source_info_by_index(x64emu_t* emu, void* context, uint32_t idx, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_get_source_info_by_index(context, idx, find_module_info_Fct(cb), data); +} + +EXPORT void my_pa_context_set_source_volume_by_index(x64emu_t* emu, void* context, uint32_t idx, void* volume, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + my->pa_context_set_source_volume_by_index(context, idx, volume, find_success_context_Fct(cb), data); +} + +EXPORT void my_pa_context_set_source_mute_by_index(x64emu_t* emu, void* context, uint32_t idx, int mute, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + my->pa_context_set_source_mute_by_index(context, idx, mute, find_success_context_Fct(cb), data); +} + +EXPORT void my_pa_context_set_sink_volume_by_index(x64emu_t* emu, void* context, uint32_t idx, void* volume, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + my->pa_context_set_sink_volume_by_index(context, idx, volume, find_success_context_Fct(cb), data); +} + +EXPORT void* my_pa_context_unload_module(x64emu_t* emu, void* context, uint32_t idx, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_unload_module(context, idx, find_success_context_Fct(cb), data); +} + +EXPORT void* my_pa_context_load_module(x64emu_t* emu, void* context, void* name, void* arg, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_load_module(context, name, arg, find_context_index_Fct(cb), data); +} + +EXPORT void* my_pa_context_subscribe(x64emu_t* emu, void* context, uint32_t m, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_subscribe(context, m, find_success_context_Fct(cb), data); +} + +EXPORT void my_pa_context_set_subscribe_callback(x64emu_t* emu, void* context, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_set_subscribe_callback(context, find_subscribe_context_Fct(cb), data); +} + +EXPORT void* my_pa_context_drain(x64emu_t* emu, void* context, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_drain(context, find_notify_context_Fct(cb), data); +} + +EXPORT void* my_pa_context_exit_daemon(x64emu_t* emu, void* context, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_exit_daemon(context, find_success_context_Fct(cb), data); +} + +EXPORT void* my_pa_context_proplist_remove(x64emu_t* emu, void* context, void* keys, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_proplist_remove(context, keys, find_success_context_Fct(cb), data); +} + +EXPORT void* my_pa_context_proplist_update(x64emu_t* emu, void* context, int mode, void* p, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_proplist_update(context, mode, p, find_success_context_Fct(cb), data); +} + +EXPORT void my_pa_context_set_event_callback(x64emu_t* emu, void* context, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + my->pa_context_set_event_callback(context, find_event_context_Fct(cb), data); +} + +EXPORT void* my_pa_context_set_name(x64emu_t* emu, void* context, void* name, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_set_name(context, name, find_success_context_Fct(cb), data); +} + +EXPORT void* my_pa_context_set_source_volume_by_name(x64emu_t* emu, void* context, void* name,void* volume, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_set_source_volume_by_name(context, name, volume, find_success_context_Fct(cb), data); +} + +EXPORT void* my_pa_context_get_source_info_by_name(x64emu_t* emu, void* context, void* name, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_context_get_source_info_by_name(context, name, find_module_info_Fct(cb), data); +} + +// Stream functions + +EXPORT void* my_pa_stream_drain(x64emu_t* emu, void* stream, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_stream_drain(stream, find_stream_success_Fct(cb), data); +} + +EXPORT void* my_pa_stream_flush(x64emu_t* emu, void* stream, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_stream_flush(stream, find_stream_success_Fct(cb), data); +} + +EXPORT void my_pa_stream_set_latency_update_callback(x64emu_t* emu, void* stream, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + my->pa_stream_set_latency_update_callback(stream, find_stream_notify_Fct(cb), data); +} + +EXPORT void my_pa_stream_set_read_callback(x64emu_t* emu, void* stream, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + my->pa_stream_set_read_callback(stream, find_stream_request_Fct(cb), data); +} + +EXPORT int my_pa_stream_write(x64emu_t* emu, void* stream, void* d, size_t nbytes, void* cb, int64_t offset, int seek) +{ + if(!emu->context->pulse) + return 0; + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + if(!my) + return 0; + return my->pa_stream_write(stream, d, nbytes, findFreeFct(cb), offset, seek); +} + +EXPORT void* my_pa_stream_update_timing_info(x64emu_t* emu, void* stream, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_stream_update_timing_info(stream, find_stream_success_Fct(cb), data); +} + +EXPORT void* my_pa_stream_prebuf(x64emu_t* emu, void* stream, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_stream_prebuf(stream, find_stream_success_Fct(cb), data); +} + +EXPORT void* my_pa_stream_proplist_remove(x64emu_t* emu, void* stream, void* keys, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_stream_proplist_remove(stream, keys, find_stream_success_Fct(cb), data); +} + +EXPORT void* my_pa_stream_proplist_update(x64emu_t* emu, void* stream, int32_t mode, void* p, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_stream_proplist_update(stream, mode, p, find_stream_success_Fct(cb), data); +} + +EXPORT void* my_pa_stream_set_buffer_attr(x64emu_t* emu, void* stream, void* attr, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_stream_set_buffer_attr(stream, attr, find_stream_success_Fct(cb), data); +} + +EXPORT void my_pa_stream_set_buffer_attr_callback(x64emu_t* emu, void* stream, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + my->pa_stream_set_buffer_attr_callback(stream, find_stream_notify_Fct(cb), data); +} + +EXPORT void my_pa_stream_set_event_callback(x64emu_t* emu, void* stream, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + my->pa_stream_set_event_callback(stream, find_stream_event_Fct(cb), data); +} + +EXPORT void my_pa_stream_set_moved_callback(x64emu_t* emu, void* stream, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + my->pa_stream_set_moved_callback(stream, find_stream_notify_Fct(cb), data); +} + +EXPORT void* my_pa_stream_set_name(x64emu_t* emu, void* stream, void* name, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_stream_set_name(stream, name, find_stream_success_Fct(cb), data); +} + +EXPORT void my_pa_stream_set_overflow_callback(x64emu_t* emu, void* stream, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + my->pa_stream_set_overflow_callback(stream, find_stream_notify_Fct(cb), data); +} + +EXPORT void my_pa_stream_set_started_callback(x64emu_t* emu, void* stream, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + my->pa_stream_set_started_callback(stream, find_stream_notify_Fct(cb), data); +} + +EXPORT void my_pa_stream_set_state_callback(x64emu_t* emu, void* stream, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + my->pa_stream_set_state_callback(stream, find_stream_state_Fct(cb), data); +} + +EXPORT void my_pa_stream_set_suspended_callback(x64emu_t* emu, void* stream, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + my->pa_stream_set_suspended_callback(stream, find_stream_notify_Fct(cb), data); +} + +EXPORT void my_pa_stream_set_underflow_callback(x64emu_t* emu, void* stream, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + my->pa_stream_set_underflow_callback(stream, find_stream_notify_Fct(cb), data); +} + +EXPORT void my_pa_stream_set_write_callback(x64emu_t* emu, void* stream, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + my->pa_stream_set_write_callback(stream, find_stream_request_Fct(cb), data); +} + +EXPORT void* my_pa_stream_trigger(x64emu_t* emu, void* stream, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_stream_trigger(stream, find_stream_success_Fct(cb), data); +} + +EXPORT void* my_pa_stream_update_sample_rate(x64emu_t* emu, void* stream, uint32_t rate, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_stream_update_sample_rate(stream, rate, find_stream_success_Fct(cb), data); +} + +EXPORT void* my_pa_stream_cork(x64emu_t* emu, void* stream, int32_t b, void* cb, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + return my->pa_stream_cork(stream, b, find_stream_success_Fct(cb), data); +} + +EXPORT int my_pa_proplist_setf(x64emu_t* emu, void* p, void* key, void* fmt, uint64_t* b) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + char* format; + myStackAlign(emu, (const char*)fmt, b, emu->scratch, R_EAX, 3); + PREPARE_VALIST; + int dummy = vasprintf(&format, fmt, VARARGS); + (void)dummy; + int ret = my->pa_proplist_setf(p, key, format); + free(format); + return ret; +} + +EXPORT void my_pa_mainloop_set_poll_func(x64emu_t* emu, void* m, void* f, void* data) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + + my->pa_mainloop_set_poll_func(m, find_poll_Fct(f), data); +} + +#if 0 +EXPORT void my_pa_log_level_meta(x64emu_t* emu, int level, void* file, int line, void* func, void* format, void* b, va_list V) +{ + pulse_my_t* my = (pulse_my_t*)emu->context->pulse->priv.w.p2; + #ifndef NOALIGN + // need to align on arm + myStackAlign((const char*)format, b, emu->scratch); + PREPARE_VALIST; + return my->pa_log_level_meta(level, file, line, func, format, emu->scratch); + #else + return my->pa_log_level_meta(level, file, line, func, format, V); + #endif +} +#endif + +#define PRE_INIT \ + if(box64_nopulse) \ + return -1; + +#define CUSTOM_INIT \ + lib->priv.w.p2 = getPulseMy(lib); \ + box64->pulse = lib; \ + + +#define CUSTOM_FINI \ + lib->context->pulse = NULL; \ + freePulseMy(lib->priv.w.p2); \ + free(lib->priv.w.p2); + +#include "wrappedlib_init.h" + diff --git a/src/wrapped/wrappedpulse_private.h b/src/wrapped/wrappedpulse_private.h new file mode 100755 index 00000000..223d5e6e --- /dev/null +++ b/src/wrapped/wrappedpulse_private.h @@ -0,0 +1,288 @@ +#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA)) +#error Meh... +#endif + +GO(pa_ascii_filter, pFp) +GO(pa_ascii_valid, pFp) +GO(pa_bytes_per_second, LFp) +GO(pa_bytes_snprint, pFpLu) +GO(pa_bytes_to_usec, UFUp) +GO(pa_channel_map_can_balance, iFp) +GO(pa_channel_map_can_fade, iFp) +GO(pa_channel_map_compatible, iFpp) +GO(pa_channel_map_equal, iFpp) +GO(pa_channel_map_init, pFp) +GO(pa_channel_map_init_auto, pFpui) +GO(pa_channel_map_init_extend, pFpui) +GO(pa_channel_map_init_mono, pFp) +GO(pa_channel_map_init_stereo, pFp) +GO(pa_channel_map_parse, pFpp) +GO(pa_channel_map_snprint, pFpup) +GO(pa_channel_map_superset, iFpp) +GO(pa_channel_map_to_name, pFp) +GO(pa_channel_map_to_pretty_name, pFp) +GO(pa_channel_map_valid, iFp) +GO(pa_channel_position_to_pretty_string, pFi) +GO(pa_channel_position_to_string, pFi) +//GO(pa_context_add_autoload, +GOM(pa_context_connect, iFEppip) +GO(pa_context_disconnect, vFp) +GOM(pa_context_drain, pFEppp) +GO(pa_context_errno, iFp) +GOM(pa_context_exit_daemon, pFEppp) +//GO(pa_context_get_autoload_info_by_index, +//GO(pa_context_get_autoload_info_by_name, +//GO(pa_context_get_autoload_info_list, +//GO(pa_context_get_card_info_by_index, +//GO(pa_context_get_card_info_by_name, +//GO(pa_context_get_card_info_list, +//GO(pa_context_get_client_info, +GOM(pa_context_get_client_info_list, pFEppp) +GO(pa_context_get_index, uFp) +//GO(pa_context_get_module_info, +GOM(pa_context_get_module_info_list, pFEppp) +GO(pa_context_get_protocol_version, uFp) +//GO(pa_context_get_sample_info_by_index, +//GO(pa_context_get_sample_info_by_name, +//GO(pa_context_get_sample_info_list, +GO(pa_context_get_server, pFp) +GOM(pa_context_get_server_info, pFEppp) +GO(pa_context_get_server_protocol_version, uFp) +GOM(pa_context_get_sink_info_by_index, pFEpupp) +GOM(pa_context_get_sink_info_by_name, pFEpppp) +GOM(pa_context_get_sink_info_list, pFEppp) +GOM(pa_context_get_sink_input_info, pFEpupp) +GOM(pa_context_get_sink_input_info_list, pFEppp) +GOM(pa_context_get_source_info_by_index, pFEpupp) +GOM(pa_context_get_source_info_by_name, pFEpppp) +GOM(pa_context_get_source_info_list, pFEppp) +//GO(pa_context_get_source_output_info, +//GO(pa_context_get_source_output_info_list, +GO(pa_context_get_state, iFp) +GO(pa_context_is_local, iFp) +GO(pa_context_is_pending, iFp) +//GO(pa_context_kill_client, +//GO(pa_context_kill_sink_input, +//GO(pa_context_kill_source_output, +GOM(pa_context_load_module, pFEppppp) +GOM(pa_context_move_sink_input_by_index, pFEpuupp) +//GO(pa_context_move_sink_input_by_name, +//GO(pa_context_move_source_output_by_index, +//GO(pa_context_move_source_output_by_name, +GOM(pa_context_new, pFEpp) +GOM(pa_context_new_with_proplist, pFEppp) +//GO(pa_context_play_sample, +//GO(pa_context_play_sample_with_proplist, +GOM(pa_context_proplist_remove, pFEpppp) +GOM(pa_context_proplist_update, pFEpippp) +GO(pa_context_ref, pFp) +//GO(pa_context_remove_autoload_by_index, +//GO(pa_context_remove_autoload_by_name, +//GO(pa_context_remove_sample, +//GO(pa_context_set_card_profile_by_index, +//GO(pa_context_set_card_profile_by_name, +GOM(pa_context_set_default_sink, pFEpppp) +GOM(pa_context_set_default_source, pFEpppp) +GOM(pa_context_set_event_callback, vFEppp) +GOM(pa_context_set_name, pFEpppp) +GOM(pa_context_set_sink_input_mute, pFEpuipp) +GOM(pa_context_set_sink_input_volume, pFEpuppp) +//GO(pa_context_set_sink_mute_by_index, +//GO(pa_context_set_sink_mute_by_name, +GOM(pa_context_set_sink_volume_by_index, pFEpuppp) +//GO(pa_context_set_sink_volume_by_name, +GOM(pa_context_set_source_mute_by_index, pFEpuipp) +//GO(pa_context_set_source_mute_by_name, +GOM(pa_context_set_source_volume_by_index, pFEpuppp) +GOM(pa_context_set_source_volume_by_name, pFEppppp) +GOM(pa_context_set_state_callback, vFEppp) +GOM(pa_context_set_subscribe_callback, vFEppp) +//GO(pa_context_stat, +GOM(pa_context_subscribe, pFEpupp) +//GO(pa_context_suspend_sink_by_index, +//GO(pa_context_suspend_sink_by_name, +//GO(pa_context_suspend_source_by_index, +//GO(pa_context_suspend_source_by_name, +GOM(pa_context_unload_module, pFEpupp) +GO(pa_context_unref, vFp) +GO(pa_cvolume_avg, uFp) +GO(pa_cvolume_channels_equal_to, iFpu) +GO(pa_cvolume_compatible, iFpp) +GO(pa_cvolume_compatible_with_channel_map, iFpp) +GO(pa_cvolume_equal, iFpp) +GO(pa_cvolume_get_balance, fFpp) +GO(pa_cvolume_get_fade, fFpp) +GO(pa_cvolume_init, pFp) +GO(pa_cvolume_max, uFp) +GO(pa_cvolume_remap, pFppp) +GO(pa_cvolume_scale, pFpu) +GO(pa_cvolume_set, pFpuu) +GO(pa_cvolume_set_balance, pFppf) +GO(pa_cvolume_set_fade, pFppf) +GO(pa_cvolume_snprint, pFplp) +GO(pa_cvolume_valid, iFp) +//GO(pa_ext_stream_restore_delete, +//GO(pa_ext_stream_restore_read, +//GO(pa_ext_stream_restore_set_subscribe_cb, +//GO(pa_ext_stream_restore_subscribe, +//GO(pa_ext_stream_restore_test, +//GO(pa_ext_stream_restore_write, +GO(pa_frame_size, LFp) +GO(pa_get_binary_name, pFpL) +GO(pa_get_fqdn, pFpL) +GO(pa_get_home_dir, pFpL) +GO(pa_get_host_name, pFpL) +GO(pa_get_library_version, pFv) +GO(pa_gettimeofday, pFp) +GO(pa_get_user_name, pFpL) +//GO(pa_locale_to_utf8, +//GO(pa_mainloop_api_once, +GO(pa_mainloop_dispatch, iFp) +GOM(pa_mainloop_free, vFEp) +GOM(pa_mainloop_get_api, pFEp) +GO(pa_mainloop_get_retval, iFp) +GO(pa_mainloop_iterate, iFpip) +GO(pa_mainloop_new, pFv) +GO(pa_mainloop_poll, iFp) +GO(pa_mainloop_prepare, iFpi) +GO(pa_mainloop_quit, vFpi) +GO(pa_mainloop_run, iFpp) +GOM(pa_mainloop_set_poll_func, vFEppp) //B is typedef int(*pa_poll_func) (struct pollfd *ufds, unsigned long nfds, int timeout, void *userdata) +GO(pa_mainloop_wakeup, vFp) +//GO(pa_msleep, +GO(pa_operation_cancel, vFp) +GO(pa_operation_get_state, iFp) +GO(pa_operation_ref, pFp) +GO(pa_operation_unref, vFp) +GO(pa_parse_sample_format, iFp) +GO(pa_path_get_filename, pFp) +//GO(pa_proplist_clear, +//GO(pa_proplist_contains, +//GO(pa_proplist_copy, +GO(pa_proplist_free, vFp) +//GO(pa_proplist_from_string, +//GO(pa_proplist_get, +GO(pa_proplist_gets, pFpp) +//GO(pa_proplist_isempty, +//GO(pa_proplist_iterate, +GO(pa_proplist_new, pFv) +GO(pa_proplist_set, iFpppL) +GOM(pa_proplist_setf, iFEpppV) +GO(pa_proplist_sets, iFppp) +GO(pa_proplist_size, uFp) +GO(pa_proplist_to_string, pFp) +GO(pa_proplist_to_string_sep, pFpp) +GO(pa_proplist_unset, iFpp) +GO(pa_proplist_unset_many, iFpp) +GO(pa_proplist_update, vFpip) +GO(pa_sample_format_to_string, pFi) +GO(pa_sample_size, LFp) +GO(pa_sample_size_of_format, LFp) +GO(pa_sample_spec_equal, iFpp) +GO(pa_sample_spec_init, pFp) +GO(pa_sample_spec_snprint, pFpLp) +GO(pa_sample_spec_valid, iFp) +GO(pa_signal_done, vFv) +GO(pa_signal_free, vFp) +GOM(pa_signal_init, iFEp) +GOM(pa_signal_new, pFEipp) +GOM(pa_signal_set_destroy, vFEpp) +GO(pa_stream_connect_playback, iFpppipp) +GO(pa_stream_connect_record, iFpppi) +GO(pa_stream_connect_upload, iFpL) +GOM(pa_stream_cork, pFEpipp) +GO(pa_stream_disconnect, iFp) +GOM(pa_stream_drain, pFEppp) +GO(pa_stream_drop, iFp) +GO(pa_stream_finish_upload, iFp) +GOM(pa_stream_flush, pFEppp) +GO(pa_stream_get_buffer_attr, pFp) +GO(pa_stream_get_channel_map, pFp) +GO(pa_stream_get_context, pFp) +GO(pa_stream_get_device_index, uFp) +GO(pa_stream_get_device_name, pFp) +GO(pa_stream_get_index, uFp) +GO(pa_stream_get_latency, iFppp) +GO(pa_stream_get_monitor_stream, uFp) +GO(pa_stream_get_sample_spec, pFp) +GO(pa_stream_get_state, iFp) +GO(pa_stream_get_time, iFpp) +GO(pa_stream_get_timing_info, pFp) +GO(pa_stream_is_corked, iFp) +GO(pa_stream_is_suspended, iFp) +GO(pa_stream_new, pFpppp) +GO(pa_stream_new_with_proplist, pFppppp) +GO(pa_stream_peek, iFppp) +GOM(pa_stream_prebuf, pFEppp) +GOM(pa_stream_proplist_remove, pFEpppp) +GOM(pa_stream_proplist_update, pFEpippp) +GO(pa_stream_readable_size, LFp) +GO(pa_stream_ref, pFp) +GOM(pa_stream_set_buffer_attr, pFEpppp) +GOM(pa_stream_set_buffer_attr_callback, vFEppp) +GOM(pa_stream_set_event_callback, vFEppp) +GOM(pa_stream_set_latency_update_callback, vFEppp) +GO(pa_stream_set_monitor_stream, iFpu) +GOM(pa_stream_set_moved_callback, vFEppp) +GOM(pa_stream_set_name, pFEpppp) +GOM(pa_stream_set_overflow_callback, vFEppp) +GOM(pa_stream_set_read_callback, vFEppp) +GOM(pa_stream_set_started_callback, vFEppp) +GOM(pa_stream_set_state_callback, vFEppp) +GOM(pa_stream_set_suspended_callback, vFEppp) +GOM(pa_stream_set_underflow_callback, vFEppp) +GOM(pa_stream_set_write_callback, vFEppp) +GOM(pa_stream_trigger, pFEppp) +GO(pa_stream_unref, vFp) +GOM(pa_stream_update_sample_rate, pFEpupp) +GOM(pa_stream_update_timing_info, pFEppp) +GO(pa_stream_writable_size, LFp) +GOM(pa_stream_write, iFEppLpIi) +GO(pa_strerror, pFi) +GO(pa_sw_cvolume_divide, pFppp) +GO(pa_sw_cvolume_multiply, pFppp) +GO(pa_sw_cvolume_snprint_dB, pFpLp) +GO(pa_sw_volume_divide, uFuu) +GO(pa_sw_volume_from_dB, uFd) +GO(pa_sw_volume_from_linear, uFd) +GO(pa_sw_volume_multiply, uFuu) +GO(pa_sw_volume_snprint_dB, pFpuu) +GO(pa_sw_volume_to_dB, dFu) +GO(pa_sw_volume_to_linear, dFu) +GO(pa_threaded_mainloop_accept, vFp) +GOM(pa_threaded_mainloop_free, vFEp) +GOM(pa_threaded_mainloop_get_api, pFEp) +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_signal, vFpi) +GO(pa_threaded_mainloop_start, iFp) +GO(pa_threaded_mainloop_stop, vFp) +GO(pa_threaded_mainloop_unlock, vFp) +GO(pa_threaded_mainloop_wait, vFp) +GO(pa_timeval_add, pFpU) +GO(pa_timeval_age, UFp) +GO(pa_timeval_cmp, iFpp) +GO(pa_timeval_diff, UFpp) +GO(pa_timeval_load, UFp) +GO(pa_timeval_store, pFpU) +GO(pa_timeval_sub, pFpU) +GO(pa_usec_to_bytes, uFUp) +GO(pa_utf8_filter, pFp) +GO(pa_utf8_to_locale, pFp) +GO(pa_utf8_valid, pFp) +GO(pa_volume_snprint, pFpLu) +GO(pa_xfree, vFp) +GO(pa_xmalloc, pFL) +GO(pa_xmalloc0, pFL) +GO(pa_xmemdup, pFpL) +GO(pa_xrealloc, pFpL) +GO(pa_xstrdup, pFp) +GO(pa_xstrndup, pFpL) + +GO(pa_stream_begin_write, iFppp) // 0.9.16+ +GO(pa_stream_cancel_write, iFp) // 0.9.16+ + +GO(dummy_io_new, pFpiipp) // dumy function to create Wrapper +GO(dummy_io_new2, vFppiip) // and another one \ No newline at end of file diff --git a/src/wrapped/wrappedpulsesimple.c b/src/wrapped/wrappedpulsesimple.c new file mode 100755 index 00000000..57d1d3b0 --- /dev/null +++ b/src/wrapped/wrappedpulsesimple.c @@ -0,0 +1,33 @@ +#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 "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* pulsesimpleName = "libpulse-simple.so.0"; +#define LIBNAME pulsesimple + +#define PRE_INIT \ + if(box64_nopulse) \ + return -1; + +#define CUSTOM_INIT \ + lib->priv.w.needed = 1; \ + lib->priv.w.neededlibs = (char**)calloc(lib->priv.w.needed, sizeof(char*)); \ + lib->priv.w.neededlibs[0] = strdup("libpulse.so.0"); \ + +#include "wrappedlib_init.h" + diff --git a/src/wrapped/wrappedpulsesimple_private.h b/src/wrapped/wrappedpulsesimple_private.h new file mode 100755 index 00000000..fb602d82 --- /dev/null +++ b/src/wrapped/wrappedpulsesimple_private.h @@ -0,0 +1,11 @@ +#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA)) +#error Meh... +#endif + +GO(pa_simple_drain, iFpp) +GO(pa_simple_flush, iFpp) +GO(pa_simple_free, vFp) +GO(pa_simple_get_latency, UFpp) +GO(pa_simple_new, pFppipppppp) +GO(pa_simple_read, iFppLp) +GO(pa_simple_write, iFppLp) |