From 81a8b3827722ead71e6bfcfb8bfd85d2fc0f70f1 Mon Sep 17 00:00:00 2001 From: tomikun <60690056+alexytomi@users.noreply.github.com> Date: Wed, 10 Jun 2026 01:18:48 +0800 Subject: [PATCH] fix(SDL): Set SDL env vars for renderer --- .../main/java/net/kdt/pojavlaunch/Tools.java | 2 +- .../net/kdt/pojavlaunch/utils/JREUtils.java | 20 ++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java index 28335f24e..68aef5bdb 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/Tools.java @@ -1920,7 +1920,7 @@ public final class Tools { return motionListener; } - static class SDL { + public static class SDL { /** * Initializes gamepad, joystick, and event subsystems. * This triggers {@link SDLControllerManager#pollInputDevices()} and subsequently disables diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java index e6343346d..b1f4fe58e 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/utils/JREUtils.java @@ -241,6 +241,7 @@ public class JREUtils { envMap.put("MESA_GLSL_VERSION_OVERRIDE","460"); } } + if(LauncherPreferences.PREF_BIG_CORE_AFFINITY) envMap.put("POJAV_BIG_CORE_AFFINITY", "1"); envMap.put("AWTSTUB_WIDTH", Integer.toString(CallbackBridge.windowWidth > 0 ? CallbackBridge.windowWidth : CallbackBridge.physicalWidth)); envMap.put("AWTSTUB_HEIGHT", Integer.toString(CallbackBridge.windowHeight > 0 ? CallbackBridge.windowHeight : CallbackBridge.physicalHeight)); @@ -305,8 +306,16 @@ public class JREUtils { JREUtils.relocateLibPath(runtime, runtimeHome); setJavaEnvironment(activity, runtimeHome); - final String graphicsLib = loadGraphicsLibrary(); + + // Has to run after SDL env vars are set + try { + Os.setenv("SDL_OPENGL_LIBRARY", graphicsLib, true); + Os.setenv("SDL_EGL_LIBRARY", NATIVE_LIB_DIR+"/"+Os.getenv("POJAVEXEC_EGL"), true); + } catch (ErrnoException e) { + Log.wtf("RENDER_LIBRARY", "Failed to load set SDL env vars"); + } + List userArgs = getJavaArgs(activity, runtimeHome, userArgsString); //Remove arguments that can interfere with the good working of the launcher @@ -506,6 +515,15 @@ public class JREUtils { renderLibrary = "libng_gl4es.so"; break; } + // Has to run before dlopening mobileglues + if(LOCAL_RENDERER.equals("opengles_mobileglues")){ + try { + Os.setenv("MG_DIR_PATH", Tools.DIR_DATA + "/MobileGlues", true); + Os.setenv("POJAVEXEC_EGL",renderLibrary, true); + } catch (ErrnoException e) { + Log.wtf("RENDER_LIBRARY", "Failed to load MobileGlues settings"); + } + } if (!dlopen(renderLibrary) && !dlopen(findInLdLibPath(renderLibrary))) { Log.e("RENDER_LIBRARY","Failed to load renderer " + renderLibrary + ". Falling back to Krypton Wrapper");