From 14cabd6bb9b69bab239f173875e7878f55002dff Mon Sep 17 00:00:00 2001 From: The412Banner <205237651+The412Banner@users.noreply.github.com> Date: Wed, 2 Dec 2026 07:08:22 +0000 Subject: [PATCH] fix(library): keep another program picked in a Steam game's folder listed --- .../com/droiddeck/launcher/frontend/Library.kt | 2 +- .../launcher/frontend/LibraryArchTest.kt | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/droiddeck/launcher/frontend/Library.kt b/app/src/main/java/com/droiddeck/launcher/frontend/Library.kt index 26c9c99813..ed55c65f50 100644 --- a/app/src/main/java/com/droiddeck/launcher/frontend/Library.kt +++ b/app/src/main/java/com/droiddeck/launcher/frontend/Library.kt @@ -243,7 +243,7 @@ object Library { if (runCatching { SteamGrid.sync(context, targets) }.getOrDefault(false)) steam = steamGames(context, strictRead, arch) val claimed = claimedFolders(steam) val own = list.filter { g -> - g.steamAppId != null || claimed.isEmpty() || + g.steamAppId != null || !g.steamProgram || claimed.isEmpty() || (runCatching { g.folder.canonicalPath }.getOrDefault(g.folder.absolutePath) !in claimed && AddedGames.guestPath(context, g.folder).let { it == null || it !in claimed }) } diff --git a/app/src/test/java/com/droiddeck/launcher/frontend/LibraryArchTest.kt b/app/src/test/java/com/droiddeck/launcher/frontend/LibraryArchTest.kt index 0b05b0e842..5d2f86b063 100644 --- a/app/src/test/java/com/droiddeck/launcher/frontend/LibraryArchTest.kt +++ b/app/src/test/java/com/droiddeck/launcher/frontend/LibraryArchTest.kt @@ -3,6 +3,7 @@ package com.droiddeck.launcher.frontend import com.droiddeck.launcher.session.SessionPrefs import java.io.File import org.junit.Assert.assertEquals +import org.junit.Assert.assertTrue import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @@ -49,4 +50,20 @@ class LibraryArchTest { val second = AddedGames.Game(other, "Other", File(other, "Other.exe"), "/g/Other.exe", "/g", 0x81234567L, (0x81234567L shl 32) or 0x02000000L, emptyList()) assertEquals(listOf("Example" to "internal", "Other" to Library.ADDED), Library.launchableGames(app, added = listOf(added, second), arch = "arm64").map { it.name to it.library }) } + + @Test fun anotherProgramPickedInASteamGamesFolderIsListedBesideTheSteamGame() { + SessionPrefs.setGameStorage(app, SessionPrefs.GAME_STORAGE_OFF, "") + SessionPrefs.setAddedGamesDirs(app, emptyList()) + SessionPrefs.setSteamClientArch(app, "arm64") + val apps = File(SessionPrefs.steamRoot(app, "arm64"), "steamapps").apply { mkdirs() } + val folder = File(apps, "common/Example").apply { mkdirs() } + val main = File(folder, "Example.exe").apply { writeBytes(ByteArray(16)) } + val launcher = File(folder, "ModLauncher.exe").apply { writeBytes(ByteArray(16)) } + File(apps, "appmanifest_42.acf").writeText("\"AppState\"\n{\n\t\"appid\"\t\t\"42\"\n\t\"name\"\t\t\"Example\"\n\t\"StateFlags\"\t\t\"4\"\n\t\"installdir\"\t\t\"Example\"\n}\n") + fun listed() = Library.launchableGames(app, arch = "arm64").map { it.library to it.gameFiles } + assertTrue(AddedGames.addExe(app, launcher) is AddedGames.AddResult.Added) + assertEquals(listOf("internal" to folder, Library.ADDED to folder), listed()) + assertTrue(AddedGames.addExe(app, main) is AddedGames.AddResult.Switched) + assertEquals(listOf("internal" to folder), listed()) + } }