diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-12-03 18:45:46 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-12-03 18:45:46 +0100 |
| commit | fb276bdc6bf02cc1781da2eaf1b60e824d840b8b (patch) | |
| tree | bebc487e28c45d1977476f11a562cf87bb6024e2 /src | |
| parent | 1c1a26626ba1ceda224757ccaf8483534885cbe3 (diff) | |
| download | box64-fb276bdc6bf02cc1781da2eaf1b60e824d840b8b.tar.gz box64-fb276bdc6bf02cc1781da2eaf1b60e824d840b8b.zip | |
[BOX32][WRAPER] Fixed Xcursor wrapping
Diffstat (limited to 'src')
| -rw-r--r-- | src/libtools/my_x11_defs.h | 17 | ||||
| -rw-r--r-- | src/libtools/my_x11_defs_32.h | 17 | ||||
| -rw-r--r-- | src/wrapped32/generated/functions_list.txt | 14 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrappedlibxcursortypes32.h | 13 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.c | 6 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrapper32.h | 3 | ||||
| -rw-r--r-- | src/wrapped32/wrappedlibxcursor.c | 111 | ||||
| -rw-r--r-- | src/wrapped32/wrappedlibxcursor_private.h | 14 |
8 files changed, 187 insertions, 8 deletions
diff --git a/src/libtools/my_x11_defs.h b/src/libtools/my_x11_defs.h index e422f8f3..97b328eb 100644 --- a/src/libtools/my_x11_defs.h +++ b/src/libtools/my_x11_defs.h @@ -1240,6 +1240,23 @@ typedef struct my_XcursorCursors_s { void* cursors; //Cursor* } my_XcursorCursors_t; +typedef struct my_XcursorImage_s { + uint32_t version; + uint32_t size; + uint32_t width; + uint32_t height; + uint32_t xhot; + uint32_t yhot; + uint32_t delay; + void* pixels; +} my_XcursorImage_t; + +typedef struct my_XcursorImages_s { + int nimage; + my_XcursorImage_t** images; + char* name; +} my_XcursorImages_t; + typedef struct my_XExtCodes_s { int extension; int major_opcode; diff --git a/src/libtools/my_x11_defs_32.h b/src/libtools/my_x11_defs_32.h index cbe78f75..8e131848 100644 --- a/src/libtools/my_x11_defs_32.h +++ b/src/libtools/my_x11_defs_32.h @@ -1172,6 +1172,23 @@ typedef struct my_XcursorCursors_32_s { ptr_t cursors; //Cursor* } my_XcursorCursors_32_t; +typedef struct my_XcursorImage_32_s { + uint32_t version; + uint32_t size; + uint32_t width; + uint32_t height; + uint32_t xhot; + uint32_t yhot; + uint32_t delay; + ptr_t pixels; //XcursorPixel* +} my_XcursorImage_32_t; + +typedef struct my_XcursorImages_32_s { + int nimage; + ptr_t images; //my_XcursorImage_t** + ptr_t name; //char* +} my_XcursorImages_32_t; + typedef struct my_XExtCodes_32_s { int extension; int major_opcode; diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index 0195599b..03e81b01 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -294,6 +294,7 @@ #() LFXp -> LFXp #() pFEv -> pFEv #() pEEv -> pEEv +#() pFEi -> pFEi #() pEEu -> pEEu #() pFEp -> pFEp #() pEEp -> pEEp @@ -579,6 +580,7 @@ #() lFppL -> lFppL #() LFEpi -> LFEpi #() LFEpp -> LFEpp +#() LFEXp -> LFEXp #() LFpii -> LFpii #() LEpip -> LEpip #() LFppi -> LFppi @@ -590,6 +592,7 @@ #() LFXLC -> LFXLC #() LFXpi -> LFXpi #() LFXpp -> LFXpp +#() pFEii -> pFEii #() pEEip -> pEEip #() pFEiV -> pFEiV #() pEEpi -> pEEpi @@ -2345,8 +2348,19 @@ wrappedlibxcomposite: wrappedlibxcursor: - vFp: - XcursorCursorsDestroy + - XcursorImageDestroy + - XcursorImagesDestroy +- pFi: + - XcursorImagesCreate +- LFXp: + - XcursorImageLoadCursor + - XcursorImagesLoadCursor +- pFii: + - XcursorImageCreate - pFXi: - XcursorCursorsCreate +- pFXp: + - XcursorImagesLoadCursors wrappedlibxext: - vFp: - XdbeFreeVisualInfo diff --git a/src/wrapped32/generated/wrappedlibxcursortypes32.h b/src/wrapped32/generated/wrappedlibxcursortypes32.h index 8433e982..b01813c7 100644 --- a/src/wrapped32/generated/wrappedlibxcursortypes32.h +++ b/src/wrapped32/generated/wrappedlibxcursortypes32.h @@ -12,10 +12,21 @@ #endif typedef void (*vFp_t)(void*); +typedef void* (*pFi_t)(int32_t); +typedef uintptr_t (*LFXp_t)(void*, void*); +typedef void* (*pFii_t)(int32_t, int32_t); typedef void* (*pFXi_t)(void*, int32_t); +typedef void* (*pFXp_t)(void*, void*); #define SUPER() ADDED_FUNCTIONS() \ GO(XcursorCursorsDestroy, vFp_t) \ - GO(XcursorCursorsCreate, pFXi_t) + GO(XcursorImageDestroy, vFp_t) \ + GO(XcursorImagesDestroy, vFp_t) \ + GO(XcursorImagesCreate, pFi_t) \ + GO(XcursorImageLoadCursor, LFXp_t) \ + GO(XcursorImagesLoadCursor, LFXp_t) \ + GO(XcursorImageCreate, pFii_t) \ + GO(XcursorCursorsCreate, pFXi_t) \ + GO(XcursorImagesLoadCursors, pFXp_t) #endif // __wrappedlibxcursorTYPES32_H_ diff --git a/src/wrapped32/generated/wrapper32.c b/src/wrapped32/generated/wrapper32.c index 263236b1..37c495c6 100644 --- a/src/wrapped32/generated/wrapper32.c +++ b/src/wrapped32/generated/wrapper32.c @@ -385,6 +385,7 @@ typedef uintptr_t (*LFXL_t)(void*, uintptr_t); typedef uintptr_t (*LFXp_t)(void*, void*); typedef void* (*pFEv_t)(x64emu_t*); typedef void* (*pEEv_t)(x64emu_t*); +typedef void* (*pFEi_t)(x64emu_t*, int32_t); typedef void* (*pEEu_t)(x64emu_t*, uint32_t); typedef void* (*pFEp_t)(x64emu_t*, void*); typedef void* (*pEEp_t)(x64emu_t*, void*); @@ -670,6 +671,7 @@ typedef intptr_t (*lFppi_t)(void*, void*, int32_t); typedef intptr_t (*lFppL_t)(void*, void*, uintptr_t); typedef uintptr_t (*LFEpi_t)(x64emu_t*, void*, int32_t); typedef uintptr_t (*LFEpp_t)(x64emu_t*, void*, void*); +typedef uintptr_t (*LFEXp_t)(x64emu_t*, void*, void*); typedef uintptr_t (*LFpii_t)(void*, int32_t, int32_t); typedef uintptr_t (*LEpip_t)(void*, int32_t, void*); typedef uintptr_t (*LFppi_t)(void*, void*, int32_t); @@ -681,6 +683,7 @@ typedef uintptr_t (*LFXLi_t)(void*, uintptr_t, int32_t); typedef uintptr_t (*LFXLC_t)(void*, uintptr_t, uint8_t); typedef uintptr_t (*LFXpi_t)(void*, void*, int32_t); typedef uintptr_t (*LFXpp_t)(void*, void*, void*); +typedef void* (*pFEii_t)(x64emu_t*, int32_t, int32_t); typedef void* (*pEEip_t)(x64emu_t*, int32_t, void*); typedef void* (*pFEiV_t)(x64emu_t*, int32_t, void*); typedef void* (*pEEpi_t)(x64emu_t*, void*, int32_t); @@ -2029,6 +2032,7 @@ void LFXL_32(x64emu_t *emu, uintptr_t fcn) { LFXL_t fn = (LFXL_t)fcn; R_EAX = to void LFXp_32(x64emu_t *emu, uintptr_t fcn) { LFXp_t fn = (LFXp_t)fcn; R_EAX = to_ulong(fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8))); } void pFEv_32(x64emu_t *emu, uintptr_t fcn) { pFEv_t fn = (pFEv_t)fcn; R_EAX = to_ptrv(fn(emu)); } void pEEv_32(x64emu_t *emu, uintptr_t fcn) { pEEv_t fn = (pEEv_t)fcn; errno = emu->libc_err; R_EAX = to_ptrv(fn(emu)); emu->libc_err = errno; } +void pFEi_32(x64emu_t *emu, uintptr_t fcn) { pFEi_t fn = (pFEi_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptri(int32_t, R_ESP + 4))); } void pEEu_32(x64emu_t *emu, uintptr_t fcn) { pEEu_t fn = (pEEu_t)fcn; errno = emu->libc_err; R_EAX = to_ptrv(fn(emu, from_ptri(uint32_t, R_ESP + 4))); emu->libc_err = errno; } void pFEp_32(x64emu_t *emu, uintptr_t fcn) { pFEp_t fn = (pFEp_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4))); } void pEEp_32(x64emu_t *emu, uintptr_t fcn) { pEEp_t fn = (pEEp_t)fcn; errno = emu->libc_err; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4))); emu->libc_err = errno; } @@ -2314,6 +2318,7 @@ void lFppi_32(x64emu_t *emu, uintptr_t fcn) { lFppi_t fn = (lFppi_t)fcn; R_EAX = void lFppL_32(x64emu_t *emu, uintptr_t fcn) { lFppL_t fn = (lFppL_t)fcn; R_EAX = to_long(fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ulong(from_ptri(ulong_t, R_ESP + 12)))); } void LFEpi_32(x64emu_t *emu, uintptr_t fcn) { LFEpi_t fn = (LFEpi_t)fcn; R_EAX = to_ulong(fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8))); } void LFEpp_32(x64emu_t *emu, uintptr_t fcn) { LFEpp_t fn = (LFEpp_t)fcn; R_EAX = to_ulong(fn(emu, from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8))); } +void LFEXp_32(x64emu_t *emu, uintptr_t fcn) { LFEXp_t fn = (LFEXp_t)fcn; R_EAX = to_ulong(fn(emu, getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8))); } void LFpii_32(x64emu_t *emu, uintptr_t fcn) { LFpii_t fn = (LFpii_t)fcn; R_EAX = to_ulong(fn(from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptri(int32_t, R_ESP + 12))); } void LEpip_32(x64emu_t *emu, uintptr_t fcn) { LEpip_t fn = (LEpip_t)fcn; errno = emu->libc_err; R_EAX = to_ulong(fn(from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8), from_ptriv(R_ESP + 12))); emu->libc_err = errno; } void LFppi_32(x64emu_t *emu, uintptr_t fcn) { LFppi_t fn = (LFppi_t)fcn; R_EAX = to_ulong(fn(from_ptriv(R_ESP + 4), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12))); } @@ -2325,6 +2330,7 @@ void LFXLi_32(x64emu_t *emu, uintptr_t fcn) { LFXLi_t fn = (LFXLi_t)fcn; R_EAX = void LFXLC_32(x64emu_t *emu, uintptr_t fcn) { LFXLC_t fn = (LFXLC_t)fcn; R_EAX = to_ulong(fn(getDisplay(from_ptriv(R_ESP + 4)), from_ulong(from_ptri(ulong_t, R_ESP + 8)), from_ptri(uint8_t, R_ESP + 12))); } void LFXpi_32(x64emu_t *emu, uintptr_t fcn) { LFXpi_t fn = (LFXpi_t)fcn; R_EAX = to_ulong(fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptri(int32_t, R_ESP + 12))); } void LFXpp_32(x64emu_t *emu, uintptr_t fcn) { LFXpp_t fn = (LFXpp_t)fcn; R_EAX = to_ulong(fn(getDisplay(from_ptriv(R_ESP + 4)), from_ptriv(R_ESP + 8), from_ptriv(R_ESP + 12))); } +void pFEii_32(x64emu_t *emu, uintptr_t fcn) { pFEii_t fn = (pFEii_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptri(int32_t, R_ESP + 8))); } void pEEip_32(x64emu_t *emu, uintptr_t fcn) { pEEip_t fn = (pEEip_t)fcn; errno = emu->libc_err; R_EAX = to_ptrv(fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptriv(R_ESP + 8))); emu->libc_err = errno; } void pFEiV_32(x64emu_t *emu, uintptr_t fcn) { pFEiV_t fn = (pFEiV_t)fcn; R_EAX = to_ptrv(fn(emu, from_ptri(int32_t, R_ESP + 4), from_ptrv(R_ESP + 8))); } void pEEpi_32(x64emu_t *emu, uintptr_t fcn) { pEEpi_t fn = (pEEpi_t)fcn; errno = emu->libc_err; R_EAX = to_ptrv(fn(emu, from_ptriv(R_ESP + 4), from_ptri(int32_t, R_ESP + 8))); emu->libc_err = errno; } diff --git a/src/wrapped32/generated/wrapper32.h b/src/wrapped32/generated/wrapper32.h index 94568724..40314fd9 100644 --- a/src/wrapped32/generated/wrapper32.h +++ b/src/wrapped32/generated/wrapper32.h @@ -335,6 +335,7 @@ void LFXL_32(x64emu_t *emu, uintptr_t fnc); void LFXp_32(x64emu_t *emu, uintptr_t fnc); void pFEv_32(x64emu_t *emu, uintptr_t fnc); void pEEv_32(x64emu_t *emu, uintptr_t fnc); +void pFEi_32(x64emu_t *emu, uintptr_t fnc); void pEEu_32(x64emu_t *emu, uintptr_t fnc); void pFEp_32(x64emu_t *emu, uintptr_t fnc); void pEEp_32(x64emu_t *emu, uintptr_t fnc); @@ -620,6 +621,7 @@ void lFppi_32(x64emu_t *emu, uintptr_t fnc); void lFppL_32(x64emu_t *emu, uintptr_t fnc); void LFEpi_32(x64emu_t *emu, uintptr_t fnc); void LFEpp_32(x64emu_t *emu, uintptr_t fnc); +void LFEXp_32(x64emu_t *emu, uintptr_t fnc); void LFpii_32(x64emu_t *emu, uintptr_t fnc); void LEpip_32(x64emu_t *emu, uintptr_t fnc); void LFppi_32(x64emu_t *emu, uintptr_t fnc); @@ -631,6 +633,7 @@ void LFXLi_32(x64emu_t *emu, uintptr_t fnc); void LFXLC_32(x64emu_t *emu, uintptr_t fnc); void LFXpi_32(x64emu_t *emu, uintptr_t fnc); void LFXpp_32(x64emu_t *emu, uintptr_t fnc); +void pFEii_32(x64emu_t *emu, uintptr_t fnc); void pEEip_32(x64emu_t *emu, uintptr_t fnc); void pFEiV_32(x64emu_t *emu, uintptr_t fnc); void pEEpi_32(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped32/wrappedlibxcursor.c b/src/wrapped32/wrappedlibxcursor.c index 655484ee..2e0ece0f 100644 --- a/src/wrapped32/wrappedlibxcursor.c +++ b/src/wrapped32/wrappedlibxcursor.c @@ -64,6 +64,67 @@ void inplace_XcursorCursors_enlarge(void* a) dst->dpy = FindDisplay(from_ptrv(src->dpy)); } +void inplace_XcursorImage_shrink(void* a) +{ + if(!a) return; + my_XcursorImage_t* src = a; + my_XcursorImage_32_t* dst = a; + + dst->version = src->version; + dst->size = src->size; + dst->width = src->width; + dst->height = src->height; + dst->xhot = src->xhot; + dst->yhot = src->yhot; + dst->delay = src->delay; + dst->pixels = to_ptrv(src->pixels); +} +void inplace_XcursorImage_enlarge(void* a) +{ + if(!a) return; + my_XcursorImage_32_t* src = a; + my_XcursorImage_t* dst = a; + + dst->pixels = from_ptrv(src->pixels); + dst->delay = src->delay; + dst->yhot = src->yhot; + dst->xhot = src->xhot; + dst->height = src->height; + dst->width = src->width; + dst->size = src->size; + dst->version = src->version; +} + +void inplace_XcursorImages_shrink(void* a) +{ + if(!a) return; + my_XcursorImages_t* src = a; + my_XcursorImages_32_t* dst = a; + + for(int i=0; i<src->nimage; ++i) + inplace_XcursorCursors_shrink(src->images[i]); + for(int i=0; i<src->nimage; ++i) + ((ptr_t*)src->images)[i] = to_ptrv(src->images[i]); + dst->nimage = src->nimage; + dst->images = to_ptrv(src->images); + dst->name = to_ptrv(src->name); +} + +void inplace_XcursorImages_enlarge(void* a) +{ + if(!a) return; + my_XcursorImages_32_t* src = a; + my_XcursorImages_t* dst = a; + + dst->name = from_ptrv(src->name); + dst->images = from_ptrv(src->images); + dst->nimage = src->nimage; + for(int i=dst->nimage-1; i>=0; --i) + dst->images[i] = from_ptrv(((ptr_t*)dst->images)[i]); + for(int i=dst->nimage-1; i>=0; --i) + inplace_XcursorCursors_enlarge(dst->images[i]); +} + EXPORT void* my32_XcursorCursorsCreate(x64emu_t* emu, void* dpy, int n) { void* ret = my->XcursorCursorsCreate(dpy, n); @@ -77,5 +138,55 @@ EXPORT void my32_XcursorCursorsDestroy(x64emu_t* emu, void* a) my->XcursorCursorsDestroy(a); } +EXPORT void* my32_XcursorImageCreate(x64emu_t* emu, int w, int h) +{ + void* ret = my->XcursorImageCreate(w, h); + inplace_XcursorImage_shrink(ret); + return ret; +} + +EXPORT void my32_XcursorImageDestroy(x64emu_t* emu, void* image) +{ + inplace_XcursorImage_enlarge(image); + my->XcursorImageDestroy(image); +} + +EXPORT unsigned long my32_XcursorImageLoadCursor(x64emu_t*, void* dpy, void* image) +{ + inplace_XcursorImage_enlarge(image); + unsigned long ret = my->XcursorImageLoadCursor(dpy, image); + inplace_XcursorImage_shrink(image); +} + +EXPORT void* my_XcursorImagesCreate(x64emu_t* emu, int n) +{ + void* ret = my->XcursorImagesCreate(n); + inplace_XcursorImages_shrink(ret); + return ret; +} + +EXPORT void my_XcursorImagesDestroy(x64emu_t* emu, void* images) +{ + inplace_XcursorCursors_enlarge(images); + my->XcursorImagesDestroy(images); +} + +EXPORT unsigned long my_XcursorImagesLoadCursors(x64emu_t* emu, void* dpy, void* images) +{ + inplace_XcursorImages_enlarge(images); + unsigned long ret = my->XcursorImagesLoadCursor(dpy, images); + inplace_XcursorImages_shrink(images); + return ret; +} + +EXPORT void* my_XcursorImagesLoadCursor(x64emu_t* emu, void* dpy, void* images) +{ + inplace_XcursorImages_enlarge(images); + void* ret = my->XcursorImagesLoadCursors(dpy, images); + inplace_XcursorImages_shrink(images); + inplace_XcursorCursors_shrink(ret); + return ret; +} + #include "wrappedlib_init32.h" diff --git a/src/wrapped32/wrappedlibxcursor_private.h b/src/wrapped32/wrappedlibxcursor_private.h index 7d2a07ee..e404911f 100644 --- a/src/wrapped32/wrappedlibxcursor_private.h +++ b/src/wrapped32/wrappedlibxcursor_private.h @@ -31,14 +31,14 @@ GOM(XcursorCursorsDestroy, vFEp) //GO(_XcursorGetDisplayInfo, //GO(XcursorGetTheme, pFp) //GO(XcursorGetThemeCore, iFp) -GO(XcursorImageCreate, pFii) -GO(XcursorImageDestroy, vFp) +GOM(XcursorImageCreate, pFEii) +GOM(XcursorImageDestroy, vFEp) //GOM(XcursorImageHash, vFEpp) // needs unbridge XImage (first p) -GO(XcursorImageLoadCursor, LFXp) -GO(XcursorImagesCreate, pFi) -GO(XcursorImagesDestroy, vFp) -GO(XcursorImagesLoadCursor, LFXp) -//GO(XcursorImagesLoadCursors, pFpp) +GOM(XcursorImageLoadCursor, LFEXp) +GOM(XcursorImagesCreate, pFEi) +GOM(XcursorImagesDestroy, vFEp) +GOM(XcursorImagesLoadCursor, LFEXp) +GOM(XcursorImagesLoadCursors, pFEXp) //GO(XcursorImagesSetName, vFpp) GO(XcursorLibraryLoadCursor, LFXp) //GO(XcursorLibraryLoadCursors, pFpp) |