build: fix build after openxr integration

BREAKING CHANGE:
Mobile SDK and the VrApi library have been replaced with OpenXR Mobile SDK
A new environment is required in order to build the game, check the website for more information
https://developer.oculus.com/documentation/native/android/mobile-openxr/
This commit is contained in:
Emanuele Disco 2022-12-29 00:00:14 +09:00
parent 8c179fad17
commit 201b3291d7
2 changed files with 34 additions and 0 deletions

View file

@ -10,6 +10,7 @@
#include <android/native_window_jni.h> // for native window JNI #include <android/native_window_jni.h> // for native window JNI
#include <android/input.h> #include <android/input.h>
#include "cmdlib.h"
#include "argtable3.h" #include "argtable3.h"
#include "VrInput.h" #include "VrInput.h"
@ -66,6 +67,8 @@ static bool useVirtualScreen = true;
static bool hasIWADs = false; static bool hasIWADs = false;
static bool hasLauncher = false; static bool hasLauncher = false;
extern const char* M_GetActiveProfile();
/* /*
================================================================================ ================================================================================
@ -413,6 +416,7 @@ Activity lifecycle
*/ */
jmethodID android_shutdown; jmethodID android_shutdown;
jmethodID android_reload;
static JavaVM *jVM; static JavaVM *jVM;
static jobject jniCallbackObj=0; static jobject jniCallbackObj=0;
@ -433,6 +437,28 @@ void VR_Shutdown()
jni_shutdown(); jni_shutdown();
} }
void jni_reload(const char* profile)
{
ALOGV("Calling: jni_reload");
JNIEnv *env;
jobject tmp;
if ((jVM->GetEnv((void**) &env, JNI_VERSION_1_4))<0)
{
jVM->AttachCurrentThread(&env, NULL);
}
jstring jprofile = env->NewStringUTF(profile);
return env->CallVoidMethod(jniCallbackObj, android_reload, jprofile);
}
void QzDoom_Restart()
{
const char* profile = M_GetActiveProfile();
//Ask Java to restart the app
jni_reload(profile);
}
jmethodID android_haptic_event; jmethodID android_haptic_event;
jmethodID android_haptic_stopevent; jmethodID android_haptic_stopevent;
jmethodID android_haptic_enable; jmethodID android_haptic_enable;
@ -584,6 +610,7 @@ JNIEXPORT void JNICALL Java_com_drbeef_questzdoom_GLES3JNILib_onStart( JNIEnv *
jclass callbackClass = env->GetObjectClass( jniCallbackObj); jclass callbackClass = env->GetObjectClass( jniCallbackObj);
android_shutdown = env->GetMethodID(callbackClass,"shutdown","()V"); android_shutdown = env->GetMethodID(callbackClass,"shutdown","()V");
android_reload = env->GetMethodID(callbackClass,"reload","(Ljava/lang/String;)V");
android_haptic_event = env->GetMethodID(callbackClass, "haptic_event", "(Ljava/lang/String;IIFF)V"); android_haptic_event = env->GetMethodID(callbackClass, "haptic_event", "(Ljava/lang/String;IIFF)V");
android_haptic_stopevent = env->GetMethodID(callbackClass, "haptic_stopevent", "(Ljava/lang/String;)V"); android_haptic_stopevent = env->GetMethodID(callbackClass, "haptic_stopevent", "(Ljava/lang/String;)V");
@ -721,4 +748,10 @@ JNIEXPORT void JNICALL Java_com_drbeef_questzdoom_GLES3JNILib_onSurfaceDestroyed
appThread->NativeWindow = NULL; appThread->NativeWindow = NULL;
} }
JNIEXPORT void JNICALL Java_com_drbeef_questzdoom_GLES3JNILib_prepareEnvironment(JNIEnv * env, jclass obj, jstring path) {
auto p = env->GetStringUTFChars(path, NULL);
progdir = p;
chdir(p);
}
} }

View file

@ -83,6 +83,7 @@ void QuatToYawPitchRoll(XrQuaternionf q, vec3_t rotation, vec3_t out);
//Called from engine code //Called from engine code
void QzDoom_setUseScreenLayer(bool use); void QzDoom_setUseScreenLayer(bool use);
void QzDoom_Restart();
void jni_shutdown(); void jni_shutdown();