Skip to content

Commit

Permalink
Revert "Change vloader path"
Browse files Browse the repository at this point in the history
This reverts commit ab016d3.
  • Loading branch information
The Judge committed Dec 18, 2024
1 parent ab016d3 commit e5071de
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/main/jni/libopenxr_loader.so
Git LFS file not shown
46 changes: 34 additions & 12 deletions src/main/jni/vloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@

extern "C"
JNIEXPORT jlong JNICALL
Java_org_digitalgenesis_VLoader_getEGLDisplay(JNIEnv* env, jclass clazz) {
Java_org_vivecraft_util_VLoader_getEGLDisplay(JNIEnv* env, jclass clazz) {
return reinterpret_cast<jlong>(eglGetCurrentDisplay());
}

extern "C"
JNIEXPORT jlong JNICALL
Java_org_digitalgenesis_VLoader_getEGLContext(JNIEnv* env, jclass clazz) {
Java_org_vivecraft_util_VLoader_getEGLContext(JNIEnv* env, jclass clazz) {
return reinterpret_cast<jlong>(eglGetCurrentContext());
}

extern "C"
JNIEXPORT jlong JNICALL
Java_org_digitalgenesis_VLoader_getEGLConfig(JNIEnv* env, jclass clazz) {
Java_org_vivecraft_util_VLoader_getEGLConfig(JNIEnv* env, jclass clazz) {
EGLConfig cfg;
EGLint num_configs;

Expand All @@ -51,22 +51,44 @@ Java_org_digitalgenesis_VLoader_getEGLConfig(JNIEnv* env, jclass clazz) {
}

extern "C"
JNIEXPORT jlong JNICALL
Java_org_digitalgenesis_VLoader_getDalvikVM(JNIEnv* env, jclass clazz) {
return reinterpret_cast<jlong>(pojav_environ->dalvikJavaVMPtr);
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)) {
printf("xrGetInstanceProcAddr returned %d.\n", res);
}

XrLoaderInitInfoAndroidKHR loaderInitInfoAndroidKhr = {
XR_TYPE_LOADER_INIT_INFO_ANDROID_KHR,
nullptr,
(void *) pojav_environ->dalvikJavaVMPtr,
(void *) pojav_environ->activity
};

res = initializeLoader((const XrLoaderInitInfoBaseHeaderKHR *) &loaderInitInfoAndroidKhr);
if (!XR_SUCCEEDED(res)) {
printf("xrInitializeLoaderKHR returned %d.\n", res);
}

JNIEnv *newEnv;
pojav_environ->dalvikJavaVMPtr->AttachCurrentThread(&newEnv, NULL);
}

extern "C"
JNIEXPORT jlong JNICALL
Java_org_digitalgenesis_VLoader_getDalvikActivity(JNIEnv* env, jclass clazz) {
return reinterpret_cast<jlong>(pojav_environ->activity);
Java_org_vivecraft_util_VLoader_getDalvikVM(JNIEnv* env, jclass clazz) {
return reinterpret_cast<jlong>(pojav_environ->dalvikJavaVMPtr);
}

extern "C"
JNIEXPORT void JNICALL
Java_org_digitalgenesis_VLoader_setupAndroid(JNIEnv* env, jclass clazz) {
JNIEnv *newEnv;
pojav_environ->dalvikJavaVMPtr->AttachCurrentThread(&newEnv, NULL);
JNIEXPORT jlong JNICALL
Java_org_vivecraft_util_VLoader_getDalvikActivity(JNIEnv* env, jclass clazz) {
return reinterpret_cast<jlong>(pojav_environ->activity);
}

extern "C"
Expand Down

0 comments on commit e5071de

Please sign in to comment.