[BOX32][WRAPPER] Added 32bits wrapped libGLX

This commit is contained in:
ptitSeb 2025-04-12 15:22:14 +02:00
parent 163689d2bb
commit 20377b9927
9 changed files with 207 additions and 0 deletions

View File

@ -863,6 +863,7 @@ if(BOX32)
"${BOX64_ROOT}/src/wrapped32/wrappedlibcups.c"
"${BOX64_ROOT}/src/wrapped32/wrappedgbm.c"
"${BOX64_ROOT}/src/wrapped32/wrappedlibegl.c"
"${BOX64_ROOT}/src/wrapped32/wrappedlibglx.c"
)
endif()
string(REPLACE ".c" "_private.h" MODROOT ${BOX64_ROOT})

View File

@ -875,6 +875,7 @@ def readFiles(files: Iterable[str]) -> Tuple[JumbledFunctions, JumbledFunctions,
or match("gstreamer010","gstreamer") \
or match("appindicator","appindicator3")\
or match("libgl", "libegl") \
or match("libgl", "libglx") \
\
or match("libc", "tcmallocminimal") \
or match("libc", "ldlinux") \

View File

@ -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)

View File

@ -2525,6 +2525,19 @@ wrappedlibglu:
- gluNurbsCallback
- gluQuadricCallback
- gluTessCallback
wrappedlibglx:
- pFp:
- glXGetProcAddress
- glXGetProcAddressARB
- pFXp:
- glXGetVisualFromFBConfig
- pFXip:
- glXChooseVisual
- glXGetFBConfigs
- pFXipp:
- glXChooseFBConfig
- pFXppi:
- glXCreateContext
wrappedlibm:
- UEs:
- cacosf

View File

@ -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_

View File

@ -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_

View File

@ -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_

View File

@ -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"

View File

@ -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)