VMLauncher... TODO LD_LIBRARY_PATH to support Android 5...

This commit is contained in:
khanhduytran0 committed 2020-08-23 12:45:04 +07:00
1 parent 965b9ff10e
commit ffc2f640d9
11 files changed
+23 -6

No files matched your search

@@ -0,0 +1,7 @@
package com.oracle.dalvik;
public final class VMLauncher {
private VMLauncher() {
}
public static native int launchJVM(String[] args);
}
@@ -4,6 +4,8 @@ package net.kdt.pojavlaunch;
public class BinaryExecutor
{
public static void initJavaRuntime() {
chdir(Tools.MAIN_PATH);
dlopen(Tools.homeJreDir + "/lib/jli/libjli.so");
dlopen(Tools.homeJreDir + "/lib/server/libjvm.so");
dlopen(Tools.homeJreDir + "/lib/libverify.so");
@@ -12,8 +14,6 @@ public class BinaryExecutor
dlopen(Tools.homeJreDir + "/lib/libnio.so");
dlopen(Tools.homeJreDir + "/lib/libawt.so");
dlopen(Tools.homeJreDir + "/lib/libawt_headless.so");
chdir(Tools.MAIN_PATH);
}
public static native int chdir(String path);
@@ -29,6 +29,7 @@ import org.lwjgl.input.*;
import org.lwjgl.opengl.*;
import android.app.AlertDialog;
import com.oracle.dalvik.*;
public class MainActivity extends AppCompatActivity implements OnTouchListener, OnClickListener
{
@@ -673,7 +674,8 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
AndroidContextImplementation.display = egl10.eglGetCurrentDisplay();
AndroidContextImplementation.read = egl10.eglGetCurrentSurface(EGL10.EGL_READ);
AndroidContextImplementation.draw = egl10.eglGetCurrentSurface(EGL10.EGL_DRAW);
egl10.eglMakeCurrent(AndroidContextImplementation.display, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
// egl10.eglMakeCurrent(AndroidContextImplementation.display, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
System.out.println(new StringBuffer().append("Gave up context: ").append(AndroidContextImplementation.context).toString());
AndroidDisplay.windowWidth += navBarHeight;
@@ -1018,10 +1020,11 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
launchClassPath = Tools.generateLaunchClassPath(mProfile.getVersion());
launchLibrarySearchPath = getApplicationInfo().nativeLibraryDir;
/*
System.out.println("> Running Minecraft with classpath:");
System.out.println(launchClassPath);
System.out.println();
*/
redirectStdio();
BinaryExecutor.initJavaRuntime();
@@ -1029,7 +1032,8 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
BinaryExecutor.dlopen(Tools.homeJreDir + "/bin/java");
List<String> javaArgList = new ArrayList<String>();
javaArgList.add(Tools.homeJreDir + "/bin/java");
// javaArgList.add(Tools.homeJreDir + "/bin/java");
javaArgList.add("java");
// javaArgList.add("-Xms512m");
javaArgList.add("-Xmx512m");
@@ -1058,6 +1062,10 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
javaArgList.add(mVersionInfo.mainClass);
javaArgList.addAll(Arrays.asList(launchArgs));
StringBuilder strb = new StringBuilder();
for (String cmd : javaArgList) {strb.append(cmd + " ");}
appendlnToLog("Java arguments: " + strb.toString() + "\n", false);
/*
ShellProcessOperation sp = new ShellProcessOperation(new ShellProcessOperation.OnPrintListener(){
@@ -1071,7 +1079,9 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
sp.writeToProcess(javaArgList.toArray(new String[0]));
*/
BinaryExecutor.executeBinary(javaArgList.toArray(new String[0]));
// BinaryExecutor.executeBinary(javaArgList.toArray(new String[0]));
VMLauncher.launchJVM(javaArgList.toArray(new String[0]));
/*
"-Dorg.apache.logging.log4j.level=INFO",
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.