mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2026-04-22 18:47:11 -04:00
Allow load custom OpenGL library: Regal
This commit is contained in:
@@ -3,6 +3,7 @@ package net.kdt.pojavlaunch;
|
||||
import android.system.*;
|
||||
import java.io.*;
|
||||
import android.content.*;
|
||||
import net.kdt.pojavlaunch.prefs.*;
|
||||
|
||||
public class JREUtils
|
||||
{
|
||||
@@ -17,7 +18,11 @@ public class JREUtils
|
||||
dlopen(Tools.homeJreDir + "/lib/libnio.so");
|
||||
dlopen(Tools.homeJreDir + "/lib/libawt.so");
|
||||
dlopen(Tools.homeJreDir + "/lib/libawt_headless.so");
|
||||
dlopen("libgl04es.so");
|
||||
|
||||
if (!dlopen(LauncherPreferences.PREF_CUSTOM_OPENGL_LIBNAME)) {
|
||||
System.err.println("Failed to load custom OpenGL library " + LauncherPreferences.PREF_CUSTOM_OPENGL_LIBNAME + ". Fallbacking to GL4ES.");
|
||||
dlopen("libgl04es.so");
|
||||
}
|
||||
}
|
||||
|
||||
public static File redirectStdio(boolean current) throws ErrnoException {
|
||||
|
||||
@@ -16,6 +16,7 @@ public class LauncherPreferences
|
||||
public static int PREF_LONGPRESS_TRIGGER = 500;
|
||||
public static String PREF_DEFAULTCTRL_PATH = Tools.CTRLDEF_FILE;
|
||||
public static String PREF_CUSTOM_JAVA_ARGS;
|
||||
public static String PREF_CUSTOM_OPENGL_LIBNAME = "libgl04es.so";
|
||||
|
||||
public static void loadPreferences() {
|
||||
PREF_BUTTONSIZE = DEFAULT_PREF.getFloat("controlSize", 1f);
|
||||
@@ -44,5 +45,12 @@ public class LauncherPreferences
|
||||
PREF_CUSTOM_JAVA_ARGS = DEFAULT_JAVA_ARGS;
|
||||
DEFAULT_PREF.edit().putString("javaArgs", DEFAULT_JAVA_ARGS).commit();
|
||||
}
|
||||
|
||||
String argLwjglLibname = "-Dorg.lwjgl.opengl.libname=";
|
||||
for (String arg : PREF_CUSTOM_JAVA_ARGS.split(" ")) {
|
||||
if (arg.startsWith(argLwjglLibname)) {
|
||||
PREF_CUSTOM_JAVA_ARGS = arg.substring(argLwjglLibname.length());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user