about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-03-05 22:25:19 +0100
committerptitSeb <sebastien.chev@gmail.com>2023-03-05 22:25:19 +0100
commitd59a98ffe6b265e0c1dec2ad84020dba80522031 (patch)
tree2108c06437b5a6ee35d00d1779e9b9f425144a44 /src
parent5e9429afe86eeb0dd7d3e793b63fc4b671709e2b (diff)
downloadbox64-d59a98ffe6b265e0c1dec2ad84020dba80522031.tar.gz
box64-d59a98ffe6b265e0c1dec2ad84020dba80522031.zip
Added back the load of libGL when using GL in SDL2 (fixed regression with Nuclear Blaze)
Diffstat (limited to 'src')
-rwxr-xr-xsrc/wrapped/wrappedsdl2.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/wrapped/wrappedsdl2.c b/src/wrapped/wrappedsdl2.c
index 40b39edf..2e665e9f 100755
--- a/src/wrapped/wrappedsdl2.c
+++ b/src/wrapped/wrappedsdl2.c
@@ -650,6 +650,14 @@ EXPORT void* my2_SDL_GL_GetProcAddress(x64emu_t* emu, void* name)
 {
     khint_t k;
     const char* rname = (const char*)name;
+    static int lib_checked = 0;
+    if(!lib_checked) {
+        lib_checked = 1;
+            // check if libGL is loaded, load it if not (helps some Haxe games, like DeadCells or Nuclear Blaze)
+        if(!my_glhandle && !GetLibInternal(box64_libGL?box64_libGL:"libGL.so.1"))
+            // use a my_dlopen to actually open that lib, like SDL2 is doing...
+            my_glhandle = my_dlopen(emu, box64_libGL?box64_libGL:"libGL.so.1", RTLD_LAZY|RTLD_GLOBAL);
+    }
     return getGLProcAddress(emu, (glprocaddress_t)my->SDL_GL_GetProcAddress, rname);
 }