diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-05-09 21:59:32 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-05-09 21:59:32 +0200 |
| commit | d38f659f428544de524fe6f2a49355a104055555 (patch) | |
| tree | c26f2d251706919f7496b8fe6d857acd75a6b888 /src/core.c | |
| parent | 6d95a644123181addb647f51712ad3e5782d5052 (diff) | |
| download | box64-d38f659f428544de524fe6f2a49355a104055555.tar.gz box64-d38f659f428544de524fe6f2a49355a104055555.zip | |
Changed the workaround for MiniMetro/Steam, using rcfile now (for #1311)
Diffstat (limited to 'src/core.c')
| -rw-r--r-- | src/core.c | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/src/core.c b/src/core.c index bc58b040..36ce41dd 100644 --- a/src/core.c +++ b/src/core.c @@ -55,6 +55,7 @@ int box64_cefdisablegpu = 0; int box64_cefdisablegpucompositor = 0; int box64_malloc_hack = 0; int box64_dynarec_test = 0; +path_collection_t box64_addlibs = {0}; int box64_maxcpu = 0; int box64_maxcpu_immutable = 0; #if defined(SD845) || defined(SD888) || defined(SD8G2) || defined(TEGRAX1) @@ -1195,6 +1196,12 @@ int GatherEnv(char*** dest, char** env, char* prog) return 0; } +void AddNewLibs(const char* list) +{ + AppendList(&box64_addlibs, list, 0); + printf_log(LOG_INFO, "BOX64: Adding %s to the libs\n", list); +} + void PrintFlags() { printf("Environment Variables:\n"); printf(" BOX64_PATH is the box64 version of PATH (default is '.:bin')\n"); @@ -1369,6 +1376,9 @@ void LoadEnvVars(box64context_t *context) printf_log(LOG_INFO, "BOX64: Disabling handling of SigILL\n"); } } + if(getenv("BOX64_ADDLIBS")) { + AddNewLibs(getenv("BOX64_ADDLIBS")); + } // check BOX64_PATH and load it LoadEnvPath(&context->box64_path, ".:bin", "BOX64_PATH"); if(getenv("PATH")) @@ -1834,24 +1844,23 @@ int initialize(int argc, const char **argv, char** env, x64emu_t** emulator, elf printf_log(LOG_INFO, "%s ", ld_preload.paths[i]); printf_log(LOG_INFO, "\n"); } - } else { - if(getenv("LD_PRELOAD")) { - char* p = getenv("LD_PRELOAD"); - if(strstr(p, "libtcmalloc_minimal.so.0")) - box64_tcmalloc_minimal = 1; - if(strstr(p, "libtcmalloc_minimal.so.4")) - box64_tcmalloc_minimal = 1; - if(strstr(p, "libtcmalloc_minimal_debug.so.4")) - box64_tcmalloc_minimal = 1; - if(strstr(p, "libasan.so")) - box64_tcmalloc_minimal = 1; // it seems Address Sanitizer doesn't handle dlsym'd malloc very well - ParseList(p, &ld_preload, 0); - if (ld_preload.size && box64_log) { - printf_log(LOG_INFO, "BOX64 trying to Preload "); - for (int i=0; i<ld_preload.size; ++i) - printf_log(LOG_INFO, "%s ", ld_preload.paths[i]); - printf_log(LOG_INFO, "\n"); - } + } + if(getenv("LD_PRELOAD")) { + char* p = getenv("LD_PRELOAD"); + if(strstr(p, "libtcmalloc_minimal.so.0")) + box64_tcmalloc_minimal = 1; + if(strstr(p, "libtcmalloc_minimal.so.4")) + box64_tcmalloc_minimal = 1; + if(strstr(p, "libtcmalloc_minimal_debug.so.4")) + box64_tcmalloc_minimal = 1; + if(strstr(p, "libasan.so")) + box64_tcmalloc_minimal = 1; // it seems Address Sanitizer doesn't handle dlsym'd malloc very well + AppendList(&ld_preload, p, 0); + if (ld_preload.size && box64_log) { + printf_log(LOG_INFO, "BOX64 trying to Preload "); + for (int i=0; i<ld_preload.size; ++i) + printf_log(LOG_INFO, "%s ", ld_preload.paths[i]); + printf_log(LOG_INFO, "\n"); } } // print PATH and LD_LIB used |