Java 8: Fix awt_xawt and Caciocavallo
This commit is contained in:
1 parent
56c5df0305
commit
0783f2d43a
3 files changed
+31
-20
No files matched your search
@@ -38,27 +38,32 @@ public class UIKit {
|
||||
} catch (ClassNotFoundException e) {
|
||||
getCurrentScreenRGB = Class.forName("com.github.caciocavallosilano.cacio.ctc.CTCScreen").getMethod("getCurrentScreenRGB");
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
System.err.println("Failed to find class CTCScreen");
|
||||
th.printStackTrace();
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
long lastTime = System.currentTimeMillis();
|
||||
while (true) {
|
||||
int[] pixelsArray = null;
|
||||
try{
|
||||
pixelsArray = (int[])getCurrentScreenRGB.invoke(null);
|
||||
} catch (NullPointerException e) {
|
||||
Thread.sleep(500);
|
||||
}
|
||||
if (pixelsArray != null) {
|
||||
//System.out.println(java.util.Arrays.toString(pixelsArray));
|
||||
refreshAWTBuffer(pixelsArray);
|
||||
}
|
||||
long currentTime = System.currentTimeMillis();
|
||||
if (currentTime - lastTime < 16) {
|
||||
Thread.sleep(16 - (currentTime - lastTime));
|
||||
}
|
||||
lastTime = currentTime;
|
||||
long lastTime = System.currentTimeMillis();
|
||||
while (true) {
|
||||
int[] pixelsArray = null;
|
||||
try{
|
||||
pixelsArray = (int[])getCurrentScreenRGB.invoke(null);
|
||||
} catch (Throwable e) {}
|
||||
if (pixelsArray != null) {
|
||||
//System.out.println(java.util.Arrays.toString(pixelsArray));
|
||||
refreshAWTBuffer(pixelsArray);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
long currentTime = System.currentTimeMillis();
|
||||
if (currentTime - lastTime < 16) {
|
||||
try {
|
||||
Thread.sleep(16 - (currentTime - lastTime));
|
||||
} catch (InterruptedException e) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
lastTime = currentTime;
|
||||
}
|
||||
}, "AWTFBRefreshThread").start();
|
||||
|
||||
|
||||
@@ -111,6 +111,10 @@ const void * _CGDataProviderGetBytePointerCallbackAWT(void *info) {
|
||||
}
|
||||
|
||||
- (void)surfaceOnClick:(UITapGestureRecognizer *)sender {
|
||||
if (runtimeJNIEnvPtr == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (method_ReceiveInput == NULL) {
|
||||
class_CTCAndroidInput = (*runtimeJNIEnvPtr)->FindClass(runtimeJNIEnvPtr, "net/java/openjdk/cacio/ctc/CTCAndroidInput");
|
||||
if ((*runtimeJNIEnvPtr)->ExceptionCheck(runtimeJNIEnvPtr) == JNI_TRUE) {
|
||||
|
||||
@@ -50,7 +50,9 @@ void init_loadCustomEnv() {
|
||||
/* Define default env */
|
||||
|
||||
// I accidentally patched a bit wrong, the value should be a path containing libawt_xawt.dylib, but here is libawt.dylib path (no need to exist)
|
||||
setenv("JAVA_AWT_PATH", [NSString stringWithFormat:@"%s/Frameworks/libawt.dylib", getenv("BUNDLE_PATH")].UTF8String, 1);
|
||||
if (getenv("POJAV_DETECTEDJB")) {
|
||||
setenv("JAVA_AWT_PATH", [NSString stringWithFormat:@"%s/Frameworks/libawt.dylib", getenv("BUNDLE_PATH")].UTF8String, 1);
|
||||
}
|
||||
|
||||
// Disable overloaded functions hack for Minecraft 1.17+
|
||||
setenv("LIBGL_NOINTOVLHACK", "1", 1);
|
||||
|
||||
Reference in new issue
Block a user