summaryrefslogtreecommitdiff
path: root/Source/Android/app/src/main/java
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2024-06-26 20:34:16 +0200
committerJosJuice <josjuice@gmail.com>2024-06-26 20:36:46 +0200
commitbc67fc97c39628c76a4dbca411b0e8a9bfaf726a (patch)
tree6b7cfcbf4ad79b125db6aa96c83a7d022b514c34 /Source/Android/app/src/main/java
parent3dbaf38eae8415f6ed8420ab36b49358c39cf3eb (diff)
Revert "Audit uses of IsRunning and GetState"
This reverts commit 72cf2bdb87f09deff22e1085de3290126aa4ad05. SYSCONF settings are getting cleared when they shouldn't be. Let's revert the change until I get proper time to figure out why it's broken.
Diffstat (limited to 'Source/Android/app/src/main/java')
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java10
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/Settings.kt2
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/RunRunnable.kt2
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SettingsItem.kt2
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt4
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.kt8
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.kt2
7 files changed, 12 insertions, 18 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 1cdd9fa473..43880bd0ba 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
@@ -381,15 +381,9 @@ public final class NativeLibrary
*/
public static native boolean IsRunning();
- /**
- * Returns true if emulation is running and not paused.
- */
- public static native boolean IsRunningAndUnpaused();
+ public static native boolean IsRunningAndStarted();
- /**
- * Returns true if emulation is fully shut down.
- */
- public static native boolean IsUninitialized();
+ public static native boolean IsRunningAndUnpaused();
/**
* Writes out the JitBlock Cache log dump
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/Settings.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/Settings.kt
index eedc1405ff..c5c1851e5d 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/Settings.kt
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/Settings.kt
@@ -36,7 +36,7 @@ class Settings : Closeable {
if (isGameSpecific) {
// Loading game INIs while the core is running will mess with the game INIs loaded by the core
- check(NativeLibrary.IsUninitialized()) { "Attempted to load game INI while emulating" }
+ check(!NativeLibrary.IsRunning()) { "Attempted to load game INI while emulating" }
NativeConfig.loadGameInis(gameId, revision)
}
}
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/RunRunnable.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/RunRunnable.kt
index c52964ff0b..f9d5786e22 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/RunRunnable.kt
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/RunRunnable.kt
@@ -20,5 +20,5 @@ class RunRunnable(
override val setting: AbstractSetting? = null
override val isEditable: Boolean
- get() = worksDuringEmulation || NativeLibrary.IsUninitialized()
+ get() = worksDuringEmulation || !NativeLibrary.IsRunning()
}
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SettingsItem.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SettingsItem.kt
index 01c4796e68..3209400ff6 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SettingsItem.kt
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/SettingsItem.kt
@@ -54,7 +54,7 @@ abstract class SettingsItem {
open val isEditable: Boolean
get() {
- if (NativeLibrary.IsUninitialized()) return true
+ if (!NativeLibrary.IsRunning()) return true
val setting = setting
return setting != null && setting.isRuntimeEditable
}
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt
index 1573b6408c..6de39ed1e9 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.kt
@@ -69,7 +69,7 @@ class SettingsFragmentPresenter(
} else if (
menuTag == MenuTag.GRAPHICS
&& this.gameId.isNullOrEmpty()
- && NativeLibrary.IsUninitialized()
+ && !NativeLibrary.IsRunning()
&& GpuDriverHelper.supportsCustomDriverLoading()
) {
this.gpuDriver =
@@ -1303,7 +1303,7 @@ class SettingsFragmentPresenter(
if (
this.gpuDriver != null && this.gameId.isNullOrEmpty()
- && NativeLibrary.IsUninitialized()
+ && !NativeLibrary.IsRunning()
&& GpuDriverHelper.supportsCustomDriverLoading()
) {
sl.add(
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.kt
index eeb223c3db..637f4fb924 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.kt
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.kt
@@ -180,11 +180,11 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
private fun run(isActivityRecreated: Boolean) {
if (isActivityRecreated) {
- if (NativeLibrary.IsUninitialized()) {
- loadPreviousTemporaryState = true
- } else {
+ if (NativeLibrary.IsRunning()) {
loadPreviousTemporaryState = false
deleteFile(temporaryStateFilePath)
+ } else {
+ loadPreviousTemporaryState = true
}
} else {
Log.debug("[EmulationFragment] activity resumed or fresh start")
@@ -203,7 +203,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
private fun runWithValidSurface() {
runWhenSurfaceIsValid = false
- if (NativeLibrary.IsUninitialized()) {
+ if (!NativeLibrary.IsRunning()) {
NativeLibrary.SetIsBooting()
val emulationThread = Thread({
if (loadPreviousTemporaryState) {
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.kt
index 7964cc1ebc..dfe557e712 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.kt
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.kt
@@ -83,7 +83,7 @@ class InputOverlay(context: Context?, attrs: AttributeSet?) : SurfaceView(contex
fun initTouchPointer() {
// Check if we have all the data we need yet
- val aspectRatioAvailable = NativeLibrary.IsRunning()
+ val aspectRatioAvailable = NativeLibrary.IsRunningAndStarted()
if (!aspectRatioAvailable || surfacePosition == null)
return