diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-07-13 18:40:15 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-07-13 18:40:15 +0200 |
| commit | f1d238b78ddb7e8394e8b951a50716f3646509ed (patch) | |
| tree | 10c94ca4f7f6936abf3c73b078795ede08676013 /src | |
| parent | 41ebdc7604a0d41484df84b7bc2fa51e0a75ec16 (diff) | |
| download | box64-f1d238b78ddb7e8394e8b951a50716f3646509ed.tar.gz box64-f1d238b78ddb7e8394e8b951a50716f3646509ed.zip | |
Added wrapped libmpg123 (for #53)
Diffstat (limited to 'src')
| -rwxr-xr-x | src/library_list.h | 2 | ||||
| -rw-r--r-- | src/wrapped/generated/functions_list.txt | 12 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedmpg123types.h | 21 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.c | 20 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.h | 7 | ||||
| -rwxr-xr-x | src/wrapped/wrappedmpg123.c | 161 | ||||
| -rwxr-xr-x | src/wrapped/wrappedmpg123_private.h | 139 |
7 files changed, 361 insertions, 1 deletions
diff --git a/src/library_list.h b/src/library_list.h index 90596c76..51ea173b 100755 --- a/src/library_list.h +++ b/src/library_list.h @@ -143,7 +143,7 @@ GO("libpanel.so.5", libpanel) GO("libncurses.so.6", libncurses6) GO("libtinfo.so.6", libtinfo6) GO("libtcmalloc_minimal.so.4", tcmallocminimal) -//GO("libmpg123.so.0", mpg123) +GO("libmpg123.so.0", mpg123) GO("libgnutls.so.30", gnutls) GO("libpcre.so.3", libpcre) GO("libcups.so.2", libcups) diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt index b7678f06..8ee82250 100644 --- a/src/wrapped/generated/functions_list.txt +++ b/src/wrapped/generated/functions_list.txt @@ -137,6 +137,7 @@ #() IFEp #() IFpi #() IFpu +#() IFpd #() CFui #() CFpi #() CFpu @@ -553,6 +554,7 @@ #() iFpiip #() iFpiuL #() iFpiup +#() iFpild #() iFpipi #() iFpipC #() iFpipp @@ -570,6 +572,7 @@ #() iFpupL #() iFpupp #() iFpupV +#() iFplii #() iFplip #() iFpLwp #() iFpLpi @@ -579,6 +582,7 @@ #() iFppiu #() iFppiL #() iFppip +#() iFppIL #() iFppCC #() iFppuw #() iFppui @@ -594,6 +598,7 @@ #() iFpppL #() iFpppp #() IFEpIi +#() IFpIip #() IFppip #() IFSIii #() uFEpup @@ -1014,6 +1019,7 @@ #() iFppupip #() iFpplppi #() iFppLupp +#() iFppLpLp #() iFpppiuu #() iFpppipi #() iFpppipp @@ -1133,6 +1139,7 @@ #() iFpiupiii #() iFpippLpp #() iFpippppp +#() iFpIIpppp #() iFpuuiuui #() iFpuupppp #() iFpupuuui @@ -1915,6 +1922,11 @@ wrappedlibz: - inflateInit2_ - iFpiiiiipi: - deflateInit2_ +wrappedmpg123: +- iFpppp: + - mpg123_replace_reader_handle + - mpg123_replace_reader_handle_32 + - mpg123_replace_reader_handle_64 wrappedopenal: - vFv: - alRequestFoldbackStop diff --git a/src/wrapped/generated/wrappedmpg123types.h b/src/wrapped/generated/wrappedmpg123types.h new file mode 100644 index 00000000..61830079 --- /dev/null +++ b/src/wrapped/generated/wrappedmpg123types.h @@ -0,0 +1,21 @@ +/******************************************************************* + * File automatically generated by rebuild_wrappers.py (v2.0.1.14) * + *******************************************************************/ +#ifndef __wrappedmpg123TYPES_H_ +#define __wrappedmpg123TYPES_H_ + +#ifndef LIBNAME +#error You should only #include this file inside a wrapped*.c file +#endif +#ifndef ADDED_FUNCTIONS +#define ADDED_FUNCTIONS() +#endif + +typedef int64_t (*iFpppp_t)(void*, void*, void*, void*); + +#define SUPER() ADDED_FUNCTIONS() \ + GO(mpg123_replace_reader_handle, iFpppp_t) \ + GO(mpg123_replace_reader_handle_32, iFpppp_t) \ + GO(mpg123_replace_reader_handle_64, iFpppp_t) + +#endif // __wrappedmpg123TYPES_H_ diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c index 1f747877..38619b55 100644 --- a/src/wrapped/generated/wrapper.c +++ b/src/wrapped/generated/wrapper.c @@ -171,6 +171,7 @@ typedef int64_t (*iFSi_t)(void*, int64_t); typedef int64_t (*IFEp_t)(x64emu_t*, void*); typedef int64_t (*IFpi_t)(void*, int64_t); typedef int64_t (*IFpu_t)(void*, uint64_t); +typedef int64_t (*IFpd_t)(void*, double); typedef uint8_t (*CFui_t)(uint64_t, int64_t); typedef uint8_t (*CFpi_t)(void*, int64_t); typedef uint8_t (*CFpu_t)(void*, uint64_t); @@ -587,6 +588,7 @@ typedef int64_t (*iFpiiL_t)(void*, int64_t, int64_t, uintptr_t); typedef int64_t (*iFpiip_t)(void*, int64_t, int64_t, void*); typedef int64_t (*iFpiuL_t)(void*, int64_t, uint64_t, uintptr_t); typedef int64_t (*iFpiup_t)(void*, int64_t, uint64_t, void*); +typedef int64_t (*iFpild_t)(void*, int64_t, intptr_t, double); typedef int64_t (*iFpipi_t)(void*, int64_t, void*, int64_t); typedef int64_t (*iFpipC_t)(void*, int64_t, void*, uint8_t); typedef int64_t (*iFpipp_t)(void*, int64_t, void*, void*); @@ -604,6 +606,7 @@ typedef int64_t (*iFpupu_t)(void*, uint64_t, void*, uint64_t); typedef int64_t (*iFpupL_t)(void*, uint64_t, void*, uintptr_t); typedef int64_t (*iFpupp_t)(void*, uint64_t, void*, void*); typedef int64_t (*iFpupV_t)(void*, uint64_t, void*, void*); +typedef int64_t (*iFplii_t)(void*, intptr_t, int64_t, int64_t); typedef int64_t (*iFplip_t)(void*, intptr_t, int64_t, void*); typedef int64_t (*iFpLwp_t)(void*, uintptr_t, int16_t, void*); typedef int64_t (*iFpLpi_t)(void*, uintptr_t, void*, int64_t); @@ -613,6 +616,7 @@ typedef int64_t (*iFppii_t)(void*, void*, int64_t, int64_t); typedef int64_t (*iFppiu_t)(void*, void*, int64_t, uint64_t); typedef int64_t (*iFppiL_t)(void*, void*, int64_t, uintptr_t); typedef int64_t (*iFppip_t)(void*, void*, int64_t, void*); +typedef int64_t (*iFppIL_t)(void*, void*, int64_t, uintptr_t); typedef int64_t (*iFppCC_t)(void*, void*, uint8_t, uint8_t); typedef int64_t (*iFppuw_t)(void*, void*, uint64_t, int16_t); typedef int64_t (*iFppui_t)(void*, void*, uint64_t, int64_t); @@ -628,6 +632,7 @@ typedef int64_t (*iFpppu_t)(void*, void*, void*, uint64_t); typedef int64_t (*iFpppL_t)(void*, void*, void*, uintptr_t); typedef int64_t (*iFpppp_t)(void*, void*, void*, void*); typedef int64_t (*IFEpIi_t)(x64emu_t*, void*, int64_t, int64_t); +typedef int64_t (*IFpIip_t)(void*, int64_t, int64_t, void*); typedef int64_t (*IFppip_t)(void*, void*, int64_t, void*); typedef int64_t (*IFSIii_t)(void*, int64_t, int64_t, int64_t); typedef uint64_t (*uFEpup_t)(x64emu_t*, void*, uint64_t, void*); @@ -1048,6 +1053,7 @@ typedef int64_t (*iFppuupp_t)(void*, void*, uint64_t, uint64_t, void*, void*); typedef int64_t (*iFppupip_t)(void*, void*, uint64_t, void*, int64_t, void*); typedef int64_t (*iFpplppi_t)(void*, void*, intptr_t, void*, void*, int64_t); typedef int64_t (*iFppLupp_t)(void*, void*, uintptr_t, uint64_t, void*, void*); +typedef int64_t (*iFppLpLp_t)(void*, void*, uintptr_t, void*, uintptr_t, void*); typedef int64_t (*iFpppiuu_t)(void*, void*, void*, int64_t, uint64_t, uint64_t); typedef int64_t (*iFpppipi_t)(void*, void*, void*, int64_t, void*, int64_t); typedef int64_t (*iFpppipp_t)(void*, void*, void*, int64_t, void*, void*); @@ -1167,6 +1173,7 @@ typedef int64_t (*iFpiuiipp_t)(void*, int64_t, uint64_t, int64_t, int64_t, void* typedef int64_t (*iFpiupiii_t)(void*, int64_t, uint64_t, void*, int64_t, int64_t, int64_t); typedef int64_t (*iFpippLpp_t)(void*, int64_t, void*, void*, uintptr_t, void*, void*); typedef int64_t (*iFpippppp_t)(void*, int64_t, void*, void*, void*, void*, void*); +typedef int64_t (*iFpIIpppp_t)(void*, int64_t, int64_t, void*, void*, void*, void*); typedef int64_t (*iFpuuiuui_t)(void*, uint64_t, uint64_t, int64_t, uint64_t, uint64_t, int64_t); typedef int64_t (*iFpuupppp_t)(void*, uint64_t, uint64_t, void*, void*, void*, void*); typedef int64_t (*iFpupuuui_t)(void*, uint64_t, void*, uint64_t, uint64_t, uint64_t, int64_t); @@ -1589,6 +1596,7 @@ void iFSi(x64emu_t *emu, uintptr_t fcn) { iFSi_t fn = (iFSi_t)fcn; R_RAX=(int64_ void IFEp(x64emu_t *emu, uintptr_t fcn) { IFEp_t fn = (IFEp_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI); } void IFpi(x64emu_t *emu, uintptr_t fcn) { IFpi_t fn = (IFpi_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI); } void IFpu(x64emu_t *emu, uintptr_t fcn) { IFpu_t fn = (IFpu_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (uint64_t)R_RSI); } +void IFpd(x64emu_t *emu, uintptr_t fcn) { IFpd_t fn = (IFpd_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, emu->xmm[0].d[0]); } void CFui(x64emu_t *emu, uintptr_t fcn) { CFui_t fn = (CFui_t)fcn; R_RAX=(unsigned char)fn((uint64_t)R_RDI, (int64_t)R_RSI); } void CFpi(x64emu_t *emu, uintptr_t fcn) { CFpi_t fn = (CFpi_t)fcn; R_RAX=(unsigned char)fn((void*)R_RDI, (int64_t)R_RSI); } void CFpu(x64emu_t *emu, uintptr_t fcn) { CFpu_t fn = (CFpu_t)fcn; R_RAX=(unsigned char)fn((void*)R_RDI, (uint64_t)R_RSI); } @@ -2005,6 +2013,7 @@ void iFpiiL(x64emu_t *emu, uintptr_t fcn) { iFpiiL_t fn = (iFpiiL_t)fcn; R_RAX=( void iFpiip(x64emu_t *emu, uintptr_t fcn) { iFpiip_t fn = (iFpiip_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, (void*)R_RCX); } void iFpiuL(x64emu_t *emu, uintptr_t fcn) { iFpiuL_t fn = (iFpiuL_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (uint64_t)R_RDX, (uintptr_t)R_RCX); } void iFpiup(x64emu_t *emu, uintptr_t fcn) { iFpiup_t fn = (iFpiup_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (uint64_t)R_RDX, (void*)R_RCX); } +void iFpild(x64emu_t *emu, uintptr_t fcn) { iFpild_t fn = (iFpild_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (intptr_t)R_RDX, emu->xmm[0].d[0]); } void iFpipi(x64emu_t *emu, uintptr_t fcn) { iFpipi_t fn = (iFpipi_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (int64_t)R_RCX); } void iFpipC(x64emu_t *emu, uintptr_t fcn) { iFpipC_t fn = (iFpipC_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (uint8_t)R_RCX); } void iFpipp(x64emu_t *emu, uintptr_t fcn) { iFpipp_t fn = (iFpipp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (void*)R_RCX); } @@ -2022,6 +2031,7 @@ void iFpupu(x64emu_t *emu, uintptr_t fcn) { iFpupu_t fn = (iFpupu_t)fcn; R_RAX=( void iFpupL(x64emu_t *emu, uintptr_t fcn) { iFpupL_t fn = (iFpupL_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (uint64_t)R_RSI, (void*)R_RDX, (uintptr_t)R_RCX); } void iFpupp(x64emu_t *emu, uintptr_t fcn) { iFpupp_t fn = (iFpupp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (uint64_t)R_RSI, (void*)R_RDX, (void*)R_RCX); } void iFpupV(x64emu_t *emu, uintptr_t fcn) { iFpupV_t fn = (iFpupV_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (uint64_t)R_RSI, (void*)R_RDX, (void*)(R_RSP + 8)); } +void iFplii(x64emu_t *emu, uintptr_t fcn) { iFplii_t fn = (iFplii_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (intptr_t)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX); } void iFplip(x64emu_t *emu, uintptr_t fcn) { iFplip_t fn = (iFplip_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (intptr_t)R_RSI, (int64_t)R_RDX, (void*)R_RCX); } void iFpLwp(x64emu_t *emu, uintptr_t fcn) { iFpLwp_t fn = (iFpLwp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (uintptr_t)R_RSI, (int16_t)R_RDX, (void*)R_RCX); } void iFpLpi(x64emu_t *emu, uintptr_t fcn) { iFpLpi_t fn = (iFpLpi_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (uintptr_t)R_RSI, (void*)R_RDX, (int64_t)R_RCX); } @@ -2031,6 +2041,7 @@ void iFppii(x64emu_t *emu, uintptr_t fcn) { iFppii_t fn = (iFppii_t)fcn; R_RAX=( void iFppiu(x64emu_t *emu, uintptr_t fcn) { iFppiu_t fn = (iFppiu_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (int64_t)R_RDX, (uint64_t)R_RCX); } void iFppiL(x64emu_t *emu, uintptr_t fcn) { iFppiL_t fn = (iFppiL_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (int64_t)R_RDX, (uintptr_t)R_RCX); } void iFppip(x64emu_t *emu, uintptr_t fcn) { iFppip_t fn = (iFppip_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (int64_t)R_RDX, (void*)R_RCX); } +void iFppIL(x64emu_t *emu, uintptr_t fcn) { iFppIL_t fn = (iFppIL_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (int64_t)R_RDX, (uintptr_t)R_RCX); } void iFppCC(x64emu_t *emu, uintptr_t fcn) { iFppCC_t fn = (iFppCC_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (uint8_t)R_RDX, (uint8_t)R_RCX); } void iFppuw(x64emu_t *emu, uintptr_t fcn) { iFppuw_t fn = (iFppuw_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (uint64_t)R_RDX, (int16_t)R_RCX); } void iFppui(x64emu_t *emu, uintptr_t fcn) { iFppui_t fn = (iFppui_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (uint64_t)R_RDX, (int64_t)R_RCX); } @@ -2046,6 +2057,7 @@ void iFpppu(x64emu_t *emu, uintptr_t fcn) { iFpppu_t fn = (iFpppu_t)fcn; R_RAX=( void iFpppL(x64emu_t *emu, uintptr_t fcn) { iFpppL_t fn = (iFpppL_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (uintptr_t)R_RCX); } void iFpppp(x64emu_t *emu, uintptr_t fcn) { iFpppp_t fn = (iFpppp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX); } void IFEpIi(x64emu_t *emu, uintptr_t fcn) { IFEpIi_t fn = (IFEpIi_t)fcn; R_RAX=(int64_t)fn(emu, (void*)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX); } +void IFpIip(x64emu_t *emu, uintptr_t fcn) { IFpIip_t fn = (IFpIip_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, (void*)R_RCX); } void IFppip(x64emu_t *emu, uintptr_t fcn) { IFppip_t fn = (IFppip_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (int64_t)R_RDX, (void*)R_RCX); } void IFSIii(x64emu_t *emu, uintptr_t fcn) { IFSIii_t fn = (IFSIii_t)fcn; R_RAX=(int64_t)fn(io_convert((void*)R_RDI), (int64_t)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX); } void uFEpup(x64emu_t *emu, uintptr_t fcn) { uFEpup_t fn = (uFEpup_t)fcn; R_RAX=(uint64_t)fn(emu, (void*)R_RDI, (uint64_t)R_RSI, (void*)R_RDX); } @@ -2466,6 +2478,7 @@ void iFppuupp(x64emu_t *emu, uintptr_t fcn) { iFppuupp_t fn = (iFppuupp_t)fcn; R void iFppupip(x64emu_t *emu, uintptr_t fcn) { iFppupip_t fn = (iFppupip_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (uint64_t)R_RDX, (void*)R_RCX, (int64_t)R_R8, (void*)R_R9); } void iFpplppi(x64emu_t *emu, uintptr_t fcn) { iFpplppi_t fn = (iFpplppi_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (intptr_t)R_RDX, (void*)R_RCX, (void*)R_R8, (int64_t)R_R9); } void iFppLupp(x64emu_t *emu, uintptr_t fcn) { iFppLupp_t fn = (iFppLupp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (uint64_t)R_RCX, (void*)R_R8, (void*)R_R9); } +void iFppLpLp(x64emu_t *emu, uintptr_t fcn) { iFppLpLp_t fn = (iFppLpLp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (void*)R_RCX, (uintptr_t)R_R8, (void*)R_R9); } void iFpppiuu(x64emu_t *emu, uintptr_t fcn) { iFpppiuu_t fn = (iFpppiuu_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (int64_t)R_RCX, (uint64_t)R_R8, (uint64_t)R_R9); } void iFpppipi(x64emu_t *emu, uintptr_t fcn) { iFpppipi_t fn = (iFpppipi_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (int64_t)R_RCX, (void*)R_R8, (int64_t)R_R9); } void iFpppipp(x64emu_t *emu, uintptr_t fcn) { iFpppipp_t fn = (iFpppipp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (int64_t)R_RCX, (void*)R_R8, (void*)R_R9); } @@ -2585,6 +2598,7 @@ void iFpiuiipp(x64emu_t *emu, uintptr_t fcn) { iFpiuiipp_t fn = (iFpiuiipp_t)fcn void iFpiupiii(x64emu_t *emu, uintptr_t fcn) { iFpiupiii_t fn = (iFpiupiii_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (uint64_t)R_RDX, (void*)R_RCX, (int64_t)R_R8, (int64_t)R_R9, *(int64_t*)(R_RSP + 8)); } void iFpippLpp(x64emu_t *emu, uintptr_t fcn) { iFpippLpp_t fn = (iFpippLpp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (uintptr_t)R_R8, (void*)R_R9, *(void**)(R_RSP + 8)); } void iFpippppp(x64emu_t *emu, uintptr_t fcn) { iFpippppp_t fn = (iFpippppp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8)); } +void iFpIIpppp(x64emu_t *emu, uintptr_t fcn) { iFpIIpppp_t fn = (iFpIIpppp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8)); } void iFpuuiuui(x64emu_t *emu, uintptr_t fcn) { iFpuuiuui_t fn = (iFpuuiuui_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (uint64_t)R_RSI, (uint64_t)R_RDX, (int64_t)R_RCX, (uint64_t)R_R8, (uint64_t)R_R9, *(int64_t*)(R_RSP + 8)); } void iFpuupppp(x64emu_t *emu, uintptr_t fcn) { iFpuupppp_t fn = (iFpuupppp_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (uint64_t)R_RSI, (uint64_t)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8)); } void iFpupuuui(x64emu_t *emu, uintptr_t fcn) { iFpupuuui_t fn = (iFpupuuui_t)fcn; R_RAX=(int64_t)fn((void*)R_RDI, (uint64_t)R_RSI, (void*)R_RDX, (uint64_t)R_RCX, (uint64_t)R_R8, (uint64_t)R_R9, *(int64_t*)(R_RSP + 8)); } @@ -3001,6 +3015,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFpp) return 1; if (fun == &IFpi) return 1; if (fun == &IFpu) return 1; + if (fun == &IFpd) return 2; if (fun == &CFui) return 1; if (fun == &CFpi) return 1; if (fun == &CFpu) return 1; @@ -3354,6 +3369,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFpiip) return 1; if (fun == &iFpiuL) return 1; if (fun == &iFpiup) return 1; + if (fun == &iFpild) return 2; if (fun == &iFpipi) return 1; if (fun == &iFpipC) return 1; if (fun == &iFpipp) return 1; @@ -3369,6 +3385,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFpupu) return 1; if (fun == &iFpupL) return 1; if (fun == &iFpupp) return 1; + if (fun == &iFplii) return 1; if (fun == &iFplip) return 1; if (fun == &iFpLwp) return 1; if (fun == &iFpLpi) return 1; @@ -3378,6 +3395,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFppiu) return 1; if (fun == &iFppiL) return 1; if (fun == &iFppip) return 1; + if (fun == &iFppIL) return 1; if (fun == &iFppCC) return 1; if (fun == &iFppuw) return 1; if (fun == &iFppui) return 1; @@ -3392,6 +3410,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFpppu) return 1; if (fun == &iFpppL) return 1; if (fun == &iFpppp) return 1; + if (fun == &IFpIip) return 1; if (fun == &IFppip) return 1; if (fun == &uFifff) return 4; if (fun == &uFuuuu) return 1; @@ -3757,6 +3776,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFppupip) return 1; if (fun == &iFpplppi) return 1; if (fun == &iFppLupp) return 1; + if (fun == &iFppLpLp) return 1; if (fun == &iFpppiuu) return 1; if (fun == &iFpppipi) return 1; if (fun == &iFpppipp) return 1; diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h index dacff7a7..b4702def 100644 --- a/src/wrapped/generated/wrapper.h +++ b/src/wrapped/generated/wrapper.h @@ -167,6 +167,7 @@ void iFSi(x64emu_t *emu, uintptr_t fnc); void IFEp(x64emu_t *emu, uintptr_t fnc); void IFpi(x64emu_t *emu, uintptr_t fnc); void IFpu(x64emu_t *emu, uintptr_t fnc); +void IFpd(x64emu_t *emu, uintptr_t fnc); void CFui(x64emu_t *emu, uintptr_t fnc); void CFpi(x64emu_t *emu, uintptr_t fnc); void CFpu(x64emu_t *emu, uintptr_t fnc); @@ -583,6 +584,7 @@ void iFpiiL(x64emu_t *emu, uintptr_t fnc); void iFpiip(x64emu_t *emu, uintptr_t fnc); void iFpiuL(x64emu_t *emu, uintptr_t fnc); void iFpiup(x64emu_t *emu, uintptr_t fnc); +void iFpild(x64emu_t *emu, uintptr_t fnc); void iFpipi(x64emu_t *emu, uintptr_t fnc); void iFpipC(x64emu_t *emu, uintptr_t fnc); void iFpipp(x64emu_t *emu, uintptr_t fnc); @@ -600,6 +602,7 @@ void iFpupu(x64emu_t *emu, uintptr_t fnc); void iFpupL(x64emu_t *emu, uintptr_t fnc); void iFpupp(x64emu_t *emu, uintptr_t fnc); void iFpupV(x64emu_t *emu, uintptr_t fnc); +void iFplii(x64emu_t *emu, uintptr_t fnc); void iFplip(x64emu_t *emu, uintptr_t fnc); void iFpLwp(x64emu_t *emu, uintptr_t fnc); void iFpLpi(x64emu_t *emu, uintptr_t fnc); @@ -609,6 +612,7 @@ void iFppii(x64emu_t *emu, uintptr_t fnc); void iFppiu(x64emu_t *emu, uintptr_t fnc); void iFppiL(x64emu_t *emu, uintptr_t fnc); void iFppip(x64emu_t *emu, uintptr_t fnc); +void iFppIL(x64emu_t *emu, uintptr_t fnc); void iFppCC(x64emu_t *emu, uintptr_t fnc); void iFppuw(x64emu_t *emu, uintptr_t fnc); void iFppui(x64emu_t *emu, uintptr_t fnc); @@ -624,6 +628,7 @@ void iFpppu(x64emu_t *emu, uintptr_t fnc); void iFpppL(x64emu_t *emu, uintptr_t fnc); void iFpppp(x64emu_t *emu, uintptr_t fnc); void IFEpIi(x64emu_t *emu, uintptr_t fnc); +void IFpIip(x64emu_t *emu, uintptr_t fnc); void IFppip(x64emu_t *emu, uintptr_t fnc); void IFSIii(x64emu_t *emu, uintptr_t fnc); void uFEpup(x64emu_t *emu, uintptr_t fnc); @@ -1044,6 +1049,7 @@ void iFppuupp(x64emu_t *emu, uintptr_t fnc); void iFppupip(x64emu_t *emu, uintptr_t fnc); void iFpplppi(x64emu_t *emu, uintptr_t fnc); void iFppLupp(x64emu_t *emu, uintptr_t fnc); +void iFppLpLp(x64emu_t *emu, uintptr_t fnc); void iFpppiuu(x64emu_t *emu, uintptr_t fnc); void iFpppipi(x64emu_t *emu, uintptr_t fnc); void iFpppipp(x64emu_t *emu, uintptr_t fnc); @@ -1163,6 +1169,7 @@ void iFpiuiipp(x64emu_t *emu, uintptr_t fnc); void iFpiupiii(x64emu_t *emu, uintptr_t fnc); void iFpippLpp(x64emu_t *emu, uintptr_t fnc); void iFpippppp(x64emu_t *emu, uintptr_t fnc); +void iFpIIpppp(x64emu_t *emu, uintptr_t fnc); void iFpuuiuui(x64emu_t *emu, uintptr_t fnc); void iFpuupppp(x64emu_t *emu, uintptr_t fnc); void iFpupuuui(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped/wrappedmpg123.c b/src/wrapped/wrappedmpg123.c new file mode 100755 index 00000000..3b3fc123 --- /dev/null +++ b/src/wrapped/wrappedmpg123.c @@ -0,0 +1,161 @@ +#define _GNU_SOURCE +#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 "librarian.h" +#include "box64context.h" +#include "emu/x64emu_private.h" + +const char* mpg123Name = "libmpg123.so.0"; +#define LIBNAME mpg123 + +typedef int (*iFpppp_t) (void*, void*, void*, void*); + +#define SUPER() \ + GO(mpg123_replace_reader_handle, iFpppp_t) \ + GO(mpg123_replace_reader_handle_32, iFpppp_t) \ + GO(mpg123_replace_reader_handle_64, iFpppp_t) \ + +typedef struct mpg123_my_s { + // functions + #define GO(A, B) B A; + SUPER() + #undef GO +} mpg123_my_t; + +void* getMpg123My(library_t* lib) +{ + mpg123_my_t* my = (mpg123_my_t*)calloc(1, sizeof(mpg123_my_t)); + #define GO(A, W) my->A = (W)dlsym(lib->priv.w.lib, #A); + SUPER() + #undef GO + return my; +} + +void freeMpg123My(void* lib) +{ + //mpg123_my_t *my = (mpg123_my_t *)lib; +} + +#undef SUPER + +#define SUPER() \ +GO(0) \ +GO(1) \ +GO(2) \ +GO(3) \ +GO(4) + +// r_read ... +#define GO(A) \ +static uintptr_t my_r_read_fct_##A = 0; \ +static ssize_t my_r_read_##A(void* a, void* b, size_t n) \ +{ \ + return (ssize_t)RunFunction(my_context, my_r_read_fct_##A, 3, a, b, n); \ +} +SUPER() +#undef GO +static void* find_r_read_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_r_read_fct_##A == (uintptr_t)fct) return my_r_read_##A; + SUPER() + #undef GO + #define GO(A) if(my_r_read_fct_##A == 0) {my_r_read_fct_##A = (uintptr_t)fct; return my_r_read_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for mpg123 r_read callback\n"); + return NULL; +} +// r_lseek ... +#define GO(A) \ +static uintptr_t my_r_lseek_fct_##A = 0; \ +static int64_t my_r_lseek_##A(void* a, int64_t b, int n) \ +{ \ + return (int64_t)RunFunction(my_context, my_r_lseek_fct_##A, 3, a, b, n); \ +} +SUPER() +#undef GO +static void* find_r_lseek_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_r_lseek_fct_##A == (uintptr_t)fct) return my_r_lseek_##A; + SUPER() + #undef GO + #define GO(A) if(my_r_lseek_fct_##A == 0) {my_r_lseek_fct_##A = (uintptr_t)fct; return my_r_lseek_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for mpg123 r_lseek callback\n"); + return NULL; +} +// cleanup ... +#define GO(A) \ +static uintptr_t my_cleanup_fct_##A = 0; \ +static void my_cleanup_##A(void* a) \ +{ \ + RunFunction(my_context, my_cleanup_fct_##A, 1, a); \ +} +SUPER() +#undef GO +static void* find_cleanup_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_cleanup_fct_##A == (uintptr_t)fct) return my_cleanup_##A; + SUPER() + #undef GO + #define GO(A) if(my_cleanup_fct_##A == 0) {my_cleanup_fct_##A = (uintptr_t)fct; return my_cleanup_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for mpg123 cleanup callback\n"); + return NULL; +} + +#undef SUPER + +EXPORT int my_mpg123_replace_reader_handle(x64emu_t* emu, void* mh, void* r_read, void* r_lseek, void* cleanup) +{ + library_t * lib = GetLibInternal(mpg123Name); + mpg123_my_t *my = (mpg123_my_t*)lib->priv.w.p2; + + return my->mpg123_replace_reader_handle(mh, find_r_read_Fct(r_read), find_r_lseek_Fct(r_lseek), find_cleanup_Fct(cleanup)); +} + +EXPORT int my_mpg123_replace_reader_handle_32(x64emu_t* emu, void* mh, void* r_read, void* r_lseek, void* cleanup) +{ + library_t * lib = GetLibInternal(mpg123Name); + mpg123_my_t *my = (mpg123_my_t*)lib->priv.w.p2; + + return my->mpg123_replace_reader_handle_32(mh, find_r_read_Fct(r_read), find_r_lseek_Fct(r_lseek), find_cleanup_Fct(cleanup)); +} + +EXPORT int my_mpg123_replace_reader_handle_64(x64emu_t* emu, void* mh, void* r_read, void* r_lseek, void* cleanup) +{ + library_t * lib = GetLibInternal(mpg123Name); + mpg123_my_t *my = (mpg123_my_t*)lib->priv.w.p2; + + return my->mpg123_replace_reader_handle_64(mh, find_r_read_Fct(r_read), find_r_lseek_Fct(r_lseek), find_cleanup_Fct(cleanup)); +} + +#define CUSTOM_INIT \ + lib->priv.w.p2 = getMpg123My(lib); + +#define CUSTOM_FINI \ + freeMpg123My(lib->priv.w.p2); \ + free(lib->priv.w.p2); + +#include "wrappedlib_init.h" + diff --git a/src/wrapped/wrappedmpg123_private.h b/src/wrapped/wrappedmpg123_private.h new file mode 100755 index 00000000..b122d48e --- /dev/null +++ b/src/wrapped/wrappedmpg123_private.h @@ -0,0 +1,139 @@ +#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA)) +#error Meh.... +#endif + +//GO(mpg123_add_string, +//GO(mpg123_add_substring, +//GO(mpg123_chomp_string, +//GO(mpg123_clip, +GO(mpg123_close, iFp) +//GO(mpg123_copy_string, +//GO(mpg123_current_decoder, +//GO(mpg123_decode, +GO(mpg123_decode_frame, iFpppp) +GO(mpg123_decode_frame_32, iFpppp) +GO(mpg123_decode_frame_64, iFpppp) +GO(mpg123_decoder, iFppLpLp) +//GO(mpg123_decoders, +GO(mpg123_delete, vFp) +//GO(mpg123_delete_pars, +//GO(mpg123_enc_from_id3, +GO(mpg123_encodings, vFpp) +GO(mpg123_encsize, iFi) +//GO(mpg123_eq, +GO(mpg123_errcode, iFp) +GO(mpg123_exit, vFv) +GO(mpg123_feature, iFi) +GO(mpg123_feed, iFppL) +GO(mpg123_feedseek, IFpIip) // Warning, off_t is 64bits! +GO(mpg123_feedseek_32, IFpIip) +GO(mpg123_feedseek_64, IFpIip) +//GO(mpg123_fmt, +//GO(mpg123_fmt_all, +//GO(mpg123_fmt_none, +//GO(mpg123_fmt_support, +GO(mpg123_format, iFplii) +GO(mpg123_format_all, iFp) +GO(mpg123_format_none, iFp) +GO(mpg123_format_support, iFpli) +GO(mpg123_framebyframe_decode, iFpppp) +GO(mpg123_framebyframe_decode_32, iFpppp) +GO(mpg123_framebyframe_decode_64, iFpppp) +GO(mpg123_framebyframe_next, iFp) +GO(mpg123_framedata, iFpppp) +GO(mpg123_framelength, IFp) +GO(mpg123_framelength_32, IFp) +GO(mpg123_framelength_64, IFp) +GO(mpg123_framepos, IFp) +GO(mpg123_framepos_32, IFp) +GO(mpg123_framepos_64, IFp) +//GO(mpg123_free_string, +//GO(mpg123_geteq, +GO(mpg123_getformat, iFpppp) +GO(mpg123_getformat2, iFppppi) +//GO(mpg123_getpar, +GO(mpg123_getparam, iFpipp) +//GO(mpg123_getstate, +//GO(mpg123_getvolume, +//GO(mpg123_grow_string, +//GO(mpg123_icy, +//GO(mpg123_icy2utf8, +//GO(mpg123_id3, +GO(mpg123_index, iFpppp) +GO(mpg123_index_32, iFpppp) +GO(mpg123_index_64, iFpppp) +//GO(mpg123_info, +GO(mpg123_init, iFv) +//GO(mpg123_init_string, +GO(mpg123_length, IFp) +GO(mpg123_length_32, IFp) +GO(mpg123_length_64, IFp) +//GO(mpg123_meta_check, +//GO(mpg123_meta_free, +GO(mpg123_new, pFpp) +//GO(mpg123_new_pars, +GO(mpg123_open, iFpp) +GO(mpg123_open_32, iFpp) +GO(mpg123_open_64, iFpp) +GO(mpg123_open_fd, iFpi) +GO(mpg123_open_fd_32, iFpi) +GO(mpg123_open_fd_64, iFpi) +GO(mpg123_open_feed, iFp) +GO(mpg123_open_handle, iFpp) +GO(mpg123_open_handle_32, iFpp) +GO(mpg123_open_handle_64, iFpp) +//GO(mpg123_outblock, +//GO(mpg123_par, +GO(mpg123_param, iFpild) +//GO(mpg123_parnew, +//GO(mpg123_plain_strerror, +GO(mpg123_position, iFpIIpppp) +GO(mpg123_position_32, iFpIIpppp) +GO(mpg123_position_64, iFpIIpppp) +GO(mpg123_rates, vFpp) +GO(mpg123_read, iFppp) +//GO(mpg123_replace_buffer, +//GO(mpg123_replace_reader, +//GO(mpg123_replace_reader_32, +//GO(mpg123_replace_reader_64, +GOM(mpg123_replace_reader_handle, iFEpppp) +GOM(mpg123_replace_reader_handle_32, iFEpppp) +GOM(mpg123_replace_reader_handle_64, iFEpppp) +//GO(mpg123_reset_eq, +//GO(mpg123_resize_string, +//GO(mpg123_safe_buffer, +//GO(mpg123_scan, +GO(mpg123_seek, IFpIi) +GO(mpg123_seek_32, IFpIi) +GO(mpg123_seek_64, IFpIi) +GO(mpg123_seek_frame, IFpIi) +GO(mpg123_seek_frame_32, IFpIi) +GO(mpg123_seek_frame_64, IFpIi) +GO(mpg123_set_filesize, iFpI) +GO(mpg123_set_filesize_32, iFpI) +GO(mpg123_set_filesize_64, iFpI) +GO(mpg123_set_index, iFppIL) +GO(mpg123_set_index_32, iFppIL) +GO(mpg123_set_index_64, iFppIL) +//GO(mpg123_set_string, +//GO(mpg123_set_substring, +//GO(mpg123_spf, +//GO(mpg123_store_utf8, +GO(mpg123_strerror, pFp) +//GO(mpg123_strlen, +//GO(mpg123_supported_decoders, +GO(mpg123_tell, IFp) +GO(mpg123_tell_32, IFp) +GO(mpg123_tell_64, IFp) +GO(mpg123_tellframe, IFp) +GO(mpg123_tellframe_32, IFp) +GO(mpg123_tellframe_64, IFp) +GO(mpg123_tell_stream, IFp) +GO(mpg123_tell_stream_32, IFp) +GO(mpg123_tell_stream_64, IFp) +GO(mpg123_timeframe, IFpd) +GO(mpg123_timeframe_32, IFpd) +GO(mpg123_timeframe_64, IFpd) +//GO(mpg123_tpf, +//GO(mpg123_volume, +//GO(mpg123_volume_change, |