Better error checking

This commit is contained in:
Simon 2020-04-25 15:37:26 +01:00
parent 755762da33
commit 89a9f9bbc4
3 changed files with 15 additions and 9 deletions

View File

@ -159,7 +159,8 @@ LAMBDA1VR Stuff
//This is now controlled by the engine
static bool useVirtualScreen = true;
static bool hasIWADsAndLauncher = false;
static bool hasIWADs = false;
static bool hasLauncher = false;
void QzDoom_setUseScreenLayer(bool use)
{
@ -1475,11 +1476,15 @@ void * AppThreadFunction(void * parm ) {
showLoadingIcon();
}
if (hasIWADsAndLauncher) {
if (hasIWADs && hasLauncher) {
//Should now be all set up and ready - start the Doom main loop
VR_DoomMain(argc, argv);
} else {
vrapi_ShowFatalError(&gAppState.Java, "Missing Launcher", "Please install Baggyg's Launcher to start QuestZDoom correctly", "", 666);
if (!hasLauncher) {
vrapi_ShowFatalError(&gAppState.Java, "Missing Launcher",
"Please install Baggyg's Launcher to start QuestZDoom correctly",
"QuestZDoom", 666);
}
}
//We are done, shutdown cleanly
@ -1750,7 +1755,7 @@ int JNI_OnLoad(JavaVM* vm, void* reserved)
}
JNIEXPORT jlong JNICALL Java_com_drbeef_questzdoom_GLES3JNILib_onCreate( JNIEnv * env, jclass activityClass, jobject activity,
jstring commandLineParams, jboolean jHasIWADs)
jstring commandLineParams, jboolean jHasIWADs, jboolean jHasLauncher)
{
ALOGV( " GLES3JNILib::onCreate()" );
@ -1767,7 +1772,8 @@ JNIEXPORT jlong JNICALL Java_com_drbeef_questzdoom_GLES3JNILib_onCreate( JNIEnv
jboolean iscopy;
const char *arg = (*env)->GetStringUTFChars(env, commandLineParams, &iscopy);
hasIWADsAndLauncher = jHasIWADs != 0;
hasIWADs = jHasIWADs != 0;
hasLauncher = jHasLauncher != 0;
char *cmdLine = NULL;
if (arg && strlen(arg))

View File

@ -195,9 +195,9 @@ import android.support.v4.content.ContextCompat;
//If there are no IWADS, then should exit after creating the folders
//to allow the launcher app to do its thing, otherwise it would crash anyway
//Check that launcher is installed too
boolean hasIWADsAndLauncher = ((new File("/sdcard/QuestZDoom/wads").listFiles().length) > 0) &&
isPackageInstalled("com.Baggyg.QuestZDoom_Launcher", this.getPackageManager());
mNativeHandle = GLES3JNILib.onCreate( this, commandLineParams, hasIWADsAndLauncher);
boolean hasIWADs = ((new File("/sdcard/QuestZDoom/wads").listFiles().length) > 0);
boolean hasLauncher = isPackageInstalled("com.Baggyg.QuestZDoom_Launcher", this.getPackageManager());
mNativeHandle = GLES3JNILib.onCreate( this, commandLineParams, hasIWADs, hasLauncher );
}
public void copy_asset(String path, String name, boolean force) {

View File

@ -9,7 +9,7 @@ import android.view.Surface;
public class GLES3JNILib
{
// Activity lifecycle
public static native long onCreate( Activity obj, String commandLineParams, boolean hasIWADs );
public static native long onCreate( Activity obj, String commandLineParams, boolean hasIWADs, boolean hasLauncher );
public static native void onStart( long handle, Object obj );
public static native void onResume( long handle );
public static native void onPause( long handle );