diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2025-05-11 14:01:46 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2025-05-11 14:01:46 +0200 |
| commit | b1eabd758349fafb92871254c34ff7e207b508be (patch) | |
| tree | 1631b1c827fe67494d6e4dbc1c788b98f15256e9 /src | |
| parent | 7a2d9967f5aba185ea641cee996310187002fa24 (diff) | |
| download | box64-b1eabd758349fafb92871254c34ff7e207b508be.tar.gz box64-b1eabd758349fafb92871254c34ff7e207b508be.zip | |
[WRAPPER] Added more wrapped function to ffmpeg, and disable it with NOGTK=1, as wrapping needs more work on structure callbacks
Diffstat (limited to 'src')
| -rw-r--r-- | src/emu/x64printer.c | 20 | ||||
| -rw-r--r-- | src/include/callback.h | 1 | ||||
| -rw-r--r-- | src/tools/callback.c | 173 | ||||
| -rw-r--r-- | src/wrapped/generated/functions_list.txt | 34 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedlibavutil56types.h | 26 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.c | 30 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.h | 10 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibavcodec58.c | 4 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibavcodec58_private.h | 40 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibavformat58.c | 4 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibavformat58_private.h | 18 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibavutil56.c | 231 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibavutil56_private.h | 45 |
13 files changed, 585 insertions, 51 deletions
diff --git a/src/emu/x64printer.c b/src/emu/x64printer.c index d4e5c7e4..adf0b97e 100644 --- a/src/emu/x64printer.c +++ b/src/emu/x64printer.c @@ -75,6 +75,8 @@ void x64Print(x64emu_t* emu, char* buff, size_t buffsz, const char* func, int ti snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIu16 ")", tid, *(void**)(R_RSP), func, (uint16_t)R_RDI); } else if (w == iFu) { snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIu32 ")", tid, *(void**)(R_RSP), func, (uint32_t)R_RDI); + } else if (w == iFU) { + snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIu64 ")", tid, *(void**)(R_RSP), func, (uint64_t)R_RDI); } else if (w == iFf) { snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIf ")", tid, *(void**)(R_RSP), func, emu->xmm[0].f[0]); } else if (w == iFd) { @@ -371,6 +373,8 @@ void x64Print(x64emu_t* emu, char* buff, size_t buffsz, const char* func, int ti snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIu32 ", %" PRIu64 ")", tid, *(void**)(R_RSP), func, (uint32_t)R_RDI, (uintptr_t)R_RSI); } else if (w == iFup) { snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIu32 ", %" PRIp ")", tid, *(void**)(R_RSP), func, (uint32_t)R_RDI, (void*)R_RSI); + } else if (w == iFUU) { + snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIu64 ", %" PRIu64 ")", tid, *(void**)(R_RSP), func, (uint64_t)R_RDI, (uint64_t)R_RSI); } else if (w == iFUp) { snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIu64 ", %" PRIp ")", tid, *(void**)(R_RSP), func, (uint64_t)R_RDI, (void*)R_RSI); } else if (w == iFli) { @@ -605,6 +609,8 @@ void x64Print(x64emu_t* emu, char* buff, size_t buffsz, const char* func, int ti snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIp ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (void*)R_RSI); } else if (w == pFEi) { snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIi32 ")", tid, *(void**)(R_RSP), func, (int32_t)R_RDI); + } else if (w == pFEl) { + snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIi64 ")", tid, *(void**)(R_RSP), func, (intptr_t)R_RDI); } else if (w == pFEL) { snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIu64 ")", tid, *(void**)(R_RSP), func, (uintptr_t)R_RDI); } else if (w == pFEp) { @@ -1027,6 +1033,8 @@ void x64Print(x64emu_t* emu, char* buff, size_t buffsz, const char* func, int ti snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIi32 ", %" PRIu64 ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (int32_t)R_RSI, (uintptr_t)R_RDX); } else if (w == iFpip) { snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIi32 ", %" PRIp ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX); + } else if (w == iFpIi) { + snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIi64 ", %" PRIi32 ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (int64_t)R_RSI, (int32_t)R_RDX); } else if (w == iFpIp) { snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIi64 ", %" PRIp ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX); } else if (w == iFpCu) { @@ -1109,6 +1117,8 @@ void x64Print(x64emu_t* emu, char* buff, size_t buffsz, const char* func, int ti snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIi32 ", %" PRIi64 ", %" PRIi32 ")", tid, *(void**)(R_RSP), func, (int32_t)R_RDI, (int64_t)R_RSI, (int32_t)R_RDX); } else if (w == IFIII) { snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIi64 ", %" PRIi64 ", %" PRIi64 ")", tid, *(void**)(R_RSP), func, (int64_t)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX); + } else if (w == IFIUU) { + snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIi64 ", %" PRIu64 ", %" PRIu64 ")", tid, *(void**)(R_RSP), func, (int64_t)R_RDI, (uint64_t)R_RSI, (uint64_t)R_RDX); } else if (w == IFUUU) { snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIu64 ", %" PRIu64 ", %" PRIu64 ")", tid, *(void**)(R_RSP), func, (uint64_t)R_RDI, (uint64_t)R_RSI, (uint64_t)R_RDX); } else if (w == IFpIi) { @@ -1345,6 +1355,8 @@ void x64Print(x64emu_t* emu, char* buff, size_t buffsz, const char* func, int ti snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIi32 ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (int32_t)R_RSI); } else if (w == pFEpu) { snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIu32 ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (uint32_t)R_RSI); + } else if (w == pFEpL) { + snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIu64 ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (uintptr_t)R_RSI); } else if (w == pFEpp) { snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIp ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (void*)R_RSI); } else if (w == pFEpV) { @@ -1689,6 +1701,8 @@ void x64Print(x64emu_t* emu, char* buff, size_t buffsz, const char* func, int ti snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIi32 ", %" PRIi32 ", %" PRIi32 ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX); } else if (w == vFpiiu) { snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIi32 ", %" PRIi32 ", %" PRIu32 ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (uint32_t)R_RCX); + } else if (w == vFpiiU) { + snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIi32 ", %" PRIi32 ", %" PRIu64 ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (uint64_t)R_RCX); } else if (w == vFpiid) { snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIi32 ", %" PRIi32 ", %" PRIf ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, emu->xmm[0].d[0]); } else if (w == vFpiip) { @@ -3447,6 +3461,8 @@ void x64Print(x64emu_t* emu, char* buff, size_t buffsz, const char* func, int ti snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIp ", %" PRIu64 ", %" PRIp ", %" PRIp ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (void*)R_RCX, (void*)R_R8); } else if (w == LFELppu) { snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIu64 ", %" PRIp ", %" PRIp ", %" PRIu32 ")", tid, *(void**)(R_RSP), func, (uintptr_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (uint32_t)R_RCX); + } else if (w == LFEpLpV) { + snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIu64 ", %" PRIp ", %" PRIp ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (uintptr_t)R_RSI, (void*)R_RDX, (void*)(R_RSP + 8)); } else if (w == LFEppLL) { snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIp ", %" PRIu64 ", %" PRIu64 ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (uintptr_t)R_RCX); } else if (w == LFEpppp) { @@ -4447,6 +4463,8 @@ void x64Print(x64emu_t* emu, char* buff, size_t buffsz, const char* func, int ti snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIu64 ", %" PRIp ", %" PRIp ", %" PRIp ", %" PRIp ")", tid, *(void**)(R_RSP), func, (uintptr_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8); } else if (w == pFEpiupp) { snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIi32 ", %" PRIu32 ", %" PRIp ", %" PRIp ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (int32_t)R_RSI, (uint32_t)R_RDX, (void*)R_RCX, (void*)R_R8); + } else if (w == pFEpippi) { + snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIi32 ", %" PRIp ", %" PRIp ", %" PRIi32 ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (int32_t)R_R8); } else if (w == pFEpippp) { snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIi32 ", %" PRIp ", %" PRIp ", %" PRIp ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8); } else if (w == pFEpuipp) { @@ -5975,6 +5993,8 @@ void x64Print(x64emu_t* emu, char* buff, size_t buffsz, const char* func, int ti snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIu32 ", %" PRIp ", %" PRIp ", %" PRIp ", %" PRIu64 ", %" PRIp ", %" PRIp ", %" PRIu64 ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (uint32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (uintptr_t)R_R9, *(void**)(R_RSP + 8), *(void**)(R_RSP + 16), *(uintptr_t*)(R_RSP + 24)); } else if (w == iFEppppppipp) { snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIp ", %" PRIp ", %" PRIp ", %" PRIp ", %" PRIp ", %" PRIi32 ", %" PRIp ", %" PRIp ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(int32_t*)(R_RSP + 8), *(void**)(R_RSP + 16), *(void**)(R_RSP + 24)); + } else if (w == iFEpppppppip) { + snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIp ", %" PRIp ", %" PRIp ", %" PRIp ", %" PRIp ", %" PRIp ", %" PRIp ", %" PRIi32 ", %" PRIp ")", tid, *(void**)(R_RSP), func, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8), *(int32_t*)(R_RSP + 16), *(void**)(R_RSP + 24)); } else if (w == iFuiiiuuiiip) { snprintf(buff, buffsz, "%04d|%p: Calling %s(%" PRIu32 ", %" PRIi32 ", %" PRIi32 ", %" PRIi32 ", %" PRIu32 ", %" PRIu32 ", %" PRIi32 ", %" PRIi32 ", %" PRIi32 ", %" PRIp ")", tid, *(void**)(R_RSP), func, (uint32_t)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (uint32_t)R_R8, (uint32_t)R_R9, *(int32_t*)(R_RSP + 8), *(int32_t*)(R_RSP + 16), *(int32_t*)(R_RSP + 24), *(void**)(R_RSP + 32)); } else if (w == iFpiiLiiipip) { diff --git a/src/include/callback.h b/src/include/callback.h index 48d360c5..502a9dc7 100644 --- a/src/include/callback.h +++ b/src/include/callback.h @@ -7,6 +7,7 @@ typedef struct x64emu_s x64emu_t; uint64_t RunFunction(uintptr_t fnc, int nargs, ...); uint64_t RunFunctionFmt(uintptr_t fnc, const char* fmt, ...); +double RunFunctionFmtD(uintptr_t fnc, const char* fmt, ...); // save all modified register uint64_t RunSafeFunction(uintptr_t fnc, int nargs, ...); // use emu state to run function diff --git a/src/tools/callback.c b/src/tools/callback.c index f7e914b4..e5a8148c 100644 --- a/src/tools/callback.c +++ b/src/tools/callback.c @@ -14,6 +14,7 @@ #include "box64cpu_util.h" #ifdef BOX32 #include "box32.h" +#include "emu/x87emu_private.h" #endif EXPORTDYN @@ -251,6 +252,178 @@ uint64_t RunFunctionFmt(uintptr_t fnc, const char* fmt, ...) } EXPORTDYN +double RunFunctionFmtD(uintptr_t fnc, const char* fmt, ...) +{ + x64emu_t *emu = thread_get_emu(); + int nargs = 0; + int ni = 0; + int ndf = 0; + for (int i=0; fmt[i]; ++i) { + #ifdef BOX32 + if(box64_is32bits) + switch(fmt[i]) { + case 'd': + case 'I': + case 'U': nargs+=2; break; + case 'p': + case 'L': + case 'l': + case 'f': + case 'i': + case 'u': + case 'w': + case 'W': + case 'c': + case 'C': ++nargs; break; + default: + ++nargs; break; + } + else + #endif + switch(fmt[i]) { + case 'f': + case 'd': if(ndf<8) ++ndf; else ++nargs; break; + case 'p': + case 'i': + case 'u': + case 'I': + case 'U': + case 'L': + case 'l': + case 'w': + case 'W': + case 'c': + case 'C': if(ni<6) ++ni; else ++nargs; break; + default: + if(ni<6) ++ni; else ++nargs; break; + } + } + ni = 0; + ndf = 0; + int align = nargs&1; + int stackn = align + nargs; + int sizeof_ptr = sizeof(void*); + #ifdef BOX32 + if(box64_is32bits) { + Push_32(emu, R_EBP); // push ebp + R_RBP = R_ESP; // mov ebp, esp + sizeof_ptr = sizeof(ptr_t); + align = (4-(nargs&3))&3; + } else + #endif + { + Push64(emu, R_RBP); // push rbp + R_RBP = R_RSP; // mov rbp, rsp + } + + R_RSP -= stackn*sizeof_ptr; // need to push in reverse order + + #ifdef BOX32 + if(box64_is32bits) { + ptr_t *p = (ptr_t*)from_ptrv(R_ESP); + + #define GO(c, B, B2, N) case c: *((B*)p) = va_arg(va, B2); p+=N; break + va_list va; + va_start (va, fmt); + for (int i=0; fmt[i]; ++i) { + switch(fmt[i]) { + GO('f', float, double, 1); + GO('d', double, double, 2); + case 'p': *((ptr_t*)p) = to_ptrv(va_arg(va, void*)); p+=1; break; + GO('i', int, int, 1); + GO('u', uint32_t, uint32_t, 1); + GO('I', int64_t, int64_t, 2); + GO('U', uint64_t, uint64_t, 2); + GO('L', uint32_t, uint64_t, 1); // long are 64bits on 64bits system + GO('l', int32_t, int64_t, 1); // but 32bits on 32bits system + GO('w', int16_t, int, 1); + GO('W', uint16_t, int, 1); + GO('c', int8_t, int, 1); + GO('C', uint8_t, int, 1); + default: + printf_log(LOG_NONE, "Error, unhandled arg %d: '%c' in RunFunctionFmt\n", i, fmt[i]); + *p = va_arg(va, uint32_t); + ++p; + break; + } + } + #undef GO + va_end (va); + } else + #endif + { + uint64_t *p = (uint64_t*)R_RSP; + + static const int nn[] = {_DI, _SI, _DX, _CX, _R8, _R9}; + #define GO(c, A, B, B2, C) case c: if(ni<6) emu->regs[nn[ni++]].A[0] = C va_arg(va, B2); else {*p = 0; *((B*)p) = va_arg(va, B2); ++p;}; break; + va_list va; + va_start (va, fmt); + for (int i=0; fmt[i]; ++i) { + switch(fmt[i]) { + case 'f': if(ndf<8) + emu->xmm[ndf++].f[0] = va_arg(va, double); // float are promoted to double in ... + else { + *p = 0; + *((float*)p) = va_arg(va, double); + ++p; + } + break; + case 'd': if(ndf<8) + emu->xmm[ndf++].d[0] = va_arg(va, double); + else { + *((double*)p) = va_arg(va, double); + ++p; + } + break; + GO('p', q, void*, void*, (uintptr_t)) + GO('i', sdword, int, int, ) + GO('u', dword, uint32_t, uint32_t, ) + GO('I', sq, int64_t, int64_t, ) + GO('U', q, uint64_t, uint64_t, ) + GO('L', q, uint64_t, uint64_t, ) + GO('l', sq, int64_t, int64_t, ) + GO('w', sword, int16_t, int, ) + GO('W', word, uint16_t, int, ) + GO('c', sbyte, int8_t, int, ) + GO('C', byte, uint8_t, int, ) + default: + printf_log(LOG_NONE, "Error, unhandled arg %d: '%c' in RunFunctionFmt\n", i, fmt[i]); + if(ni<6) emu->regs[nn[ni++]].q[0] = va_arg(va, uint64_t); else {*p = va_arg(va, uint64_t); ++p;}; + break; + } + } + #undef GO + va_end (va); + } + + uintptr_t oldip = R_RIP; + DynaCall(emu, fnc); + + if(oldip==R_RIP) { + #ifdef BOX32 + if(box64_is32bits) { + R_RSP = R_EBP; // mov esp, ebp + R_RBP = Pop_32(emu); // pop ebp + } else + #endif + { + R_RSP = R_RBP; // mov rsp, rbp + R_RBP = Pop64(emu); // pop rbp + } + } + double ret; + #ifdef BOX32 + if(box64_is32bits) { + ret = ST0.d; + fpu_do_pop(emu); + } else + #endif + ret = emu->xmm[0].d[0]; + + return ret; +} + +EXPORTDYN uint64_t RunSafeFunction(uintptr_t fnc, int nargs, ...) { x64emu_t * emu = thread_get_emu(); diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt index 19169c13..5ea0032f 100644 --- a/src/wrapped/generated/functions_list.txt +++ b/src/wrapped/generated/functions_list.txt @@ -30,6 +30,7 @@ #() iFC #() iFW #() iFu +#() iFU #() iFf #() iFd #() iFD @@ -207,6 +208,7 @@ #() iFuu #() iFuL #() iFup +#() iFUU #() iFUp #() iFli #() iFlp @@ -335,6 +337,7 @@ #() LFpL #() LFpp #() pFEi +#() pFEl #() pFEL #() pFEp #() pFii @@ -569,6 +572,7 @@ #() iFpil #() iFpiL #() iFpip +#() iFpIi #() iFpIp #() iFpCu #() iFpCp @@ -622,6 +626,7 @@ #() iFbpp #() IFiIi #() IFIII +#() IFIUU #() IFUUU #() IFpIi #() IFppi @@ -759,6 +764,7 @@ #() pFEuA #() pFEpi #() pFEpu +#() pFEpL #() pFEpp #() pFEpV #() pFEpA @@ -957,6 +963,7 @@ #() vFpwwu #() vFpiii #() vFpiiu +#() vFpiiU #() vFpiid #() vFpiip #() vFpiui @@ -1909,6 +1916,7 @@ #() lFppLpL #() lFppLpp #() LFELppu +#() LFEpLpV #() LFEppLL #() LFEpppp #() LFuuuuu @@ -2437,6 +2445,7 @@ #() pFELpppV #() pFELpApp #() pFEpiupp +#() pFEpippi #() pFEpippp #() pFEpuipp #() pFEpuupp @@ -3255,6 +3264,7 @@ #() iFEpiiiiippp #() iFEpupppLppL #() iFEppppppipp +#() iFEpppppppip #() iFuiiiuuiiip #() iFpiiLiiipip #() iFpiLLiiipip @@ -4511,6 +4521,30 @@ wrappedlibavformat58: wrappedlibavutil56: - vFp: - av_log_set_callback +- pFl: + - av_malloc_tracked +- pFL: + - av_mallocz_tracked +- pFip: + - av_buffer_pool_init +- pFpL: + - av_realloc_tracked +- pFpV: + - av_asprintf +- vFppV: + - av_bprintf +- vFppA: + - av_vbprintf +- vFpipV: + - av_log +- LFpLpV: + - av_strlcatf +- iFppppi: + - avpriv_slicethread_create +- pFpippi: + - av_buffer_create +- iFpppppppip: + - av_expr_parse wrappedlibbsd: wrappedlibc: - vFv: diff --git a/src/wrapped/generated/wrappedlibavutil56types.h b/src/wrapped/generated/wrappedlibavutil56types.h index 405fba99..bbf9af4d 100644 --- a/src/wrapped/generated/wrappedlibavutil56types.h +++ b/src/wrapped/generated/wrappedlibavutil56types.h @@ -12,8 +12,32 @@ #endif typedef void (*vFp_t)(void*); +typedef void* (*pFl_t)(intptr_t); +typedef void* (*pFL_t)(uintptr_t); +typedef void* (*pFip_t)(int32_t, void*); +typedef void* (*pFpL_t)(void*, uintptr_t); +typedef void* (*pFpV_t)(void*, ...); +typedef void (*vFppV_t)(void*, void*, ...); +typedef void (*vFppA_t)(void*, void*, va_list); +typedef void (*vFpipV_t)(void*, int32_t, void*, ...); +typedef uintptr_t (*LFpLpV_t)(void*, uintptr_t, void*, ...); +typedef int32_t (*iFppppi_t)(void*, void*, void*, void*, int32_t); +typedef void* (*pFpippi_t)(void*, int32_t, void*, void*, int32_t); +typedef int32_t (*iFpppppppip_t)(void*, void*, void*, void*, void*, void*, void*, int32_t, void*); #define SUPER() ADDED_FUNCTIONS() \ - GO(av_log_set_callback, vFp_t) + GO(av_log_set_callback, vFp_t) \ + GO(av_malloc_tracked, pFl_t) \ + GO(av_mallocz_tracked, pFL_t) \ + GO(av_buffer_pool_init, pFip_t) \ + GO(av_realloc_tracked, pFpL_t) \ + GO(av_asprintf, pFpV_t) \ + GO(av_bprintf, vFppV_t) \ + GO(av_vbprintf, vFppA_t) \ + GO(av_log, vFpipV_t) \ + GO(av_strlcatf, LFpLpV_t) \ + GO(avpriv_slicethread_create, iFppppi_t) \ + GO(av_buffer_create, pFpippi_t) \ + GO(av_expr_parse, iFpppppppip_t) #endif // __wrappedlibavutil56TYPES_H_ diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c index b6caa74c..d2424f0c 100644 --- a/src/wrapped/generated/wrapper.c +++ b/src/wrapped/generated/wrapper.c @@ -81,6 +81,7 @@ typedef int32_t (*iFI_t)(int64_t); typedef int32_t (*iFC_t)(uint8_t); typedef int32_t (*iFW_t)(uint16_t); typedef int32_t (*iFu_t)(uint32_t); +typedef int32_t (*iFU_t)(uint64_t); typedef int32_t (*iFf_t)(float); typedef int32_t (*iFd_t)(double); typedef int32_t (*iFl_t)(intptr_t); @@ -253,6 +254,7 @@ typedef int32_t (*iFui_t)(uint32_t, int32_t); typedef int32_t (*iFuu_t)(uint32_t, uint32_t); typedef int32_t (*iFuL_t)(uint32_t, uintptr_t); typedef int32_t (*iFup_t)(uint32_t, void*); +typedef int32_t (*iFUU_t)(uint64_t, uint64_t); typedef int32_t (*iFUp_t)(uint64_t, void*); typedef int32_t (*iFli_t)(intptr_t, int32_t); typedef int32_t (*iFlp_t)(intptr_t, void*); @@ -372,6 +374,7 @@ typedef uintptr_t (*LFpU_t)(void*, uint64_t); typedef uintptr_t (*LFpL_t)(void*, uintptr_t); typedef uintptr_t (*LFpp_t)(void*, void*); typedef void* (*pFEi_t)(x64emu_t*, int32_t); +typedef void* (*pFEl_t)(x64emu_t*, intptr_t); typedef void* (*pFEL_t)(x64emu_t*, uintptr_t); typedef void* (*pFEp_t)(x64emu_t*, void*); typedef void* (*pFii_t)(int32_t, int32_t); @@ -604,6 +607,7 @@ typedef int32_t (*iFpid_t)(void*, int32_t, double); typedef int32_t (*iFpil_t)(void*, int32_t, intptr_t); typedef int32_t (*iFpiL_t)(void*, int32_t, uintptr_t); typedef int32_t (*iFpip_t)(void*, int32_t, void*); +typedef int32_t (*iFpIi_t)(void*, int64_t, int32_t); typedef int32_t (*iFpIp_t)(void*, int64_t, void*); typedef int32_t (*iFpCu_t)(void*, uint8_t, uint32_t); typedef int32_t (*iFpCp_t)(void*, uint8_t, void*); @@ -657,6 +661,7 @@ typedef int32_t (*iFSpA_t)(void*, void*, void*); typedef int32_t (*iFbpp_t)(void*, void*, void*); typedef int64_t (*IFiIi_t)(int32_t, int64_t, int32_t); typedef int64_t (*IFIII_t)(int64_t, int64_t, int64_t); +typedef int64_t (*IFIUU_t)(int64_t, uint64_t, uint64_t); typedef int64_t (*IFUUU_t)(uint64_t, uint64_t, uint64_t); typedef int64_t (*IFpIi_t)(void*, int64_t, int32_t); typedef int64_t (*IFppi_t)(void*, void*, int32_t); @@ -791,6 +796,7 @@ typedef void* (*pFEuV_t)(x64emu_t*, uint32_t, void*); typedef void* (*pFEuA_t)(x64emu_t*, uint32_t, void*); typedef void* (*pFEpi_t)(x64emu_t*, void*, int32_t); typedef void* (*pFEpu_t)(x64emu_t*, void*, uint32_t); +typedef void* (*pFEpL_t)(x64emu_t*, void*, uintptr_t); typedef void* (*pFEpp_t)(x64emu_t*, void*, void*); typedef void* (*pFEpV_t)(x64emu_t*, void*, void*); typedef void* (*pFEpA_t)(x64emu_t*, void*, void*); @@ -988,6 +994,7 @@ typedef void (*vFLppi_t)(uintptr_t, void*, void*, int32_t); typedef void (*vFpwwu_t)(void*, int16_t, int16_t, uint32_t); typedef void (*vFpiii_t)(void*, int32_t, int32_t, int32_t); typedef void (*vFpiiu_t)(void*, int32_t, int32_t, uint32_t); +typedef void (*vFpiiU_t)(void*, int32_t, int32_t, uint64_t); typedef void (*vFpiid_t)(void*, int32_t, int32_t, double); typedef void (*vFpiip_t)(void*, int32_t, int32_t, void*); typedef void (*vFpiui_t)(void*, int32_t, uint32_t, int32_t); @@ -1938,6 +1945,7 @@ typedef intptr_t (*lFppupp_t)(void*, void*, uint32_t, void*, void*); typedef intptr_t (*lFppLpL_t)(void*, void*, uintptr_t, void*, uintptr_t); typedef intptr_t (*lFppLpp_t)(void*, void*, uintptr_t, void*, void*); typedef uintptr_t (*LFELppu_t)(x64emu_t*, uintptr_t, void*, void*, uint32_t); +typedef uintptr_t (*LFEpLpV_t)(x64emu_t*, void*, uintptr_t, void*, void*); typedef uintptr_t (*LFEppLL_t)(x64emu_t*, void*, void*, uintptr_t, uintptr_t); typedef uintptr_t (*LFEpppp_t)(x64emu_t*, void*, void*, void*, void*); typedef uintptr_t (*LFuuuuu_t)(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t); @@ -2465,6 +2473,7 @@ typedef uintptr_t (*LFSpLiip_t)(void*, void*, uintptr_t, int32_t, int32_t, void* typedef void* (*pFELpppV_t)(x64emu_t*, uintptr_t, void*, void*, void*, void*); typedef void* (*pFELpApp_t)(x64emu_t*, uintptr_t, void*, void*, void*, void*); typedef void* (*pFEpiupp_t)(x64emu_t*, void*, int32_t, uint32_t, void*, void*); +typedef void* (*pFEpippi_t)(x64emu_t*, void*, int32_t, void*, void*, int32_t); 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*); @@ -3282,6 +3291,7 @@ typedef void (*vFpppppppppp_t)(void*, void*, void*, void*, void*, void*, void*, typedef int32_t (*iFEpiiiiippp_t)(x64emu_t*, void*, int32_t, int32_t, int32_t, int32_t, int32_t, void*, void*, void*); typedef int32_t (*iFEpupppLppL_t)(x64emu_t*, void*, uint32_t, void*, void*, void*, uintptr_t, void*, void*, uintptr_t); typedef int32_t (*iFEppppppipp_t)(x64emu_t*, void*, void*, void*, void*, void*, void*, int32_t, void*, void*); +typedef int32_t (*iFEpppppppip_t)(x64emu_t*, void*, void*, void*, void*, void*, void*, void*, int32_t, void*); typedef int32_t (*iFuiiiuuiiip_t)(uint32_t, int32_t, int32_t, int32_t, uint32_t, uint32_t, int32_t, int32_t, int32_t, void*); typedef int32_t (*iFpiiLiiipip_t)(void*, int32_t, int32_t, uintptr_t, int32_t, int32_t, int32_t, void*, int32_t, void*); typedef int32_t (*iFpiLLiiipip_t)(void*, int32_t, uintptr_t, uintptr_t, int32_t, int32_t, int32_t, void*, int32_t, void*); @@ -3604,6 +3614,7 @@ void iFI(x64emu_t *emu, uintptr_t fcn) { iFI_t fn = (iFI_t)fcn; R_RAX=(uint32_t) void iFC(x64emu_t *emu, uintptr_t fcn) { iFC_t fn = (iFC_t)fcn; R_RAX=(uint32_t)fn((uint8_t)R_RDI); } void iFW(x64emu_t *emu, uintptr_t fcn) { iFW_t fn = (iFW_t)fcn; R_RAX=(uint32_t)fn((uint16_t)R_RDI); } void iFu(x64emu_t *emu, uintptr_t fcn) { iFu_t fn = (iFu_t)fcn; R_RAX=(uint32_t)fn((uint32_t)R_RDI); } +void iFU(x64emu_t *emu, uintptr_t fcn) { iFU_t fn = (iFU_t)fcn; R_RAX=(uint32_t)fn((uint64_t)R_RDI); } void iFf(x64emu_t *emu, uintptr_t fcn) { iFf_t fn = (iFf_t)fcn; R_RAX=(uint32_t)fn(emu->xmm[0].f[0]); } void iFd(x64emu_t *emu, uintptr_t fcn) { iFd_t fn = (iFd_t)fcn; R_RAX=(uint32_t)fn(emu->xmm[0].d[0]); } void iFl(x64emu_t *emu, uintptr_t fcn) { iFl_t fn = (iFl_t)fcn; R_RAX=(uint32_t)fn((intptr_t)R_RDI); } @@ -3776,6 +3787,7 @@ void iFui(x64emu_t *emu, uintptr_t fcn) { iFui_t fn = (iFui_t)fcn; R_RAX=(uint32 void iFuu(x64emu_t *emu, uintptr_t fcn) { iFuu_t fn = (iFuu_t)fcn; R_RAX=(uint32_t)fn((uint32_t)R_RDI, (uint32_t)R_RSI); } void iFuL(x64emu_t *emu, uintptr_t fcn) { iFuL_t fn = (iFuL_t)fcn; R_RAX=(uint32_t)fn((uint32_t)R_RDI, (uintptr_t)R_RSI); } void iFup(x64emu_t *emu, uintptr_t fcn) { iFup_t fn = (iFup_t)fcn; R_RAX=(uint32_t)fn((uint32_t)R_RDI, (void*)R_RSI); } +void iFUU(x64emu_t *emu, uintptr_t fcn) { iFUU_t fn = (iFUU_t)fcn; R_RAX=(uint32_t)fn((uint64_t)R_RDI, (uint64_t)R_RSI); } void iFUp(x64emu_t *emu, uintptr_t fcn) { iFUp_t fn = (iFUp_t)fcn; R_RAX=(uint32_t)fn((uint64_t)R_RDI, (void*)R_RSI); } void iFli(x64emu_t *emu, uintptr_t fcn) { iFli_t fn = (iFli_t)fcn; R_RAX=(uint32_t)fn((intptr_t)R_RDI, (int32_t)R_RSI); } void iFlp(x64emu_t *emu, uintptr_t fcn) { iFlp_t fn = (iFlp_t)fcn; R_RAX=(uint32_t)fn((intptr_t)R_RDI, (void*)R_RSI); } @@ -3895,6 +3907,7 @@ void LFpU(x64emu_t *emu, uintptr_t fcn) { LFpU_t fn = (LFpU_t)fcn; R_RAX=(uintpt void LFpL(x64emu_t *emu, uintptr_t fcn) { LFpL_t fn = (LFpL_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (uintptr_t)R_RSI); } void LFpp(x64emu_t *emu, uintptr_t fcn) { LFpp_t fn = (LFpp_t)fcn; R_RAX=(uintptr_t)fn((void*)R_RDI, (void*)R_RSI); } void pFEi(x64emu_t *emu, uintptr_t fcn) { pFEi_t fn = (pFEi_t)fcn; R_RAX=(uintptr_t)fn(emu, (int32_t)R_RDI); } +void pFEl(x64emu_t *emu, uintptr_t fcn) { pFEl_t fn = (pFEl_t)fcn; R_RAX=(uintptr_t)fn(emu, (intptr_t)R_RDI); } void pFEL(x64emu_t *emu, uintptr_t fcn) { pFEL_t fn = (pFEL_t)fcn; R_RAX=(uintptr_t)fn(emu, (uintptr_t)R_RDI); } void pFEp(x64emu_t *emu, uintptr_t fcn) { pFEp_t fn = (pFEp_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI); } void pFii(x64emu_t *emu, uintptr_t fcn) { pFii_t fn = (pFii_t)fcn; R_RAX=(uintptr_t)fn((int32_t)R_RDI, (int32_t)R_RSI); } @@ -4127,6 +4140,7 @@ void iFpid(x64emu_t *emu, uintptr_t fcn) { iFpid_t fn = (iFpid_t)fcn; R_RAX=(uin void iFpil(x64emu_t *emu, uintptr_t fcn) { iFpil_t fn = (iFpil_t)fcn; R_RAX=(uint32_t)fn((void*)R_RDI, (int32_t)R_RSI, (intptr_t)R_RDX); } void iFpiL(x64emu_t *emu, uintptr_t fcn) { iFpiL_t fn = (iFpiL_t)fcn; R_RAX=(uint32_t)fn((void*)R_RDI, (int32_t)R_RSI, (uintptr_t)R_RDX); } void iFpip(x64emu_t *emu, uintptr_t fcn) { iFpip_t fn = (iFpip_t)fcn; R_RAX=(uint32_t)fn((void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX); } +void iFpIi(x64emu_t *emu, uintptr_t fcn) { iFpIi_t fn = (iFpIi_t)fcn; R_RAX=(uint32_t)fn((void*)R_RDI, (int64_t)R_RSI, (int32_t)R_RDX); } void iFpIp(x64emu_t *emu, uintptr_t fcn) { iFpIp_t fn = (iFpIp_t)fcn; R_RAX=(uint32_t)fn((void*)R_RDI, (int64_t)R_RSI, (void*)R_RDX); } void iFpCu(x64emu_t *emu, uintptr_t fcn) { iFpCu_t fn = (iFpCu_t)fcn; R_RAX=(uint32_t)fn((void*)R_RDI, (uint8_t)R_RSI, (uint32_t)R_RDX); } void iFpCp(x64emu_t *emu, uintptr_t fcn) { iFpCp_t fn = (iFpCp_t)fcn; R_RAX=(uint32_t)fn((void*)R_RDI, (uint8_t)R_RSI, (void*)R_RDX); } @@ -4180,6 +4194,7 @@ void iFSpA(x64emu_t *emu, uintptr_t fcn) { iFSpA_t fn = (iFSpA_t)fcn; R_RAX=(uin void iFbpp(x64emu_t *emu, uintptr_t fcn) { iFbpp_t fn = (iFbpp_t)fcn; void *aligned_xcb = align_xcb_connection((void*)R_RDI); R_RAX=(uint32_t)fn(aligned_xcb, (void*)R_RSI, (void*)R_RDX); unalign_xcb_connection(aligned_xcb, (void*)R_RDI); } void IFiIi(x64emu_t *emu, uintptr_t fcn) { IFiIi_t fn = (IFiIi_t)fcn; S_RAX=(int64_t)fn((int32_t)R_RDI, (int64_t)R_RSI, (int32_t)R_RDX); } void IFIII(x64emu_t *emu, uintptr_t fcn) { IFIII_t fn = (IFIII_t)fcn; S_RAX=(int64_t)fn((int64_t)R_RDI, (int64_t)R_RSI, (int64_t)R_RDX); } +void IFIUU(x64emu_t *emu, uintptr_t fcn) { IFIUU_t fn = (IFIUU_t)fcn; S_RAX=(int64_t)fn((int64_t)R_RDI, (uint64_t)R_RSI, (uint64_t)R_RDX); } void IFUUU(x64emu_t *emu, uintptr_t fcn) { IFUUU_t fn = (IFUUU_t)fcn; S_RAX=(int64_t)fn((uint64_t)R_RDI, (uint64_t)R_RSI, (uint64_t)R_RDX); } void IFpIi(x64emu_t *emu, uintptr_t fcn) { IFpIi_t fn = (IFpIi_t)fcn; S_RAX=(int64_t)fn((void*)R_RDI, (int64_t)R_RSI, (int32_t)R_RDX); } void IFppi(x64emu_t *emu, uintptr_t fcn) { IFppi_t fn = (IFppi_t)fcn; S_RAX=(int64_t)fn((void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX); } @@ -4314,6 +4329,7 @@ void pFEuV(x64emu_t *emu, uintptr_t fcn) { pFEuV_t fn = (pFEuV_t)fcn; R_RAX=(uin void pFEuA(x64emu_t *emu, uintptr_t fcn) { pFEuA_t fn = (pFEuA_t)fcn; R_RAX=(uintptr_t)fn(emu, (uint32_t)R_RDI, (void*)R_RSI); } void pFEpi(x64emu_t *emu, uintptr_t fcn) { pFEpi_t fn = (pFEpi_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (int32_t)R_RSI); } void pFEpu(x64emu_t *emu, uintptr_t fcn) { pFEpu_t fn = (pFEpu_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (uint32_t)R_RSI); } +void pFEpL(x64emu_t *emu, uintptr_t fcn) { pFEpL_t fn = (pFEpL_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (uintptr_t)R_RSI); } void pFEpp(x64emu_t *emu, uintptr_t fcn) { pFEpp_t fn = (pFEpp_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (void*)R_RSI); } void pFEpV(x64emu_t *emu, uintptr_t fcn) { pFEpV_t fn = (pFEpV_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (void*)(R_RSP + 8)); } void pFEpA(x64emu_t *emu, uintptr_t fcn) { pFEpA_t fn = (pFEpA_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (void*)R_RSI); } @@ -4511,6 +4527,7 @@ void vFLppi(x64emu_t *emu, uintptr_t fcn) { vFLppi_t fn = (vFLppi_t)fcn; fn((uin void vFpwwu(x64emu_t *emu, uintptr_t fcn) { vFpwwu_t fn = (vFpwwu_t)fcn; fn((void*)R_RDI, (int16_t)R_RSI, (int16_t)R_RDX, (uint32_t)R_RCX); } void vFpiii(x64emu_t *emu, uintptr_t fcn) { vFpiii_t fn = (vFpiii_t)fcn; fn((void*)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX); } void vFpiiu(x64emu_t *emu, uintptr_t fcn) { vFpiiu_t fn = (vFpiiu_t)fcn; fn((void*)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (uint32_t)R_RCX); } +void vFpiiU(x64emu_t *emu, uintptr_t fcn) { vFpiiU_t fn = (vFpiiU_t)fcn; fn((void*)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (uint64_t)R_RCX); } void vFpiid(x64emu_t *emu, uintptr_t fcn) { vFpiid_t fn = (vFpiid_t)fcn; fn((void*)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, emu->xmm[0].d[0]); } void vFpiip(x64emu_t *emu, uintptr_t fcn) { vFpiip_t fn = (vFpiip_t)fcn; fn((void*)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (void*)R_RCX); } void vFpiui(x64emu_t *emu, uintptr_t fcn) { vFpiui_t fn = (vFpiui_t)fcn; fn((void*)R_RDI, (int32_t)R_RSI, (uint32_t)R_RDX, (int32_t)R_RCX); } @@ -5461,6 +5478,7 @@ void lFppupp(x64emu_t *emu, uintptr_t fcn) { lFppupp_t fn = (lFppupp_t)fcn; R_RA void lFppLpL(x64emu_t *emu, uintptr_t fcn) { lFppLpL_t fn = (lFppLpL_t)fcn; R_RAX=(intptr_t)fn((void*)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (void*)R_RCX, (uintptr_t)R_R8); } void lFppLpp(x64emu_t *emu, uintptr_t fcn) { lFppLpp_t fn = (lFppLpp_t)fcn; R_RAX=(intptr_t)fn((void*)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (void*)R_RCX, (void*)R_R8); } void LFELppu(x64emu_t *emu, uintptr_t fcn) { LFELppu_t fn = (LFELppu_t)fcn; R_RAX=(uintptr_t)fn(emu, (uintptr_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (uint32_t)R_RCX); } +void LFEpLpV(x64emu_t *emu, uintptr_t fcn) { LFEpLpV_t fn = (LFEpLpV_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (uintptr_t)R_RSI, (void*)R_RDX, (void*)(R_RSP + 8)); } void LFEppLL(x64emu_t *emu, uintptr_t fcn) { LFEppLL_t fn = (LFEppLL_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (uintptr_t)R_RCX); } void LFEpppp(x64emu_t *emu, uintptr_t fcn) { LFEpppp_t fn = (LFEpppp_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX); } void LFuuuuu(x64emu_t *emu, uintptr_t fcn) { LFuuuuu_t fn = (LFuuuuu_t)fcn; R_RAX=(uintptr_t)fn((uint32_t)R_RDI, (uint32_t)R_RSI, (uint32_t)R_RDX, (uint32_t)R_RCX, (uint32_t)R_R8); } @@ -5988,6 +6006,7 @@ void LFSpLiip(x64emu_t *emu, uintptr_t fcn) { LFSpLiip_t fn = (LFSpLiip_t)fcn; R void pFELpppV(x64emu_t *emu, uintptr_t fcn) { pFELpppV_t fn = (pFELpppV_t)fcn; R_RAX=(uintptr_t)fn(emu, (uintptr_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)(R_RSP + 8)); } void pFELpApp(x64emu_t *emu, uintptr_t fcn) { pFELpApp_t fn = (pFELpApp_t)fcn; R_RAX=(uintptr_t)fn(emu, (uintptr_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8); } void pFEpiupp(x64emu_t *emu, uintptr_t fcn) { pFEpiupp_t fn = (pFEpiupp_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (int32_t)R_RSI, (uint32_t)R_RDX, (void*)R_RCX, (void*)R_R8); } +void pFEpippi(x64emu_t *emu, uintptr_t fcn) { pFEpippi_t fn = (pFEpippi_t)fcn; R_RAX=(uintptr_t)fn(emu, (void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (int32_t)R_R8); } 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); } @@ -6805,6 +6824,7 @@ void vFpppppppppp(x64emu_t *emu, uintptr_t fcn) { vFpppppppppp_t fn = (vFppppppp void iFEpiiiiippp(x64emu_t *emu, uintptr_t fcn) { iFEpiiiiippp_t fn = (iFEpiiiiippp_t)fcn; R_RAX=(uint32_t)fn(emu, (void*)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), *(void**)(R_RSP + 16), *(void**)(R_RSP + 24)); } void iFEpupppLppL(x64emu_t *emu, uintptr_t fcn) { iFEpupppLppL_t fn = (iFEpupppLppL_t)fcn; R_RAX=(uint32_t)fn(emu, (void*)R_RDI, (uint32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (uintptr_t)R_R9, *(void**)(R_RSP + 8), *(void**)(R_RSP + 16), *(uintptr_t*)(R_RSP + 24)); } void iFEppppppipp(x64emu_t *emu, uintptr_t fcn) { iFEppppppipp_t fn = (iFEppppppipp_t)fcn; R_RAX=(uint32_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(int32_t*)(R_RSP + 8), *(void**)(R_RSP + 16), *(void**)(R_RSP + 24)); } +void iFEpppppppip(x64emu_t *emu, uintptr_t fcn) { iFEpppppppip_t fn = (iFEpppppppip_t)fcn; R_RAX=(uint32_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8), *(int32_t*)(R_RSP + 16), *(void**)(R_RSP + 24)); } void iFuiiiuuiiip(x64emu_t *emu, uintptr_t fcn) { iFuiiiuuiiip_t fn = (iFuiiiuuiiip_t)fcn; R_RAX=(uint32_t)fn((uint32_t)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (uint32_t)R_R8, (uint32_t)R_R9, *(int32_t*)(R_RSP + 8), *(int32_t*)(R_RSP + 16), *(int32_t*)(R_RSP + 24), *(void**)(R_RSP + 32)); } void iFpiiLiiipip(x64emu_t *emu, uintptr_t fcn) { iFpiiLiiipip_t fn = (iFpiiLiiipip_t)fcn; R_RAX=(uint32_t)fn((void*)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (uintptr_t)R_RCX, (int32_t)R_R8, (int32_t)R_R9, *(int32_t*)(R_RSP + 8), *(void**)(R_RSP + 16), *(int32_t*)(R_RSP + 24), *(void**)(R_RSP + 32)); } void iFpiLLiiipip(x64emu_t *emu, uintptr_t fcn) { iFpiLLiiipip_t fn = (iFpiLLiiipip_t)fcn; R_RAX=(uint32_t)fn((void*)R_RDI, (int32_t)R_RSI, (uintptr_t)R_RDX, (uintptr_t)R_RCX, (int32_t)R_R8, (int32_t)R_R9, *(int32_t*)(R_RSP + 8), *(void**)(R_RSP + 16), *(int32_t*)(R_RSP + 24), *(void**)(R_RSP + 32)); } @@ -7161,6 +7181,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFC) return 1; if (fun == &iFW) return 1; if (fun == &iFu) return 1; + if (fun == &iFU) return 1; if (fun == &iFf) return 2; if (fun == &iFd) return 2; if (fun == &iFl) return 1; @@ -7291,6 +7312,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFuu) return 1; if (fun == &iFuL) return 1; if (fun == &iFup) return 1; + if (fun == &iFUU) return 1; if (fun == &iFUp) return 1; if (fun == &iFli) return 1; if (fun == &iFlp) return 1; @@ -7570,6 +7592,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFpil) return 1; if (fun == &iFpiL) return 1; if (fun == &iFpip) return 1; + if (fun == &iFpIi) return 1; if (fun == &iFpIp) return 1; if (fun == &iFpCu) return 1; if (fun == &iFpCp) return 1; @@ -7611,6 +7634,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFppp) return 1; if (fun == &IFiIi) return 1; if (fun == &IFIII) return 1; + if (fun == &IFIUU) return 1; if (fun == &IFUUU) return 1; if (fun == &IFpIi) return 1; if (fun == &IFppi) return 1; @@ -7862,6 +7886,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &vFpwwu) return 1; if (fun == &vFpiii) return 1; if (fun == &vFpiiu) return 1; + if (fun == &vFpiiU) return 1; if (fun == &vFpiid) return 2; if (fun == &vFpiip) return 1; if (fun == &vFpiui) return 1; @@ -9220,6 +9245,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFC) return 1; if (fun == &iFW) return 1; if (fun == &iFu) return 17; + if (fun == &iFU) return 1; if (fun == &iFf) return 2; if (fun == &iFd) return 2; if (fun == &iFl) return 1; @@ -9350,6 +9376,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFuu) return 49; if (fun == &iFuL) return 17; if (fun == &iFup) return 17; + if (fun == &iFUU) return 1; if (fun == &iFUp) return 1; if (fun == &iFli) return 33; if (fun == &iFlp) return 1; @@ -9629,6 +9656,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFpil) return 33; if (fun == &iFpiL) return 33; if (fun == &iFpip) return 33; + if (fun == &iFpIi) return 65; if (fun == &iFpIp) return 1; if (fun == &iFpCu) return 65; if (fun == &iFpCp) return 1; @@ -9670,6 +9698,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFppp) return 1; if (fun == &IFiIi) return 81; if (fun == &IFIII) return 1; + if (fun == &IFIUU) return 1; if (fun == &IFUUU) return 1; if (fun == &IFpIi) return 65; if (fun == &IFppi) return 65; @@ -9921,6 +9950,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &vFpwwu) return 225; if (fun == &vFpiii) return 225; if (fun == &vFpiiu) return 225; + if (fun == &vFpiiU) return 97; if (fun == &vFpiid) return 98; if (fun == &vFpiip) return 97; if (fun == &vFpiui) return 225; diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h index a9b7cc0a..f0e0bb67 100644 --- a/src/wrapped/generated/wrapper.h +++ b/src/wrapped/generated/wrapper.h @@ -67,6 +67,7 @@ void iFI(x64emu_t *emu, uintptr_t fnc); void iFC(x64emu_t *emu, uintptr_t fnc); void iFW(x64emu_t *emu, uintptr_t fnc); void iFu(x64emu_t *emu, uintptr_t fnc); +void iFU(x64emu_t *emu, uintptr_t fnc); void iFf(x64emu_t *emu, uintptr_t fnc); void iFd(x64emu_t *emu, uintptr_t fnc); void iFD(x64emu_t *emu, uintptr_t fnc); @@ -244,6 +245,7 @@ void iFui(x64emu_t *emu, uintptr_t fnc); void iFuu(x64emu_t *emu, uintptr_t fnc); void iFuL(x64emu_t *emu, uintptr_t fnc); void iFup(x64emu_t *emu, uintptr_t fnc); +void iFUU(x64emu_t *emu, uintptr_t fnc); void iFUp(x64emu_t *emu, uintptr_t fnc); void iFli(x64emu_t *emu, uintptr_t fnc); void iFlp(x64emu_t *emu, uintptr_t fnc); @@ -372,6 +374,7 @@ void LFpU(x64emu_t *emu, uintptr_t fnc); void LFpL(x64emu_t *emu, uintptr_t fnc); void LFpp(x64emu_t *emu, uintptr_t fnc); void pFEi(x64emu_t *emu, uintptr_t fnc); +void pFEl(x64emu_t *emu, uintptr_t fnc); void pFEL(x64emu_t *emu, uintptr_t fnc); void pFEp(x64emu_t *emu, uintptr_t fnc); void pFii(x64emu_t *emu, uintptr_t fnc); @@ -606,6 +609,7 @@ void iFpid(x64emu_t *emu, uintptr_t fnc); void iFpil(x64emu_t *emu, uintptr_t fnc); void iFpiL(x64emu_t *emu, uintptr_t fnc); void iFpip(x64emu_t *emu, uintptr_t fnc); +void iFpIi(x64emu_t *emu, uintptr_t fnc); void iFpIp(x64emu_t *emu, uintptr_t fnc); void iFpCu(x64emu_t *emu, uintptr_t fnc); void iFpCp(x64emu_t *emu, uintptr_t fnc); @@ -659,6 +663,7 @@ void iFSpA(x64emu_t *emu, uintptr_t fnc); void iFbpp(x64emu_t *emu, uintptr_t fnc); void IFiIi(x64emu_t *emu, uintptr_t fnc); void IFIII(x64emu_t *emu, uintptr_t fnc); +void IFIUU(x64emu_t *emu, uintptr_t fnc); void IFUUU(x64emu_t *emu, uintptr_t fnc); void IFpIi(x64emu_t *emu, uintptr_t fnc); void IFppi(x64emu_t *emu, uintptr_t fnc); @@ -796,6 +801,7 @@ void pFEuV(x64emu_t *emu, uintptr_t fnc); void pFEuA(x64emu_t *emu, uintptr_t fnc); void pFEpi(x64emu_t *emu, uintptr_t fnc); void pFEpu(x64emu_t *emu, uintptr_t fnc); +void pFEpL(x64emu_t *emu, uintptr_t fnc); void pFEpp(x64emu_t *emu, uintptr_t fnc); void pFEpV(x64emu_t *emu, uintptr_t fnc); void pFEpA(x64emu_t *emu, uintptr_t fnc); @@ -994,6 +1000,7 @@ void vFLppi(x64emu_t *emu, uintptr_t fnc); void vFpwwu(x64emu_t *emu, uintptr_t fnc); void vFpiii(x64emu_t *emu, uintptr_t fnc); void vFpiiu(x64emu_t *emu, uintptr_t fnc); +void vFpiiU(x64emu_t *emu, uintptr_t fnc); void vFpiid(x64emu_t *emu, uintptr_t fnc); void vFpiip(x64emu_t *emu, uintptr_t fnc); void vFpiui(x64emu_t *emu, uintptr_t fnc); @@ -1946,6 +1953,7 @@ void lFppupp(x64emu_t *emu, uintptr_t fnc); void lFppLpL(x64emu_t *emu, uintptr_t fnc); void lFppLpp(x64emu_t *emu, uintptr_t fnc); void LFELppu(x64emu_t *emu, uintptr_t fnc); +void LFEpLpV(x64emu_t *emu, uintptr_t fnc); void LFEppLL(x64emu_t *emu, uintptr_t fnc); void LFEpppp(x64emu_t *emu, uintptr_t fnc); void LFuuuuu(x64emu_t *emu, uintptr_t fnc); @@ -2474,6 +2482,7 @@ void LFSpLiip(x64emu_t *emu, uintptr_t fnc); void pFELpppV(x64emu_t *emu, uintptr_t fnc); void pFELpApp(x64emu_t *emu, uintptr_t fnc); void pFEpiupp(x64emu_t *emu, uintptr_t fnc); +void pFEpippi(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); @@ -3292,6 +3301,7 @@ void vFpppppppppp(x64emu_t *emu, uintptr_t fnc); void iFEpiiiiippp(x64emu_t *emu, uintptr_t fnc); void iFEpupppLppL(x64emu_t *emu, uintptr_t fnc); void iFEppppppipp(x64emu_t *emu, uintptr_t fnc); +void iFEpppppppip(x64emu_t *emu, uintptr_t fnc); void iFuiiiuuiiip(x64emu_t *emu, uintptr_t fnc); void iFpiiLiiipip(x64emu_t *emu, uintptr_t fnc); void iFpiLLiiipip(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped/wrappedlibavcodec58.c b/src/wrapped/wrappedlibavcodec58.c index 17e4170d..f0afe381 100644 --- a/src/wrapped/wrappedlibavcodec58.c +++ b/src/wrapped/wrappedlibavcodec58.c @@ -35,4 +35,8 @@ GO(2) \ GO(3) \ GO(4) +#define PRE_INIT \ + if(BOX64ENV(nogtk)) \ + return -1; + #include "wrappedlib_init.h" diff --git a/src/wrapped/wrappedlibavcodec58_private.h b/src/wrapped/wrappedlibavcodec58_private.h index 7a504c3a..38771b45 100644 --- a/src/wrapped/wrappedlibavcodec58_private.h +++ b/src/wrapped/wrappedlibavcodec58_private.h @@ -22,9 +22,9 @@ GO(av_bsf_list_free, vFp) GO(av_bsf_receive_packet, iFpp) // AVBSFContext* contains AVClass* which might needs wrapping GO(av_bsf_send_packet, iFpp) // AVBSFContext* contains AVClass* which might needs wrapping //GOM(avcodec_align_dimensions, vFEppp) -//GOM(avcodec_align_dimensions2, vFEpppp) -//GOM(avcodec_alloc_context3, pFEp) -//GOM(avcodec_close, iFEp) +GO(avcodec_align_dimensions2, vFpppp) +GO(avcodec_alloc_context3, pFp) +GO(avcodec_close, iFp) GO(avcodec_configuration, pFv) //GOM(avcodec_dct_alloc, pFEv) //GOM(avcodec_dct_get_class, pFEv) @@ -32,7 +32,7 @@ GO(avcodec_configuration, pFv) //GOM(avcodec_decode_subtitle2, iFEpppp) //GOM(avcodec_default_execute, iFEppppii) //GOM(avcodec_default_execute2, iFEppppi) -//GOM(avcodec_default_get_buffer2, iFEppi) +GO(avcodec_default_get_buffer2, iFppi) //GOM(avcodec_default_get_encode_buffer, iFEppi) //GOM(avcodec_default_get_format, iFEpp) GO(avcodec_descriptor_get, pFu) @@ -43,11 +43,11 @@ DATA(av_codec_ffversion, 8) // Warning: failed to confirm GO(avcodec_fill_audio_frame, iFpiipii) GO(avcodec_find_best_pix_fmt_of_list, iFpiip) GO(avcodec_find_decoder, pFu) -//GOM(avcodec_find_decoder_by_name, pFEp) -//GOM(avcodec_find_encoder, pFEu) -//GOM(avcodec_find_encoder_by_name, pFEp) -//GOM(avcodec_flush_buffers, vFEp) -//GOM(avcodec_free_context, vFEp) +GO(avcodec_find_decoder_by_name, pFp) +GO(avcodec_find_encoder, pFu) +GO(avcodec_find_encoder_by_name, pFp) +GO(avcodec_flush_buffers, vFp) +GO(avcodec_free_context, vFp) //GOM(avcodec_get_class, pFEv) //GOM(avcodec_get_hw_config, pFEpi) //GOM(avcodec_get_hw_frames_parameters, iFEppip) @@ -55,23 +55,23 @@ GO(avcodec_get_name, pFu) //GOM(avcodec_get_subtitle_rect_class, pFEv) //GOM(avcodec_get_supported_config, iFEppuupp) GO(avcodec_get_type, iFu) -//GOM(av_codec_is_decoder, iFEp) -//GOM(av_codec_is_encoder, iFEp) -//GOM(avcodec_is_open, iFEp) -//GOM(av_codec_iterate, pFEp) +GO(av_codec_is_decoder, iFp) +GO(av_codec_is_encoder, iFp) +GO(avcodec_is_open, iFp) +GO(av_codec_iterate, pFp) GO(avcodec_license, pFv) -//GOM(avcodec_open2, iFEppp) +GO(avcodec_open2, iFppp) GO(avcodec_parameters_alloc, pFv) GO(avcodec_parameters_copy, iFpp) GO(avcodec_parameters_free, vFp) -//GOM(avcodec_parameters_from_context, iFEpp) -//GOM(avcodec_parameters_to_context, iFEpp) +GO(avcodec_parameters_from_context, iFpp) +GO(avcodec_parameters_to_context, iFpp) GO(avcodec_pix_fmt_to_codec_tag, uFi) GO(avcodec_profile_name, pFui) -//GOM(avcodec_receive_frame, iFEpp) -//GOM(avcodec_receive_packet, iFEpp) -//GOM(avcodec_send_frame, iFEpp) -//GOM(avcodec_send_packet, iFEpp) +GO(avcodec_receive_frame, iFpp) +GO(avcodec_receive_packet, iFpp) +GO(avcodec_send_frame, iFpp) +GO(avcodec_send_packet, iFpp) //GOM(avcodec_string, vFEpipi) GO(avcodec_version, uFv) GO(av_cpb_properties_alloc, pFp) diff --git a/src/wrapped/wrappedlibavformat58.c b/src/wrapped/wrappedlibavformat58.c index 87f3757c..2aefe469 100644 --- a/src/wrapped/wrappedlibavformat58.c +++ b/src/wrapped/wrappedlibavformat58.c @@ -110,4 +110,8 @@ EXPORT void* my_avio_alloc_context(x64emu_t* emu, void* buffer, int buffer_size, return my->avio_alloc_context(buffer, buffer_size, write_flag, opaque, find_read_packet_Fct(read_packet), find_write_packet_Fct(write_packet), find_seek_Fct(seek)); } +#define PRE_INIT \ + if(BOX64ENV(nogtk)) \ + return -1; + #include "wrappedlib_init.h" diff --git a/src/wrapped/wrappedlibavformat58_private.h b/src/wrapped/wrappedlibavformat58_private.h index 84ebfbd1..df411a20 100644 --- a/src/wrapped/wrappedlibavformat58_private.h +++ b/src/wrapped/wrappedlibavformat58_private.h @@ -13,13 +13,13 @@ GO(av_disposition_to_string, pFi) //GOM(av_dump_format, vFEpipi) GO(av_filename_number_test, iFp) //GOM(av_find_best_stream, iFEpiiipi) -//GOM(av_find_default_stream_index, iFEp) +GO(av_find_default_stream_index, iFp) GO(av_find_input_format, pFp) // return AVInputFormat* wich might need wrapping //GOM(av_find_program_from_stream, pFEppi) //GOM(av_fmt_ctx_get_duration_estimation_method, uFEp) GO(avformat_alloc_context, pFv) // return AVFormatContext* wich might needs some wrapping? //GOM(avformat_alloc_output_context2, iFEpppp) -//GOM(avformat_close_input, vFEp) +GO(avformat_close_input, vFp) GO(avformat_configuration, pFv) DATA(av_format_ffversion, 8) // Warning: failed to confirm GO(avformat_find_stream_info, iFpp) // AVFormatContext* might need some wrapping @@ -39,7 +39,7 @@ GO(avformat_license, pFv) //GOM(avformat_match_stream_specifier, iFEppp) GO(avformat_network_deinit, iFv) GO(avformat_network_init, iFv) -//GOM(avformat_new_stream, pFEpp) +GO(avformat_new_stream, pFpp) GO(avformat_open_input, iFpppp) // many strucure might need wrapping here //GOM(avformat_query_codec, iFEpui) //GOM(avformat_queue_attached_pictures, iFEp) @@ -49,7 +49,7 @@ GO(avformat_seek_file, iFpiIIIi) GO(avformat_stream_group_name, pFu) //GOM(avformat_transfer_internal_stream_timing_info, iFEpppi) GO(avformat_version, uFv) -//GOM(avformat_write_header, iFEpp) +GO(avformat_write_header, iFpp) GO(av_get_frame_filename, iFpipi) GO(av_get_frame_filename2, iFpipii) //GOM(av_get_output_timestamp, iFEpipp) @@ -60,7 +60,7 @@ GO(av_get_frame_filename2, iFpipii) //GOM(av_guess_sample_aspect_ratio, UFEppp) GO(av_hex_dump, vFSpi) GO(av_hex_dump_log, vFpipi) -//GOM(av_index_search_timestamp, iFEpIi) +GO(av_index_search_timestamp, iFpIi) //GOM(av_interleaved_write_frame, iFEpp) //GOM(av_interleaved_write_uncoded_frame, iFEpip) //GOM(avio_accept, iFEpp) @@ -74,7 +74,7 @@ GO(avio_context_free, vFp) GO(avio_enum_protocols, pFpi) //GOM(avio_feof, iFEp) GO(avio_find_protocol_name, pFp) -//GOM(avio_flush, vFEp) +GO(avio_flush, vFp) GO(avio_free_directory_entry, vFp) //GOM(avio_get_dyn_buf, iFEpp) //GOM(avio_get_str, iFEpipi) @@ -122,7 +122,7 @@ GO(avio_read_dir, iFpp) //GOM(avio_write, vFEppi) //GOM(avio_write_marker, vFEpIu) GO(av_match_ext, iFpp) -//GOM(av_muxer_iterate, pFEp) +GO(av_muxer_iterate, pFp) //GOM(av_new_program, pFEpi) //GOM(av_pkt_dump2, vFESpip) //GOM(av_pkt_dump_log2, vFEpipip) @@ -156,7 +156,7 @@ GO(av_seek_frame, iFpiIi) //GOM(av_stream_group_get_class, pFEv) //GOM(av_stream_new_side_data, pFEpuL) GO(av_url_split, vFpipipippip) -//GOM(av_write_frame, iFEpp) -//GOM(av_write_trailer, iFEp) +GO(av_write_frame, iFpp) +GO(av_write_trailer, iFp) //GOM(av_write_uncoded_frame, iFEpip) //GOM(av_write_uncoded_frame_query, iFEpi) diff --git a/src/wrapped/wrappedlibavutil56.c b/src/wrapped/wrappedlibavutil56.c index a714651d..8fdfe0c5 100644 --- a/src/wrapped/wrappedlibavutil56.c +++ b/src/wrapped/wrappedlibavutil56.c @@ -25,6 +25,9 @@ const char* libavutil56Name = "libavutil.so.56"; #define LIBNAME libavutil56 #define ADDED_FUNCTIONS() \ + GO(av_malloc, pFL_t) \ + GO(av_mallocz, pFL_t) \ + GO(av_realloc, pFpL_t) \ #include "generated/wrappedlibavutil56types.h" @@ -63,6 +66,138 @@ static void* find_log_callback_Fct(void* fct) printf_log(LOG_NONE, "Warning, no more slot for libavutil56 log_callback callback\n"); return NULL; } +// alloc ... +#define GO(A) \ +static uintptr_t my_alloc_fct_##A = 0; \ +static void* my_alloc_##A(int a) \ +{ \ + return (void*)RunFunctionFmt(my_alloc_fct_##A, "i", a); \ +} +SUPER() +#undef GO +static void* find_alloc_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_alloc_fct_##A == (uintptr_t)fct) return my_alloc_##A; + SUPER() + #undef GO + #define GO(A) if(my_alloc_fct_##A == 0) {my_alloc_fct_##A = (uintptr_t)fct; return my_alloc_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libavutil56 alloc callback\n"); + return NULL; +} +// func1 ... +#define GO(A) \ +static uintptr_t my_func1_fct_##A = 0; \ +static double my_func1_##A(void* a, double b) \ +{ \ + return RunFunctionFmtD(my_func1_fct_##A, "pd", a, b); \ +} +SUPER() +#undef GO +static void* find_func1_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_func1_fct_##A == (uintptr_t)fct) return my_func1_##A; + SUPER() + #undef GO + #define GO(A) if(my_func1_fct_##A == 0) {my_func1_fct_##A = (uintptr_t)fct; return my_func1_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libavutil56 func1 callback\n"); + return NULL; +} +// func2 ... +#define GO(A) \ +static uintptr_t my_func2_fct_##A = 0; \ +static double my_func2_##A(void* a, double b, double c) \ +{ \ + return RunFunctionFmtD(my_func2_fct_##A, "pdd", a, b, c); \ +} +SUPER() +#undef GO +static void* find_func2_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_func2_fct_##A == (uintptr_t)fct) return my_func2_##A; + SUPER() + #undef GO + #define GO(A) if(my_func2_fct_##A == 0) {my_func2_fct_##A = (uintptr_t)fct; return my_func2_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libavutil56 func2 callback\n"); + return NULL; +} +// worker ... +#define GO(A) \ +static uintptr_t my_worker_fct_##A = 0; \ +static void my_worker_##A(void* a, int b, int c, int d, int e) \ +{ \ + RunFunctionFmt(my_worker_fct_##A, "piiii", a, b, c, d, e); \ +} +SUPER() +#undef GO +static void* find_worker_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_worker_fct_##A == (uintptr_t)fct) return my_worker_##A; + SUPER() + #undef GO + #define GO(A) if(my_worker_fct_##A == 0) {my_worker_fct_##A = (uintptr_t)fct; return my_worker_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libavutil56 worker callback\n"); + return NULL; +} +// main ... +#define GO(A) \ +static uintptr_t my_main_fct_##A = 0; \ +static void my_main_##A(void* a) \ +{ \ + RunFunctionFmt(my_main_fct_##A, "p", a); \ +} +SUPER() +#undef GO +static void* find_main_Fct(void* fct) +{ + if(!fct) return fct; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_main_fct_##A == (uintptr_t)fct) return my_main_##A; + SUPER() + #undef GO + #define GO(A) if(my_main_fct_##A == 0) {my_main_fct_##A = (uintptr_t)fct; return my_main_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libavutil56 main callback\n"); + return NULL; +} +// free ... +#define GO(A) \ +static uintptr_t my_free_fct_##A = 0; \ +static void my_free_##A(void* a, void* b) \ +{ \ + RunFunctionFmt(my_free_fct_##A, "pp", a, b); \ +} +SUPER() +#undef GO +static void* find_free_Fct(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 libavutil56 free callback\n"); + return NULL; +} #undef SUPER @@ -71,4 +206,100 @@ EXPORT void my_av_log_set_callback(x64emu_t* emu, void* f) my->av_log_set_callback(find_log_callback_Fct(f)); } +EXPORT void* my_av_asprintf(x64emu_t* emu, void * fmt, uint64_t * b) { + myStackAlign(emu, (const char*)fmt, b, emu->scratch, R_EAX, 1); + PREPARE_VALIST; + char* buff = NULL; + vasprintf(&buff, (char*)fmt, VARARGS); + void* ret = my->av_asprintf("%s", buff); + free(buff); + return ret; +} + +EXPORT void my_av_vbprintf(x64emu_t* emu, void* buff, void* fmt, x64_va_list_t b) +{ + (void)emu; + #ifdef CONVERT_VALIST + CONVERT_VALIST(b); + #else + myStackAlignValist(emu, (const char*)fmt, emu->scratch, b); + PREPARE_VALIST; + #endif + my->av_vbprintf(buff, fmt, VARARGS); +} +EXPORT void my_av_bprintf(x64emu_t* emu, void** buff, void * fmt, uint64_t * b) { + myStackAlign(emu, (const char*)fmt, b, emu->scratch, R_EAX, 2); + PREPARE_VALIST; + my->av_vbprintf((char**)buff, (char*)fmt, VARARGS); +} + +EXPORT void* my_av_buffer_pool_init(x64emu_t* emu, int size, void* alloc) +{ + return my->av_buffer_pool_init(size, find_alloc_Fct(alloc)); +} + +EXPORT int my_av_expr_parse(x64emu_t* emu, void* expr, void* s, void** const_names, void** func1_names, void** funcs1, void** func2_names, void** funcs2, int offset, void* log) +{ + int n_f1 = 0, n_f2 = 0; + // find n of f1 and f2 first + while(funcs1[n_f1]) ++n_f1; + while(funcs2[n_f2]) ++n_f2; + n_f1++; n_f2++; // include NULL marker + void* funcs1_[n_f1]; + void* funcs2_[n_f2]; + for(int i=0; i<n_f1; ++i) funcs1_[i] = find_func1_Fct(funcs1[i]); + for(int i=0; i<n_f2; ++i) funcs2_[i] = find_func2_Fct(funcs2[i]); + return my->av_expr_parse(expr, s, const_names, func1_names, funcs1_, func2_names, funcs2_, offset, log); +} + +EXPORT void my_av_log(x64emu_t* emu, void* avcl, int lvl, void* fmt, uint64_t* b) +{ + myStackAlign(emu, (const char*)fmt, b, emu->scratch, R_EAX, 3); + PREPARE_VALIST; + char* buff = NULL; + vasprintf(&buff, (char*)fmt, VARARGS); + my->av_log(avcl, lvl, "%s", buff); + free(buff); +} + +EXPORT void* my_av_malloc_tracked(x64emu_t* emu, size_t size) +{ + return my->av_malloc_tracked?my->av_malloc_tracked(size):my->av_malloc(size); +} + +EXPORT void* my_av_mallocz_tracked(x64emu_t* emu, size_t size) +{ + return my->av_mallocz_tracked?my->av_mallocz_tracked(size):my->av_mallocz(size); +} + +EXPORT void* my_av_realloc_tracked(x64emu_t* emu, void* p, size_t size) +{ + return my->av_realloc_tracked?my->av_realloc_tracked(p, size):my->av_realloc(p, size); +} + +EXPORT size_t my_av_strlcatf(x64emu_t* emu, void* dst, size_t size, void* fmt, uint64_t* b) +{ + myStackAlign(emu, (const char*)fmt, b, emu->scratch, R_EAX, 3); + PREPARE_VALIST; + char* buff = NULL; + vasprintf(&buff, (char*)fmt, VARARGS); + size_t ret = my->av_strlcatf(dst, size, "%s", buff); + free(buff); + return ret; +} + +EXPORT int my_avpriv_slicethread_create(x64emu_t* emu, void* pctx, void* priv, void* worker, void* main_func, int nb) +{ + return my->avpriv_slicethread_create(pctx, priv, find_worker_Fct(worker), find_main_Fct(main_func), nb); +} + +EXPORT void* my_av_buffer_create(x64emu_t* emu, void* data, int size, void* f, void* opaque, int flags) +{ + return my->av_buffer_create(data, size, find_free_Fct(f), opaque, flags); +} + +#define PRE_INIT \ + if(BOX64ENV(nogtk)) \ + return -1; + #include "wrappedlib_init.h" diff --git a/src/wrapped/wrappedlibavutil56_private.h b/src/wrapped/wrappedlibavutil56_private.h index 4e937ebd..1e526ba0 100644 --- a/src/wrapped/wrappedlibavutil56_private.h +++ b/src/wrapped/wrappedlibavutil56_private.h @@ -20,7 +20,7 @@ GO(av_aes_ctr_set_random_iv, vFp) GO(av_aes_init, iFppii) DATA(av_aes_size, 4) GO(av_append_path_component, pFpp) -//GOM(av_asprintf, pFEpV) +GOM(av_asprintf, pFEpV) GO(av_assert0_fpu, vFv) GO(av_audio_fifo_alloc, pFiii) GO(av_audio_fifo_drain, iFpi) @@ -46,7 +46,7 @@ GO(av_bprint_append_data, vFppu) GO(av_bprint_chars, vFpcu) GO(av_bprint_clear, vFp) GO(av_bprint_escape, vFpppui) -//GOM(av_bprintf, vFEppV) +GOM(av_bprintf, vFEppV) GO(av_bprint_finalize, iFpp) GO(av_bprint_get_buffer, vFpupp) GO(av_bprint_init, vFpuu) @@ -54,7 +54,7 @@ GO(av_bprint_init_for_buffer, vFppu) GO(av_bprint_strftime, vFppp) GO(av_buffer_alloc, pFL) GO(av_buffer_allocz, pFL) -//GOM(av_buffer_create, pFEpLppi) +GOM(av_buffer_create, pFEpippi) GO(av_buffer_default_free, vFpp) GO(av_buffer_get_opaque, pFp) GO(av_buffer_get_ref_count, iFp) @@ -62,7 +62,7 @@ GO(av_buffer_is_writable, iFp) GO(av_buffer_make_writable, iFp) GO(av_buffer_pool_buffer_get_opaque, pFp) GO(av_buffer_pool_get, pFp) -//GOM(av_buffer_pool_init, pFELp) +GOM(av_buffer_pool_init, pFEip) //GOM(av_buffer_pool_init2, pFELppp) GO(av_buffer_pool_uninit, vFp) GO(av_buffer_realloc, iFpL) @@ -143,7 +143,7 @@ GO(av_expr_count_func, iFppii) GO(av_expr_count_vars, iFppi) GO(av_expr_eval, dFppp) GO(av_expr_free, vFp) -//GOM(av_expr_parse, iFEpppppppip) +GOM(av_expr_parse, iFEpppppppip) //GOM(av_expr_parse_and_eval, iFEpppppppppip) GO(av_fast_malloc, vFppL) GO(av_fast_mallocz, vFppL) @@ -222,15 +222,15 @@ GO(av_get_alt_sample_fmt, iFii) GO(av_get_bits_per_pixel, iFp) GO(av_get_bytes_per_sample, iFi) //GO(av_get_channel_description, -//GO(av_get_channel_layout, -//GO(av_get_channel_layout_channel_index, -//GO(av_get_channel_layout_nb_channels, -//GO(av_get_channel_layout_string, -//GO(av_get_channel_name, +GO(av_get_channel_layout, UFp) +GO(av_get_channel_layout_channel_index, iFUU) +GO(av_get_channel_layout_nb_channels, iFU) +GO(av_get_channel_layout_string, vFpiiU) +GO(av_get_channel_name, pFU) //GO(av_get_colorspace_name, GO(av_get_cpu_flags, iFv) -//GO(av_get_default_channel_layout, -//GO(av_get_extended_channel_layout, +GO(av_get_default_channel_layout, UFi) +GO(av_get_extended_channel_layout, iFppp) GO(av_get_known_color_name, pFip) GO(av_get_media_type_string, pFi) GO(av_get_packed_sample_fmt, iFi) @@ -307,7 +307,7 @@ GO(av_image_get_linesize, iFiii) GO(av_int_list_length_for_size, uFupU) GO(av_lfg_init, vFpu) GO(av_lfg_init_from_data, iFppu) -//GOM(av_log, vFEpipV) +GOM(av_log, vFEpipV) GO(av_log2, iFu) GO(av_log2_16bit, iFu) //GO(av_log2_i, @@ -322,9 +322,11 @@ GO(av_log_set_flags, vFi) GO(av_log_set_level, vFi) //GO(av_lzo1x_decode, GO(av_malloc, pFL) +GOM(av_malloc_tracked, pFEl) GO(av_malloc_array, pFLL) GO(av_mallocz, pFL) -//GO(av_mallocz_array, +GOM(av_mallocz_tracked, pFEL) // not wlways defined +GO(av_mallocz_array, pFLL) GO(av_mastering_display_metadata_alloc, pFv) GO(av_mastering_display_metadata_create_side_data, pFp) GO(av_match_list, iFppc) @@ -422,10 +424,10 @@ GO(av_pix_fmt_swap_endianness, iFi) //GO(avpriv_report_missing_feature, //GO(avpriv_request_sample, //GO(avpriv_scalarproduct_float_c, -//GO(avpriv_set_systematic_pal2, -//GO(avpriv_slicethread_create, -//GO(avpriv_slicethread_execute, -//GO(avpriv_slicethread_free, +GO(avpriv_set_systematic_pal2, iFpu) +GOM(avpriv_slicethread_create, iFEppppi) +GO(avpriv_slicethread_execute, vFpii) +GO(avpriv_slicethread_free, vFp) //GO(avpriv_solve_lls, //GO(avpriv_tempfile, //DATA(avpriv_vga16_font, @@ -438,12 +440,13 @@ GO(av_read_image_line2, vFppppiiiiii) GO(av_realloc, pFpL) GO(av_realloc_array, pFpLL) GO(av_realloc_f, pFpLL) +GOM(av_realloc_tracked, pFEpL) //not always defined GO(av_reallocp, iFpL) GO(av_reallocp_array, iFpLL) GO(av_reduce, iFppIII) GO(av_rescale, IFIII) //GO(av_rescale_delta, -//GO(av_rescale_q, +GO(av_rescale_q, IFIUU) // Both U are AVRationnal: struct with 2 ints GO(av_rescale_q_rnd, IFIUUu) // Both U are AVRationnal: struct with 2 ints GO(av_rescale_rnd, IFIIIu) GO(av_ripemd_alloc, pFv) @@ -488,7 +491,7 @@ GO(av_strireplace, pFppp) GO(av_stristart, iFppp) GO(av_stristr, pFpp) GO(av_strlcat, LFppL) -//GOM(av_strlcatf, LFEpLpV) +GOM(av_strlcatf, LFEpLpV) GO(av_strlcpy, LFppL) GO(av_strncasecmp, iFppL) GO(av_strndup, pFpL) @@ -542,7 +545,7 @@ GO(avutil_configuration, pFv) DATA(av_util_ffversion, 8) // Warning: failed to confirm GO(avutil_license, pFv) GO(avutil_version, uFv) -//GOM(av_vbprintf, vFEppA) +GOM(av_vbprintf, vFEppA) GO(av_version_info, pFv) GO(av_video_enc_params_alloc, pFiup) GO(av_video_enc_params_create_side_data, pFpiu) |