Start a launcher-run game without scanning its folder and keep Play on Starting until it launches (#2586)

* Start a launcher-run game without scanning its folder and keep Play on Starting until it launches

* Create the shared added-games cache under one lock

* Read a rewritten game manifest again instead of reusing the saved ranking

* Tie a saved ranking to the declared executables that exist
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-11-13 18:47:15 -05:00
1 parent 6d1a0d9fd0
commit b3ebd54d87
6 files changed
+83 -23

No files matched your search

@@ -111,6 +111,38 @@ class AddedGamesCacheTest {
assertEquals("Bastion", AddedGamesCache(file).name("named"))
}
@Test fun aRewrittenManifestIsReadAgain() {
val folder = tmp.newFolder("Game")
val first = File(folder, "First.exe").apply { writeText("first") }
val second = File(folder, "Second.exe").apply { writeText("second") }
val manifest = File(folder, "MicrosoftGame.config").apply { writeText("<Executable Name=\"First.exe\"/>") }
val files = tmp.newFolder("files")
val context = object : android.content.ContextWrapper(app) {
override fun getFilesDir() = files
}
AddedGames.scan(context)
assertEquals(first, AddedGames.rank(folder).exes.first())
val modified = folder.lastModified()
manifest.writeText("<Executable Name=\"Second.exe\"/>")
folder.setLastModified(modified)
assertEquals(second, AddedGames.rank(folder, reuse = true).exes.first())
}
@Test fun aDeclaredExecutableThatArrivesLaterIsPicked() {
val folder = tmp.newFolder("Game")
val guessed = File(folder, "Game.exe").apply { writeText("game") }
val inner = File(folder, "Content").apply { mkdirs() }
File(folder, "MicrosoftGame.config").writeText("<Executable Name=\"Content\\Late.exe\"/>")
val files = tmp.newFolder("files")
val context = object : android.content.ContextWrapper(app) {
override fun getFilesDir() = files
}
AddedGames.scan(context)
assertEquals(guessed, AddedGames.rank(folder).exes.first())
val late = File(inner, "Late.exe").apply { writeText("late") }
assertEquals(late, AddedGames.rank(folder, reuse = true).exes.first())
}
@Test fun aRankingAScanReusedIsNotHandedToAFreshLookup() {
val folder = tmp.newFolder("Game")
val walked = File(folder, "Game.exe").apply { writeText("game") }
@@ -70,6 +70,13 @@ class NoSteamLaunchTest {
assertEquals(NoSteamLaunch.EPIC to listOf("run"), epic.program to epic.args)
}
@Test fun onlyAnAddedGameStartedFromItsOwnFilesHasItsFolderRead() {
assertTrue(NoSteamLaunch.needsAddedGame(shortcut))
assertFalse(NoSteamLaunch.needsAddedGame(Library.SteamGame(shortcut.appId, shortcut.name, null, Library.ADDED, source = com.droiddeck.launcher.stores.Store.BATTLENET.id)))
assertFalse(NoSteamLaunch.needsAddedGame(steamGame))
assertFalse(NoSteamLaunch.needsAddedGame(launcher))
}
@Test fun anAddedGameOwnedOnSteamUsesItsSteamIdForSettingsAndLaunch() {
val routed = AddedGames.Game(
File("/x/Stardew Valley"), "Stardew Valley", File("/x/Stardew Valley/Stardew Valley.exe"),