Revert "Audit uses of IsRunning and GetState"

This reverts commit 72cf2bdb87.

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.
This commit is contained in:
JosJuice
2024-06-26 20:34:16 +02:00
parent 3dbaf38eae
commit bc67fc97c3
32 changed files with 100 additions and 131 deletions

View File

@ -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

View File

@ -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)
}
}

View File

@ -20,5 +20,5 @@ class RunRunnable(
override val setting: AbstractSetting? = null
override val isEditable: Boolean
get() = worksDuringEmulation || NativeLibrary.IsUninitialized()
get() = worksDuringEmulation || !NativeLibrary.IsRunning()
}

View File

@ -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
}

View File

@ -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(

View File

@ -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) {

View File

@ -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