Move emulation lifecycle handling into EmulationFragment.

The Activity is responsible for just its views and menus and such. It
signals the Fragment via setGamePath, StartEmulation and StopEmulation.

The Fragment manages the actual emulation lifecycle. It is solely
responsible for calling the NativeLibrary lifecycle methods.

With this lifecycle simplification, the NativeLibrary no longer needs to
kill the Activity. It happens normally now.

This simplifies a lot of things, live handling rotation.
This commit is contained in:
Mike Harris
2017-10-05 00:21:37 -07:00
parent d48c64457a
commit 4cab718065
6 changed files with 162 additions and 178 deletions

View File

@ -58,7 +58,6 @@ std::string s_set_userpath;
jclass s_jni_class;
jmethodID s_jni_method_alert;
jmethodID s_jni_method_end;
// The Core only supports using a single Host thread.
// If multiple threads want to call host functions then they need to queue
@ -732,7 +731,6 @@ Java_org_dolphinemu_dolphinemu_NativeLibrary_CacheClassesAndMethods(JNIEnv* env,
// Source/Android/app/build/intermediates/classes/arm/debug/org/dolphinemu/dolphinemu/NativeLibrary.class
s_jni_method_alert =
env->GetStaticMethodID(s_jni_class, "displayAlertMsg", "(Ljava/lang/String;)V");
s_jni_method_end = env->GetStaticMethodID(s_jni_class, "endEmulationActivity", "()V");
}
// Surface Handling
@ -816,9 +814,6 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv*
ANativeWindow_release(s_surf);
s_surf = nullptr;
}
// Execute the Java method.
env->CallStaticVoidMethod(s_jni_class, s_jni_method_end);
}
#ifdef __cplusplus