summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharles Lombardo <clombardo169@gmail.com>2023-05-11 22:57:13 +0200
committerbunnei <bunneidev@gmail.com>2023-06-03 09:06:01 +0200
commitbafd4d344f455c4f4a790a73766b9beaecd6a2f0 (patch)
tree4144c29cd4ec10a7241e5bb601d90bad6dde2232
parentandroid: Invert rotation to match phone orientation (diff)
downloadyuzu-bafd4d344f455c4f4a790a73766b9beaecd6a2f0.tar
yuzu-bafd4d344f455c4f4a790a73766b9beaecd6a2f0.tar.gz
yuzu-bafd4d344f455c4f4a790a73766b9beaecd6a2f0.tar.bz2
yuzu-bafd4d344f455c4f4a790a73766b9beaecd6a2f0.tar.lz
yuzu-bafd4d344f455c4f4a790a73766b9beaecd6a2f0.tar.xz
yuzu-bafd4d344f455c4f4a790a73766b9beaecd6a2f0.tar.zst
yuzu-bafd4d344f455c4f4a790a73766b9beaecd6a2f0.zip
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/model/GamesViewModel.kt10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/GamesViewModel.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/GamesViewModel.kt
index 5a35b14c9..d4de7a09a 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/GamesViewModel.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/GamesViewModel.kt
@@ -3,6 +3,8 @@
package org.yuzu.yuzu_emu.model
+import android.net.Uri
+import androidx.documentfile.provider.DocumentFile
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
@@ -44,7 +46,13 @@ class GamesViewModel : ViewModel() {
if (storedGames!!.isNotEmpty()) {
val deserializedGames = mutableSetOf<Game>()
storedGames.forEach {
- deserializedGames.add(Json.decodeFromString(it))
+ val game: Game = Json.decodeFromString(it)
+ val gameExists =
+ DocumentFile.fromSingleUri(YuzuApplication.appContext, Uri.parse(game.path))
+ ?.exists()
+ if (gameExists == true) {
+ deserializedGames.add(game)
+ }
}
setGames(deserializedGames.toList())
}