mirror of
https://github.com/ptitSeb/box86.git
synced 2024-12-04 04:53:44 +00:00
Allow setting any OpenGL library (doesn't overload SDL_VIDEO_GL_DRIVER variable for SDL/SDL2 program)
This commit is contained in:
parent
53b56ba123
commit
d048d4964e
5
USAGE.md
5
USAGE.md
@ -85,3 +85,8 @@ Set level of DynaRec log
|
||||
#### BOX86_DYNAREC_TRACE
|
||||
* 0 : Disable trace for generated code (default)
|
||||
* 1 : Enable trace for generated code (like regular Trace, this will slow down a lot and generate huge logs)
|
||||
|
||||
#### BOX86_LIBGL
|
||||
* libXXXX set the name for libGL (default to libGL.so.1)
|
||||
* /PATH/TO/libGLXXX set the name and path for libGL
|
||||
Don't forget you need to use SDL_VIDEO_GL_DRIVER for SDL/SDL2 programs
|
@ -46,6 +46,7 @@ int box86_dynarec_trace = 0;
|
||||
#ifdef PANDORA
|
||||
int x11color16 = 0;
|
||||
#endif
|
||||
char* libGL = NULL;
|
||||
|
||||
FILE* ftrace = NULL;
|
||||
|
||||
@ -165,6 +166,11 @@ void LoadLogEnv()
|
||||
printf_log(LOG_INFO, "Try to adjust X11 Color (32->16bits) : %s\n", x11color16?"Yes":"No");
|
||||
}
|
||||
#endif
|
||||
p = getenv("BOX86_LIBGL");
|
||||
if(p) {
|
||||
libGL = strdup(p);
|
||||
printf("BOX86 using \"%s\" as libGL.so.1\n", p);
|
||||
}
|
||||
}
|
||||
|
||||
void LoadEnvPath(path_collection_t *col, const char* defpath, const char* env)
|
||||
@ -268,6 +274,7 @@ void PrintHelp() {
|
||||
#ifdef PANDORA
|
||||
printf(" BOX86_X11COLOR16=1 to try convert X11 color from 32 bits to 16 bits (to avoid light green on light cyan windows\n");
|
||||
#endif
|
||||
printf(" BOX86_LIBGL=libXXXX set the name (and optionnaly full path) for libGL.so.1\n");
|
||||
}
|
||||
|
||||
int main(int argc, const char **argv, const char **env) {
|
||||
@ -535,6 +542,8 @@ int main(int argc, const char **argv, const char **env) {
|
||||
|
||||
// all done, free context
|
||||
FreeBox86Context(&context);
|
||||
if(libGL)
|
||||
free(libGL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
void* my_glXGetProcAddress(x86emu_t* emu, void* name);
|
||||
void* my_glXGetProcAddressARB(x86emu_t* emu, void* name);
|
||||
void my_glDebugMessageCallback(x86emu_t* emu, void* prod, void* param);
|
||||
char* libGL;
|
||||
|
||||
const char* libglName = "libGL.so.1";
|
||||
#define LIBNAME libgl
|
||||
@ -57,7 +58,7 @@ EXPORT void* my_glXGetProcAddress(x86emu_t* emu, void* name)
|
||||
emu->context->glwrappers = fillGLProcWrapper();
|
||||
// check if glxprocaddress is filled, and search for lib and fill it if needed
|
||||
if(!emu->context->glxprocaddress) {
|
||||
library_t* lib = GetLib(emu->context->maplib, libglName);
|
||||
library_t* lib = GetLib(emu->context->maplib, libGL?libGL:libglName);
|
||||
if(!lib) {
|
||||
printf_log(LOG_NONE, "Warning, libGL not found in librarian?!\n");
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user