Allow load custom OpenGL library: Regal

This commit is contained in:
khanhduytran0
2020-09-09 12:34:30 +07:00
parent 5bf7e11127
commit 7045371568
2 changed files with 14 additions and 1 deletions

View File

@@ -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 {

View File

@@ -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());
}
}
}
}