mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 16:47:14 -04:00
Changes
- Remove dummy libfontconfig - Remove MC 1.12.x check for indirect input. - Try always indirect pipe.
This commit is contained in:
parent
d456317389
commit
72176bc589
@ -86,7 +86,7 @@ public class AWTCanvasView extends TextureView implements TextureView.SurfaceTex
|
|||||||
canvas.drawRGB(0, 0, 0);
|
canvas.drawRGB(0, 0, 0);
|
||||||
|
|
||||||
if (!attached) {
|
if (!attached) {
|
||||||
attached = CallbackBridge.nativeAttachThreadToOther(true, false, BaseMainActivity.isInputStackCall);
|
attached = CallbackBridge.nativeAttachThreadToOther(true, BaseMainActivity.isInputStackCall);
|
||||||
} else {
|
} else {
|
||||||
int[] rgbArray = JREUtils.renderAWTScreenFrame(/* canvas, mWidth, mHeight */);
|
int[] rgbArray = JREUtils.renderAWTScreenFrame(/* canvas, mWidth, mHeight */);
|
||||||
mDrawing = rgbArray != null;
|
mDrawing = rgbArray != null;
|
||||||
|
@ -125,12 +125,11 @@ public class BaseMainActivity extends LoggableActivity {
|
|||||||
mProfile = PojavProfile.getCurrentProfileContent(this);
|
mProfile = PojavProfile.getCurrentProfileContent(this);
|
||||||
mVersionInfo = Tools.getVersionInfo(mProfile.getVersion());
|
mVersionInfo = Tools.getVersionInfo(mProfile.getVersion());
|
||||||
// Minecraft 1.12.x special case: use indirect char pipe
|
// Minecraft 1.12.x special case: use indirect char pipe
|
||||||
CallbackBridge.isMinecraft1p12 = mVersionInfo.assets.startsWith("1.12");
|
|
||||||
|
|
||||||
setTitle("Minecraft " + mProfile.getVersion());
|
setTitle("Minecraft " + mProfile.getVersion());
|
||||||
|
|
||||||
// Minecraft 1.13+
|
// Minecraft 1.13+
|
||||||
isInputStackCall = mVersionInfo.arguments != null;
|
isInputStackCall = true; // mVersionInfo.arguments != null;
|
||||||
|
|
||||||
this.displayMetrics = Tools.getDisplayMetrics(this);
|
this.displayMetrics = Tools.getDisplayMetrics(this);
|
||||||
CallbackBridge.windowWidth = displayMetrics.widthPixels / scaleFactor;
|
CallbackBridge.windowWidth = displayMetrics.widthPixels / scaleFactor;
|
||||||
|
@ -118,6 +118,7 @@ public class JavaGUILauncherActivity extends LoggableActivity {
|
|||||||
appendlnToLog("Detected Forge installer!");
|
appendlnToLog("Detected Forge installer!");
|
||||||
new ForgeInstaller(installer).install(this);
|
new ForgeInstaller(installer).install(this);
|
||||||
} else {
|
} else {
|
||||||
|
appendlnToLog("No mod detected. Starting JVM");
|
||||||
isLogAllow = false;
|
isLogAllow = false;
|
||||||
mSkipDetectMod = true;
|
mSkipDetectMod = true;
|
||||||
JREUtils.redirectAndPrintJRELog(this, null);
|
JREUtils.redirectAndPrintJRELog(this, null);
|
||||||
|
@ -356,7 +356,7 @@ public class PojavLoginActivity extends BaseActivity
|
|||||||
|
|
||||||
// Refresh libraries
|
// Refresh libraries
|
||||||
copyDummyNativeLib("libawt_xawt.so");
|
copyDummyNativeLib("libawt_xawt.so");
|
||||||
copyDummyNativeLib("libfontconfig.so");
|
// copyDummyNativeLib("libfontconfig.so");
|
||||||
}
|
}
|
||||||
catch(Throwable e){
|
catch(Throwable e){
|
||||||
Tools.showError(this, e);
|
Tools.showError(this, e);
|
||||||
|
@ -11,7 +11,6 @@ public class CallbackBridge {
|
|||||||
public static final int CLIPBOARD_COPY = 2000;
|
public static final int CLIPBOARD_COPY = 2000;
|
||||||
public static final int CLIPBOARD_PASTE = 2001;
|
public static final int CLIPBOARD_PASTE = 2001;
|
||||||
|
|
||||||
public static boolean isMinecraft1p12;
|
|
||||||
public static volatile int windowWidth, windowHeight;
|
public static volatile int windowWidth, windowHeight;
|
||||||
public static int mouseX, mouseY;
|
public static int mouseX, mouseY;
|
||||||
public static boolean mouseLeft;
|
public static boolean mouseLeft;
|
||||||
@ -32,7 +31,7 @@ public class CallbackBridge {
|
|||||||
private static boolean threadAttached;
|
private static boolean threadAttached;
|
||||||
public static void sendCursorPos(int x, int y) {
|
public static void sendCursorPos(int x, int y) {
|
||||||
if (!threadAttached) {
|
if (!threadAttached) {
|
||||||
threadAttached = CallbackBridge.nativeAttachThreadToOther(true, isMinecraft1p12, BaseMainActivity.isInputStackCall);
|
threadAttached = CallbackBridge.nativeAttachThreadToOther(true, BaseMainActivity.isInputStackCall);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_STRING.append("CursorPos=" + x + ", " + y + "\n");
|
DEBUG_STRING.append("CursorPos=" + x + ", " + y + "\n");
|
||||||
@ -124,7 +123,7 @@ public class CallbackBridge {
|
|||||||
private static native void nativeSendData(boolean isAndroid, int type, String data);
|
private static native void nativeSendData(boolean isAndroid, int type, String data);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static native boolean nativeAttachThreadToOther(boolean isAndroid, boolean isMinecraft1p12, boolean isUsePushPoll);
|
public static native boolean nativeAttachThreadToOther(boolean isAndroid, boolean isUsePushPoll);
|
||||||
private static native boolean nativeSendChar(int codepoint);
|
private static native boolean nativeSendChar(int codepoint);
|
||||||
// GLFW: GLFWCharModsCallback deprecated, but is Minecraft still use?
|
// GLFW: GLFWCharModsCallback deprecated, but is Minecraft still use?
|
||||||
private static native boolean nativeSendCharMods(int codepoint, int mods);
|
private static native boolean nativeSendCharMods(int codepoint, int mods);
|
||||||
|
@ -46,11 +46,3 @@ LOCAL_SRC_FILES := \
|
|||||||
awt_Taskbar.c
|
awt_Taskbar.c
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
# libfontconfig dummy implementation, althought have Android port...
|
|
||||||
LOCAL_PATH := $(HERE_PATH)/fontconfig
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
LOCAL_MODULE := fontconfig
|
|
||||||
LOCAL_SRC_FILES := \
|
|
||||||
fontconfig.c
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
|
||||||
|
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
// dummy implementation of Unix fontconfig
|
|
||||||
|
|
@ -34,7 +34,6 @@ typedef void GLFW_invoke_MouseButton_func(void* window, int button, int action,
|
|||||||
typedef void GLFW_invoke_Scroll_func(void* window, double xoffset, double yoffset);
|
typedef void GLFW_invoke_Scroll_func(void* window, double xoffset, double yoffset);
|
||||||
typedef void GLFW_invoke_WindowSize_func(void* window, int width, int height);
|
typedef void GLFW_invoke_WindowSize_func(void* window, int width, int height);
|
||||||
|
|
||||||
bool isMinecraft1p12;
|
|
||||||
int grabCursorX, grabCursorY, lastCursorX, lastCursorY;
|
int grabCursorX, grabCursorY, lastCursorX, lastCursorY;
|
||||||
|
|
||||||
jclass inputBridgeClass_ANDROID, inputBridgeClass_JRE;
|
jclass inputBridgeClass_ANDROID, inputBridgeClass_JRE;
|
||||||
@ -98,7 +97,7 @@ jboolean attachThread(bool isAndroid, JNIEnv** secondJNIEnvPtr) {
|
|||||||
LOGD("Debug: Attaching %s thread to %s, javavm.isNull=%d\n", isAndroid ? "Android" : "JRE", isAndroid ? "JRE" : "Android", (isAndroid ? runtimeJavaVMPtr : dalvikJavaVMPtr) == NULL);
|
LOGD("Debug: Attaching %s thread to %s, javavm.isNull=%d\n", isAndroid ? "Android" : "JRE", isAndroid ? "JRE" : "Android", (isAndroid ? runtimeJavaVMPtr : dalvikJavaVMPtr) == NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (*secondJNIEnvPtr != NULL || (!isMinecraft1p12 && !isUseStackQueueCall)) return JNI_TRUE;
|
if (*secondJNIEnvPtr != NULL || (!isUseStackQueueCall)) return JNI_TRUE;
|
||||||
|
|
||||||
if (isAndroid && runtimeJavaVMPtr) {
|
if (isAndroid && runtimeJavaVMPtr) {
|
||||||
(*runtimeJavaVMPtr)->AttachCurrentThread(runtimeJavaVMPtr, secondJNIEnvPtr, NULL);
|
(*runtimeJavaVMPtr)->AttachCurrentThread(runtimeJavaVMPtr, secondJNIEnvPtr, NULL);
|
||||||
@ -140,14 +139,13 @@ void sendData(int type, int i1, int i2, int i3, int i4) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeAttachThreadToOther(JNIEnv* env, jclass clazz, jboolean isAndroid, jboolean isMinecraft1p12Bool, jboolean isUseStackQueueBool) {
|
JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeAttachThreadToOther(JNIEnv* env, jclass clazz, jboolean isAndroid, jboolean isUseStackQueueBool) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
LOGD("Debug: JNI attaching thread, isUseStackQueue=%d\n", isUseStackQueue);
|
LOGD("Debug: JNI attaching thread, isUseStackQueue=%d\n", isUseStackQueue);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
jboolean result;
|
jboolean result;
|
||||||
|
|
||||||
isMinecraft1p12 = isMinecraft1p12Bool;
|
|
||||||
isUseStackQueueCall = (int) isUseStackQueueBool;
|
isUseStackQueueCall = (int) isUseStackQueueBool;
|
||||||
if (isAndroid) {
|
if (isAndroid) {
|
||||||
result = attachThread(true, &runtimeJNIEnvPtr_ANDROID);
|
result = attachThread(true, &runtimeJNIEnvPtr_ANDROID);
|
||||||
@ -156,7 +154,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeAttachThread
|
|||||||
// getJavaInputBridge(&inputBridgeClass_JRE, &inputBridgeMethod_JRE);
|
// getJavaInputBridge(&inputBridgeClass_JRE, &inputBridgeMethod_JRE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((isMinecraft1p12 || isUseStackQueueCall) && isAndroid && result) {
|
if (isUseStackQueueCall && isAndroid && result) {
|
||||||
isPrepareGrabPos = true;
|
isPrepareGrabPos = true;
|
||||||
getJavaInputBridge(&inputBridgeClass_ANDROID, &inputBridgeMethod_ANDROID);
|
getJavaInputBridge(&inputBridgeClass_ANDROID, &inputBridgeMethod_ANDROID);
|
||||||
}
|
}
|
||||||
@ -195,7 +193,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeIsGrabbing(J
|
|||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSendChar(JNIEnv* env, jclass clazz, jint codepoint) {
|
JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSendChar(JNIEnv* env, jclass clazz, jint codepoint) {
|
||||||
if (GLFW_invoke_Char && isInputReady) {
|
if (GLFW_invoke_Char && isInputReady) {
|
||||||
if (isMinecraft1p12 || isUseStackQueueCall) {
|
if (isUseStackQueueCall) {
|
||||||
sendData(EVENT_TYPE_CHAR, codepoint, 0, 0, 0);
|
sendData(EVENT_TYPE_CHAR, codepoint, 0, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
GLFW_invoke_Char(showingWindow, (unsigned int) codepoint);
|
GLFW_invoke_Char(showingWindow, (unsigned int) codepoint);
|
||||||
@ -207,7 +205,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSendChar(JNI
|
|||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSendCharMods(JNIEnv* env, jclass clazz, jint codepoint, jint mods) {
|
JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSendCharMods(JNIEnv* env, jclass clazz, jint codepoint, jint mods) {
|
||||||
if (GLFW_invoke_CharMods && isInputReady) {
|
if (GLFW_invoke_CharMods && isInputReady) {
|
||||||
if (isMinecraft1p12 || isUseStackQueueCall) {
|
if (isUseStackQueueCall) {
|
||||||
sendData(EVENT_TYPE_CHAR_MODS, (unsigned int) codepoint, mods, 0, 0);
|
sendData(EVENT_TYPE_CHAR_MODS, (unsigned int) codepoint, mods, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
GLFW_invoke_CharMods(showingWindow, codepoint, mods);
|
GLFW_invoke_CharMods(showingWindow, codepoint, mods);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user