diff --git a/src/main/assets/lwjgl/version b/src/main/assets/lwjgl/version index b7b15c73..d04d82ab 100644 --- a/src/main/assets/lwjgl/version +++ b/src/main/assets/lwjgl/version @@ -1 +1 @@ -1729135685550 \ No newline at end of file +1729544610054 \ No newline at end of file diff --git a/src/main/jni/environ/environ.h b/src/main/jni/environ/environ.h index f6402236..02d3d21a 100644 --- a/src/main/jni/environ/environ.h +++ b/src/main/jni/environ/environ.h @@ -54,8 +54,6 @@ struct pojav_environ_s { JavaVM* dalvikJavaVMPtr; JNIEnv* dalvikJNIEnvPtr_ANDROID; jobject activity; - XrInstanceCreateInfoAndroidKHR *XRAndroidInstanceBinding; - XrGraphicsBindingOpenGLESAndroidKHR *XRAndroidGLESBinding; long showingWindow; bool isInputReady, isCursorEntered, isUseStackQueueCall, shouldUpdateMouse; int savedWidth, savedHeight; diff --git a/src/main/jni/input_bridge_v3.c b/src/main/jni/input_bridge_v3.c index 7b11b746..e57ea4e7 100644 --- a/src/main/jni/input_bridge_v3.c +++ b/src/main/jni/input_bridge_v3.c @@ -63,11 +63,6 @@ jint JNI_OnLoad(JavaVM* vm, __attribute__((unused)) void* reserved) { hookExec(); installLinkerBugMitigation(); installEMUIIteratorMititgation(); - - pojav_environ->XRAndroidInstanceBinding = malloc(sizeof(XrInstanceCreateInfoAndroidKHR)); - pojav_environ->XRAndroidInstanceBinding->type = XR_TYPE_INSTANCE_CREATE_INFO_ANDROID_KHR; - pojav_environ->XRAndroidInstanceBinding->applicationVM = (void*) pojav_environ->dalvikJavaVMPtr; - pojav_environ->XRAndroidInstanceBinding->applicationActivity = (void*) pojav_environ->activity; } if(pojav_environ->dalvikJavaVMPtr == vm) { diff --git a/src/main/jni/vloader.cpp b/src/main/jni/vloader.cpp index 8d80d27a..338c4aab 100644 --- a/src/main/jni/vloader.cpp +++ b/src/main/jni/vloader.cpp @@ -18,66 +18,79 @@ extern "C" JNIEXPORT jlong JNICALL -Java_org_vivecraft_util_VLoader_getEGLGlobal(JNIEnv* env, jclass clazz) { - if(pojav_environ->XRAndroidGLESBinding == nullptr) { - EGLConfig cfg; - EGLint num_configs; +Java_org_vivecraft_util_VLoader_getEGLDisplay(JNIEnv* env, jclass clazz) { + return reinterpret_cast(eglGetCurrentDisplay()); +} - static const EGLint attribs[] = { - EGL_RED_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_BLUE_SIZE, 8, - EGL_ALPHA_SIZE, 8, - // Minecraft required on initial 24 - EGL_DEPTH_SIZE, 24, - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT, - EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, - EGL_NONE - }; +extern "C" +JNIEXPORT jlong JNICALL +Java_org_vivecraft_util_VLoader_getEGLContext(JNIEnv* env, jclass clazz) { + return reinterpret_cast(eglGetCurrentContext()); +} - eglChooseConfig(eglGetCurrentDisplay(), attribs, &cfg, 1, &num_configs); - pojav_environ->XRAndroidGLESBinding = new XrGraphicsBindingOpenGLESAndroidKHR{ - XR_TYPE_GRAPHICS_BINDING_OPENGL_ES_ANDROID_KHR, - nullptr, - (void *) eglGetCurrentDisplay(), - (void *) cfg, - (void *) eglGetCurrentContext() - }; - } +extern "C" +JNIEXPORT jlong JNICALL +Java_org_vivecraft_util_VLoader_getEGLConfig(JNIEnv* env, jclass clazz) { + EGLConfig cfg; + EGLint num_configs; - return reinterpret_cast(pojav_environ->XRAndroidGLESBinding); + static const EGLint attribs[] = { + EGL_RED_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_BLUE_SIZE, 8, + EGL_ALPHA_SIZE, 8, + // Minecraft required on initial 24 + EGL_DEPTH_SIZE, 24, + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT, + EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, + EGL_NONE + }; + + eglChooseConfig(eglGetCurrentDisplay(), attribs, &cfg, 1, &num_configs); + return reinterpret_cast(cfg); } extern "C" -JNIEXPORT jlong JNICALL -Java_org_vivecraft_util_VLoader_getAndroidCreateInfo(JNIEnv* env, jclass clazz) { +JNIEXPORT void JNICALL +Java_org_vivecraft_util_VLoader_initOpenXRLoader(JNIEnv* env, jclass clazz) { PFN_xrInitializeLoaderKHR initializeLoader = nullptr; XrResult res; res = xrGetInstanceProcAddr(XR_NULL_HANDLE, "xrInitializeLoaderKHR", (PFN_xrVoidFunction *) (&initializeLoader)); - if(!XR_SUCCEEDED(res)) { + if (!XR_SUCCEEDED(res)) { printf("xrGetInstanceProcAddr returned %d.\n", res); } XrLoaderInitInfoAndroidKHR loaderInitInfoAndroidKhr = { XR_TYPE_LOADER_INIT_INFO_ANDROID_KHR, nullptr, - (void*) pojav_environ->dalvikJavaVMPtr, - (void*) pojav_environ->activity + (void *) pojav_environ->dalvikJavaVMPtr, + (void *) pojav_environ->activity }; res = initializeLoader((const XrLoaderInitInfoBaseHeaderKHR *) &loaderInitInfoAndroidKhr); - if(!XR_SUCCEEDED(res)) { + if (!XR_SUCCEEDED(res)) { printf("xrInitializeLoaderKHR returned %d.\n", res); } - JNIEnv* newEnv; + JNIEnv *newEnv; pojav_environ->dalvikJavaVMPtr->AttachCurrentThread(&newEnv, NULL); +} - return reinterpret_cast(pojav_environ->XRAndroidInstanceBinding); +extern "C" +JNIEXPORT jlong JNICALL +Java_org_vivecraft_util_VLoader_getDalvikVM(JNIEnv* env, jclass clazz) { + return reinterpret_cast(pojav_environ->dalvikJavaVMPtr); } + +extern "C" +JNIEXPORT jlong JNICALL +Java_org_vivecraft_util_VLoader_getDalvikActivity(JNIEnv* env, jclass clazz) { + return reinterpret_cast(pojav_environ->activity); +} + extern "C" JNIEXPORT void JNICALL Java_pojlib_util_VLoader_setAndroidInitInfo(JNIEnv *env, jclass clazz, jobject ctx) {