diff options
| author | Yang Liu <liuyang22@iscas.ac.cn> | 2025-01-21 23:13:51 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-21 16:13:51 +0100 |
| commit | 044dec0bfa0f3f8f62f7703d6b0a8600c1354dc5 (patch) | |
| tree | dc41c611965cec299dcb62185c5fba4935b6251f /src/wrapped32 | |
| parent | ed8b6fe9db863a8d9e473a645e84700c7291bb06 (diff) | |
| download | box64-044dec0bfa0f3f8f62f7703d6b0a8600c1354dc5.tar.gz box64-044dec0bfa0f3f8f62f7703d6b0a8600c1354dc5.zip | |
[ENV] Initial refactor of env variables infrastructure (#2274)
* [ENV] Initial refactor of env variables infrastructure * Ported BOX64_DYNAREC_LOG * Ported more options * Ported BOX64_MALLOC_HACK * Ported BOX64_DYNAREC_TEST * Ported more options * Ported more options * Ported more options * Ported all options * Removed old rcfile parser * Fix * review * fix * fix * more fixes
Diffstat (limited to 'src/wrapped32')
| -rwxr-xr-x | src/wrapped32/wrappedcrashhandler.c | 2 | ||||
| -rwxr-xr-x | src/wrapped32/wrappedlibc.c | 11 | ||||
| -rw-r--r-- | src/wrapped32/wrappedlibgl.c | 6 | ||||
| -rw-r--r-- | src/wrapped32/wrappedlibx11.c | 6 | ||||
| -rw-r--r-- | src/wrapped32/wrappedsdl2.c | 6 |
5 files changed, 15 insertions, 16 deletions
diff --git a/src/wrapped32/wrappedcrashhandler.c b/src/wrapped32/wrappedcrashhandler.c index 8e8e68fa..430c5a5d 100755 --- a/src/wrapped32/wrappedcrashhandler.c +++ b/src/wrapped32/wrappedcrashhandler.c @@ -21,7 +21,7 @@ static const char* crashhandlerName = "crashhandler.so"; #define LIBNAME crashhandler #define PRE_INIT \ - if(!box64_dummy_crashhandler) \ + if(!BOX64ENV(dummy_crashhandler)) \ return -1; \ if(1) \ lib->w.lib = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL);\ diff --git a/src/wrapped32/wrappedlibc.c b/src/wrapped32/wrappedlibc.c index 9f42db10..e1fedcf8 100755 --- a/src/wrapped32/wrappedlibc.c +++ b/src/wrapped32/wrappedlibc.c @@ -21,7 +21,7 @@ #include <poll.h> #include <sys/epoll.h> #include <ftw.h> -#include <sys/syscall.h> +#include <sys/syscall.h> #include <sys/utsname.h> #include <sys/mman.h> #include <sys/ipc.h> @@ -128,7 +128,6 @@ static const char* libcName = #endif ; -extern int fix_64bit_inodes; typedef int32_t (*iFiiV_t)(int32_t, int32_t, ...); typedef int32_t (*iFpipp_t)(void*, int32_t, void*, void*); #if 0 @@ -518,7 +517,7 @@ void EXPORT my32___stack_chk_fail(x64emu_t* emu) #else sprintf(buff, "%p: Stack is corrupted, aborting ESP=0x%x %s\n", addr, R_ESP, name); #endif - print_cycle_log(LOG_INFO); + print_rolling_log(LOG_INFO); StopEmu(emu, buff, 1); } int EXPORT my32___xmknod(x64emu_t* emu, int ver, const char* path, mode_t mode, dev_t* dev) @@ -1119,7 +1118,7 @@ static int FillStatFromStat64(int vers, const struct stat64 *st64, void *st32) i386st->st_dev = st64->st_dev; i386st->__pad1 = 0; - if (fix_64bit_inodes) + if (BOX64ENV(fix_64bit_inodes)) { i386st->st_ino = st64->st_ino ^ (st64->st_ino >> 32); } @@ -1436,7 +1435,7 @@ EXPORT void* my32_readdir(x64emu_t* emu, void* dirp) EXPORT int32_t my32_readdir_r(x64emu_t* emu, void* dirp, void* entry, void** result) { struct dirent64 d64, *dp64; - if (fix_64bit_inodes && (sizeof(d64.d_name) > 1)) + if (BOX64ENV(fix_64bit_inodes) && (sizeof(d64.d_name) > 1)) { static iFppp_t f = NULL; if(!f) { @@ -1530,7 +1529,7 @@ EXPORT ssize_t my32_read(int fd, void* buf, size_t count) { int ret = read(fd, buf, count); #ifdef DYNAREC - if(ret!=count && ret>0 && box64_dynarec) { + if(ret!=count && ret>0 && BOX64ENV(dynarec)) { // continue reading... void* p = buf+ret; if(hasDBFromAddress((uintptr_t)p)) { diff --git a/src/wrapped32/wrappedlibgl.c b/src/wrapped32/wrappedlibgl.c index 25d9ac00..1e191df3 100644 --- a/src/wrapped32/wrappedlibgl.c +++ b/src/wrapped32/wrappedlibgl.c @@ -890,9 +890,9 @@ static void* find_glVDPAUUnmapSurfacesNV_Fct(void* fct) #undef SUPER #define PRE_INIT \ - if(box64_libGL) { \ - lib->w.lib = dlopen(box64_libGL, RTLD_LAZY | RTLD_GLOBAL); \ - lib->path = strdup(box64_libGL); \ + if(BOX64ENV(libgl)) { \ + lib->w.lib = dlopen(BOX64ENV(libgl), RTLD_LAZY | RTLD_GLOBAL); \ + lib->path = strdup(BOX64ENV(libgl)); \ } else if(strstr(lib->name, "libGLX_nvidia.so.0")) { \ lib->w.lib = dlopen("libGLX_nvidia.so.0", RTLD_LAZY | RTLD_GLOBAL); \ if(lib->w.lib) lib->path = strdup("libGLX_nvidia.so.0"); \ diff --git a/src/wrapped32/wrappedlibx11.c b/src/wrapped32/wrappedlibx11.c index 4018febc..acae4c87 100644 --- a/src/wrapped32/wrappedlibx11.c +++ b/src/wrapped32/wrappedlibx11.c @@ -1655,7 +1655,7 @@ EXPORT int my32_XUnregisterIMInstantiateCallback(x64emu_t* emu, void* d, void* d EXPORT int my32_XQueryExtension(x64emu_t* emu, void* display, char* name, int* major, int* first_event, int* first_error) { int ret = my->XQueryExtension(display, name, major, first_event, first_error); - if(!ret && name && !strcmp(name, "GLX") && box64_x11glx) { + if(!ret && name && !strcmp(name, "GLX") && BOX64ENV(x11glx)) { // hack to force GLX to be accepted, even if not present // left major and first_XXX to default... ret = 1; @@ -1688,7 +1688,7 @@ EXPORT void* my32_XSynchronize(x64emu_t* emu, void* display, int onoff) EXPORT void* my32_XOpenDisplay(void* name) { void* ret = my->XOpenDisplay(name); - if(ret && box64_x11sync) {my->XSynchronize(ret, 1); printf_log(LOG_INFO, "Forcing Syncronized operation on Display %p\n", ret);} + if(ret && BOX64ENV(x11sync)) {my->XSynchronize(ret, 1); printf_log(LOG_INFO, "Forcing Syncronized operation on Display %p\n", ret);} return ret; } @@ -2670,7 +2670,7 @@ EXPORT int my32__XReply(x64emu_t* emu, void* dpy, void* rep, int extra, int disc #define CUSTOM_INIT \ AddAutomaticBridge(lib->w.bridge, vFp_32, *(void**)dlsym(lib->w.lib, "_XLockMutex_fn"), 0, "_XLockMutex_fn"); \ AddAutomaticBridge(lib->w.bridge, vFp_32, *(void**)dlsym(lib->w.lib, "_XUnlockMutex_fn"), 0, "_XUnlockMutex_fn"); \ - if(box64_x11threads) my->XInitThreads(); \ + if(BOX64ENV(x11threads)) my->XInitThreads(); \ my_context->libx11 = lib; #define CUSTOM_FINI \ diff --git a/src/wrapped32/wrappedsdl2.c b/src/wrapped32/wrappedsdl2.c index 3b043431..9046b634 100644 --- a/src/wrapped32/wrappedsdl2.c +++ b/src/wrapped32/wrappedsdl2.c @@ -783,8 +783,8 @@ EXPORT unsigned long my32_2_SDL_GetThreadID(x64emu_t* emu, void* thread) EXPORT int my32_2_SDL_GetCPUCount(x64emu_t* emu) { int ret = my->SDL_GetCPUCount(); - if(box64_maxcpu && ret>box64_maxcpu) - ret = box64_maxcpu; + if(BOX64ENV(maxcpu) && ret>BOX64ENV(maxcpu)) + ret = BOX64ENV(maxcpu); return ret; } @@ -803,4 +803,4 @@ EXPORT int my32_2_SDL_GetCPUCount(x64emu_t* emu) my_context->sdl2freerw = NULL; -#include "wrappedlib_init32.h" \ No newline at end of file +#include "wrappedlib_init32.h" |