mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-21 13:55:58 +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
@@ -16,6 +16,46 @@ class XboxManifestTest {
|
||||
java.io.File(root, "MicrosoftGame.Config").writeText("<Game><ExecutableList><Executable Name=\"bin\\GAME.EXE\" TargetDeviceFamily=\"PC\"/></ExecutableList></Game>")
|
||||
assertEquals("Bin/Game.exe", XboxInstaller.executable(root))
|
||||
}
|
||||
@Test fun aLauncherMenuIsSkippedForTheProgramItNames() {
|
||||
val root = temporary.newFolder()
|
||||
java.io.File(root, "EmuMenu").mkdir()
|
||||
java.io.File(root, "EmuMenu/EmuMenu.exe").writeText("menu")
|
||||
java.io.File(root, "Emu.exe").writeText("emulator")
|
||||
java.io.File(root, "MicrosoftGame.config").writeText("<Game><ExecutableList><Executable Name=\"EmuMenu\\EmuMenu.exe\"/></ExecutableList></Game>")
|
||||
java.io.File(root, "EmuMenu/EmuMenuLaunchArguments.txt").writeText("exe=..\\Emu.exe\r\ntitlename=Game\r\n")
|
||||
assertEquals("Emu.exe", XboxInstaller.executable(root))
|
||||
java.io.File(root, "EmuMenu/EmuMenuLaunchArguments.txt").writeText("exe=..\\..\\outside.exe\r\n")
|
||||
assertEquals("EmuMenu/EmuMenu.exe", XboxInstaller.executable(root))
|
||||
java.io.File(root, "EmuMenu/EmuMenuLaunchArguments.txt").writeText("titlename=Game\r\n")
|
||||
assertEquals("EmuMenu/EmuMenu.exe", XboxInstaller.executable(root))
|
||||
java.io.File(root, "EmuMenu/EmuMenuLaunchArguments.txt").writeText("exe=..\\EMU.EXE\r\n")
|
||||
assertEquals("Emu.exe", XboxInstaller.executable(root))
|
||||
java.io.File(root, "emu.exe").writeText("other")
|
||||
if (root.listFiles().orEmpty().count { it.name.equals("emu.exe", true) } == 2)
|
||||
assertEquals("EmuMenu/EmuMenu.exe", XboxInstaller.executable(root))
|
||||
}
|
||||
@Test fun anUnreadableForwardingFileFallsBackToTheDeclaredProgram() {
|
||||
val root = temporary.newFolder()
|
||||
java.io.File(root, "EmuMenu").mkdir()
|
||||
java.io.File(root, "EmuMenu/EmuMenu.exe").writeText("menu")
|
||||
java.io.File(root, "Emu.exe").writeText("emulator")
|
||||
java.io.File(root, "MicrosoftGame.config").writeText("<Game><ExecutableList><Executable Name=\"EmuMenu\\EmuMenu.exe\"/></ExecutableList></Game>")
|
||||
val arguments = java.io.File(root, "EmuMenu/EmuMenuLaunchArguments.txt").apply { writeText("exe=..\\Emu.exe\r\n") }
|
||||
org.junit.Assume.assumeTrue(arguments.setReadable(false, false) && !arguments.canRead())
|
||||
try { assertEquals("EmuMenu/EmuMenu.exe", XboxInstaller.executable(root)) } finally { arguments.setReadable(true, false) }
|
||||
}
|
||||
@Test fun aForwardedProgramStaysRelativeWhenTheFolderIsReachedThroughALink() {
|
||||
val real = temporary.newFolder()
|
||||
java.io.File(real, "EmuMenu").mkdir()
|
||||
java.io.File(real, "EmuMenu/EmuMenu.exe").writeText("menu")
|
||||
java.io.File(real, "Emu.exe").writeText("emulator")
|
||||
java.io.File(real, "MicrosoftGame.config").writeText("<Game><ExecutableList><Executable Name=\"EmuMenu\\EmuMenu.exe\"/></ExecutableList></Game>")
|
||||
java.io.File(real, "EmuMenu/EmuMenuLaunchArguments.txt").writeText("exe=..\\Emu.exe\r\n")
|
||||
val link = java.io.File(temporary.root, "linked")
|
||||
val linked = runCatching { java.nio.file.Files.createSymbolicLink(link.toPath(), real.toPath()) }.isSuccess
|
||||
org.junit.Assume.assumeTrue(linked)
|
||||
assertEquals("Emu.exe", XboxInstaller.executable(link))
|
||||
}
|
||||
@Test fun rejectsTraversalAndExternalEntities() {
|
||||
for (xml in listOf("<Game><Executable Name=\"../escape.exe\"/></Game>",
|
||||
"<!DOCTYPE Game [<!ENTITY external SYSTEM 'file:///etc/passwd'>]><Game>&external;</Game>",
|
||||
|
||||
Reference in new issue
Block a user