Added BOX86_ALLOWMISSING_SYMBOLS option, rename BOX86_ALLOWINGLIBS, and added a special case for hl_linux (for #559)

This commit is contained in:
ptitSeb 2022-01-23 16:33:00 +01:00
parent 00df171604
commit c8147ce3d4
4 changed files with 28 additions and 5 deletions

View File

@ -141,11 +141,16 @@ Enable/Disable simulation of Strong Memory model
Some games uses an old version of some libraries, with an ABI incompatible with native version.
Note that LittleInferno for example is auto detected, and libvorbis.so.0 is automatical added to emulated libs, and same for Don't Starve (and Together / Server variant) that use an old SDL2 too
#### BOX86_ALLOWMISSINGLIBS
Allow Box86 to continue even if a library is missing.
#### BOX86_ALLOWMISSING_LIBS
Allow Box86 to continue even if a library is missing (renamed from BOX86_ALLOWMISSINGLIBS).
* 0 : Box86 will stop if a library cannot be loaded. (Default.)
* 1 : Continue even if a needed library cannot be loaded. Unadvised, this will, in most cases, crash later on.
#### BOX86_ALLOWMISSING_SYMBOLS
Allow dlopen with RTLD_NOW flag to not resolve all symbols.
* 0 : Box86 will stop if a library have unresolved symbols. (Default.)
* 1 : Continue even if a needed library have unresolved symbols (like symbols not yet wrapped).
#### BOX86_NOPULSE
Disables the load of pulseaudio libraries.
* 0 : Load pulseaudio libraries if found. (Default.)

View File

@ -30,6 +30,7 @@ extern int box86_steam;
extern int box86_nopulse; // disabling the use of wrapped pulseaudio
extern int box86_nogtk; // disabling the use of wrapped gtk
extern int box86_novulkan; // disabling the use of wrapped vulkan
extern int allow_missing_symbols;
extern uintptr_t trace_start, trace_end;
extern char* trace_func;
extern uintptr_t fmod_smc_start, fmod_smc_end; // to handle libfmod (from Unreal) SMC (self modifying code)

View File

@ -84,6 +84,7 @@ int box86_zoom = 0;
int x11threads = 0;
int x11glx = 1;
int allow_missing_libs = 0;
int allow_missing_symbols = 0;
int fix_64bit_inodes = 0;
int box86_steam = 0;
int box86_nopulse = 0;
@ -418,8 +419,10 @@ void LoadLogEnv()
if(libGL) {
printf_log(LOG_INFO, "BOX86 using \"%s\" as libGL.so.1\n", p);
}
p = getenv("BOX86_ALLOWMISSINGLIBS");
if(p) {
p = getenv("BOX86_ALLOWMISSING_LIBS");
if(!p)
p = getenv("BOX86_ALLOWMISSINGLIBS");
if(p) {
if(strlen(p)==1) {
if(p[0]>='0' && p[0]<='0'+1)
allow_missing_libs = p[0]-'0';
@ -427,6 +430,15 @@ void LoadLogEnv()
if(allow_missing_libs)
printf_log(LOG_INFO, "Allow missing needed libs\n");
}
p = getenv("BOX86_ALLOWMISSING_SYMBOLS");
if(p) {
if(strlen(p)==1) {
if(p[0]>='0' && p[0]<='0'+1)
allow_missing_symbols = p[0]-'0';
}
if(allow_missing_symbols)
printf_log(LOG_INFO, "Allow missing needed symbols\n");
}
p = getenv("BOX86_NOPULSE");
if(p) {
if(strlen(p)==1) {
@ -1067,6 +1079,11 @@ int main(int argc, const char **argv, const char **env) {
printf_log(LOG_INFO, "X3Reunion detected, forcing emulated libjpeg\n");
AddPath("libjpeg.so.62", &my_context->box86_emulated_libs, 0);
}
// special case for hl_linux
if(strstr(prgname, "hl_linux")==prgname) {
printf_log(LOG_INFO, "HalfLife Linux detected, allowing missing symbols\n");
allow_missing_symbols = 1;
}
/*if(strstr(prgname, "awesomium_process")==prgname) {
printf_log(LOG_INFO, "awesomium_process detected, forcing emulated libpng12\n");
AddPath("libpng12.so.0", &my_context->box86_emulated_libs, 0);

View File

@ -122,7 +122,7 @@ void* my_dlopen(x86emu_t* emu, void *filename, int flag)
// Then open the lib
const char* libs[] = {rfilename};
my_context->deferedInit = 1;
int bindnow = (flag&0x2)?1:0;
int bindnow = (flag&0x2 && !allow_missing_symbols)?1:0;
if(AddNeededLib(NULL, NULL, NULL, is_local, bindnow, libs, 1, emu->context, emu)) {
printf_log(LOG_INFO, "Warning: Cannot dlopen(\"%s\"/%p, %X)\n", rfilename, filename, flag);
if(!dl->last_error)