diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-02-16 12:41:13 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-02-16 12:41:13 +0100 |
| commit | 10c479034f4b969a0370a1d2734ab895b3a52bbb (patch) | |
| tree | 1163ddd5f546f0653d5209ba495c28c272f1a49a /src | |
| parent | 3c95826c5ce888f3823dc5655dde238cd00fded7 (diff) | |
| download | box64-10c479034f4b969a0370a1d2734ab895b3a52bbb.tar.gz box64-10c479034f4b969a0370a1d2734ab895b3a52bbb.zip | |
Added some more wrapped function to libc, libXt and libX11
Diffstat (limited to 'src')
| -rw-r--r-- | src/wrapped/generated/functions_list.txt | 8 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedlibxttypes.h | 6 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.c | 5 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.h | 2 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibc_private.h | 2 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibx11_private.h | 2 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibxt.c | 92 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibxt_private.h | 14 |
8 files changed, 122 insertions, 9 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt index 96a58864..d9abe642 100644 --- a/src/wrapped/generated/functions_list.txt +++ b/src/wrapped/generated/functions_list.txt @@ -2576,6 +2576,7 @@ #() iFpLpppppp #() iFppiiipip #() iFppillppp +#() iFppippppp #() iFppIIIppp #() iFppuiiuuu #() iFppuuuuuu @@ -2841,6 +2842,7 @@ #() iFpppppppppu #() uFpddpippppp #() uFpppppppppp +#() lFpLppdddddd #() pFEiippppppp #() pFEpiiiiiipp #() pFEpippppppp @@ -4902,10 +4904,16 @@ wrappedlibxrandr: wrappedlibxrender: wrappedlibxss: wrappedlibxt: +- vFpp: + - XtAppSetErrorHandler + - XtAppSetErrorMsgHandler + - XtAppSetWarningHandler + - XtAppSetWarningMsgHandler - lFppp: - XtAppAddWorkProc - vFpuipp: - XtAddEventHandler + - XtAddRawEventHandler - lFpippp: - XtAppAddInput wrappedlibxtst: diff --git a/src/wrapped/generated/wrappedlibxttypes.h b/src/wrapped/generated/wrappedlibxttypes.h index 20239185..bfa25435 100644 --- a/src/wrapped/generated/wrappedlibxttypes.h +++ b/src/wrapped/generated/wrappedlibxttypes.h @@ -11,13 +11,19 @@ #define ADDED_FUNCTIONS() #endif +typedef void (*vFpp_t)(void*, void*); typedef intptr_t (*lFppp_t)(void*, void*, void*); typedef void (*vFpuipp_t)(void*, uint32_t, int32_t, void*, void*); typedef intptr_t (*lFpippp_t)(void*, int32_t, void*, void*, void*); #define SUPER() ADDED_FUNCTIONS() \ + GO(XtAppSetErrorHandler, vFpp_t) \ + GO(XtAppSetErrorMsgHandler, vFpp_t) \ + GO(XtAppSetWarningHandler, vFpp_t) \ + GO(XtAppSetWarningMsgHandler, vFpp_t) \ GO(XtAppAddWorkProc, lFppp_t) \ GO(XtAddEventHandler, vFpuipp_t) \ + GO(XtAddRawEventHandler, vFpuipp_t) \ GO(XtAppAddInput, lFpippp_t) #endif // __wrappedlibxtTYPES_H_ diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c index 4e094135..6c5f3753 100644 --- a/src/wrapped/generated/wrapper.c +++ b/src/wrapped/generated/wrapper.c @@ -2614,6 +2614,7 @@ typedef int32_t (*iFpLpppupu_t)(void*, uintptr_t, void*, void*, void*, uint32_t, typedef int32_t (*iFpLpppppp_t)(void*, uintptr_t, void*, void*, void*, void*, void*, void*); typedef int32_t (*iFppiiipip_t)(void*, void*, int32_t, int32_t, int32_t, void*, int32_t, void*); typedef int32_t (*iFppillppp_t)(void*, void*, int32_t, intptr_t, intptr_t, void*, void*, void*); +typedef int32_t (*iFppippppp_t)(void*, void*, int32_t, void*, void*, void*, void*, void*); typedef int32_t (*iFppIIIppp_t)(void*, void*, int64_t, int64_t, int64_t, void*, void*, void*); typedef int32_t (*iFppuiiuuu_t)(void*, void*, uint32_t, int32_t, int32_t, uint32_t, uint32_t, uint32_t); typedef int32_t (*iFppuuuuuu_t)(void*, void*, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t); @@ -2879,6 +2880,7 @@ typedef int32_t (*iFpppppppipi_t)(void*, void*, void*, void*, void*, void*, void typedef int32_t (*iFpppppppppu_t)(void*, void*, void*, void*, void*, void*, void*, void*, void*, uint32_t); typedef uint32_t (*uFpddpippppp_t)(void*, double, double, void*, int32_t, void*, void*, void*, void*, void*); typedef uint32_t (*uFpppppppppp_t)(void*, void*, void*, void*, void*, void*, void*, void*, void*, void*); +typedef intptr_t (*lFpLppdddddd_t)(void*, uintptr_t, void*, void*, double, double, double, double, double, double); typedef void* (*pFEiippppppp_t)(x64emu_t*, int32_t, int32_t, void*, void*, void*, void*, void*, void*, void*); typedef void* (*pFEpiiiiiipp_t)(x64emu_t*, void*, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, void*, void*); typedef void* (*pFEpippppppp_t)(x64emu_t*, void*, int32_t, void*, void*, void*, void*, void*, void*, void*); @@ -5669,6 +5671,7 @@ void iFpLpppupu(x64emu_t *emu, uintptr_t fcn) { iFpLpppupu_t fn = (iFpLpppupu_t) void iFpLpppppp(x64emu_t *emu, uintptr_t fcn) { iFpLpppppp_t fn = (iFpLpppppp_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (uintptr_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8), *(void**)(R_RSP + 16)); } void iFppiiipip(x64emu_t *emu, uintptr_t fcn) { iFppiiipip_t fn = (iFppiiipip_t)fcn; R_RAX=(int32_t)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**)(R_RSP + 16)); } void iFppillppp(x64emu_t *emu, uintptr_t fcn) { iFppillppp_t fn = (iFppillppp_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (intptr_t)R_RCX, (intptr_t)R_R8, (void*)R_R9, *(void**)(R_RSP + 8), *(void**)(R_RSP + 16)); } +void iFppippppp(x64emu_t *emu, uintptr_t fcn) { iFppippppp_t fn = (iFppippppp_t)fcn; R_RAX=(int32_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 iFppIIIppp(x64emu_t *emu, uintptr_t fcn) { iFppIIIppp_t fn = (iFppIIIppp_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (void*)R_RSI, (int64_t)R_RDX, (int64_t)R_RCX, (int64_t)R_R8, (void*)R_R9, *(void**)(R_RSP + 8), *(void**)(R_RSP + 16)); } void iFppuiiuuu(x64emu_t *emu, uintptr_t fcn) { iFppuiiuuu_t fn = (iFppuiiuuu_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (void*)R_RSI, (uint32_t)R_RDX, (int32_t)R_RCX, (int32_t)R_R8, (uint32_t)R_R9, *(uint32_t*)(R_RSP + 8), *(uint32_t*)(R_RSP + 16)); } void iFppuuuuuu(x64emu_t *emu, uintptr_t fcn) { iFppuuuuuu_t fn = (iFppuuuuuu_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (void*)R_RSI, (uint32_t)R_RDX, (uint32_t)R_RCX, (uint32_t)R_R8, (uint32_t)R_R9, *(uint32_t*)(R_RSP + 8), *(uint32_t*)(R_RSP + 16)); } @@ -5934,6 +5937,7 @@ void iFpppppppipi(x64emu_t *emu, uintptr_t fcn) { iFpppppppipi_t fn = (iFppppppp void iFpppppppppu(x64emu_t *emu, uintptr_t fcn) { iFpppppppppu_t fn = (iFpppppppppu_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8), *(void**)(R_RSP + 16), *(void**)(R_RSP + 24), *(uint32_t*)(R_RSP + 32)); } void uFpddpippppp(x64emu_t *emu, uintptr_t fcn) { uFpddpippppp_t fn = (uFpddpippppp_t)fcn; R_RAX=(uint32_t)fn((void*)R_RDI, emu->xmm[0].d[0], emu->xmm[1].d[0], (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 uFpppppppppp(x64emu_t *emu, uintptr_t fcn) { uFpppppppppp_t fn = (uFpppppppppp_t)fcn; R_RAX=(uint32_t)fn((void*)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8), *(void**)(R_RSP + 16), *(void**)(R_RSP + 24), *(void**)(R_RSP + 32)); } +void lFpLppdddddd(x64emu_t *emu, uintptr_t fcn) { lFpLppdddddd_t fn = (lFpLppdddddd_t)fcn; R_RAX=(intptr_t)fn((void*)R_RDI, (uintptr_t)R_RSI, (void*)R_RDX, (void*)R_RCX, emu->xmm[0].d[0], emu->xmm[1].d[0], emu->xmm[2].d[0], emu->xmm[3].d[0], emu->xmm[4].d[0], emu->xmm[5].d[0]); } void pFEiippppppp(x64emu_t *emu, uintptr_t fcn) { pFEiippppppp_t fn = (pFEiippppppp_t)fcn; R_RAX=(uintptr_t)fn(emu, (int32_t)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9, *(void**)(R_RSP + 8), *(void**)(R_RSP + 16), *(void**)(R_RSP + 24)); } void pFEpiiiiiipp(x64emu_t *emu, uintptr_t fcn) { pFEpiiiiiipp_t fn = (pFEpiiiiiipp_t)fcn; R_RAX=(uintptr_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, *(int32_t*)(R_RSP + 8), *(void**)(R_RSP + 16), *(void**)(R_RSP + 24)); } void pFEpippppppp(x64emu_t *emu, uintptr_t fcn) { pFEpippppppp_t fn = (pFEpippppppp_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*)R_R9, *(void**)(R_RSP + 8), *(void**)(R_RSP + 16), *(void**)(R_RSP + 24)); } @@ -7972,6 +7976,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &vFuddiiddiip) return 5; if (fun == &vFppdddddddd) return 9; if (fun == &iFpippddiidd) return 5; + if (fun == &lFpLppdddddd) return 7; #if defined(NOALIGN) if (fun == &iFipiip) return 1; #endif diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h index bd9cb116..0392a7c5 100644 --- a/src/wrapped/generated/wrapper.h +++ b/src/wrapped/generated/wrapper.h @@ -2614,6 +2614,7 @@ void iFpLpppupu(x64emu_t *emu, uintptr_t fnc); void iFpLpppppp(x64emu_t *emu, uintptr_t fnc); void iFppiiipip(x64emu_t *emu, uintptr_t fnc); void iFppillppp(x64emu_t *emu, uintptr_t fnc); +void iFppippppp(x64emu_t *emu, uintptr_t fnc); void iFppIIIppp(x64emu_t *emu, uintptr_t fnc); void iFppuiiuuu(x64emu_t *emu, uintptr_t fnc); void iFppuuuuuu(x64emu_t *emu, uintptr_t fnc); @@ -2879,6 +2880,7 @@ void iFpppppppipi(x64emu_t *emu, uintptr_t fnc); void iFpppppppppu(x64emu_t *emu, uintptr_t fnc); void uFpddpippppp(x64emu_t *emu, uintptr_t fnc); void uFpppppppppp(x64emu_t *emu, uintptr_t fnc); +void lFpLppdddddd(x64emu_t *emu, uintptr_t fnc); void pFEiippppppp(x64emu_t *emu, uintptr_t fnc); void pFEpiiiiiipp(x64emu_t *emu, uintptr_t fnc); void pFEpippppppp(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h index 308e2d2e..c0ebefd1 100644 --- a/src/wrapped/wrappedlibc_private.h +++ b/src/wrapped/wrappedlibc_private.h @@ -1896,7 +1896,7 @@ GO(__strerror_r, pFipL) GO(strerror_r, pFipL) //GO(strfmon, lFpLpV) //GO(__strfmon_l, -//GOW(strfmon_l, lFpLppV) +GOW(strfmon_l, lFpLppdddddd) // should be V, but only double are allowed... GO(strfromd, iFpLpd) GO(strfromf, iFpLpf) GO(strfromf128, iFpLpD) diff --git a/src/wrapped/wrappedlibx11_private.h b/src/wrapped/wrappedlibx11_private.h index 271c1ffb..7b9c0434 100644 --- a/src/wrapped/wrappedlibx11_private.h +++ b/src/wrapped/wrappedlibx11_private.h @@ -791,7 +791,7 @@ GO(XmbTextEscapement, iFppi) GO(XmbTextExtents, iFppipp) GO(XmbTextListToTextProperty, iFppiip) //GO(_XmbTextListToTextProperty, -//GO(XmbTextPerCharExtents +GO(XmbTextPerCharExtents, iFppippppp) GO(XmbTextPropertyToTextList, iFpppp) //GO(_XmbTextPropertyToTextList, GO(_Xmbtowc, iFppi) diff --git a/src/wrapped/wrappedlibxt.c b/src/wrapped/wrappedlibxt.c index 94f28659..382b03a0 100644 --- a/src/wrapped/wrappedlibxt.c +++ b/src/wrapped/wrappedlibxt.c @@ -105,6 +105,73 @@ static void* findInputCallbackFct(void* fct) printf_log(LOG_NONE, "Warning, no more slot for libXt InputCallback callback\n"); return NULL; } +// XtErrorMsgHandler +#define GO(A) \ +static uintptr_t my_XtErrorMsgHandler_fct_##A = 0; \ +static void my_XtErrorMsgHandler_##A(void* a, void* b, void* c, void* d, void* e, void* f) \ +{ \ + RunFunctionFmt(my_XtErrorMsgHandler_fct_##A, "pppppp", a, b, c, d, e, f); \ +} +SUPER() +#undef GO +static void* findXtErrorMsgHandlerFct(void* fct) +{ + if(!fct) return NULL; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_XtErrorMsgHandler_fct_##A == (uintptr_t)fct) return my_XtErrorMsgHandler_##A; + SUPER() + #undef GO + #define GO(A) if(my_XtErrorMsgHandler_fct_##A == 0) {my_XtErrorMsgHandler_fct_##A = (uintptr_t)fct; return my_XtErrorMsgHandler_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libXt XtErrorMsgHandler callback\n"); + return NULL; +} +// XtErrorHandler +#define GO(A) \ +static uintptr_t my_XtErrorHandler_fct_##A = 0; \ +static void my_XtErrorHandler_##A(void* a) \ +{ \ + RunFunctionFmt(my_XtErrorHandler_fct_##A, "p", a); \ +} +SUPER() +#undef GO +static void* findXtErrorHandlerFct(void* fct) +{ + if(!fct) return NULL; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_XtErrorHandler_fct_##A == (uintptr_t)fct) return my_XtErrorHandler_##A; + SUPER() + #undef GO + #define GO(A) if(my_XtErrorHandler_fct_##A == 0) {my_XtErrorHandler_fct_##A = (uintptr_t)fct; return my_XtErrorHandler_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libXt XtErrorHandler callback\n"); + return NULL; +} +// XtEventHandler +#define GO(A) \ +static uintptr_t my_XtEventHandler_fct_##A = 0; \ +static void my_XtEventHandler_##A(void* a, void* b, void* c, void* d) \ +{ \ + RunFunctionFmt(my_XtEventHandler_fct_##A, "pppp", a, b, c, d); \ +} +SUPER() +#undef GO +static void* findXtEventHandlerFct(void* fct) +{ + if(!fct) return NULL; + if(GetNativeFnc((uintptr_t)fct)) return GetNativeFnc((uintptr_t)fct); + #define GO(A) if(my_XtEventHandler_fct_##A == (uintptr_t)fct) return my_XtEventHandler_##A; + SUPER() + #undef GO + #define GO(A) if(my_XtEventHandler_fct_##A == 0) {my_XtEventHandler_fct_##A = (uintptr_t)fct; return my_XtEventHandler_##A; } + SUPER() + #undef GO + printf_log(LOG_NONE, "Warning, no more slot for libXt XtEventHandler callback\n"); + return NULL; +} + #undef SUPER @@ -127,6 +194,31 @@ EXPORT long my_XtAppAddInput(x64emu_t* emu, void* context, int source, void* con return my->XtAppAddInput(context, source, cond, findInputCallbackFct(proc), data); } +EXPORT void my_XtAppSetWarningMsgHandler(x64emu_t* emu, void* ctx, void* f) +{ + my->XtAppSetWarningMsgHandler(ctx, findXtErrorMsgHandlerFct(f)); +} + +EXPORT void my_XtAppSetErrorMsgHandler(x64emu_t* emu, void* ctx, void* f) +{ + my->XtAppSetErrorMsgHandler(ctx, findXtErrorMsgHandlerFct(f)); +} + +EXPORT void my_XtAppSetWarningHandler(x64emu_t* emu, void* ctx, void* f) +{ + my->XtAppSetWarningHandler(ctx, findXtErrorHandlerFct(f)); +} + +EXPORT void my_XtAppSetErrorHandler(x64emu_t* emu, void* ctx, void* f) +{ + my->XtAppSetErrorHandler(ctx, findXtErrorHandlerFct(f)); +} + +EXPORT void my_XtAddRawEventHandler(x64emu_t* emu, void* w, uint32_t mask, int nonmaskable, void* f, void* data) +{ + my->XtAddRawEventHandler(w, mask, nonmaskable, findXtEventHandlerFct(f), data); +} + #ifdef ANDROID #define NEEDED_LIBS "libX11.so", "libXext.so" #else diff --git a/src/wrapped/wrappedlibxt_private.h b/src/wrapped/wrappedlibxt_private.h index 68139c5e..2f22dcc0 100644 --- a/src/wrapped/wrappedlibxt_private.h +++ b/src/wrapped/wrappedlibxt_private.h @@ -14,7 +14,7 @@ GOM(XtAddEventHandler, vFEpuipp) //GO(XtAddExposureToRegion, //GO(XtAddGrab, //GO(XtAddInput, -//GO(XtAddRawEventHandler, +GOM(XtAddRawEventHandler, vFEpuipp) //GO(_XtAddShellToHookObj, //GO(XtAddSignal, //GO(XtAddTimeOut, @@ -49,14 +49,14 @@ GO(XtAppCreateShell, pFpppppu) GO(XtAppPending, pFp) GO(XtAppProcessEvent, vFpu) //GO(XtAppReleaseCacheRefs, -//GO(XtAppSetErrorHandler, -//GO(XtAppSetErrorMsgHandler, +GOM(XtAppSetErrorHandler, vFEpp) +GOM(XtAppSetErrorMsgHandler, vFEpp) //GO(XtAppSetExitFlag, GO(XtAppSetFallbackResources, vFpp) //GO(XtAppSetSelectionTimeout, //GO(XtAppSetTypeConverter, -//GO(XtAppSetWarningHandler, -//GO(XtAppSetWarningMsgHandler, +GOM(XtAppSetWarningHandler, vFEpp) +GOM(XtAppSetWarningMsgHandler, vFEpp) //GO(XtAppUnlock, //GO(XtAppWarning, //GO(XtAppWarningMsg, @@ -183,7 +183,7 @@ GO(XtDisplayToApplicationContext, pFp) //GO(_XtFillAncestorList, //GO(XtFindFile, //GO(_XtFindRemapWidget, -//GO(XtFree, +GO(XtFree, vFp) //GO(_XtFreeActions, //GO(_XtFreeArgList, //GO(_XtFreeConverterTable, @@ -412,7 +412,7 @@ GO(XtUngrabPointer, vFpu) //GO(_XtUnmergeTranslations, GO(XtUnrealizeWidget, vFp) GO(XtUnregisterDrawable, vFpp) -//GO(XtVaAppCreateShell, +GO(XtVaAppCreateShell, pFpppppppppppppppp) // should be pFppppV //GO(XtVaAppInitialize, //GO(_XtVaAppInitialize, //GO(XtVaCreateArgsList, |