Added Caciocavallo17; Get JRE build from Actions

This commit is contained in:
Duy Tran Khanh committed 2022-08-24 12:34:06 +07:00
1 parent d75f203bf3
commit b7cc2d097e
14 files changed
+169 -174

No files matched your search

@@ -43,6 +43,10 @@ public class PojavLauncher {
});
System.setProperty("cacio.managed.screensize", args[2]);
try {
// Try to initialize Caciocavallo17
Class.forName("com.github.caciocavallosilano.cacio.ctc.CTCPreloadClassLoader");
} catch (ClassNotFoundException e) {}
if (args[0].equals(".LaunchJAR")) {
UIKit.callback_JavaGUIViewController_launchJarFile(args[1]);
@@ -3,7 +3,6 @@ package net.kdt.pojavlaunch.uikit;
import java.io.*;
import java.lang.reflect.*;
import java.util.jar.*;
import net.java.openjdk.cacio.ctc.CTCScreen;
import net.kdt.pojavlaunch.utils.MCOptionUtils;
import net.kdt.pojavlaunch.*;
import org.lwjgl.glfw.*;
@@ -32,12 +31,19 @@ public class UIKit {
public static void callback_JavaGUIViewController_launchJarFile(final String filepath) throws Throwable {
// Thread for refreshing the AWT buffer
new Thread(() -> {
Method getCurrentScreenRGB;
try {
try {
getCurrentScreenRGB = Class.forName("net.java.openjdk.cacio.ctc.CTCScreen").getMethod("getCurrentScreenRGB");
} catch (ClassNotFoundException e) {
getCurrentScreenRGB = Class.forName("com.github.caciocavallosilano.cacio.ctc.CTCScreen").getMethod("getCurrentScreenRGB");
}
long lastTime = System.currentTimeMillis();
while (true) {
int[] pixelsArray = null;
try{
pixelsArray = CTCScreen.getCurrentScreenRGB();
pixelsArray = (int[])getCurrentScreenRGB.invoke(null);
} catch (NullPointerException e) {
Thread.sleep(500);
}
@@ -51,7 +57,7 @@ public class UIKit {
}
lastTime = currentTime;
}
} catch (InterruptedException e) {
} catch (Throwable e) {
e.printStackTrace();
}
}, "AWTFBRefreshThread").start();