- Remove dummy libfontconfig
- Remove MC 1.12.x check for indirect input.
- Try always indirect pipe.
This commit is contained in:
khanhduytran0 2020-11-23 05:48:54 +07:00
parent d456317389
commit 72176bc589
8 changed files with 11 additions and 24 deletions

View File

@ -86,7 +86,7 @@ public class AWTCanvasView extends TextureView implements TextureView.SurfaceTex
canvas.drawRGB(0, 0, 0);
if (!attached) {
attached = CallbackBridge.nativeAttachThreadToOther(true, false, BaseMainActivity.isInputStackCall);
attached = CallbackBridge.nativeAttachThreadToOther(true, BaseMainActivity.isInputStackCall);
} else {
int[] rgbArray = JREUtils.renderAWTScreenFrame(/* canvas, mWidth, mHeight */);
mDrawing = rgbArray != null;

View File

@ -125,12 +125,11 @@ public class BaseMainActivity extends LoggableActivity {
mProfile = PojavProfile.getCurrentProfileContent(this);
mVersionInfo = Tools.getVersionInfo(mProfile.getVersion());
// Minecraft 1.12.x special case: use indirect char pipe
CallbackBridge.isMinecraft1p12 = mVersionInfo.assets.startsWith("1.12");
setTitle("Minecraft " + mProfile.getVersion());
// Minecraft 1.13+
isInputStackCall = mVersionInfo.arguments != null;
isInputStackCall = true; // mVersionInfo.arguments != null;
this.displayMetrics = Tools.getDisplayMetrics(this);
CallbackBridge.windowWidth = displayMetrics.widthPixels / scaleFactor;

View File

@ -118,6 +118,7 @@ public class JavaGUILauncherActivity extends LoggableActivity {
appendlnToLog("Detected Forge installer!");
new ForgeInstaller(installer).install(this);
} else {
appendlnToLog("No mod detected. Starting JVM");
isLogAllow = false;
mSkipDetectMod = true;
JREUtils.redirectAndPrintJRELog(this, null);

View File

@ -356,7 +356,7 @@ public class PojavLoginActivity extends BaseActivity
// Refresh libraries
copyDummyNativeLib("libawt_xawt.so");
copyDummyNativeLib("libfontconfig.so");
// copyDummyNativeLib("libfontconfig.so");
}
catch(Throwable e){
Tools.showError(this, e);

View File

@ -11,7 +11,6 @@ public class CallbackBridge {
public static final int CLIPBOARD_COPY = 2000;
public static final int CLIPBOARD_PASTE = 2001;
public static boolean isMinecraft1p12;
public static volatile int windowWidth, windowHeight;
public static int mouseX, mouseY;
public static boolean mouseLeft;
@ -32,7 +31,7 @@ public class CallbackBridge {
private static boolean threadAttached;
public static void sendCursorPos(int x, int y) {
if (!threadAttached) {
threadAttached = CallbackBridge.nativeAttachThreadToOther(true, isMinecraft1p12, BaseMainActivity.isInputStackCall);
threadAttached = CallbackBridge.nativeAttachThreadToOther(true, BaseMainActivity.isInputStackCall);
}
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);
*/
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);
// GLFW: GLFWCharModsCallback deprecated, but is Minecraft still use?
private static native boolean nativeSendCharMods(int codepoint, int mods);

View File

@ -46,11 +46,3 @@ LOCAL_SRC_FILES := \
awt_Taskbar.c
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)

View File

@ -1,2 +0,0 @@
// dummy implementation of Unix fontconfig

View File

@ -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_WindowSize_func(void* window, int width, int height);
bool isMinecraft1p12;
int grabCursorX, grabCursorY, lastCursorX, lastCursorY;
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);
#endif
if (*secondJNIEnvPtr != NULL || (!isMinecraft1p12 && !isUseStackQueueCall)) return JNI_TRUE;
if (*secondJNIEnvPtr != NULL || (!isUseStackQueueCall)) return JNI_TRUE;
if (isAndroid && runtimeJavaVMPtr) {
(*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
LOGD("Debug: JNI attaching thread, isUseStackQueue=%d\n", isUseStackQueue);
#endif
jboolean result;
isMinecraft1p12 = isMinecraft1p12Bool;
isUseStackQueueCall = (int) isUseStackQueueBool;
if (isAndroid) {
result = attachThread(true, &runtimeJNIEnvPtr_ANDROID);
@ -156,7 +154,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeAttachThread
// getJavaInputBridge(&inputBridgeClass_JRE, &inputBridgeMethod_JRE);
}
if ((isMinecraft1p12 || isUseStackQueueCall) && isAndroid && result) {
if (isUseStackQueueCall && isAndroid && result) {
isPrepareGrabPos = true;
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) {
if (GLFW_invoke_Char && isInputReady) {
if (isMinecraft1p12 || isUseStackQueueCall) {
if (isUseStackQueueCall) {
sendData(EVENT_TYPE_CHAR, codepoint, 0, 0, 0);
} else {
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) {
if (GLFW_invoke_CharMods && isInputReady) {
if (isMinecraft1p12 || isUseStackQueueCall) {
if (isUseStackQueueCall) {
sendData(EVENT_TYPE_CHAR_MODS, (unsigned int) codepoint, mods, 0, 0);
} else {
GLFW_invoke_CharMods(showingWindow, codepoint, mods);