diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2025-04-12 15:22:14 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2025-04-12 15:22:14 +0200 |
| commit | 20377b992768be46a9deb526de748bc3b5619fda (patch) | |
| tree | 0f48cab456af6749fe1868c03e931353fb4b18c3 /src | |
| parent | 163689d2bba3b0ee46d30412d864886ab504c732 (diff) | |
| download | box64-20377b992768be46a9deb526de748bc3b5619fda.tar.gz box64-20377b992768be46a9deb526de748bc3b5619fda.zip | |
[BOX32][WRAPPER] Added 32bits wrapped libGLX
Diffstat (limited to 'src')
| -rw-r--r-- | src/library_list_32.h | 2 | ||||
| -rw-r--r-- | src/wrapped32/generated/functions_list.txt | 13 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrappedlibglxdefs32.h | 8 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrappedlibglxtypes32.h | 29 | ||||
| -rw-r--r-- | src/wrapped32/generated/wrappedlibglxundefs32.h | 8 | ||||
| -rw-r--r-- | src/wrapped32/wrappedlibglx.c | 97 | ||||
| -rw-r--r-- | src/wrapped32/wrappedlibglx_private.h | 48 |
7 files changed, 205 insertions, 0 deletions
diff --git a/src/library_list_32.h b/src/library_list_32.h index a085c164..f6ff790c 100644 --- a/src/library_list_32.h +++ b/src/library_list_32.h @@ -33,6 +33,8 @@ GO("libfreetype.so.6", freetype) GO("libfontconfig.so.1", fontconfig) GO("libEGL.so", libegl) GO("libEGL.so.1", libegl) +GO("libGLX.so", libglx) +GO("libGLX.so.0", libglx) GO("libX11.so", libx11) GO("libXdamage.so", libxdamage) diff --git a/src/wrapped32/generated/functions_list.txt b/src/wrapped32/generated/functions_list.txt index 14a96b97..7fc7a475 100644 --- a/src/wrapped32/generated/functions_list.txt +++ b/src/wrapped32/generated/functions_list.txt @@ -2525,6 +2525,19 @@ wrappedlibglu: - gluNurbsCallback - gluQuadricCallback - gluTessCallback +wrappedlibglx: +- pFp: + - glXGetProcAddress + - glXGetProcAddressARB +- pFXp: + - glXGetVisualFromFBConfig +- pFXip: + - glXChooseVisual + - glXGetFBConfigs +- pFXipp: + - glXChooseFBConfig +- pFXppi: + - glXCreateContext wrappedlibm: - UEs: - cacosf diff --git a/src/wrapped32/generated/wrappedlibglxdefs32.h b/src/wrapped32/generated/wrappedlibglxdefs32.h new file mode 100644 index 00000000..79be6f7a --- /dev/null +++ b/src/wrapped32/generated/wrappedlibglxdefs32.h @@ -0,0 +1,8 @@ +/********************************************************************* + * File automatically generated by rebuild_wrappers_32.py (v0.0.2.2) * + *********************************************************************/ +#ifndef __wrappedlibglxDEFS32_H_ +#define __wrappedlibglxDEFS32_H_ + + +#endif // __wrappedlibglxDEFS32_H_ diff --git a/src/wrapped32/generated/wrappedlibglxtypes32.h b/src/wrapped32/generated/wrappedlibglxtypes32.h new file mode 100644 index 00000000..4e2436e6 --- /dev/null +++ b/src/wrapped32/generated/wrappedlibglxtypes32.h @@ -0,0 +1,29 @@ +/********************************************************************* + * File automatically generated by rebuild_wrappers_32.py (v0.0.2.2) * + *********************************************************************/ +#ifndef __wrappedlibglxTYPES32_H_ +#define __wrappedlibglxTYPES32_H_ + +#ifndef LIBNAME +#error You should only #include this file inside a wrapped*.c file +#endif +#ifndef ADDED_FUNCTIONS +#define ADDED_FUNCTIONS() +#endif + +typedef void* (*pFp_t)(void*); +typedef void* (*pFXp_t)(void*, void*); +typedef void* (*pFXip_t)(void*, int32_t, void*); +typedef void* (*pFXipp_t)(void*, int32_t, void*, void*); +typedef void* (*pFXppi_t)(void*, void*, void*, int32_t); + +#define SUPER() ADDED_FUNCTIONS() \ + GO(glXGetProcAddress, pFp_t) \ + GO(glXGetProcAddressARB, pFp_t) \ + GO(glXGetVisualFromFBConfig, pFXp_t) \ + GO(glXChooseVisual, pFXip_t) \ + GO(glXGetFBConfigs, pFXip_t) \ + GO(glXChooseFBConfig, pFXipp_t) \ + GO(glXCreateContext, pFXppi_t) + +#endif // __wrappedlibglxTYPES32_H_ diff --git a/src/wrapped32/generated/wrappedlibglxundefs32.h b/src/wrapped32/generated/wrappedlibglxundefs32.h new file mode 100644 index 00000000..5d7cddd3 --- /dev/null +++ b/src/wrapped32/generated/wrappedlibglxundefs32.h @@ -0,0 +1,8 @@ +/********************************************************************* + * File automatically generated by rebuild_wrappers_32.py (v0.0.2.2) * + *********************************************************************/ +#ifndef __wrappedlibglxUNDEFS32_H_ +#define __wrappedlibglxUNDEFS32_H_ + + +#endif // __wrappedlibglxUNDEFS32_H_ diff --git a/src/wrapped32/wrappedlibglx.c b/src/wrapped32/wrappedlibglx.c new file mode 100644 index 00000000..4da58cc0 --- /dev/null +++ b/src/wrapped32/wrappedlibglx.c @@ -0,0 +1,97 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#define _GNU_SOURCE /* See feature_test_macros(7) */ +#include <dlfcn.h> + +#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 "myalign32.h" +#include "gltools.h" +#include "libtools/my_x11_conv.h" + +static const char* libglxName = "libGLX.so.0"; +#define LIBNAME libglx + +#include "generated/wrappedlibglxtypes32.h" + +#include "wrappercallback32.h" + +#define SUPER() \ +GO(0) \ +GO(1) \ +GO(2) \ +GO(3) \ + + +#undef SUPER + +EXPORT void* myx32_glXGetProcAddress(x64emu_t* emu, void* name) +{ + khint_t k; + const char* rname = (const char*)name; + return getGLProcAddress32(emu, (glprocaddress_t)my->glXGetProcAddress, rname); +} +EXPORT void* myx32_glXGetProcAddressARB(x64emu_t* emu, void* name) __attribute__((alias("myx32_glXGetProcAddress"))); + +EXPORT void* myx32_glXChooseFBConfig(x64emu_t* emu, void* dpy, int screen, int* list, int* nelement) +{ + void** res = my->glXChooseFBConfig(dpy, screen, list, nelement); + if(!res) + return NULL; + ptr_t *fbconfig = (ptr_t*)res; + for(int i=0; i<*nelement; ++i) + fbconfig[i] = to_ptrv(res[i]); + return res; +} + +EXPORT void* myx32_glXGetVisualFromFBConfig(x64emu_t* emu, void* dpy, void* config) +{ + void* res = my->glXGetVisualFromFBConfig(dpy, config); + if(!res) return NULL; + my_XVisualInfo_32_t* vinfo = (my_XVisualInfo_32_t*)res; + convert_XVisualInfo_to_32(dpy, vinfo, res); + return vinfo; +} + +EXPORT void* myx32_glXChooseVisual(x64emu_t* emu, void* dpy, int screen, int* attr) +{ + void* res = my->glXChooseVisual(dpy, screen, attr); + if(!res) return NULL; + my_XVisualInfo_32_t* vinfo = (my_XVisualInfo_32_t*)res; + convert_XVisualInfo_to_32(dpy, vinfo, res); + return vinfo; +} + +EXPORT void* myx32_glXCreateContext(x64emu_t* emu, void* dpy, my_XVisualInfo_32_t* info, void* shared, int direct) +{ + my_XVisualInfo_t info_l = {0}; + convert_XVisualInfo_to_64(dpy, &info_l, info); + return my->glXCreateContext(dpy, &info_l, shared, direct); +} + +EXPORT void* myx32_glXGetFBConfigs(x64emu_t* emu, void* dpy, int screen, int* n) +{ + void* ret = my->glXGetFBConfigs(dpy, screen, n); + if(!ret) return NULL; + ptr_t* dst = ret; + void** src = ret; + for(int i=0; i<*n; ++i) + dst[i] = to_ptrv(src[i]); + return ret; +} + + +#define ALTMY myx32_ + +#include "wrappedlib_init32.h" diff --git a/src/wrapped32/wrappedlibglx_private.h b/src/wrapped32/wrappedlibglx_private.h new file mode 100644 index 00000000..9e658c6d --- /dev/null +++ b/src/wrapped32/wrappedlibglx_private.h @@ -0,0 +1,48 @@ +#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA)) +#error Meh... +#endif + +// __glXGLLoadGLXFunction +GOM(glXChooseFBConfig, pFEXipp) +GOM(glXChooseVisual, pFEXip) +GO(glXCopyContext, vFXppL) +GOM(glXCreateContext, pFEXppi) +//GOM(glXCreateGLXPixmap, LFEXbpLiiiLLLii_L) +GO(glXCreateNewContext, pFXpipi) +GO(glXCreatePbuffer, LFXpp) +GO(glXCreatePixmap, LFXpLp) +GO(glXCreateWindow, LFXpLp) +GO(glXDestroyContext, vFXp) +GO(glXDestroyGLXPixmap, vFXL) +GO(glXDestroyPbuffer, vFXL) +GO(glXDestroyPixmap, vFXL) +GO(glXDestroyWindow, vFXL) +GO(glXGetClientString, pFXi) +//GOM(glXGetConfig, iFEXbpLiiiLLLii_ip) +GO(glXGetCurrentContext, pFv) +GO(glXGetCurrentDisplay, XFv) +GO(glXGetCurrentDrawable, LFv) +GO(glXGetCurrentReadDrawable, LFv) +GO(glXGetFBConfigAttrib, iFXpip) +GOM(glXGetFBConfigs, pFEXip) +GOM(glXGetProcAddress, pFEp) +GOM(glXGetProcAddressARB, pFEp) +GO(glXGetSelectedEvent, vFXLbL_) +GOM(glXGetVisualFromFBConfig, pFEXp) +GO(glXIsDirect, iFXp) +GO(glXMakeContextCurrent, iFXLLp) +GO(glXMakeCurrent, iFXLp) +GO(glXQueryContext, iFXpip) +GO(glXQueryDrawable, vFXLip) +GO(glXQueryExtension, iFXpp) +GO(glXQueryExtensionsString, pFXi) +GO(glXQueryServerString, pFXii) +GO(glXQueryVersion, iFXpp) +GO(glXSelectEvent, vFXLL) +GO(glXSwapBuffers, vFXL) +GO(glXUseXFont, vFLiii) +GO(glXWaitGL, vFv) +GO(glXWaitX, vFv) + + + |