mirror of
https://github.com/azahar-emu/azahar.git
synced 2026-06-06 02:33:44 -04:00
android: Fix long-press menu for games in app dir displaying no file error
This commit is contained in:
parent
30779d35cd
commit
0407568006
3 changed files with 24 additions and 5 deletions
|
|
@ -256,6 +256,8 @@ object NativeLibrary {
|
||||||
return uninstallTitle(titleId, mediaType.value)
|
return uninstallTitle(titleId, mediaType.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
external fun nativeFileExists(path: String): Boolean
|
||||||
|
|
||||||
private var coreErrorAlertResult = false
|
private var coreErrorAlertResult = false
|
||||||
private val coreErrorAlertLock = Object()
|
private val coreErrorAlertLock = Object()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,10 @@ import org.citra.citra_emu.databinding.DialogShortcutBinding
|
||||||
import org.citra.citra_emu.features.cheats.ui.CheatsFragmentDirections
|
import org.citra.citra_emu.features.cheats.ui.CheatsFragmentDirections
|
||||||
import org.citra.citra_emu.fragments.IndeterminateProgressDialogFragment
|
import org.citra.citra_emu.fragments.IndeterminateProgressDialogFragment
|
||||||
import org.citra.citra_emu.model.Game
|
import org.citra.citra_emu.model.Game
|
||||||
|
import org.citra.citra_emu.utils.BuildUtil
|
||||||
import org.citra.citra_emu.utils.FileUtil
|
import org.citra.citra_emu.utils.FileUtil
|
||||||
import org.citra.citra_emu.utils.GameIconUtils
|
import org.citra.citra_emu.utils.GameIconUtils
|
||||||
|
import org.citra.citra_emu.utils.Log
|
||||||
import org.citra.citra_emu.viewmodel.GamesViewModel
|
import org.citra.citra_emu.viewmodel.GamesViewModel
|
||||||
|
|
||||||
class GameAdapter(
|
class GameAdapter(
|
||||||
|
|
@ -153,12 +155,21 @@ class GameAdapter(
|
||||||
if (holder.game.isInstalled) {
|
if (holder.game.isInstalled) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
val path = holder.game.path
|
||||||
val gameExists = DocumentFile.fromSingleUri(
|
val pathUri = path.toUri()
|
||||||
CitraApplication.appContext,
|
var gameExists: Boolean
|
||||||
Uri.parse(holder.game.path)
|
if (BuildUtil.isGooglePlayBuild || FileUtil.isNativePath(path)) {
|
||||||
)?.exists() == true
|
gameExists =
|
||||||
|
DocumentFile.fromSingleUri(
|
||||||
|
CitraApplication.appContext,
|
||||||
|
pathUri
|
||||||
|
)?.exists() == true
|
||||||
|
} else {
|
||||||
|
val nativePath = NativeLibrary.getNativePath(pathUri)
|
||||||
|
gameExists = NativeLibrary.nativeFileExists(nativePath)
|
||||||
|
}
|
||||||
return if (!gameExists) {
|
return if (!gameExists) {
|
||||||
|
Log.error("[GameAdapter] ROM file does not exist: $path")
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
CitraApplication.appContext,
|
CitraApplication.appContext,
|
||||||
R.string.loader_error_file_not_found,
|
R.string.loader_error_file_not_found,
|
||||||
|
|
|
||||||
|
|
@ -1124,4 +1124,10 @@ jboolean Java_org_citra_citra_1emu_NativeLibrary_uninstallTitle(JNIEnv* env, job
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
jboolean Java_org_citra_citra_1emu_NativeLibrary_nativeFileExists(JNIEnv* env, jobject obj,
|
||||||
|
jstring j_path) {
|
||||||
|
const auto path = GetJString(env, j_path);
|
||||||
|
return FileUtil::Exists(path);
|
||||||
|
}
|
||||||
|
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue