diff options
Diffstat (limited to 'Source/Android/app/src/main/java')
3 files changed, 7 insertions, 20 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java index 9e7c9bb208..0c35a35da0 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java @@ -403,15 +403,13 @@ public final class NativeLibrary */ public static native void StopEmulation(); - public static native boolean IsBooting(); - - public static native void WaitUntilDoneBooting(); - /** * Returns true if emulation is running (or is paused). */ public static native boolean IsRunning(); + public static native boolean IsRunningAndStarted(); + /** * Enables or disables CPU block profiling * @@ -487,7 +485,7 @@ public final class NativeLibrary private static native String GetCurrentTitleDescriptionUnchecked(); public static boolean displayAlertMsg(final String caption, final String text, - final boolean yesNo, final boolean isWarning) + final boolean yesNo, final boolean isWarning, final boolean nonBlocking) { Log.error("[NativeLibrary] Alert: " + text); final EmulationActivity emulationActivity = sEmulationActivity.get(); @@ -498,10 +496,9 @@ public final class NativeLibrary } else { - // AlertMessages while the core is booting will deadlock if WaitUntilDoneBooting is called. - // We also can't use AlertMessages unless we have a non-null activity reference. - // As a fallback, we use toasts instead. - if (emulationActivity == null || IsBooting()) + // We can't use AlertMessages unless we have a non-null activity reference + // and are allowed to block. As a fallback, we can use toasts. + if (emulationActivity == null || nonBlocking) { new Handler(Looper.getMainLooper()).post( () -> Toast.makeText(DolphinApplication.getAppContext(), text, Toast.LENGTH_LONG) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java index 4cdb0051e5..cfcd28ea02 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java @@ -330,16 +330,6 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C mSurface = null; Log.debug("[EmulationFragment] Surface destroyed."); - if (state != State.STOPPED && !NativeLibrary.IsShowingAlertMessage()) - { - // In order to avoid dereferencing nullptr, we must not destroy the surface while booting - // the core, so wait here if necessary. An easy (but not 100% consistent) way to reach - // this method while the core is booting is by having landscape orientation lock enabled - // and starting emulation while the phone is in portrait mode, leading to the activity - // being recreated very soon after NativeLibrary.Run has been called. - NativeLibrary.WaitUntilDoneBooting(); - } - NativeLibrary.SurfaceDestroyed(); } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java index fe37981ab5..e9abd1a05b 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java @@ -148,7 +148,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener public void initTouchPointer() { // Check if we have all the data we need yet - boolean aspectRatioAvailable = NativeLibrary.IsRunning() && !NativeLibrary.IsBooting(); + boolean aspectRatioAvailable = NativeLibrary.IsRunningAndStarted(); if (!aspectRatioAvailable || mSurfacePosition == null) return; |
