diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2023-10-11 12:15:05 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2023-10-11 12:15:05 +0200 |
| commit | 0499c38466ca094b230ec6c825ec96ddcd987892 (patch) | |
| tree | 47a4debd9df897c7523059999686b2c994dfe2e4 /src | |
| parent | 3e18d5ea57c5da660e28acf08127d46336d4d0a0 (diff) | |
| download | box64-0499c38466ca094b230ec6c825ec96ddcd987892.tar.gz box64-0499c38466ca094b230ec6c825ec96ddcd987892.zip | |
Added BOX64_SDL2_JGUID, a workaround for game using old SDL_GetJoystickGUIDInfo funciton on recent wrapped SDL2 (for #1018)
Diffstat (limited to 'src')
| -rw-r--r-- | src/include/debug.h | 1 | ||||
| -rw-r--r-- | src/main.c | 12 | ||||
| -rw-r--r-- | src/tools/rcfile.c | 4 | ||||
| -rw-r--r-- | src/wrapped/wrappedsdl2.c | 3 |
4 files changed, 18 insertions, 2 deletions
diff --git a/src/include/debug.h b/src/include/debug.h index fa387d42..6c1ed419 100644 --- a/src/include/debug.h +++ b/src/include/debug.h @@ -52,6 +52,7 @@ extern int rv64_xtheadfmv; #endif #endif extern int box64_libcef; +extern int box64_sdl2_jguid; extern int dlsym_error; // log dlsym error extern int cycle_log; // if using rolling logs #ifdef HAVE_TRACE diff --git a/src/main.c b/src/main.c index 90e3575d..47cff957 100644 --- a/src/main.c +++ b/src/main.c @@ -93,6 +93,7 @@ int rv64_xtheadfmv = 0; int box64_dynarec = 0; #endif int box64_libcef = 1; +int box64_sdl2_jguid = 0; int dlsym_error = 0; int cycle_log = 0; #ifdef HAVE_TRACE @@ -718,7 +719,16 @@ void LoadLogEnv() box64_libcef = p[0]-'0'; } if(!box64_libcef) - printf_log(LOG_INFO, "Dynarec will not detect libcef\n"); + printf_log(LOG_INFO, "BOX64 will not detect libcef\n"); + } + p = getenv("BOX64_SDL2_JGUID"); + if(p) { + if(strlen(p)==1) { + if(p[0]>='0' && p[0]<='1') + box64_sdl2_jguid = p[0]-'0'; + } + if(!box64_sdl2_jguid) + printf_log(LOG_INFO, "BOX64 will workaround the use of SDL_GetJoystickGUIDInfo with 4 args instead of 5\n"); } p = getenv("BOX64_LOAD_ADDR"); if(p) { diff --git a/src/tools/rcfile.c b/src/tools/rcfile.c index d3b3e618..98b0d4cb 100644 --- a/src/tools/rcfile.c +++ b/src/tools/rcfile.c @@ -48,6 +48,9 @@ static const char default_rcfile[] = "[pressure-vessel-wrap]\n" "BOX64_NOGTK=1\n" "\n" +"[ShovelKnight]\n" +"BOX64_SDL2_JGUID=1\n" +"\n" "[Soma.bin.x86_64]\n" "BOX64_DYNAREC_FASTROUND=0\n" "\n" @@ -99,6 +102,7 @@ ENTRYINT(BOX64_JITGDB, jit_gdb, 0, 2, 2) \ ENTRYBOOL(BOX64_NOSANDBOX, box64_nosandbox) \ ENTRYBOOL(BOX64_EXIT, want_exit) \ ENTRYBOOL(BOX64_LIBCEF, box64_libcef) \ +ENTRYBOOL(BOX64_SDL2_JGUID, box64_sdl2_jguid) \ ENTRYINT(BOX64_MALLOC_HACK, box64_malloc_hack, 0, 2, 2) \ #ifdef HAVE_TRACE diff --git a/src/wrapped/wrappedsdl2.c b/src/wrapped/wrappedsdl2.c index 080e9bd5..cf745119 100644 --- a/src/wrapped/wrappedsdl2.c +++ b/src/wrapped/wrappedsdl2.c @@ -801,8 +801,9 @@ EXPORT void* my2_SDL_Vulkan_GetVkGetInstanceProcAddr(x64emu_t* emu) EXPORT void my2_SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, uint16_t *vend, uint16_t *prod, uint16_t *ver, uint16_t* crc16) { + uint16_t dummy = 0; if(my->SDL_GetJoystickGUIDInfo) - my->SDL_GetJoystickGUIDInfo(guid, vend, prod, ver, crc16); + my->SDL_GetJoystickGUIDInfo(guid, vend, prod, ver, box64_sdl2_jguid?(&dummy):crc16); // fallback else { uint16_t *guid16 = (uint16_t *)guid.data; |