fix: hide registry-only games when product.db lists none, keep the Agent off without the game storage card

This commit is contained in:
maxjivi05 authored and MaxsTechReview committed 2026-10-26 10:30:16 -04:00
1 parent be5bec2d44
commit 538b5c5270
3 files changed
+17 -6

No files matched your search

@@ -212,15 +212,25 @@ class BattleNetTest {
)
assertEquals(listOf("agent" to "C:/ProgramData/Battle.net/Agent", "hs_beta" to "C:/Program Files (x86)/Hearthstone", "wow_classic_anniversary" to "Z:/root/Games/World of Warcraft"),
BattleNet.productDbEntries(db))
assertEquals(emptyList<Pair<String, String>>(), BattleNet.productDbEntries(db.copyOf(db.size - 3)))
assertEquals(emptyList<Pair<String, String>>(), BattleNet.productDbEntries(byteArrayOf(0x0a, 0x7f, 0x01)))
assertNull(BattleNet.productDbEntries(db.copyOf(db.size - 3)))
assertNull(BattleNet.productDbEntries(byteArrayOf(0x0a, 0x7f, 0x01)))
assertNull(BattleNet.productDbEntries(ByteArray(0)))
assertEquals(emptyList<Pair<String, String>>(), BattleNet.productDbEntries(message(field(1, message(field(1, "s1"), field(3, message(field(1, "Z:/Games/StarCraft"))), field(4, message(field(1, message(varintField(1, 0))))))))))
}
@Test fun theAgentDoesNotStartWithoutTheGameStorageCard() {
val card = Files.createTempDirectory("card").toFile()
com.droiddeck.launcher.session.SessionPrefs.setGameStorage(context, card.path, "SD Card")
assertTrue(com.droiddeck.launcher.stores.battlenet.BattleNetInstall.binds(context).any { it.endsWith(":/mnt/droiddeck-sd") })
card.deleteRecursively()
assertThrows(IllegalStateException::class.java) { com.droiddeck.launcher.stores.battlenet.BattleNetInstall.binds(context) }
}
@Test fun aGameTheAgentNoLongerTracksIsNotInstalled() {
val registry = listOf("wow" to "Z:\\mnt\\droiddeck-sd\\Games\\Battle.net\\World of Warcraft", "hs_beta" to "C:\\Hearthstone")
assertEquals(listOf("hs_beta" to "C:\\Hearthstone", "HS_BETA" to "C:/Hearthstone"), BattleNet.installs(registry, listOf("HS_BETA" to "C:/Hearthstone")))
assertEquals(registry, BattleNet.installs(registry, null))
assertEquals(registry, BattleNet.installs(registry, emptyList()))
assertEquals(emptyList<Pair<String, String>>(), BattleNet.installs(registry, emptyList()))
}
@Test fun theGamesAreTheTitlesInstalledInTheirFolders() {