diff options
author | Charles Lombardo <clombardo169@gmail.com> | 2023-05-23 00:32:18 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2023-06-03 09:06:03 +0200 |
commit | 5dbf842a46a68de87471c3f8e265f284ebc2c362 (patch) | |
tree | 3a5bc0415ee8c9658dee42d443f7a906a6478e19 /src | |
parent | android: Clean up dependencies (diff) | |
download | yuzu-5dbf842a46a68de87471c3f8e265f284ebc2c362.tar yuzu-5dbf842a46a68de87471c3f8e265f284ebc2c362.tar.gz yuzu-5dbf842a46a68de87471c3f8e265f284ebc2c362.tar.bz2 yuzu-5dbf842a46a68de87471c3f8e265f284ebc2c362.tar.lz yuzu-5dbf842a46a68de87471c3f8e265f284ebc2c362.tar.xz yuzu-5dbf842a46a68de87471c3f8e265f284ebc2c362.tar.zst yuzu-5dbf842a46a68de87471c3f8e265f284ebc2c362.zip |
Diffstat (limited to '')
-rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt | 19 | ||||
-rw-r--r-- | src/android/app/src/main/res/values/strings.xml | 1 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt index a9653475f..7f9e2e2d4 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt @@ -3,15 +3,18 @@ package org.yuzu.yuzu_emu.adapters -import android.annotation.SuppressLint import android.graphics.Bitmap import android.graphics.BitmapFactory +import android.net.Uri import android.text.TextUtils import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.ImageView +import android.widget.Toast import androidx.appcompat.app.AppCompatActivity +import androidx.documentfile.provider.DocumentFile +import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.lifecycleScope import androidx.preference.PreferenceManager import androidx.recyclerview.widget.AsyncDifferConfig @@ -27,6 +30,7 @@ import org.yuzu.yuzu_emu.databinding.CardGameBinding import org.yuzu.yuzu_emu.activities.EmulationActivity import org.yuzu.yuzu_emu.model.Game import org.yuzu.yuzu_emu.adapters.GameAdapter.GameViewHolder +import org.yuzu.yuzu_emu.model.GamesViewModel class GameAdapter(private val activity: AppCompatActivity) : ListAdapter<Game, GameViewHolder>(AsyncDifferConfig.Builder(DiffCallback()).build()), @@ -53,6 +57,19 @@ class GameAdapter(private val activity: AppCompatActivity) : */ override fun onClick(view: View) { val holder = view.tag as GameViewHolder + + val gameExists = DocumentFile.fromSingleUri(YuzuApplication.appContext, Uri.parse(holder.game.path))?.exists() == true + if (!gameExists) { + Toast.makeText( + YuzuApplication.appContext, + R.string.loader_error_file_not_found, + Toast.LENGTH_LONG + ).show() + + ViewModelProvider(activity)[GamesViewModel::class.java].reloadGames(true) + return + } + val preferences = PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext) preferences.edit() .putLong( diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index e171cf799..03a5ffc7e 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -177,6 +177,7 @@ <string name="loader_error_video_core">An error occurred initializing the video core</string> <string name="loader_error_video_core_description">This is usually caused by an incompatible GPU driver. Installing a custom GPU driver may resolve this problem.</string> <string name="loader_error_invalid_format">Unable to load ROM</string> + <string name="loader_error_file_not_found">ROM file does not exist</string> <!-- Emulation Menu --> <string name="emulation_exit">Exit Emulation</string> |