diff options
| author | JosJuice <josjuice@gmail.com> | 2020-09-16 09:49:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-16 09:49:16 +0200 |
| commit | a7b9e6857b6c4e172a4ec333a6c83d624092cdf3 (patch) | |
| tree | 9f583bee8836b7dad793b75c43309257c6b851d9 /Source/Android/jni/MainAndroid.cpp | |
| parent | e4e50691fbed68d207cfdc0570fc07a56259f040 (diff) | |
| parent | 744c0b13cff45ff799f5a584482fee3f77c9661c (diff) | |
Merge pull request #8975 from JosJuice/android-new-config
Android: Hook up the new config system
Diffstat (limited to 'Source/Android/jni/MainAndroid.cpp')
| -rw-r--r-- | Source/Android/jni/MainAndroid.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/Source/Android/jni/MainAndroid.cpp b/Source/Android/jni/MainAndroid.cpp index 0732987a9d..3dfafacf7c 100644 --- a/Source/Android/jni/MainAndroid.cpp +++ b/Source/Android/jni/MainAndroid.cpp @@ -74,6 +74,7 @@ IniFile s_ini; // 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; } // Anonymous namespace @@ -241,6 +242,9 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetCacheDire JNIEnv* env, jobject obj, jstring jDirectory); JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_DefaultCPUCore(JNIEnv* env, jobject obj); +JNIEXPORT jstring JNICALL +Java_org_dolphinemu_dolphinemu_NativeLibrary_GetDefaultGraphicsBackendName(JNIEnv* env, + jobject obj); JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetMaxLogLevel(JNIEnv* env, jobject obj); JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetProfiling(JNIEnv* env, @@ -279,9 +283,17 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_PauseEmulati JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_StopEmulation(JNIEnv* env, jobject obj) { - std::lock_guard<std::mutex> guard(s_host_identity_lock); - Core::Stop(); - s_update_main_frame_event.Set(); // Kick the waiting event + { + 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(); + } + + // Wait for shutdown, to avoid accessing the config at the same time as the shutdown code + s_emulation_end_event.Wait(); } JNIEXPORT void JNICALL @@ -425,6 +437,12 @@ JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_DefaultCPUCo return static_cast<jint>(PowerPC::DefaultCPUCore()); } +JNIEXPORT jstring JNICALL +Java_org_dolphinemu_dolphinemu_NativeLibrary_GetDefaultGraphicsBackendName(JNIEnv* env, jobject obj) +{ + return ToJString(env, VideoBackendBase::GetDefaultBackendName()); +} + JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetMaxLogLevel(JNIEnv* env, jobject obj) { @@ -589,6 +607,8 @@ static void Run(JNIEnv* env, const std::vector<std::string>& paths, ANativeWindow_release(s_surf); s_surf = nullptr; } + + s_emulation_end_event.Set(); } JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run___3Ljava_lang_String_2( |
