Launch the executable a Store package declares (#400)

Store and GDK folders name their game in MicrosoftGame.config or
appxmanifest.xml. Picking the top-level Unreal bootstrap instead failed
with "CreateProcess() returned 2" when the Store had renamed the
shipping exe.

Co-authored-by: xXJsonDeruloXx <danielhimebauch@gmail.com>
This commit is contained in:
MaxsTechReviewandxXJsonDeruloXx authored and GitHub committed 2026-10-10 13:46:03 -04:00
1 parent e8821f4efc
commit eb94916eb1
2 files changed
+73 -6

No files matched your search

@@ -27,4 +27,45 @@ class AddedGamesScanTest {
SessionPrefs.setAddedGamesDirs(app, listOf(games.path))
assertEquals(listOf("Example"), AddedGames.scan(app).map { it.name })
}
@Test fun aStorePackageLaunchesTheExecutableItDeclares() {
val game = tmp.newFolder("Minecraft Dungeons")
File(game, "Dungeons.exe").writeText("unreal bootstrap")
File(game, "Dungeons/Binaries/Win64").mkdirs()
File(game, "Dungeons/Binaries/Win64/Dungeons.exe").writeText("the game, renamed from Dungeons-Win64-Shipping.exe")
File(game, "MicrosoftGame.config").writeText(
"<Game><ExecutableList>\n <Executable Name=\"Dungeons\\Binaries\\Win64\\Dungeons.exe\"\n\n Id=\"Game\" />\n</ExecutableList></Game>",
)
assertEquals(File(game, "Dungeons/Binaries/Win64/Dungeons.exe").path, AddedGames.candidates(game).first().path)
assertEquals(2, AddedGames.candidates(game).size)
}
@Test fun anAppxManifestNamesTheGameWhenThereIsNoConfig() {
val game = tmp.newFolder("Store Game")
File(game, "Launcher.exe").writeText("bootstrap")
File(game, "Game/Binaries/Win64").mkdirs()
File(game, "Game/Binaries/Win64/Game.exe").writeText("game")
File(game, "appxmanifest.xml").writeText("<Package><Applications><Application Id=\"Game\" Executable=\"Game\\Binaries\\Win64\\Game.exe\" /></Applications></Package>")
assertEquals(File(game, "Game/Binaries/Win64/Game.exe").path, AddedGames.candidates(game).first().path)
}
@Test fun aDeclaredTopLevelExecutableKeepsItsPlace() {
val game = tmp.newFolder("Minecraft Dungeons II")
File(game, "Dungeons.exe").writeText("bootstrap")
File(game, "Other.exe").writeText("a much longer other executable")
File(game, "MicrosoftGame.config").writeText("<Executable Name=\"Dungeons.exe\" Id=\"App\" />")
assertEquals(listOf("Dungeons.exe", "Other.exe"), AddedGames.candidates(game).map { it.name })
}
@Test fun declaredHelpersMissingFilesAndPathsOutsideTheFolderAreIgnored() {
val game = tmp.newFolder("Pass Game")
File(game, "PassGame.exe").writeText("game")
File(game, "gamelaunchhelper.exe").writeText("needs gaming services")
tmp.newFile("Outside.exe").writeText("not this game")
File(game, "MicrosoftGame.config").writeText(
"<Executable Name=\"gamelaunchhelper.exe\" /><Executable Name=\"Missing.exe\" /><Executable Name=\"..\\Outside.exe\" />",
)
assertEquals(emptyList<File>(), AddedGames.declaredExes(game))
assertEquals(listOf("PassGame.exe"), AddedGames.candidates(game).map { it.name })
}
}