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

@@ -180,7 +180,7 @@ object BattleNet {
}
internal fun installs(registry: List<Pair<String, String>>, agent: List<Pair<String, String>>?): List<Pair<String, String>> {
if (agent.isNullOrEmpty()) return registry
if (agent == null) return registry
val tracked = agent.map { it.first.lowercase() }.toSet()
return registry.filter { it.first.lowercase() in tracked } + agent
}
@@ -250,8 +250,8 @@ object BattleNet {
return out.toString()
}
internal fun productDbEntries(bytes: ByteArray): List<Pair<String, String>> {
val installs = runCatching { fields(bytes, 0, bytes.size) }.getOrDefault(emptyList()).filter { it.first == 1 }
internal fun productDbEntries(bytes: ByteArray): List<Pair<String, String>>? {
val installs = runCatching { fields(bytes, 0, bytes.size) }.getOrNull()?.filter { it.first == 1 }?.takeIf { it.isNotEmpty() } ?: return null
return installs.mapNotNull { (_, start, end) ->
runCatching {
val install = fields(bytes, start, end)
@@ -73,6 +73,7 @@ object BattleNetInstall {
val out = ArrayList<String>(StoreInstallRoot.externalBindSpecs(context))
val root = LinuxRuntime.rootDir(context)
GameStorage.effective(context)?.let { library ->
if (!File(library.path).isDirectory) throw IllegalStateException(context.getString(R.string.game_sync_err_game_storage))
val content = SecondaryLibrary.contentPath(File(library.path)).path
for (guest in SecondaryLibrary.CARD_GUESTS) {
File(root, guest.removePrefix("/")).mkdirs()