mirror of
https://github.com/azahar-emu/azahar.git
synced 2026-06-06 02:33:44 -04:00
android: Fixed games located in an application directory not being accessible
This commit is contained in:
parent
7ad6621f91
commit
e878174df8
2 changed files with 19 additions and 2 deletions
|
|
@ -698,6 +698,11 @@ object NativeLibrary {
|
||||||
|
|
||||||
val dirSep = "/"
|
val dirSep = "/"
|
||||||
|
|
||||||
|
val uriString = uri.toString()
|
||||||
|
if (!uriString.contains(":")) { // These raw URIs happen when generating the game list. Why?
|
||||||
|
return uriString
|
||||||
|
}
|
||||||
|
|
||||||
val pathSegment = uri.lastPathSegment ?: return ""
|
val pathSegment = uri.lastPathSegment ?: return ""
|
||||||
val virtualPath = pathSegment.substringAfter(":")
|
val virtualPath = pathSegment.substringAfter(":")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,15 @@ object GameHelper {
|
||||||
|
|
||||||
fun getGame(uri: Uri, isInstalled: Boolean, addedToLibrary: Boolean): Game {
|
fun getGame(uri: Uri, isInstalled: Boolean, addedToLibrary: Boolean): Game {
|
||||||
val filePath = uri.toString()
|
val filePath = uri.toString()
|
||||||
var gameInfo: GameInfo? = GameInfo(filePath)
|
var nativePath: String? = null
|
||||||
|
var gameInfo: GameInfo?
|
||||||
|
if (BuildUtil.isGooglePlayBuild || FileUtil.isNativePath(filePath)) {
|
||||||
|
gameInfo = GameInfo(filePath)
|
||||||
|
} else {
|
||||||
|
nativePath = "!" + NativeLibrary.getNativePath(uri);
|
||||||
|
gameInfo = GameInfo(nativePath)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (gameInfo?.isValid() == false) {
|
if (gameInfo?.isValid() == false) {
|
||||||
gameInfo = null
|
gameInfo = null
|
||||||
|
|
@ -81,7 +89,11 @@ object GameHelper {
|
||||||
val newGame = Game(
|
val newGame = Game(
|
||||||
(gameInfo?.getTitle() ?: FileUtil.getFilename(uri)).replace("[\\t\\n\\r]+".toRegex(), " "),
|
(gameInfo?.getTitle() ?: FileUtil.getFilename(uri)).replace("[\\t\\n\\r]+".toRegex(), " "),
|
||||||
filePath.replace("\n", " "),
|
filePath.replace("\n", " "),
|
||||||
filePath,
|
if (BuildUtil.isGooglePlayBuild || FileUtil.isNativePath(filePath)) {
|
||||||
|
filePath
|
||||||
|
} else {
|
||||||
|
nativePath!!
|
||||||
|
},
|
||||||
gameInfo?.getTitleID() ?: 0,
|
gameInfo?.getTitleID() ?: 0,
|
||||||
gameInfo?.getCompany() ?: "",
|
gameInfo?.getCompany() ?: "",
|
||||||
if (isEncrypted) { CitraApplication.appContext.getString(R.string.unsupported_encrypted) } else { gameInfo?.getRegions() ?: "" },
|
if (isEncrypted) { CitraApplication.appContext.getString(R.string.unsupported_encrypted) } else { gameInfo?.getRegions() ?: "" },
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue