Skip to content

Commit d60937b

Browse files
committed
[WRAPPER] Added wrapped libGLX (backported from box64)
1 parent d0aad67 commit d60937b

File tree

9 files changed

+142
-0
lines changed

9 files changed

+142
-0
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ set(WRAPPEDS
413413
"${BOX86_ROOT}/src/wrapped/wrappedlibbsd.c"
414414
"${BOX86_ROOT}/src/wrapped/wrappedlibgl.c"
415415
"${BOX86_ROOT}/src/wrapped/wrappedlibglu.c"
416+
"${BOX86_ROOT}/src/wrapped/wrappedlibglx.c"
416417
"${BOX86_ROOT}/src/wrapped/wrappedlibx11.c"
417418
"${BOX86_ROOT}/src/wrapped/wrappedlibasound.c"
418419
"${BOX86_ROOT}/src/wrapped/wrappedlibdl.c"

rebuild_wrappers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,7 @@ def add_symbol_name(symname: Optional[str], weak: bool = False, symsname: Dict[s
753753
or match("appindicator","appindicator3")\
754754
or match("appindicator","ayatanaappindicator3")\
755755
or match("appindicator3","ayatanaappindicator3")\
756+
or match("libgl", "libglx") \
756757
\
757758
or match("libc", "tcmallocminimal") \
758759
or match("libc", "ldlinux") \

src/library_list.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ GO("libbsd.so", libbsd)
99
GO("libGL.so.1", libgl)
1010
GO("libGL.so", libgl)
1111
GO("libGLU.so.1", libglu)
12+
GO("libGLX.so.0", libglx)
13+
GO("libGLX.so", libglx)
1214
GO("libX11.so.6", libx11)
1315
GO("libasound.so.2", libasound)
1416
GO("libSDL2-2.0.so.0", sdl2)

src/wrapped/generated/functions_list.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3381,6 +3381,10 @@ wrappedlibglu:
33813381
- gluNurbsCallback
33823382
- gluQuadricCallback
33833383
- gluTessCallback
3384+
wrappedlibglx:
3385+
- pFp:
3386+
- glXGetProcAddress
3387+
- glXGetProcAddressARB
33843388
wrappedlibharfbuzz:
33853389
wrappedlibibus:
33863390
- vFpippp:
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*******************************************************************
2+
* File automatically generated by rebuild_wrappers.py (v2.0.0.11) *
3+
*******************************************************************/
4+
#ifndef __wrappedlibglxDEFS_H_
5+
#define __wrappedlibglxDEFS_H_
6+
7+
8+
#endif // __wrappedlibglxDEFS_H_
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*******************************************************************
2+
* File automatically generated by rebuild_wrappers.py (v2.0.0.11) *
3+
*******************************************************************/
4+
#ifndef __wrappedlibglxTYPES_H_
5+
#define __wrappedlibglxTYPES_H_
6+
7+
#ifndef LIBNAME
8+
#error You should only #include this file inside a wrapped*.c file
9+
#endif
10+
#ifndef ADDED_FUNCTIONS
11+
#define ADDED_FUNCTIONS()
12+
#endif
13+
14+
typedef void* (*pFp_t)(void*);
15+
16+
#define SUPER() ADDED_FUNCTIONS() \
17+
GO(glXGetProcAddress, pFp_t) \
18+
GO(glXGetProcAddressARB, pFp_t)
19+
20+
#endif // __wrappedlibglxTYPES_H_
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*******************************************************************
2+
* File automatically generated by rebuild_wrappers.py (v2.0.0.11) *
3+
*******************************************************************/
4+
#ifndef __wrappedlibglxUNDEFS_H_
5+
#define __wrappedlibglxUNDEFS_H_
6+
7+
8+
#endif // __wrappedlibglxUNDEFS_H_

src/wrapped/wrappedlibglx.c

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#include <stdio.h>
2+
#include <stdlib.h>
3+
#include <string.h>
4+
#define _GNU_SOURCE /* See feature_test_macros(7) */
5+
#include <dlfcn.h>
6+
7+
#include "wrappedlibs.h"
8+
9+
#include "debug.h"
10+
#include "wrapper.h"
11+
#include "bridge.h"
12+
#include "librarian/library_private.h"
13+
#include "x86emu.h"
14+
#include "emu/x86emu_private.h"
15+
#include "callback.h"
16+
#include "librarian.h"
17+
#include "box86context.h"
18+
#include "myalign.h"
19+
#include "gltools.h"
20+
21+
const char* libglxName = "libGLX.so.0";
22+
#define LIBNAME libglx
23+
24+
#include "generated/wrappedlibglxtypes.h"
25+
26+
#include "wrappercallback.h"
27+
28+
#define SUPER() \
29+
GO(0) \
30+
GO(1) \
31+
GO(2) \
32+
GO(3) \
33+
34+
35+
#undef SUPER
36+
37+
EXPORT void* myx_glXGetProcAddress(x86emu_t* emu, void* name)
38+
{
39+
khint_t k;
40+
const char* rname = (const char*)name;
41+
return getGLProcAddress(emu, (glprocaddress_t)my->glXGetProcAddress, rname);
42+
}
43+
44+
EXPORT void* myx_glXGetProcAddressARB(x86emu_t* emu, void* name)
45+
{
46+
khint_t k;
47+
const char* rname = (const char*)name;
48+
return getGLProcAddress(emu, (glprocaddress_t)my->glXGetProcAddressARB, rname);
49+
}
50+
51+
#define ALTMY myx_
52+
53+
#include "wrappedlib_init.h"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
2+
#error meh!
3+
#endif
4+
5+
// __glXGLLoadGLXFunction
6+
GO(glXChooseFBConfig, pFpipp)
7+
GO(glXChooseVisual, pFpip)
8+
GO(glXCopyContext,vFppp)
9+
GO(glXCreateContext,pFpppi)
10+
GO(glXCreateGLXPixmap,pFppp)
11+
GO(glXCreateNewContext,pFppipi)
12+
GO(glXCreatePbuffer,pFppp)
13+
GO(glXCreatePixmap,pFppp)
14+
GO(glXCreateWindow,pFpppp)
15+
GO(glXDestroyContext,vFpp)
16+
GO(glXDestroyGLXPixmap,vFpp)
17+
GO(glXDestroyPbuffer,vFpp)
18+
GO(glXDestroyPixmap,vFpp)
19+
GO(glXDestroyWindow,vFpp)
20+
GO(glXGetClientString, pFpi)
21+
GO(glXGetConfig, iFppip)
22+
GO(glXGetCurrentContext, pFv)
23+
GO(glXGetCurrentDisplay, pFv)
24+
GO(glXGetCurrentDrawable, pFv)
25+
GO(glXGetCurrentReadDrawable, pFv)
26+
GO(glXGetFBConfigAttrib, iFppip)
27+
GO(glXGetFBConfigs,pFpip)
28+
GOM(glXGetProcAddress, pFEp)
29+
GOM(glXGetProcAddressARB, pFEp)
30+
GO(glXGetSelectedEvent, vFppp)
31+
GO(glXGetVisualFromFBConfig, pFpp)
32+
GO(glXIsDirect,iFpp)
33+
GO(glXMakeContextCurrent,iFpppp)
34+
GO(glXMakeCurrent,iFppp)
35+
GO(glXQueryContext,iFppip)
36+
GO(glXQueryDrawable, iFppip)
37+
GO(glXQueryExtension, iFppp)
38+
GO(glXQueryExtensionsString,pFpi)
39+
GO(glXQueryServerString,pFpii)
40+
GO(glXQueryVersion,iFppp)
41+
GO(glXSelectEvent, vFppu)
42+
GO(glXSwapBuffers,vFpp)
43+
GO(glXUseXFont,vFpiii)
44+
GO(glXWaitGL,vFv)
45+
GO(glXWaitX,vFv)

0 commit comments

Comments
 (0)