[BOX32][WRAPPER] Fixed 32bits wrapping for XRenderQueryFilters function

This commit is contained in:
ptitSeb 2025-04-12 14:31:54 +02:00
parent b3165e62ab
commit 68f5512ee7
8 changed files with 61 additions and 1 deletions

View File

@ -1407,3 +1407,35 @@ void* inplace_XDeviceInfo_enlarge(void* a)
} }
return a; return a;
} }
void* inplace_XFilters_shrink(void* a)
{
if(a) {
my_XFilters_t* src = a;
my_XFilters_32_t* dst = a;
dst->nfilter = src->nfilter;
char** filter = src->filter;
dst->filter = to_ptrv(filter);
dst->nalias = src->nalias;
dst->alias = to_ptrv(src->alias);
for(int i=0; i<dst->nfilter; ++i)
((ptr_t*)(filter))[i] = to_ptrv(filter[i]);
}
return a;
}
void* inplace_XFilters_enlarge(void* a)
{
if(a) {
my_XFilters_t* dst = a;
my_XFilters_32_t* src = a;
dst->alias = from_ptrv(src->alias);
dst->nalias = src->nalias;
dst->filter = from_ptrv(src->filter);
dst->nfilter = src->nfilter;
char** filter = dst->filter;
for(int i=dst->nfilter-1; i>=0; --i)
filter[i] = from_ptrv(((ptr_t*)(filter))[i]);
}
return a;
}

View File

@ -113,4 +113,7 @@ void* inplace_XAnyClassInfo_enlarge(void* a);
void* inplace_XDeviceInfo_shrink(void* a, int n); void* inplace_XDeviceInfo_shrink(void* a, int n);
void* inplace_XDeviceInfo_enlarge(void* a); void* inplace_XDeviceInfo_enlarge(void* a);
void* inplace_XFilters_shrink(void* a);
void* inplace_XFilters_enlarge(void* a);
#endif//MY_X11_CONV #endif//MY_X11_CONV

View File

@ -1465,4 +1465,11 @@ typedef struct my_XFixesCursorImage_s {
void* name; /* Version >= 2 only */ void* name; /* Version >= 2 only */
} my_XFixesCursorImage_t; } my_XFixesCursorImage_t;
typedef struct my_XFilters_s {
int nfilter;
char **filter;
int nalias;
short *alias;
} my_XFilters_t;
#endif//MY_X11_DEFS #endif//MY_X11_DEFS

View File

@ -1407,4 +1407,11 @@ typedef struct my_XFixesCursorImage_32_s {
ptr_t name; /* Version >= 2 only */ ptr_t name; /* Version >= 2 only */
} my_XFixesCursorImage_32_t; } my_XFixesCursorImage_32_t;
typedef struct my_XFilters_32_s {
int nfilter;
ptr_t filter; //char **
int nalias;
ptr_t alias; //short *
} my_XFilters_32_t;
#endif//MY_X11_DEFS_32 #endif//MY_X11_DEFS_32

View File

@ -3035,6 +3035,8 @@ wrappedlibxrandr:
wrappedlibxrender: wrappedlibxrender:
- pFXi: - pFXi:
- XRenderFindStandardFormat - XRenderFindStandardFormat
- pFXL:
- XRenderQueryFilters
- pFXp: - pFXp:
- XRenderFindVisualFormat - XRenderFindVisualFormat
- pFXLrLiiwwwwwwwwL_i: - pFXLrLiiwwwwwwwwL_i:

View File

@ -12,11 +12,13 @@
#endif #endif
typedef void* (*pFXi_t)(void*, int32_t); typedef void* (*pFXi_t)(void*, int32_t);
typedef void* (*pFXL_t)(void*, uintptr_t);
typedef void* (*pFXp_t)(void*, void*); typedef void* (*pFXp_t)(void*, void*);
typedef void* (*pFXLrLiiwwwwwwwwL_i_t)(void*, uintptr_t, struct_LiiwwwwwwwwL_t*, int32_t); typedef void* (*pFXLrLiiwwwwwwwwL_i_t)(void*, uintptr_t, struct_LiiwwwwwwwwL_t*, int32_t);
#define SUPER() ADDED_FUNCTIONS() \ #define SUPER() ADDED_FUNCTIONS() \
GO(XRenderFindStandardFormat, pFXi_t) \ GO(XRenderFindStandardFormat, pFXi_t) \
GO(XRenderQueryFilters, pFXL_t) \
GO(XRenderFindVisualFormat, pFXp_t) \ GO(XRenderFindVisualFormat, pFXp_t) \
GO(XRenderFindFormat, pFXLrLiiwwwwwwwwL_i_t) GO(XRenderFindFormat, pFXLrLiiwwwwwwwwL_i_t)

View File

@ -86,6 +86,13 @@ EXPORT void* my32_XRenderFindVisualFormat(x64emu_t* emu, void* dpy, void* visual
kh_value(hash_picformat, k) = res; kh_value(hash_picformat, k) = res;
return res; return res;
} }
EXPORT void* my32_XRenderQueryFilters(x64emu_t* emu, void* dpy, unsigned long drawable)
{
void* ret = my->XRenderQueryFilters(dpy, drawable);
return inplace_XFilters_shrink(ret);
}
#define CUSTOM_INIT \ #define CUSTOM_INIT \
hash_picformat = kh_init(picformat); \ hash_picformat = kh_init(picformat); \

View File

@ -42,7 +42,7 @@ GO(XRenderFreeGlyphSet, vFXL)
GO(XRenderFreePicture, vFXL) GO(XRenderFreePicture, vFXL)
GO(XRenderParseColor, iFXpp) GO(XRenderParseColor, iFXpp)
GO(XRenderQueryExtension, iFXpp) GO(XRenderQueryExtension, iFXpp)
GO(XRenderQueryFilters, pFXL) GOM(XRenderQueryFilters, pFEXL)
GO(XRenderQueryFormats, iFX) GO(XRenderQueryFormats, iFX)
GO(XRenderQueryPictIndexValues, pFXrLiiwwwwwwwwL_p) GO(XRenderQueryPictIndexValues, pFXrLiiwwwwwwwwL_p)
GO(XRenderQuerySubpixelOrder, iFXi) GO(XRenderQuerySubpixelOrder, iFXi)