mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2026-06-17 21:48:32 -04:00
fix(SDL): Set SDL env vars for renderer
This commit is contained in:
@@ -129,7 +129,6 @@ public class MinecraftGLSurface extends View implements GrabListener, DirectGame
|
||||
motionListener = SDLActivity.getMotionListener();
|
||||
if (mNativeSurface == null) throw new IllegalStateException("Surface not yet loaded, can't set native surface for SDLSurface");
|
||||
SDLActivity.externalInitialize(activity, surface, ((ViewGroup)getParent()), mNativeSurface);
|
||||
if (LauncherPreferences.PREF_GAMEPAD_FORCEDSDL_PASSTHRU) Tools.SDL.initializeControllerSubsystems();
|
||||
} catch (UnsatisfiedLinkError ignored) {
|
||||
// Ignore because if SDL.setupJNI(); fails, SDL wasn't loaded.
|
||||
}
|
||||
|
||||
@@ -1925,7 +1925,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
|
||||
|
||||
@@ -249,6 +249,7 @@ public class JREUtils {
|
||||
envMap.put("POJAVEXEC_EGL","libMobileGL.so");
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
@@ -313,8 +314,18 @@ 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");
|
||||
}
|
||||
// Init must run after SDL env vars are set else they don't apply
|
||||
if (LauncherPreferences.PREF_GAMEPAD_FORCEDSDL_PASSTHRU) Tools.SDL.initializeControllerSubsystems();
|
||||
|
||||
List<String> userArgs = getJavaArgs(activity, runtimeHome, userArgsString);
|
||||
|
||||
//Remove arguments that can interfere with the good working of the launcher
|
||||
@@ -516,6 +527,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");
|
||||
|
||||
Reference in New Issue
Block a user