mirror of
https://github.com/ptitSeb/box64.git
synced 2025-10-14 02:38:54 +08:00
Detect UnityPlayer.dll to apply strongmem=1 automatically (can be disabled with BOX64_UNITYPLAYER=0)
This commit is contained in:
@@ -253,6 +253,11 @@ Detect libjvm and apply conservative settings
|
||||
* 0 : Don't detect libjvm
|
||||
* 1 : Detect libjvm, and apply BIGBLOCK=0 STRONGMEM=1 SSE42=0 if detected (Default)
|
||||
|
||||
#### BOX64_UNITYPLAYER *
|
||||
Detect UnityPlayer.dll and apply strongmem settings
|
||||
* 0 : Don't detect UnityPlayer.dll
|
||||
* 1 : Detect UnityPlayer.dll, and apply BOX64_DYNAREC_STRONGMEM=1 if detected (Default)
|
||||
|
||||
#### BOX64_SDL2_JGUID *
|
||||
Need a workaround for SDL_GetJoystickGUIDInfo function for wrapped SDL2
|
||||
* 0 : Don't use any workaround
|
||||
|
10
src/core.c
10
src/core.c
@@ -129,6 +129,7 @@ int box64_dynarec = 0;
|
||||
#endif
|
||||
int box64_libcef = 1;
|
||||
int box64_jvm = 1;
|
||||
int box64_unityplayer = 1;
|
||||
int box64_sdl2_jguid = 0;
|
||||
int dlsym_error = 0;
|
||||
int cycle_log = 0;
|
||||
@@ -924,6 +925,15 @@ void LoadLogEnv()
|
||||
if(!box64_jvm)
|
||||
printf_log(LOG_INFO, "BOX64 will not detect libjvm\n");
|
||||
}
|
||||
p = getenv("BOX64_UNITYPLAYER");
|
||||
if(p) {
|
||||
if(strlen(p)==1) {
|
||||
if(p[0]>='0' && p[0]<='1')
|
||||
box64_unityplayer = p[0]-'0';
|
||||
}
|
||||
if(!box64_unityplayer)
|
||||
printf_log(LOG_INFO, "BOX64 will not detect UnityPlayer.dll\n");
|
||||
}
|
||||
p = getenv("BOX64_SDL2_JGUID");
|
||||
if(p) {
|
||||
if(strlen(p)==1) {
|
||||
|
@@ -73,6 +73,7 @@ extern int la64_scq;
|
||||
#endif
|
||||
extern int box64_libcef;
|
||||
extern int box64_jvm;
|
||||
extern int box64_unityplayer;
|
||||
extern int box64_sdl2_jguid;
|
||||
extern int dlsym_error; // log dlsym error
|
||||
extern int cycle_log; // if using rolling logs
|
||||
|
@@ -112,6 +112,7 @@ ENTRYBOOL(BOX64_CEFDISABLEGPUCOMPOSITOR, box64_cefdisablegpucompositor)\
|
||||
ENTRYBOOL(BOX64_EXIT, want_exit) \
|
||||
ENTRYBOOL(BOX64_LIBCEF, box64_libcef) \
|
||||
ENTRYBOOL(BOX64_JVM, box64_jvm) \
|
||||
ENTRYBOOL(BOX64_UNITYPLAYER, box64_unityplayer) \
|
||||
ENTRYBOOL(BOX64_SDL2_JGUID, box64_sdl2_jguid) \
|
||||
ENTRYINT(BOX64_MALLOC_HACK, box64_malloc_hack, 0, 2, 2) \
|
||||
ENTRYINTPOS(BOX64_MAXCPU, new_maxcpu) \
|
||||
|
@@ -2883,6 +2883,22 @@ EXPORT void* my_mmap64(x64emu_t* emu, void *addr, unsigned long length, int prot
|
||||
prot |= PROT_NEVERCLEAN;
|
||||
}
|
||||
}
|
||||
static int unityplayer_detected = 0;
|
||||
if(fd>0 && box64_unityplayer && !unityplayer_detected) {
|
||||
char filename[4096];
|
||||
char buf[128];
|
||||
sprintf(buf, "/proc/self/fd/%d", fd);
|
||||
ssize_t r = readlink(buf, filename, sizeof(filename)-1);
|
||||
if(r!=1) filename[r]=0;
|
||||
if(r>0 && strlen(filename)>strlen("UnityPlayer.dll") && !strcasecmp(filename+strlen(filename)-strlen("UnityPlayer.dll"), "UnityPlayer.dll")) {
|
||||
printf_log(LOG_INFO, "BOX64: Detected UnityPlayer.dll\n");
|
||||
#ifdef DYNAREC
|
||||
if(!box64_dynarec_strongmem)
|
||||
box64_dynarec_strongmem = 1;
|
||||
#endif
|
||||
unityplayer_detected = 1;
|
||||
}
|
||||
}
|
||||
if(emu)
|
||||
setProtection_mmap((uintptr_t)ret, length, prot);
|
||||
else
|
||||
|
Reference in New Issue
Block a user