feat(recomps): a Library-style grid with real sorting and filtering

The page now matches the Library: a ModeHeader with search and Filter,
Sort and Display buttons, box-art tiles sized like the Library's with
badges for installed, owned and updates, and a detail page per recomp
for what it needs, its builds and its actions. Filters combine and show
as removable chips; sorts are best for you, popularity, recently updated,
newly listed and A-Z. A row of original systems stays under the header.

Decomp Buddy's catalog and plans are read again; its copies of projects
taken down by a legal notice stay unused (DECOMP_BUDDY_MIRROR).
This commit is contained in:
Kurt Himebauch committed 2026-12-01 12:23:55 -05:00
1 parent f39267e8b0
commit 611d2d75d1
8 files changed
+483 -191

No files matched your search

+1 -1
View File
@@ -111,7 +111,7 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
<summary><b>Recomps</b></summary>
- The Recomps tab lists the community catalogs below, read straight from their sites. Each entry shows which catalog it came from.
- [Decomp Buddy](https://decompbuddy.com) ([TanookiStudios/decomp-buddy](https://github.com/TanookiStudios/decomp-buddy), GPL-3.0) by Maddie at [Tanooki Studios](https://tanookistudios.com): matching a PC port to a Steam, GOG or Epic install follows its `src/stores.js` title rules, and arm64 Linux files are found the way its `armSibling` finds them. Reading its catalog, plans and download copies is built but turned off (`RecompCatalog.DECOMP_BUDDY_ENABLED`).
- [Decomp Buddy](https://decompbuddy.com) ([TanookiStudios/decomp-buddy](https://github.com/TanookiStudios/decomp-buddy), GPL-3.0) by Maddie at [Tanooki Studios](https://tanookistudios.com): its `catalog.json` and `plans.json` supply most entries, their exact release files, programs and scanned checksums, and the game files each needs. Matching a PC port to a Steam, GOG or Epic install follows its `src/stores.js` title rules, and arm64 Linux files are found the way its `armSibling` finds them.
- [Recomp Launcher](https://recomplauncher.com) ([elripalda/RecompLauncher](https://github.com/elripalda/RecompLauncher), GPL-3.0) by [@elripalda](https://github.com/elripalda), [@Xarishark](https://github.com/Xarishark) and contributors: its `pc-catalog.json` supplies the Windows and Linux recomps, their release pins and checksums, start programs, setup notes and the game data each needs.
- A PC game's Steam, GOG and Epic IDs come from [Wikidata](https://www.wikidata.org) (CC0), by the IGDB slug Recomp Launcher gives, and GOG product slugs from GOG's public products API.
- [Recompa](https://recompa.app) ([kalasyan/recompa](https://github.com/kalasyan/recompa), GPL-3.0) by [@kalasyan](https://github.com/kalasyan): its `index.json` supplies the Android ports, their APK checksums, package names and signing certificates, and the ROMs or files each needs.
@@ -22,8 +22,10 @@ object RecompCatalog {
val RECOMP_LAUNCHER = Feed("recomp-launcher", "Recomp Launcher", "https://recomplauncher.com/pc-catalog.json")
val RECOMPA = Feed("recompa", "Recompa", "https://recompa.app/index.json")
// Off until Decomp Buddy's author agrees to DroidDeck reading her catalog and download copies.
const val DECOMP_BUDDY_ENABLED = false
const val DECOMP_BUDDY_ENABLED = true
// Decomp Buddy also keeps copies of projects taken down by a legal notice; using them is off until that is decided.
const val DECOMP_BUDDY_MIRROR = false
val FEEDS = listOfNotNull(DECOMP_BUDDY.takeIf { DECOMP_BUDDY_ENABLED }, RECOMP_LAUNCHER, RECOMPA)
private val DOWNLOADS = listOfNotNull(
@@ -34,7 +36,7 @@ object RecompCatalog {
// donation-funded, so the copy is used only when the project's own download is gone.
fun mirrorUrl(sha256: String, name: String) = "https://files.decompbuddy.com/$sha256/${android.net.Uri.encode(name)}"
val mirrorEnabled get() = DECOMP_BUDDY_ENABLED
val mirrorEnabled get() = DECOMP_BUDDY_ENABLED && DECOMP_BUDDY_MIRROR
enum class Platform(val key: String) {
LINUX_ARM64("linux-arm64"), LINUX_X64("linux-x64"), WINDOWS_X64("windows-x64"), ANDROID("android");
@@ -70,6 +72,7 @@ object RecompCatalog {
val repo: String, val license: String, val homepage: String, val art: String?,
val builds: List<Build>, val data: Data,
val sources: List<String>, val popularity: Long = 0, val setup: String? = null, val igdb: String? = null,
val cover: String? = null, val updated: String = "", val listed: String = "",
) {
fun build(platform: Platform) = builds.firstOrNull { it.platform == platform }
@@ -219,6 +222,7 @@ object RecompCatalog {
id, g.str("title") ?: id, first.gameTitle ?: g.str("title") ?: id, origin,
if ("recomp" in repo.lowercase()) "recomp" else "port", repo, "", g.str("repoUrl") ?: "https://github.com/$repo",
g.str("iconUrl") ?: g.str("boxartUrl"), builds, data, listOf(DECOMP_BUDDY.id), g.optLong("downloads"),
cover = g.str("boxartUrl"), updated = g.str("updatedAt").orEmpty(), listed = g.str("listedAt").orEmpty(),
)
}
@@ -268,6 +272,7 @@ object RecompCatalog {
"https://github.com/$repo", a.str("icon") ?: a.str("cover"), builds,
if (what != null) Data(DataKind.DUMP, what, note = a.str("blurb").orEmpty(), file = check) else Data(DataKind.NONE, ""),
listOf(RECOMP_LAUNCHER.id), a.optLong("downloads"), setup, igdb,
cover = a.str("cover"), updated = published, listed = a.str("added").orEmpty(),
)
}
@@ -309,8 +314,9 @@ object RecompCatalog {
val id = p.str("id") ?: return null
return Entry(
id, fork.str("name") ?: p.str("name") ?: id, p.str("game") ?: p.str("name") ?: id, origin(platform), p.str("type") ?: "port",
repo, "", "https://github.com/$repo", p.optJSONObject("art")?.str("cover"), listOf(android), data,
repo, "", "https://github.com/$repo", p.optJSONObject("art")?.str("icon") ?: p.optJSONObject("art")?.str("cover"), listOf(android), data,
listOf(RECOMPA.id), fork.optLong("downloads"),
cover = p.optJSONObject("art")?.str("cover"), updated = release.str("published_at").orEmpty(),
)
}
@@ -323,7 +329,7 @@ object RecompCatalog {
if (!e.pc || e.igdb != null) e
else slugs[RecompData.norm(e.game)]?.let { slug ->
Entry(e.id, e.name, e.game, e.origin, e.type, e.repo, e.license, e.homepage, e.art, e.builds, e.data, e.sources,
e.popularity, e.setup, slug)
e.popularity, e.setup, slug, e.cover, e.updated, e.listed)
} ?: e
}
}
@@ -351,6 +357,7 @@ object RecompCatalog {
base.id, base.name, base.game, base.origin.ifEmpty { e.origin }, base.type, base.repo, base.license.ifEmpty { e.license },
base.homepage, base.art ?: e.art, builds, data,
(base.sources + e.sources).distinct(), maxOf(base.popularity, e.popularity), base.setup ?: e.setup, base.igdb ?: e.igdb,
base.cover ?: e.cover, maxOf(base.updated, e.updated), listOf(base.listed, e.listed).filter { it.isNotEmpty() }.minOrNull().orEmpty(),
)
}
return out.values.toList()
@@ -282,7 +282,7 @@ private fun NotInstalledRow(count: Int, expanded: Boolean, keys: Modifier, onFoc
internal fun libraryColumns(width: Int, base: Int, gap: Int, level: Int): Int =
(((width + gap) / (base + gap)).coerceAtLeast(1) + LibraryDisplay.DEFAULT_LEVEL - level).coerceAtLeast(1)
private class LevelCells(private val base: androidx.compose.ui.unit.Dp, private val level: Int) : GridCells {
internal class LevelCells(private val base: androidx.compose.ui.unit.Dp, private val level: Int) : GridCells {
override fun androidx.compose.ui.unit.Density.calculateCrossAxisCellSizes(availableSize: Int, spacing: Int): List<Int> {
val count = libraryColumns(availableSize, base.roundToPx(), spacing, level)
val usable = (availableSize - spacing * (count - 1)).coerceAtLeast(0)
@@ -2,39 +2,64 @@ package com.droiddeck.launcher.ui
import android.content.Intent
import android.net.Uri
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.LocalIndication
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.hoverable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.grid.GridItemSpan
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
import androidx.compose.foundation.lazy.grid.rememberLazyGridState
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.CheckCircle
import androidx.compose.material.icons.filled.FilterAlt
import androidx.compose.material.icons.filled.Sort
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.layout.boundsInRoot
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
@@ -51,46 +76,73 @@ import com.droiddeck.launcher.store.UserAppsState
import com.droiddeck.launcher.stores.Store
import com.droiddeck.launcher.stores.StoresState
internal enum class RecompFilter { ALL, INSTALLED, OWNED, NATIVE }
internal enum class RecompFilter { INSTALLED, OWNED, NATIVE, ANDROID, UPDATE, NO_SETUP }
internal enum class RecompSort { BEST, POPULAR, UPDATED, LISTED, TITLE }
// Kept while the app runs, like the Library's search and sort, so leaving the tab and coming back keeps your place.
internal object RecompsView {
var query by mutableStateOf("")
var filters by mutableStateOf(emptySet<RecompFilter>())
var sort by mutableStateOf(RecompSort.BEST)
var system by mutableStateOf<String?>(null)
var open by mutableStateOf<String?>(null)
}
internal class RecompRow(
val entry: RecompCatalog.Entry, val data: RecompData.State, val installed: RecompInstaller.Installed?,
val update: RecompInstaller.Release?,
)
) {
val platform get() = installed?.platform?.let { RecompCatalog.Platform.of(it) } ?: entry.preferred()?.platform
}
internal fun recompRows(): List<RecompRow> = RecompsState.entries.map { e ->
RecompRow(e, RecompsState.data[e.id] ?: RecompData.State.BringYourOwn(e.data), RecompsState.installed[e.id], RecompsState.updates[e.id])
}
internal fun RecompRow.matches(filter: RecompFilter): Boolean = when (filter) {
RecompFilter.ALL -> true
RecompFilter.OWNED -> data is RecompData.State.Found || data is RecompData.State.Owned || data is RecompData.State.Incomplete
RecompFilter.INSTALLED -> installed != null
RecompFilter.NATIVE -> (installed?.platform?.let { RecompCatalog.Platform.of(it) } ?: entry.preferred()?.platform) in NATIVE
}
private val NATIVE = setOf(RecompCatalog.Platform.LINUX_ARM64, RecompCatalog.Platform.ANDROID)
// The original systems present in the list, most entries first; a system with one entry is not worth a chip.
internal fun recompSystems(rows: List<RecompRow>): List<Pair<String, Int>> =
rows.groupingBy { it.entry.origin }.eachCount().filter { (origin, n) -> origin.isNotEmpty() && n > 1 }
.toList().sortedWith(compareByDescending<Pair<String, Int>> { it.second }.thenBy { it.first })
private fun RecompRow.owned() = data is RecompData.State.Found || data is RecompData.State.Owned || data is RecompData.State.Incomplete
private fun RecompRow.onSystem(system: String?) = system == null || entry.origin == system
// Installed first, then the ones whose game you already own, then the rest, each by popularity.
internal fun RecompRow.rank(): Int = when {
installed != null -> 0
data is RecompData.State.Found -> 1
data is RecompData.State.Owned || data is RecompData.State.Incomplete -> 2
else -> 3
internal fun RecompRow.matches(filter: RecompFilter): Boolean = when (filter) {
RecompFilter.INSTALLED -> installed != null
RecompFilter.OWNED -> owned()
RecompFilter.NATIVE -> platform in NATIVE
RecompFilter.ANDROID -> entry.android != null
RecompFilter.UPDATE -> update != null
RecompFilter.NO_SETUP -> entry.setup == null
}
internal fun RecompRow.matches(query: String): Boolean = query.isBlank() || query.trim().split(Regex("\\s+")).all { word ->
listOf(entry.name, entry.game, entry.origin, entry.repo).any { it.contains(word, ignoreCase = true) }
}
private const val SHOWN_LIMIT = 300
// The original systems present in the list, most entries first; a system with one entry is not worth a chip.
internal fun recompSystems(rows: List<RecompRow>): List<Pair<String, Int>> =
rows.groupingBy { it.entry.origin }.eachCount().filter { (origin, n) -> origin.isNotEmpty() && n > 1 }
.toList().sortedWith(compareByDescending<Pair<String, Int>> { it.second }.thenBy { it.first })
// Best for you: installed, then games you have on a store, then native builds, each by popularity.
internal fun RecompRow.rank(): Int = when {
installed != null -> 0
data is RecompData.State.Found -> 1
owned() -> 2
platform in NATIVE -> 3
else -> 4
}
internal fun recompOrder(sort: RecompSort): Comparator<RecompRow> = when (sort) {
RecompSort.BEST -> compareBy<RecompRow> { it.rank() }.thenByDescending { it.entry.popularity }
RecompSort.POPULAR -> compareByDescending { it.entry.popularity }
RecompSort.UPDATED -> compareByDescending { it.entry.updated }
RecompSort.LISTED -> compareByDescending { it.entry.listed }
RecompSort.TITLE -> compareBy { it.entry.name.lowercase() }
}.thenBy { it.entry.name.lowercase() }
internal fun visibleRecomps(rows: List<RecompRow>, query: String, filters: Set<RecompFilter>, system: String?, sort: RecompSort): List<RecompRow> =
rows.filter { r -> r.matches(query) && filters.all { r.matches(it) } && (system == null || r.entry.origin == system) }.sortedWith(recompOrder(sort))
private val RecompTileWidth = 116.dp
@Composable
internal fun RecompsPage(s: FrontEndState, a: FrontEndActions, onSelect: (String) -> Unit, modifier: Modifier) {
@@ -101,88 +153,227 @@ internal fun RecompsPage(s: FrontEndState, a: FrontEndActions, onSelect: (String
UserAppsState.refresh(ctx)
}
val lifecycle = androidx.compose.ui.platform.LocalLifecycleOwner.current.lifecycle
androidx.compose.runtime.DisposableEffect(lifecycle) {
DisposableEffect(lifecycle) {
val observer = androidx.lifecycle.LifecycleEventObserver { _, event ->
if (event == androidx.lifecycle.Lifecycle.Event.ON_RESUME) RecompsState.refresh(ctx, steamOwned)
}
lifecycle.addObserver(observer)
onDispose { lifecycle.removeObserver(observer) }
}
var filter by rememberSaveable { mutableStateOf(RecompFilter.ALL) }
var system by rememberSaveable { mutableStateOf<String?>(null) }
var query by rememberSaveable { mutableStateOf("") }
val rows = androidx.compose.runtime.remember(RecompsState.entries, RecompsState.data, RecompsState.installed, RecompsState.updates) {
recompRows().sortedWith(compareBy<RecompRow> { it.rank() }.thenByDescending { it.entry.popularity }.thenBy { it.entry.name.lowercase() })
val rows = remember(RecompsState.entries, RecompsState.data, RecompsState.installed, RecompsState.updates) { recompRows() }
val opened = RecompsView.open?.let { id -> rows.firstOrNull { it.entry.id == id } }
if (opened != null) {
BackHandler { RecompsView.open = null }
RecompDetail(opened, s, a, onSelect, steamOwned, modifier)
return
}
val searched = rows.filter { it.matches(query) }
val shown = searched.filter { it.matches(filter) && it.onSystem(system) }
val systems = recompSystems(searched.filter { it.matches(filter) })
BoxWithConstraints(modifier) {
val columns = if (maxWidth >= 820.dp) 2 else 1
val full: androidx.compose.foundation.lazy.grid.LazyGridItemSpanScope.() -> androidx.compose.foundation.lazy.grid.GridItemSpan =
{ androidx.compose.foundation.lazy.grid.GridItemSpan(maxLineSpan) }
androidx.compose.foundation.lazy.grid.LazyVerticalGrid(
columns = androidx.compose.foundation.lazy.grid.GridCells.Fixed(columns),
horizontalArrangement = Arrangement.spacedBy(12.dp), verticalArrangement = Arrangement.spacedBy(12.dp),
contentPadding = androidx.compose.foundation.layout.PaddingValues(bottom = 24.dp),
modifier = Modifier.fillMaxSize().testTag("recomps-list"),
val searched = remember(rows, RecompsView.query) { rows.filter { it.matches(RecompsView.query) } }
val shown = remember(searched, RecompsView.filters, RecompsView.system, RecompsView.sort) {
visibleRecomps(searched, "", RecompsView.filters, RecompsView.system, RecompsView.sort)
}
val systems = remember(searched, RecompsView.filters) { recompSystems(searched.filter { r -> RecompsView.filters.all { r.matches(it) } }) }
val colors = MaterialTheme.colorScheme
Column(modifier) {
ModeHeader(
stringResource(R.string.rail_recomps), RecompsView.query, { RecompsView.query = it },
placeholder = stringResource(R.string.recomps_search), inlineWhenStacked = true,
lead = {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.padding(end = 4.dp)) {
Text(stringResource(R.string.rail_recomps), fontSize = if (LocalNarrowPane.current) 20.sp else 24.sp, fontWeight = FontWeight.Bold,
color = colors.onBackground, maxLines = 1)
Text(shown.size.toString(), fontSize = 13.sp, color = colors.onSurfaceVariant, maxLines = 1, modifier = Modifier.testTag("recomps-count"))
}
},
) {
item(key = "header", span = full) {
Column {
PageHeader(stringResource(R.string.rail_recomps))
Lede(stringResource(R.string.recomps_lede))
AdbTextField(
value = query, onValueChange = { query = it }, label = "", keyboardType = androidx.compose.ui.text.input.KeyboardType.Text,
imeAction = androidx.compose.ui.text.input.ImeAction.Search, placeholder = stringResource(R.string.recomps_search),
compact = true, showLabel = false, modifier = Modifier.fillMaxWidth().padding(bottom = 10.dp).testTag("recomps-search"),
)
Row(Modifier.fillMaxWidth().horizontalScroll(rememberScrollState()), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
RecompFilter.entries.forEach { f ->
val count = searched.count { it.matches(f) && it.onSystem(system) }
TabChip("${filterLabel(f)} · $count", filter == f, Modifier.testTag("recomps-filter-${f.name.lowercase()}")) { filter = f }
}
}
if (systems.size > 1) Row(Modifier.fillMaxWidth().horizontalScroll(rememberScrollState()).padding(top = 8.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp)) {
TabChip(stringResource(R.string.recomps_every_system), system == null, Modifier.testTag("recomps-system-all")) { system = null }
systems.forEach { (origin, n) ->
TabChip("$origin · $n", system == origin, Modifier.testTag("recomps-system-$origin")) { system = if (system == origin) null else origin }
}
}
UserAppsState.lastError?.let { Box(Modifier.padding(top = 10.dp)) { Note(it) } }
RecompFilterButton(searched)
RecompSortButton()
DisplayButton()
}
ActiveFilters()
if (systems.size > 1) Row(
Modifier.fillMaxWidth().horizontalScroll(rememberScrollState()).padding(top = 8.dp, bottom = 4.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
TabChip(stringResource(R.string.recomps_every_system), RecompsView.system == null, Modifier.testTag("recomps-system-all")) { RecompsView.system = null }
systems.forEach { (origin, n) ->
TabChip("$origin · $n", RecompsView.system == origin, Modifier.testTag("recomps-system-$origin")) {
RecompsView.system = if (RecompsView.system == origin) null else origin
}
}
when {
RecompsState.loading -> item(key = "loading", span = full) { Text("…", color = MaterialTheme.colorScheme.onSurfaceVariant) }
rows.isEmpty() -> item(key = "empty", span = full) { Note(stringResource(R.string.recomps_empty)) }
shown.isEmpty() -> item(key = "none", span = full) { Note(stringResource(R.string.recomps_none_here)) }
else -> {
val visible = shown.take(SHOWN_LIMIT)
items(visible.size, key = { visible[it].entry.id }) { i ->
RecompCard(visible[i], s, a, onSelect, first = i == 0, steamOwned = steamOwned, modifier = Modifier.fillMaxWidth())
}
if (shown.size > visible.size) item(key = "more", span = full) {
Text(stringResource(R.string.recomps_more_results, visible.size, shown.size), fontSize = 12.sp,
color = MaterialTheme.colorScheme.onSurfaceVariant)
}
UserAppsState.lastError?.let { Box(Modifier.padding(top = 8.dp)) { Note(it) } }
when {
RecompsState.loading -> Text("…", color = colors.onSurfaceVariant, modifier = Modifier.padding(top = 16.dp))
rows.isEmpty() -> Box(Modifier.padding(top = 12.dp)) { Note(stringResource(R.string.recomps_empty)) }
shown.isEmpty() -> Box(Modifier.padding(top = 12.dp)) { Note(stringResource(R.string.recomps_none_here)) }
else -> {
val level = LibraryDisplay.level
LazyVerticalGrid(
columns = remember(level) { LevelCells(RecompTileWidth, level) }, state = rememberLazyGridState(),
horizontalArrangement = Arrangement.spacedBy(12.dp), verticalArrangement = Arrangement.spacedBy(12.dp),
contentPadding = PaddingValues(top = 8.dp, bottom = 24.dp),
modifier = Modifier.fillMaxSize().testTag("recomps-list"),
) {
items(shown, key = { it.entry.id }) { row -> RecompTile(row, first = row === shown.first()) { RecompsView.open = row.entry.id } }
item(key = "credits", span = { GridItemSpan(maxLineSpan) }) {
Text(stringResource(R.string.recomps_credits), fontSize = 11.sp, color = colors.onSurfaceVariant,
modifier = Modifier.padding(top = 12.dp).testTag("recomps-credits"))
}
}
}
item(key = "credits", span = full) {
Text(stringResource(R.string.recomps_credits), fontSize = 11.sp, color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.padding(top = 8.dp).testTag("recomps-credits"))
}
}
}
}
@Composable
private fun filterLabel(f: RecompFilter) = stringResource(when (f) {
RecompFilter.ALL -> R.string.recomps_filter_all
RecompFilter.OWNED -> R.string.recomps_filter_owned
RecompFilter.INSTALLED -> R.string.recomps_filter_installed
RecompFilter.OWNED -> R.string.recomps_filter_owned
RecompFilter.NATIVE -> R.string.recomps_filter_native
RecompFilter.ANDROID -> R.string.recomps_filter_android
RecompFilter.UPDATE -> R.string.recomps_filter_update
RecompFilter.NO_SETUP -> R.string.recomps_filter_no_setup
})
@Composable
private fun sortLabel(sort: RecompSort) = stringResource(when (sort) {
RecompSort.BEST -> R.string.recomps_sort_best
RecompSort.POPULAR -> R.string.recomps_sort_popular
RecompSort.UPDATED -> R.string.recomps_sort_updated
RecompSort.LISTED -> R.string.recomps_sort_listed
RecompSort.TITLE -> R.string.recomps_sort_title
})
@Composable
private fun RecompFilterButton(rows: List<RecompRow>) {
val pal = LocalPalette.current
val title = stringResource(R.string.library_filter)
var at by remember { mutableStateOf<Rect?>(null) }
val counts = remember(rows) { RecompFilter.entries.associateWith { f -> rows.count { it.matches(f) } } }
Box(Modifier.onGloballyPositioned { at = it.boundsInRoot() }.testTag("recomps-filter")) {
HeaderIconButton(title, Icons.Filled.FilterAlt, "recomps-filter") {
val from = at ?: return@HeaderIconButton
Steps.ask(StepAsk(
anchor = from, side = StepSide.Left, accent = pal.signal, pillCorner = 8.dp, items = RecompFilter.entries.size,
handle = { Icon(Icons.Filled.FilterAlt, null, tint = pal.signal, modifier = Modifier.size(18.dp)) },
) {
StepTitle(title)
StepList {
RecompFilter.entries.forEachIndexed { i, f ->
StepChoice(
filterLabel(f), selected = f in RecompsView.filters, enabled = open, trailing = counts[f]?.toString(),
modifier = Modifier.fillMaxWidth().stepItem(i).testTag("recomps-filter-${f.name.lowercase()}")
.then(if (i == 0) Modifier.focusRequester(first) else Modifier),
) {
RecompsView.filters = if (f in RecompsView.filters) RecompsView.filters - f else RecompsView.filters + f
}
}
}
})
}
if (RecompsView.filters.isNotEmpty()) Box(Modifier.align(Alignment.TopEnd).size(8.dp).clip(CircleShape).background(pal.signal))
}
}
@Composable
private fun RecompSortButton() {
val pal = LocalPalette.current
val title = stringResource(R.string.stores_sort)
var at by remember { mutableStateOf<Rect?>(null) }
Box(Modifier.onGloballyPositioned { at = it.boundsInRoot() }.testTag("recomps-sort")) {
HeaderIconButton(title + " · " + sortLabel(RecompsView.sort), Icons.Filled.Sort, "recomps-sort") {
val from = at ?: return@HeaderIconButton
Steps.ask(StepAsk(
anchor = from, side = StepSide.Left, accent = pal.signal, pillCorner = 8.dp, items = RecompSort.entries.size,
handle = { Icon(Icons.Filled.Sort, null, tint = pal.signal, modifier = Modifier.size(18.dp)) },
) {
StepTitle(title)
StepList {
RecompSort.entries.forEachIndexed { i, sort ->
StepChoice(
sortLabel(sort), selected = sort == RecompsView.sort, enabled = open,
modifier = Modifier.fillMaxWidth().stepItem(i).testTag("recomps-sort-${sort.name.lowercase()}")
.then(if (sort == RecompsView.sort) Modifier.focusRequester(first) else Modifier),
) {
RecompsView.sort = sort
Steps.fold()
}
}
}
})
}
}
}
// The filters in use, each one a tap to remove, so a filtered grid never looks like the whole list.
@Composable
private fun ActiveFilters() {
val filters = RecompsView.filters
if (filters.isEmpty() && RecompsView.sort == RecompSort.BEST) return
Row(
Modifier.fillMaxWidth().horizontalScroll(rememberScrollState()).padding(top = 6.dp),
horizontalArrangement = Arrangement.spacedBy(6.dp), verticalAlignment = Alignment.CenterVertically,
) {
if (RecompsView.sort != RecompSort.BEST) Text(sortLabel(RecompsView.sort), fontSize = 12.sp, color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.padding(end = 6.dp))
filters.sortedBy { it.ordinal }.forEach { f ->
TabChip(filterLabel(f) + " ✕", true, Modifier.testTag("recomps-active-${f.name.lowercase()}")) { RecompsView.filters = RecompsView.filters - f }
}
if (filters.size > 1) TabChip(stringResource(R.string.recomps_clear_filters), false) { RecompsView.filters = emptySet() }
}
}
@Composable
private fun platformShort(platform: RecompCatalog.Platform?) = when (platform) {
RecompCatalog.Platform.LINUX_ARM64 -> stringResource(R.string.recomps_runs_native)
RecompCatalog.Platform.ANDROID -> stringResource(R.string.recomps_runs_android)
RecompCatalog.Platform.LINUX_X64 -> stringResource(R.string.recomps_runs_fex)
RecompCatalog.Platform.WINDOWS_X64 -> stringResource(R.string.recomps_runs_proton)
null -> ""
}
@Composable
private fun RecompTile(row: RecompRow, first: Boolean, onOpen: () -> Unit) {
val pal = LocalPalette.current
val src = remember { MutableInteractionSource() }
val hot = rememberHot(src)
val e = row.entry
val installing = UserAppsState.working == e.name
Column(
Modifier.fillMaxWidth().testTag("recomp-${e.id}").paneItem("recomp:${e.id}").then(if (first) Modifier.paneEntry() else Modifier)
.clip(RoundedCornerShape(10.dp)).glideBorder(hot, RoundedCornerShape(10.dp), pal.signal, pal.line)
.hoverable(src).clickable(role = Role.Button, interactionSource = src, indication = LocalIndication.current, onClick = onOpen)
.controllerConfirm(onClick = onOpen),
) {
ArtCard(
e.name, wide = e.art, tall = e.cover ?: e.art, download = null, hot = hot, capsule = true,
chip = if (installing) stringResource(R.string.recomps_installing) else null,
badge = { TileBadges(row) },
) {
Text(listOf(e.origin, platformShort(row.platform)).filter { it.isNotEmpty() }.joinToString(" · "),
fontSize = 10.sp, color = Color.White.copy(alpha = 0.75f), maxLines = 1, overflow = TextOverflow.Ellipsis)
}
}
}
@Composable
private fun androidx.compose.foundation.layout.BoxScope.TileBadges(row: RecompRow) {
val pal = LocalPalette.current
Column(Modifier.align(Alignment.TopStart).padding(6.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {
if (row.installed != null) Icon(Icons.Filled.CheckCircle, stringResource(R.string.recomps_filter_installed), tint = pal.good,
modifier = Modifier.size(18.dp).clip(CircleShape).background(Color.Black.copy(alpha = 0.55f)))
val store = when (val d = row.data) {
is RecompData.State.Found -> d.store
is RecompData.State.Owned -> d.store
is RecompData.State.Incomplete -> d.store
else -> null
}
if (store != null) Text(store.shortLabel, fontSize = 9.sp, fontWeight = FontWeight.Bold, color = Color.White,
modifier = Modifier.clip(RoundedCornerShape(4.dp)).background(Color.Black.copy(alpha = 0.6f)).padding(horizontal = 5.dp, vertical = 2.dp))
}
if (row.update != null) Box(Modifier.align(Alignment.TopEnd).padding(7.dp).size(9.dp).clip(CircleShape).background(AttentionAmber))
}
@Composable
private fun buildLabel(platform: RecompCatalog.Platform?) = stringResource(when (platform) {
RecompCatalog.Platform.LINUX_ARM64 -> R.string.recomps_build_linux_arm64
@@ -194,9 +385,8 @@ private fun buildLabel(platform: RecompCatalog.Platform?) = stringResource(when
private fun storeName(store: Store) = store.shortLabel
private fun sourceName(source: String): String? = when (source) {
else -> RecompCatalog.FEEDS.firstOrNull { it.id == source }?.name
}
private fun sourceName(source: String): String? = listOf(RecompCatalog.DECOMP_BUDDY, RecompCatalog.RECOMP_LAUNCHER, RecompCatalog.RECOMPA)
.firstOrNull { it.id == source }?.name
@Composable
private fun dataLine(data: RecompData.State): Pair<String, Boolean>? = when (data) {
@@ -216,87 +406,129 @@ private fun dataLine(data: RecompData.State): Pair<String, Boolean>? = when (dat
@OptIn(ExperimentalLayoutApi::class)
@Composable
private fun RecompCard(
row: RecompRow, s: FrontEndState, a: FrontEndActions, onSelect: (String) -> Unit, first: Boolean, steamOwned: List<Pair<Int, String>>, modifier: Modifier,
private fun RecompDetail(
row: RecompRow, s: FrontEndState, a: FrontEndActions, onSelect: (String) -> Unit, steamOwned: List<Pair<Int, String>>, modifier: Modifier,
) {
val ctx = LocalContext.current
val colors = MaterialTheme.colorScheme
val pal = LocalPalette.current
val e = row.entry
val shape = RoundedCornerShape(18.dp)
val build = row.installed?.platform?.let { RecompCatalog.Platform.of(it) } ?: e.preferred()?.platform
val open: (String) -> Unit = { url -> runCatching { ctx.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)) } }
BoxWithConstraints(modifier) {
val stacked = maxWidth < 640.dp
Column(Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(bottom = 24.dp).testTag("recomp-detail-${e.id}")) {
BackLink(stringResource(R.string.rail_recomps)) { RecompsView.open = null }
val cover: @Composable () -> Unit = {
Box(Modifier.width(if (stacked) 132.dp else 180.dp).aspectRatio(5f / 7f).clip(RoundedCornerShape(12.dp)).background(artBrush(hueOf(e.name))),
contentAlignment = Alignment.Center) {
Text(e.name.take(1), fontSize = 40.sp, fontWeight = FontWeight.Bold, color = colors.onBackground.copy(alpha = 0.5f))
(e.cover ?: e.art)?.let { AsyncImage(model = it, contentDescription = null, contentScale = ContentScale.Crop, modifier = Modifier.matchParentSize()) }
}
}
val heading: @Composable () -> Unit = {
Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {
Text(e.name, fontSize = 26.sp, fontWeight = FontWeight.Bold, color = colors.onBackground)
val kind = stringResource(if (e.type == "recomp") R.string.recomps_kind_recomp else R.string.recomps_kind_port, e.origin)
Text(listOf(e.game.takeIf { it != e.name }, kind).filterNotNull().joinToString(" · "), fontSize = 14.sp, color = colors.onSurfaceVariant)
FlowRow(horizontalArrangement = Arrangement.spacedBy(6.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
Chip(buildLabel(row.platform), ok = row.platform in NATIVE)
dataLine(row.data)?.let { (t, ok) -> Chip(t, ok) }
if (e.setup != null) Chip(stringResource(R.string.recomps_setup), ok = false)
}
Spacer(Modifier.height(4.dp))
RecompActions(row, s, a, onSelect, steamOwned, open)
}
}
if (stacked) Column(verticalArrangement = Arrangement.spacedBy(14.dp), modifier = Modifier.padding(top = 8.dp)) { cover(); heading() }
else Row(horizontalArrangement = Arrangement.spacedBy(22.dp), modifier = Modifier.padding(top = 8.dp)) {
cover(); Box(Modifier.weight(1f)) { heading() }
}
if (UserAppsState.working == e.name && UserAppsState.stage != null) {
Text(UserAppsState.stage.orEmpty(), fontSize = 12.sp, color = pal.signal, modifier = Modifier.padding(top = 10.dp))
}
DetailSection(stringResource(R.string.recomps_section_needs)) {
val found = row.data as? RecompData.State.Found
when {
found != null -> DetailText(stringResource(R.string.recomps_data_folder, found.guest))
row.data is RecompData.State.NotNeeded -> DetailText(stringResource(R.string.recomps_needs_nothing))
else -> DetailText(e.data.label)
}
e.data.file?.let { DetailText(stringResource(R.string.recomps_needs_file, it)) }
if (row.data is RecompData.State.BringYourOwn && e.data.note.isNotEmpty() && e.data.note != e.data.label) DetailText(e.data.note)
e.setup?.takeIf { it.isNotBlank() }?.let { DetailText(it) }
}
DetailSection(stringResource(R.string.recomps_section_builds)) {
e.builds.sortedBy { RecompCatalog.PREFERENCE.indexOf(it.platform).let { i -> if (i < 0) 99 else i } }.forEach { b ->
val used = b.platform == row.platform
DetailText(buildLabel(b.platform) + (b.tag?.let { " · $it" } ?: "") + if (used) " ✓" else "", strong = used)
}
}
DetailSection(stringResource(R.string.recomps_section_about)) {
DetailText(e.repo)
if (e.license.isNotEmpty()) DetailText(e.license)
DetailText(e.sources.mapNotNull { sourceName(it) }.joinToString(" · ") { ctx.getString(R.string.recomps_via, it) })
}
}
}
}
@Composable
private fun DetailSection(title: String, content: @Composable () -> Unit) {
Column(Modifier.fillMaxWidth().padding(top = 18.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) {
Text(headingUppercase(title), fontSize = 11.sp, fontWeight = FontWeight.Bold, color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.padding(bottom = 2.dp))
content()
}
}
@Composable
private fun DetailText(text: String, strong: Boolean = false) =
Text(text, fontSize = 13.sp, color = if (strong) MaterialTheme.colorScheme.onBackground else MaterialTheme.colorScheme.onSurfaceVariant,
fontWeight = if (strong) FontWeight.SemiBold else FontWeight.Normal)
@OptIn(ExperimentalLayoutApi::class)
@Composable
private fun RecompActions(
row: RecompRow, s: FrontEndState, a: FrontEndActions, onSelect: (String) -> Unit, steamOwned: List<Pair<Int, String>>, open: (String) -> Unit,
) {
val ctx = LocalContext.current
val e = row.entry
val busy = UserAppsState.working
val mine = busy == e.name
val open = { url: String -> runCatching { ctx.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)) } }
Column(
modifier.testTag("recomp-${e.id}").clip(shape).background(colors.surface).border(1.dp, pal.line, shape).padding(14.dp),
verticalArrangement = Arrangement.spacedBy(10.dp),
) {
Row(horizontalArrangement = Arrangement.spacedBy(12.dp), verticalAlignment = Alignment.CenterVertically) {
Box(Modifier.size(64.dp).clip(Shape12).background(artBrush(hueOf(e.name))), contentAlignment = Alignment.Center) {
Text(e.name.take(1), fontSize = 26.sp, fontWeight = FontWeight.Bold, color = colors.onBackground.copy(alpha = 0.6f))
if (e.art != null) AsyncImage(model = e.art, contentDescription = null, contentScale = ContentScale.Crop, modifier = Modifier.matchParentSize())
val inst = row.installed
val progress = if (mine) UserAppsState.percent.takeIf { it >= 0 }?.let { it / 100f } else null
val focus = Modifier.paneEntry()
FlowRow(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
when {
inst == null -> PrimaryButton(stringResource(R.string.recomps_install), enabled = row.platform != null && busy == null && s.ready, main = true,
progress = progress, modifier = focus.testTag("recomp-install-${e.id}")) {
RecompsState.install(ctx, e, steamOwned)
}
Column(Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(2.dp)) {
Text(e.name, fontSize = 16.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground, maxLines = 1, overflow = TextOverflow.Ellipsis)
val kind = stringResource(if (e.type == "recomp") R.string.recomps_kind_recomp else R.string.recomps_kind_port, e.origin)
Text("${e.game} · $kind", fontSize = 12.sp, color = colors.onSurfaceVariant, maxLines = 2, overflow = TextOverflow.Ellipsis)
inst.appKey.startsWith("android:") -> PrimaryButton(stringResource(R.string.recomps_play), main = true,
modifier = focus.testTag("recomp-play-${e.id}")) { RecompAndroid.launch(ctx, inst.appKey.removePrefix("android:")) }
inst.appKey.startsWith("added:") -> PrimaryButton(stringResource(R.string.recomps_open_games), main = true, modifier = focus) { onSelect("games") }
else -> PrimaryButton(stringResource(R.string.recomps_play), main = true, enabled = !s.busy, modifier = focus.testTag("recomp-play-${e.id}")) {
UserAppsState.items.firstOrNull { it.key == inst.appKey }?.let(a.onUserApp)
}
}
FlowRow(horizontalArrangement = Arrangement.spacedBy(6.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {
Chip(buildLabel(build), ok = row.installed != null)
dataLine(row.data)?.let { (t, ok) -> Chip(t, ok) }
if (e.android != null && build != RecompCatalog.Platform.ANDROID) Chip(stringResource(R.string.recomps_android_too), ok = false)
if (e.setup != null) Chip(stringResource(R.string.recomps_setup), ok = false)
e.sources.mapNotNull { sourceName(it) }.forEach { Chip(stringResource(R.string.recomps_via, it), ok = false) }
if (inst != null && row.update != null) SecondaryButton(stringResource(R.string.recomps_update, row.update.tag), enabled = busy == null,
progress = progress) { RecompsState.install(ctx, e, steamOwned, row.update) }
(row.data as? RecompData.State.Owned)?.item?.let { item ->
SecondaryButton(stringResource(R.string.recomps_install_game)) { StoresState.requestInstall(ctx, item) }
}
val found = row.data as? RecompData.State.Found
if (found != null) Text(stringResource(R.string.recomps_data_folder, found.guest), fontSize = 11.sp, color = colors.onSurfaceVariant,
maxLines = 1, overflow = TextOverflow.Ellipsis)
if (row.data is RecompData.State.BringYourOwn && row.data.data.note.isNotEmpty()) {
Text(row.data.data.note, fontSize = 11.sp, color = colors.onSurfaceVariant, maxLines = 2, overflow = TextOverflow.Ellipsis)
}
if (e.setup != null) Text(e.setup, fontSize = 11.sp, color = colors.onSurfaceVariant, maxLines = 3, overflow = TextOverflow.Ellipsis)
if (mine && UserAppsState.stage != null) Text(UserAppsState.stage.orEmpty(), fontSize = 11.sp, color = pal.signal, maxLines = 1, overflow = TextOverflow.Ellipsis)
val focus = if (first) Modifier.paneEntry() else Modifier.paneItem("recomp:${e.id}")
FlowRow(horizontalArrangement = Arrangement.spacedBy(8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
val inst = row.installed
val progress = if (mine) UserAppsState.percent.takeIf { it >= 0 }?.let { it / 100f } else null
SecondaryButton(stringResource(R.string.recomps_project)) { open(e.homepage) }
if (inst != null) SecondaryButton(stringResource(R.string.recomps_remove), enabled = busy == null) {
when {
inst == null -> PrimaryButton(stringResource(R.string.recomps_install), enabled = build != null && busy == null && s.ready, main = true,
compact = true, progress = progress, modifier = focus.testTag("recomp-install-${e.id}")) {
RecompsState.install(ctx, e, steamOwned)
inst.appKey.startsWith("android:") -> RecompAndroid.uninstall(ctx, inst.appKey.removePrefix("android:"))
inst.appKey.startsWith("added:") -> UserAppsState.run(ctx, e.name, R.string.recomps_removed, after = { RecompsState.refresh(ctx, steamOwned) }) { app, _ ->
RecompInstaller.remove(app, inst); null
}
inst.appKey.startsWith("android:") -> PrimaryButton(stringResource(R.string.recomps_play), main = true, compact = true,
modifier = focus.testTag("recomp-play-${e.id}")) { RecompAndroid.launch(ctx, inst.appKey.removePrefix("android:")) }
inst.appKey.startsWith("added:") -> PrimaryButton(stringResource(R.string.recomps_open_games), main = true, compact = true, modifier = focus) {
onSelect("games")
}
else -> PrimaryButton(stringResource(R.string.recomps_play), main = true, compact = true, enabled = !s.busy, modifier = focus.testTag("recomp-play-${e.id}")) {
UserAppsState.items.firstOrNull { it.key == inst.appKey }?.let(a.onUserApp)
}
}
if (inst != null && row.update != null) SecondaryButton(stringResource(R.string.recomps_update, row.update.tag), enabled = busy == null,
compact = true, progress = progress) { RecompsState.install(ctx, e, steamOwned, row.update) }
when (val d = row.data) {
is RecompData.State.Owned -> if (d.item != null) SecondaryButton(stringResource(R.string.recomps_install_game), compact = true) {
StoresState.requestInstall(ctx, d.item)
}
else -> {}
}
if (inst != null) SecondaryButton(stringResource(R.string.recomps_remove), enabled = busy == null, compact = true) {
if (inst.appKey.startsWith("android:")) {
RecompAndroid.uninstall(ctx, inst.appKey.removePrefix("android:"))
} else if (inst.appKey.startsWith("added:")) {
UserAppsState.run(ctx, e.name, R.string.recomps_removed, after = { RecompsState.refresh(ctx, steamOwned) }) { app, _ ->
RecompInstaller.remove(app, inst); null
}
} else UserAppsState.items.firstOrNull { it.key == inst.appKey }?.let { app ->
else -> UserAppsState.items.firstOrNull { it.key == inst.appKey }?.let { app ->
UserAppsState.run(ctx, e.name, R.string.recomps_removed, after = { RecompsState.refresh(ctx, steamOwned) }) { c, p ->
com.droiddeck.launcher.runtime.UserApps.remove(c, app, p)
}
}
} else SecondaryButton(stringResource(R.string.recomps_project), compact = true) { open(e.homepage) }
}
}
}
}
+21 -6
View File
@@ -4406,21 +4406,37 @@
<string name="rail_decky">Decky</string>
<string name="rail_boot_movies">Boot movies</string>
<string name="rail_recomps">Recomps</string>
<string name="recomps_lede">PC builds of classic games, made by recompiling or reimplementing them. DroidDeck installs the build and finds the game files you already own. It never downloads ROMs or game files.</string>
<string name="recomps_filter_all">All</string>
<string name="recomps_filter_owned">You own the game</string>
<string name="recomps_filter_native">Runs natively</string>
<string name="recomps_filter_android">Android app</string>
<string name="recomps_filter_update">Update available</string>
<string name="recomps_filter_no_setup">Ready without setup</string>
<string name="recomps_clear_filters">Clear all</string>
<string name="recomps_sort_best">Best for you</string>
<string name="recomps_sort_popular">Most popular</string>
<string name="recomps_sort_updated">Recently updated</string>
<string name="recomps_sort_listed">Newly listed</string>
<string name="recomps_sort_title">A–Z</string>
<string name="recomps_runs_native">Native</string>
<string name="recomps_runs_android">Android</string>
<string name="recomps_runs_fex">FEX</string>
<string name="recomps_runs_proton">Proton</string>
<string name="recomps_installing">Installing</string>
<string name="recomps_section_needs">What it needs</string>
<string name="recomps_section_builds">Builds</string>
<string name="recomps_section_about">About</string>
<string name="recomps_needs_nothing">No game files needed</string>
<string name="recomps_needs_file">Looks for %1$s</string>
<string name="recomps_every_system">Every system</string>
<string name="recomps_filter_installed">Installed</string>
<string name="recomps_empty">The recomp list couldn\'t be loaded.</string>
<string name="recomps_none_here">Nothing here yet.</string>
<string name="recomps_none_here">Nothing matches these filters.</string>
<string name="recomps_kind_recomp">%1$s recomp</string>
<string name="recomps_kind_port">%1$s port</string>
<string name="recomps_build_linux_arm64">Linux ARM64 · native</string>
<string name="recomps_build_linux_x64">Linux x86-64 · FEX</string>
<string name="recomps_build_windows_x64">Windows · Proton</string>
<string name="recomps_build_none">No build DroidDeck can run</string>
<string name="recomps_android_too">Android app too</string>
<string name="recomps_data_found">Installed on %1$s</string>
<string name="recomps_data_found_checked">Installed on %1$s · files checked</string>
<string name="recomps_data_found_by_name">Installed on %1$s · matched by name</string>
@@ -4449,8 +4465,7 @@
<string name="recomps_search">Search recomps</string>
<string name="recomps_setup">Needs setup first</string>
<string name="recomps_via">via %1$s</string>
<string name="recomps_credits">This list is the Recomp Launcher catalog (recomplauncher.com, by elripalda, Xarishark and contributors) and the Recompa catalog (recompa.app, by kalasyan), read from their sites. Each game\'s build comes from its own developers.</string>
<string name="recomps_more_results">Showing %1$d of %2$d. Search to narrow the list.</string>
<string name="recomps_credits">This list is the Decomp Buddy catalog (decompbuddy.com, by Maddie at Tanooki Studios), the Recomp Launcher catalog (recomplauncher.com, by elripalda, Xarishark and contributors) and the Recompa catalog (recompa.app, by kalasyan), read from their sites. Each game\'s build comes from its own developers. It never downloads ROMs or game files.</string>
<string name="recomps_add_failed">The Windows build couldn\'t be added to your games</string>
<string name="decky_tab_installed">Installed · %1$d</string>
<string name="decky_tab_store">Store</string>
@@ -287,9 +287,8 @@ class RecompsTest {
assertNull(RecompData.hashOf(f, "whirlpool"))
}
@Test fun decompBuddyStaysOffUntilItsAuthorAgrees() {
assertTrue(!RecompCatalog.DECOMP_BUDDY_ENABLED)
assertEquals(listOf(RecompCatalog.RECOMP_LAUNCHER, RecompCatalog.RECOMPA), RecompCatalog.FEEDS)
@Test fun decompBuddyIsReadButItsTakenDownCopiesAreNotUsed() {
assertEquals(listOf(RecompCatalog.DECOMP_BUDDY, RecompCatalog.RECOMP_LAUNCHER, RecompCatalog.RECOMPA), RecompCatalog.FEEDS)
assertTrue(!RecompCatalog.mirrorEnabled)
}
@@ -6,10 +6,14 @@ import org.junit.Assert.assertEquals
import org.junit.Test
class RecompFiltersTest {
private fun row(id: String, origin: String, vararg platforms: RecompCatalog.Platform) = RecompRow(
private fun row(
id: String, origin: String, vararg platforms: RecompCatalog.Platform, popularity: Long = 0, updated: String = "", listed: String = "",
setup: String? = null, data: RecompData.State? = null,
) = RecompRow(
RecompCatalog.Entry(id, id, id, origin, "recomp", "o/$id", "", "", null, platforms.map { RecompCatalog.Build(it, Regex("x")) },
RecompCatalog.Data(RecompCatalog.DataKind.ROM, "rom"), listOf("recomp-launcher")),
RecompData.State.BringYourOwn(RecompCatalog.Data(RecompCatalog.DataKind.ROM, "rom")), null, null,
RecompCatalog.Data(RecompCatalog.DataKind.ROM, "rom"), listOf("recomp-launcher"), popularity, setup,
updated = updated, listed = listed),
data ?: RecompData.State.BringYourOwn(RecompCatalog.Data(RecompCatalog.DataKind.ROM, "rom")), null, null,
)
@Test fun nativeMeansTheBuildThatWouldInstallRunsWithoutFexOrProton() {
@@ -26,4 +30,35 @@ class RecompFiltersTest {
val rows = listOf(row("a", "N64"), row("b", "N64"), row("c", "PS1"), row("d", "PS1"), row("e", "PS1"), row("f", "Wii"), row("g", ""), row("h", ""))
assertEquals(listOf("PS1" to 3, "N64" to 2), recompSystems(rows))
}
@Test fun sortsOrderByWhatTheyNameAndBestPutsWhatYouHaveFirst() {
val owned = RecompData.State.Owned(com.droiddeck.launcher.stores.Store.STEAM, null, exact = true)
val rows = listOf(
row("popular", "N64", RecompCatalog.Platform.WINDOWS_X64, popularity = 900, updated = "2025-01-01", listed = "2025-01-01"),
row("fresh", "N64", RecompCatalog.Platform.WINDOWS_X64, popularity = 10, updated = "2026-11-30", listed = "2026-11-01"),
row("native", "PS1", RecompCatalog.Platform.LINUX_ARM64, popularity = 50, updated = "2026-01-01", listed = "2026-11-20"),
row("mine", "PC", RecompCatalog.Platform.LINUX_X64, popularity = 1, data = owned),
)
fun ids(sort: RecompSort) = visibleRecomps(rows, "", emptySet(), null, sort).map { it.entry.id }
assertEquals(listOf("mine", "native", "popular", "fresh"), ids(RecompSort.BEST))
assertEquals(listOf("popular", "native", "fresh", "mine"), ids(RecompSort.POPULAR))
assertEquals(listOf("fresh", "native", "popular", "mine"), ids(RecompSort.UPDATED))
assertEquals(listOf("native", "fresh", "popular", "mine"), ids(RecompSort.LISTED))
assertEquals(listOf("fresh", "mine", "native", "popular"), ids(RecompSort.TITLE))
}
@Test fun filtersCombineWithEachOtherTheSystemAndTheSearch() {
val rows = listOf(
row("zelda", "N64", RecompCatalog.Platform.LINUX_ARM64),
row("banjo", "N64", RecompCatalog.Platform.LINUX_X64),
row("setup", "N64", RecompCatalog.Platform.LINUX_ARM64, setup = "Run setup.sh"),
row("crash", "PS1", RecompCatalog.Platform.LINUX_ARM64),
)
fun ids(query: String = "", filters: Set<RecompFilter> = emptySet(), system: String? = null) =
visibleRecomps(rows, query, filters, system, RecompSort.TITLE).map { it.entry.id }
assertEquals(listOf("crash", "setup", "zelda"), ids(filters = setOf(RecompFilter.NATIVE)))
assertEquals(listOf("zelda"), ids(filters = setOf(RecompFilter.NATIVE, RecompFilter.NO_SETUP), system = "N64"))
assertEquals(listOf("banjo"), ids(query = "ban", system = "N64"))
assertEquals(emptyList<String>(), ids(filters = setOf(RecompFilter.INSTALLED)))
}
}
+26 -22
View File
@@ -41,11 +41,9 @@ DroidDeck keeps no catalog. `RecompCatalog` downloads three community catalogs,
earlier catalog wins every field it sets; a later one with the same GitHub repo (or id) adds builds the
entry lacks.
> **Decomp Buddy is turned off** (`RecompCatalog.DECOMP_BUDDY_ENABLED = false`) until its author agrees to
> DroidDeck reading her catalog and using her download copies. While it is off, the app reads only Recomp
> Launcher and Recompa, and never uses the mirror fallback. The parsing code and its tests stay. The
> title rules and the arm64 twin lookup, which follow Decomp Buddy's code, stay on. The figures below
> are with it on.
> Decomp Buddy also keeps copies of projects taken down by a legal notice. DroidDeck does not use
> those copies (`RecompCatalog.DECOMP_BUDDY_MIRROR = false`) until that is decided. Its catalog and
> plans are read.
1. **Decomp Buddy** (`TanookiStudios/decomp-buddy`, GPL-3.0):
- `https://tanookistudios.com/decomp-buddy/catalog.json`, about 4,900 games.
@@ -158,23 +156,29 @@ Console recomps are never matched, because no store sells their dumps.
## UI
- **Top of the page:** a header, one line saying what the tab does, a search box (name, game,
origin, repo), filter chips with counts (All, Installed, You own the game, Runs natively), and a
row of system chips built from the origins in the list, with the most entries first.
- "Runs natively" means the build that would install is arm64 Linux or an Android APK.
- Almost every entry needs the player's own game files, so that is shown on each card, not offered
as a filter.
- **List:** a lazy grid, two columns from 820 dp and one below, capped at 300 cards until the player
searches. Cards are sorted installed first, then games installed from a store, then owned games,
then the rest by download count.
- **Each card:**
- The catalog's art, the game and its origin.
- Chips for the build (green once installed), the data, "Android app too", "Needs setup first",
and "via Recomp Launcher" / "via Recompa".
- Actions: Install, or Play / Open in Games; Update to <tag> when a feed names a newer release;
Install game; and Remove or Project page.
- **Credits:** a line at the end of the page names both catalogs.
- **Focus:** controller focus enters on the first card's primary button.
The page follows the Library.
- **Header:** `ModeHeader` with the title and the count shown, search, and Filter, Sort and Display
buttons. These use the Library's `Steps` popovers, and Display is the Library's own tile size and
title/detail toggles.
- **Filter:** multi-select, each choice with its count: Installed, You own the game, Runs natively
(the build that would install is arm64 Linux or an APK), Android app, Update available, Ready without
setup. Filters in use show as removable chips under the header, with "Clear all", and the Filter
button gets a dot.
- **Sort:** Best for you (installed, then found in a store install, then owned, then native, each by
popularity), Most popular, Recently updated, Newly listed, A–Z.
- **Systems:** a row of the original systems in the current results, most entries first.
- **Grid:** box-art tiles (`ArtCard`, capsule art from the catalogs' covers), sized by `LevelCells` like
the Library. Each tile shows the name, "System · Native/Android/FEX/Proton", and corner badges for
installed, the store you own it on, and an available update.
- **Detail page** (opening a tile):
- Cover, name, game and kind, chips for how it runs and its data state.
- Actions: Install, Play or Open in Games, Update, Install game, Project page, Remove.
- "What it needs": the folder found, or the file it looks for, or the catalog's note.
- "Builds": every build, with the one that installs ticked.
- "About": repo, licence, sources.
- Back returns to the grid.
- **Kept in memory** (`RecompsView`): search, filters, sort and system, so leaving the tab keeps your place.
## Tested