mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 13:26:02 +00:00
feat(xbox): install MSIXVC2 back-compat titles from their content boxes (#2851)
* feat(xbox): install MSIXVC2 packages from their encrypted content boxes * feat(xbox): run a package's custom install actions once per prefix * fix(xbox): launch the program a launcher menu names instead of the menu * fix(xbox): check free space before an MSIXVC2 install starts * fix(xbox): keep a forwarded launch path relative when the install folder is reached through a link * fix(xbox): rebuild the MSIXVC2 patch on the final legacy install * fix(xbox): keep a backup whose release fails, and test an interrupted restore * fix(xbox): verify resumed msixvc2 files, contain writes, decode install action arguments * fix(xbox): keep one completion record per msixvc2 file, never follow a linked install state * fix(xbox): drop a torn msixvc2 completion record before appending to it * fix(xbox): repair a torn msixvc2 record from its tail instead of rereading it
This commit is contained in:
1 parent
b43724e5f3
commit
6ed281f78d
8 files changed
+1464
-21
No files matched your search
@@ -102,8 +102,29 @@ internal object XboxManifest {
|
||||
file = matches.single()
|
||||
}
|
||||
require(file.canonicalPath.startsWith(folder.canonicalPath + File.separator))
|
||||
if (file.isFile) return file.relativeTo(folder).invariantSeparatorsPath
|
||||
if (file.isFile) return forwarded(folder, file) ?: file.relativeTo(folder).invariantSeparatorsPath
|
||||
}
|
||||
error("The Xbox package has no supported PC launch executable.")
|
||||
}
|
||||
|
||||
private fun forwarded(folder: File, launcher: File): String? = try {
|
||||
val arguments = File(launcher.parentFile, launcher.nameWithoutExtension + "LaunchArguments.txt")
|
||||
if (!arguments.isFile || arguments.length() > 65_536) null
|
||||
else arguments.readLines().firstNotNullOfOrNull { line ->
|
||||
line.trim().takeIf { it.startsWith("exe=", ignoreCase = true) }?.substring(4)?.trim()
|
||||
}?.takeIf { it.isNotEmpty() && !it.contains(':') }?.let { target -> located(folder.canonicalFile, launcher.parentFile.canonicalFile, target) }
|
||||
} catch (_: java.io.IOException) {
|
||||
null
|
||||
}
|
||||
|
||||
private fun located(root: File, start: File, target: String): String? {
|
||||
var file = start
|
||||
for (part in target.split('/', '\\').filter { it.isNotEmpty() && it != "." }) {
|
||||
file = if (part == "..") file.parentFile ?: return null
|
||||
else file.listFiles().orEmpty().filter { it.name.equals(part, true) }.singleOrNull() ?: return null
|
||||
}
|
||||
val resolved = file.canonicalFile
|
||||
if (!resolved.isFile || !resolved.path.startsWith(root.path + File.separator) || !resolved.extension.equals("exe", true)) return null
|
||||
return resolved.relativeTo(root).invariantSeparatorsPath
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user