diff options
| author | JosJuice <josjuice@gmail.com> | 2020-11-06 19:26:56 +0100 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2020-11-09 10:33:52 +0100 |
| commit | 0280f3557c703beb4c14df7aab543349bfc001ea (patch) | |
| tree | 8a718753ffab7093de9c9d76498afbc990504448 /Source/Android/jni/MainAndroid.cpp | |
| parent | a9ef7e0e436795d1ef842aae7433c6173f623f90 (diff) | |
Android: Finish EmulationActivity from C++
This makes EmulationActivity automatically close if booting
fails, and lets us get rid of s_emulation_end_event.
Diffstat (limited to 'Source/Android/jni/MainAndroid.cpp')
| -rw-r--r-- | Source/Android/jni/MainAndroid.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/Source/Android/jni/MainAndroid.cpp b/Source/Android/jni/MainAndroid.cpp index 4079f947dc..f852d61590 100644 --- a/Source/Android/jni/MainAndroid.cpp +++ b/Source/Android/jni/MainAndroid.cpp @@ -77,7 +77,6 @@ ANativeWindow* s_surf; // sequentially for access. std::mutex s_host_identity_lock; Common::Event s_update_main_frame_event; -Common::Event s_emulation_end_event; bool s_have_wm_user_stop = false; bool s_game_metadata_is_valid = false; } // Anonymous namespace @@ -210,17 +209,11 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_PauseEmulati JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_StopEmulation(JNIEnv*, jclass) { - { - std::lock_guard<std::mutex> guard(s_host_identity_lock); - s_emulation_end_event.Reset(); - Core::Stop(); - - // Kick the waiting event - s_update_main_frame_event.Set(); - } + std::lock_guard<std::mutex> guard(s_host_identity_lock); + Core::Stop(); - // Wait for shutdown, to avoid accessing the config at the same time as the shutdown code - s_emulation_end_event.Wait(); + // Kick the waiting event + s_update_main_frame_event.Set(); } JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_IsBooting(JNIEnv*, jclass) @@ -533,7 +526,8 @@ static void Run(JNIEnv* env, const std::vector<std::string>& paths, s_surf = nullptr; } - s_emulation_end_event.Set(); + env->CallStaticVoidMethod(IDCache::GetNativeLibraryClass(), + IDCache::GetFinishEmulationActivity()); } JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run___3Ljava_lang_String_2( |
