Skip to content

Commit

Permalink
Added a loop to make DalvikVM never exit
Browse files Browse the repository at this point in the history
  • Loading branch information
khanhduytran0 committed Aug 10, 2020
1 parent 97b7b84 commit 1439477
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@
public class MinecraftEGLInitializer
{
public static void main(final String[] args) throws Throwable {
/*
new Thread(new Runnable(){
@Override
public void run() {
runOnThread(args);
}
}).start();
*/

runOnThread(args);
}

private static void runOnThread(final String[] args) {
try {
Tools.datapath = System.getenv("POJAV_DATA_DIR");

Expand All @@ -39,7 +52,6 @@ public static void main(final String[] args) throws Throwable {

GLTextureView gtv = new GLTextureView(lSurfaceTexture, lProducer, lFrameAvailableListener);
gtv.setRenderer(new GLTextureView.Renderer() {
private volatile long eglContext = 0l;
@Override
public void onSurfaceDestroyed(GL10 gl) {
System.out.println("Surface destroyed.");
Expand All @@ -58,6 +70,9 @@ public void onSurfaceCreated(GL10 gl, javax.microedition.khronos.egl.EGLConfig p
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());

int eglGetError = egl10.eglGetError();
System.out.println("eglGetError: " + Integer.toString(eglGetError) + ", success: " + Boolean.toString(eglGetError == EGL10.EGL_SUCCESS));

MainActivity.launchClassPath = args[5];
MainActivity.launchOptimizedDirectory = args[6];
MainActivity.launchLibrarySearchPath = args[7];
Expand All @@ -74,11 +89,6 @@ public void onSurfaceCreated(GL10 gl, javax.microedition.khronos.egl.EGLConfig p

try {
initEnvs();

boolean makeCurrBool = theEgl.eglMakeCurrent(display, read, draw, context);
System.out.println("Gave up context: " + context + ", makeCurrent: " + Boolean.toString(makeCurrBool));
int eglGetError = egl10.eglGetError();
System.out.println("eglGetError: " + Integer.toString(eglGetError) + ", success: " + Boolean.toString(eglGetError == EGL10.EGL_SUCCESS));
System.out.println("user.home: " + System.getProperty("user.home"));

// ActivityThread.currentActivityThread().getSystemContext().startActivity(new Intent().setComponent(new ComponentName("net.kdt.pojavlaunch", ".CustomControlsActivity")));
Expand Down Expand Up @@ -113,6 +123,10 @@ public void onSurfaceChanged(GL10 gl, int width, int height) {
gtv.setRenderMode(GLTextureView.RENDERMODE_CONTINUOUSLY);
gtv.setSize(AndroidDisplay.windowWidth, AndroidDisplay.windowHeight);

// hmmmm
while (true) {
Thread.sleep(1000);
}
} catch (Throwable th) {
System.err.println("UNEXCEPTED SHUTTING DOWN");
th.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ public class SurfaceTextureView
private boolean isTextureAvailable = false;
public SurfaceTextureView(long lSurfaceTexture, long lProducer, long lFrameAvailableListener) {
mSurfaceTexture = new SurfaceTexture(false);
/*
try {
Tools.findField(mSurfaceTexture, "mSurfaceTexture").set(mSurfaceTexture, lSurfaceTexture);
Tools.findField(mSurfaceTexture, "mProducer").set(mSurfaceTexture, lProducer);
Tools.findField(mSurfaceTexture, "mFrameAvailableListener").set(mSurfaceTexture, lFrameAvailableListener);
} catch (Throwable th) {
throw new RuntimeException(th);
}
*/
}

public SurfaceTexture getSurfaceTexture() {
Expand Down

0 comments on commit 1439477

Please sign in to comment.