diff options
Diffstat (limited to 'src/android/app/src/main/java/org/yuzu/yuzu_emu/model/EmulationViewModel.kt')
-rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/model/EmulationViewModel.kt | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/EmulationViewModel.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/EmulationViewModel.kt index b66f47fe7..d024493cd 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/EmulationViewModel.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/EmulationViewModel.kt @@ -15,6 +15,12 @@ class EmulationViewModel : ViewModel() { val isEmulationStopping: StateFlow<Boolean> get() = _isEmulationStopping private val _isEmulationStopping = MutableStateFlow(false) + private val _emulationStopped = MutableStateFlow(false) + val emulationStopped = _emulationStopped.asStateFlow() + + private val _programChanged = MutableStateFlow(-1) + val programChanged = _programChanged.asStateFlow() + val shaderProgress: StateFlow<Int> get() = _shaderProgress private val _shaderProgress = MutableStateFlow(0) @@ -35,6 +41,17 @@ class EmulationViewModel : ViewModel() { _isEmulationStopping.value = value } + fun setEmulationStopped(value: Boolean) { + if (value) { + _emulationStarted.value = false + } + _emulationStopped.value = value + } + + fun setProgramChanged(programIndex: Int) { + _programChanged.value = programIndex + } + fun setShaderProgress(progress: Int) { _shaderProgress.value = progress } @@ -56,20 +73,4 @@ class EmulationViewModel : ViewModel() { fun setDrawerOpen(value: Boolean) { _drawerOpen.value = value } - - fun clear() { - setEmulationStarted(false) - setIsEmulationStopping(false) - setShaderProgress(0) - setTotalShaders(0) - setShaderMessage("") - } - - companion object { - const val KEY_EMULATION_STARTED = "EmulationStarted" - const val KEY_IS_EMULATION_STOPPING = "IsEmulationStarting" - const val KEY_SHADER_PROGRESS = "ShaderProgress" - const val KEY_TOTAL_SHADERS = "TotalShaders" - const val KEY_SHADER_MESSAGE = "ShaderMessage" - } } |