mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 08:35:37 -04:00
Fix
This commit is contained in:
parent
af7fde08bd
commit
3253142c34
@ -56,13 +56,18 @@ public class JREUtils
|
|||||||
Log.v("jrelog","Log starts here");
|
Log.v("jrelog","Log starts here");
|
||||||
Thread t = new Thread(new Runnable(){
|
Thread t = new Thread(new Runnable(){
|
||||||
int failTime = 0;
|
int failTime = 0;
|
||||||
|
ProcessBuilder logcatPb;
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
if (logcatPb == null) {
|
||||||
|
logcatPb = new ProcessBuilder().command("logcat", /* "-G", "1mb", */ "-v", "brief", "*:S").redirectErrorStream(true);
|
||||||
|
}
|
||||||
|
|
||||||
Log.i("jrelog-logcat","Clearing logcat");
|
Log.i("jrelog-logcat","Clearing logcat");
|
||||||
new ProcessBuilder().command("logcat", "-c").redirectErrorStream(true).start();
|
new ProcessBuilder().command("logcat", "-c").redirectErrorStream(true).start();
|
||||||
Log.i("jrelog-logcat","Starting logcat");
|
Log.i("jrelog-logcat","Starting logcat");
|
||||||
java.lang.Process p = new ProcessBuilder().command("logcat", /* "-G", "1mb", */ "-v", "brief", "*:S").redirectErrorStream(true).start();
|
java.lang.Process p = logcatPb.start();
|
||||||
|
|
||||||
// idk which better, both have a bug that printf(\n) in a single line
|
// idk which better, both have a bug that printf(\n) in a single line
|
||||||
/*
|
/*
|
||||||
@ -103,10 +108,10 @@ public class JREUtils
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Log.e("jrelog-logcat", "IOException on logging thread");
|
Log.e("jrelog-logcat", "Exception on logging thread");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
||||||
act.appendlnToLog("IOException on logging thread:\n" + Log.getStackTraceString(e));
|
act.appendlnToLog("Exception on logging thread:\n" + Log.getStackTraceString(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -10,12 +10,11 @@ struct GLFWInputEvent {
|
|||||||
int i1, i2, i3, i4;
|
int i1, i2, i3, i4;
|
||||||
double d1, d2;
|
double d1, d2;
|
||||||
};
|
};
|
||||||
struct GLFWInputEvent* glfwInputEventArr;
|
struct char* glfwInputEventArr[100];
|
||||||
|
int glfwInputEventIndex;
|
||||||
|
|
||||||
int *grabCursorX, *grabCursorY, *lastCursorX, *lastCursorY;
|
int *grabCursorX, *grabCursorY, *lastCursorX, *lastCursorY;
|
||||||
|
|
||||||
int glfwInputEventIndex;
|
|
||||||
|
|
||||||
#define EVENT_TYPE_CHAR 1000
|
#define EVENT_TYPE_CHAR 1000
|
||||||
#define EVENT_TYPE_CHAR_MODS 1001
|
#define EVENT_TYPE_CHAR_MODS 1001
|
||||||
#define EVENT_TYPE_CURSOR_ENTER 1002
|
#define EVENT_TYPE_CURSOR_ENTER 1002
|
||||||
@ -124,24 +123,25 @@ void invokeCursorPos(int x, int y) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isUseStackQueueCall) {
|
if (!isUseStackQueueCall && GLFW_invoke_CursorPos) {
|
||||||
GLFW_invoke_CursorPos(showingWindow, (double) (isGrabbing ? *grabCursorX : x), (double) (isGrabbing ? *grabCursorY : y));
|
GLFW_invoke_CursorPos(showingWindow, (double) (isGrabbing ? *grabCursorX : x), (double) (isGrabbing ? *grabCursorY : y));
|
||||||
}
|
}
|
||||||
*lastCursorX = x;
|
*lastCursorX = x;
|
||||||
*lastCursorY = y;
|
*lastCursorY = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addInputToQueue(GLFWInputEvent event) {
|
||||||
|
if (glfwInputEventIndex++
|
||||||
|
glfwInputEventArr[glfwInputEventIndex] = (char*) event;
|
||||||
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeAttachThreadToOther(JNIEnv* env, jclass clazz, jboolean isAndroid, jboolean isUseStackQueue) {
|
JNIEXPORT void JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeAttachThreadToOther(JNIEnv* env, jclass clazz, jboolean isAndroid, jboolean isUseStackQueue) {
|
||||||
glfwInputEventIndex = -1;
|
glfwInputEventIndex = -1;
|
||||||
isUseStackQueueCall = 1;
|
// isUseStackQueueCall = 1;
|
||||||
// isUseStackQueueCall = (int) isUseStackQueue;
|
isUseStackQueueCall = (int) isUseStackQueue;
|
||||||
if (isUseStackQueue) {
|
if (isUseStackQueue) {
|
||||||
isPrepareGrabPos = true;
|
isPrepareGrabPos = true;
|
||||||
|
} else if (isAndroid) {
|
||||||
glfwInputEventArr = calloc(100, sizeof(struct GLFWInputEvent));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isAndroid) {
|
|
||||||
firstJavaVM = dalvikJavaVMPtr;
|
firstJavaVM = dalvikJavaVMPtr;
|
||||||
firstJNIEnv = dalvikJNIEnvPtr_ANDROID;
|
firstJNIEnv = dalvikJNIEnvPtr_ANDROID;
|
||||||
secondJavaVM = runtimeJavaVMPtr;
|
secondJavaVM = runtimeJavaVMPtr;
|
||||||
@ -314,12 +314,13 @@ JNIEXPORT void JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSendFramebufferS
|
|||||||
JNIEXPORT void JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSendKey(JNIEnv* env, jclass clazz, jint key, jint scancode, jint action, jint mods) {
|
JNIEXPORT void JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSendKey(JNIEnv* env, jclass clazz, jint key, jint scancode, jint action, jint mods) {
|
||||||
if (GLFW_invoke_Key && isInputReady) {
|
if (GLFW_invoke_Key && isInputReady) {
|
||||||
if (isUseStackQueueCall) {
|
if (isUseStackQueueCall) {
|
||||||
struct GLFWInputEvent curr = glfwInputEventArr[glfwInputEventIndex++];
|
struct GLFWInputEvent curr;
|
||||||
curr.type = EVENT_TYPE_KEY;
|
curr.type = EVENT_TYPE_KEY;
|
||||||
curr.i1 = key;
|
curr.i1 = key;
|
||||||
curr.i2 = scancode;
|
curr.i2 = scancode;
|
||||||
curr.i3 = action;
|
curr.i3 = action;
|
||||||
curr.i4 = mods;
|
curr.i4 = mods;
|
||||||
|
addInputToQueue(curr);
|
||||||
} else
|
} else
|
||||||
GLFW_invoke_Key(showingWindow, key, scancode, action, mods);
|
GLFW_invoke_Key(showingWindow, key, scancode, action, mods);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user