diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-10-06 12:14:53 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-10-06 12:14:53 +0200 |
| commit | b395cd7ccc0a3b98b82306a35a2d96a9d42c5d7d (patch) | |
| tree | 366ae945bce1592b0a2e47d995da27e95ef1eca0 /src/wrapped32/wrappedlibxrender.c | |
| parent | 8ec6b15dc21b11175cf619790c9492f344f5ab64 (diff) | |
| download | box64-b395cd7ccc0a3b98b82306a35a2d96a9d42c5d7d.tar.gz box64-b395cd7ccc0a3b98b82306a35a2d96a9d42c5d7d.zip | |
[BOX32] More work on various wrapper, and some bug fixes
Diffstat (limited to 'src/wrapped32/wrappedlibxrender.c')
| -rw-r--r-- | src/wrapped32/wrappedlibxrender.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/wrapped32/wrappedlibxrender.c b/src/wrapped32/wrappedlibxrender.c index 970aebc2..e1688640 100644 --- a/src/wrapped32/wrappedlibxrender.c +++ b/src/wrapped32/wrappedlibxrender.c @@ -6,10 +6,18 @@ #include "wrappedlibs.h" + +#include "debug.h" #include "wrapper32.h" #include "bridge.h" #include "librarian/library_private.h" #include "x64emu.h" +#include "emu/x64emu_private.h" +#include "callback.h" +#include "librarian.h" +#include "box32context.h" +#include "emu/x64emu_private.h" +#include "converter32.h" #ifdef ANDROID static const char* libxrenderName = "libXrender.so"; @@ -25,4 +33,65 @@ #define NEEDED_LIBS "libX11.so.6" #endif +#include "libtools/my_x11_defs.h" +#include "libtools/my_x11_defs_32.h" + +#include "generated/wrappedlibxrendertypes32.h" + +#include "wrappercallback32.h" + +KHASH_MAP_INIT_INT64(picformat, void*); +static kh_picformat_t* hash_picformat; + +EXPORT void* my32_XRenderFindFormat(x64emu_t* emu, void* dpy, unsigned long mask, void* tmpl, int count) +{ + void* ret = my->XRenderFindFormat(dpy, mask, tmpl, count); + khint_t k = kh_get(picformat, hash_picformat, (uintptr_t)ret); + if(k!=kh_end(hash_picformat)) + return kh_value(hash_picformat, k); + int r; + k = kh_put(picformat, hash_picformat, (uintptr_t)ret, &r); + struct_LiiuL_t* res = box_calloc(1, sizeof(struct_LiiuL_t)); + to_struct_LiiuL(to_ptrv(res), ret); + kh_value(hash_picformat, k) = res; + return res; +} + +EXPORT void* my32_XRenderFindStandardFormat(x64emu_t* emu, void* dpy, int fmt) +{ + void* ret = my->XRenderFindStandardFormat(dpy, fmt); + khint_t k = kh_get(picformat, hash_picformat, (uintptr_t)ret); + if(k!=kh_end(hash_picformat)) + return kh_value(hash_picformat, k); + int r; + k = kh_put(picformat, hash_picformat, (uintptr_t)ret, &r); + struct_LiiuL_t* res = box_calloc(1, sizeof(struct_LiiuL_t)); + to_struct_LiiuL(to_ptrv(res), ret); + kh_value(hash_picformat, k) = res; + return res; +} + +EXPORT void* my32_XRenderFindVisualFormat(x64emu_t* emu, void* dpy, void* visual) +{ + void* ret = my->XRenderFindVisualFormat(dpy, visual); + khint_t k = kh_get(picformat, hash_picformat, (uintptr_t)ret); + if(k!=kh_end(hash_picformat)) + return kh_value(hash_picformat, k); + int r; + k = kh_put(picformat, hash_picformat, (uintptr_t)ret, &r); + struct_LiiuL_t* res = box_calloc(1, sizeof(struct_LiiuL_t)); + to_struct_LiiuL(to_ptrv(res), ret); + kh_value(hash_picformat, k) = res; + return res; +} + +#define CUSTOM_INIT \ + hash_picformat = kh_init(picformat); + +#define CUSTOM_FINI \ + void* p; \ + kh_foreach_value(hash_picformat, p, box_free(p)); \ + kh_destroy(picformat, hash_picformat); \ + hash_picformat = NULL; + #include "wrappedlib_init32.h" |