Compare commits

...
5 Commits
Author SHA1 Message Date
Kurt Himebauch c812290a9b feat(recomps): filter by native builds and by original system
Nearly every recomp needs the player's own files, so that filter said
nothing. The chips are now All, Installed, You own the game and Runs
natively (arm64 Linux or an Android APK), with a row of the original
systems found in the catalogs.
2026-11-30 22:28:37 -05:00
Kurt Himebauch bc9a941b14 feat(recomps): read Recomp Launcher's and Recompa's catalogs directly, with no catalog of our own
The tab now downloads both community catalogs, caches them with their
ETags and merges them on the device, so there is nothing for DroidDeck
to maintain. The curated list, the bundled catalog and the build and pin
scripts are gone. Ownership of a PC port's game is matched by title
against the player's installs and store libraries, and the wrapper just
starts the program from its own folder.
2026-11-30 22:15:30 -05:00
Kurt Himebauch c878284319 feat(recomps): merge the Recomp Launcher and Recompa catalogs, and install Android ports
tools/recomps/build_catalog.py builds the bundled catalog from DroidDeck's
curated entries, Recomp Launcher's pc-catalog.json (Windows and Linux
recomps) and Recompa's index.json (Android ports), matched by repo. Each
entry records the catalogs it came from; the card and the README credit
them.

Android builds install through PackageInstaller after the APK's package
name and signing certificate match the catalog, and already-installed
ports are recognised. Builds without a named program get one guessed
after unpacking. The page is now a lazy grid with search, for the
2,646 entries.
2026-11-30 21:53:23 -05:00
Kurt Himebauch 3b27cbece0 feat(recomps): pin catalog releases so installs avoid the GitHub API limit 2026-11-30 21:12:23 -05:00
Kurt Himebauch 8e361bdc7c feat(recomps): a Recomps tab that installs recomps and links store-owned game files
Adds More > Recomps: a curated catalog of recompiled and reimplemented
games. Each card installs the best build for the device (native arm64
Linux, x86-64 Linux through FEX, or Windows through Proton as an added
game), finds the game's data in a Steam, GOG or Epic install the player
already has, and passes that folder to the program at launch. ROM-based
recomps say which dump they need and never download one.

The catalog ships in assets and can be replaced by recomps.json in
DroidDeck-Components. tools/recomps/pin_catalog.py pins each entry to a
release so installs skip the rate-limited GitHub API.
2026-11-30 20:58:15 -05:00
18 changed files with 1522 additions and 12 deletions

No files matched your search

+10
View File
@@ -107,6 +107,16 @@ DroidDeck is [GPL-3.0](LICENSE). Steam and Proton belong to Valve Corporation. V
</details>
<details>
<summary><b>Recomps</b></summary>
- The Recomps tab lists the two community catalogs below, read straight from their sites. Each entry shows which catalog it came from.
- [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.
- [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.
- Every game's build is downloaded from its own developers' releases and keeps its own licence. DroidDeck ships no ROMs or game files.
</details>
<details>
<summary><b>Audio, video and HUD</b></summary>
@@ -1,5 +1,7 @@
package com.droiddeck.launcher.ui
import com.droiddeck.launcher.runtime.RecompData
import com.droiddeck.launcher.stores.Store
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
@@ -70,6 +72,7 @@ internal val previewCases: List<PreviewCase> = listOf(
PreviewCase("library-empty", storesLoaded) { Launcher("games", games = emptyList()) },
PreviewCase("stores", storesLoaded) { Launcher("stores") },
PreviewCase("downloads") { Launcher("downloads") },
PreviewCase("recomps") { RecompsTab() },
PreviewCase("settings") { Launcher("setup") },
PreviewCase("runtime-missing") { Launcher("setup", ready = false) },
PreviewCase("session-menu-controller") { SessionMenu(SessionDrawerPage.CONTROLLER) },
@@ -81,3 +84,34 @@ internal val previewCases: List<PreviewCase> = listOf(
PreviewCase("session-menu-docked-display") { DockedMenu(SessionDrawerPage.DISPLAY) },
PreviewCase("bottom-panel-bar") { BottomPanelBar() },
)
/** The Recomps tab with one recomp installed, one game installed from Steam, one owned on GOG and an Android port. */
@Composable
private fun RecompsTab(): Unit {
androidx.compose.runtime.remember {
fun entry(id: String, name: String, game: String, origin: String, platform: com.droiddeck.launcher.runtime.RecompCatalog.Platform,
needs: String, sources: List<String>) =
com.droiddeck.launcher.runtime.RecompCatalog.Entry(id, name, game, origin, if (origin == "PC") "port" else "recomp", "o/$id", "", "",
null, listOf(com.droiddeck.launcher.runtime.RecompCatalog.Build(platform, Regex("x"))),
com.droiddeck.launcher.runtime.RecompCatalog.Data(com.droiddeck.launcher.runtime.RecompCatalog.DataKind.ROM, needs), sources)
val list = listOf(
entry("zelda64recomp", "Zelda 64: Recompiled", "The Legend of Zelda: Majora's Mask", "N64", com.droiddeck.launcher.runtime.RecompCatalog.Platform.LINUX_ARM64, "Majora's Mask (USA) N64 ROM", listOf("recomp-launcher")),
entry("ironwail", "Ironwail", "Quake", "PC", com.droiddeck.launcher.runtime.RecompCatalog.Platform.LINUX_X64, "Quake's id1 folder", listOf("recomp-launcher")),
entry("fallout2-ce", "Fallout 2 Community Edition", "Fallout 2", "PC", com.droiddeck.launcher.runtime.RecompCatalog.Platform.WINDOWS_X64, "Fallout 2's master.dat", listOf("recomp-launcher", "recompa")),
entry("shipwright", "Ship of Harkinian", "The Legend of Zelda: Ocarina of Time", "N64", com.droiddeck.launcher.runtime.RecompCatalog.Platform.ANDROID, "Ocarina of Time ROM", listOf("recompa")),
)
val states: Map<String, RecompData.State> = mapOf(
"zelda64recomp" to RecompData.State.BringYourOwn(list[0].data),
"ironwail" to RecompData.State.Found(Store.STEAM, java.io.File("/q"), "/root/.local/share/Steam/steamapps/common/Quake"),
"fallout2-ce" to RecompData.State.Owned(Store.GOG, null),
"shipwright" to RecompData.State.BringYourOwn(list[3].data),
)
val installed = mapOf("zelda64recomp" to com.droiddeck.launcher.runtime.RecompInstaller.Installed(
"zelda64recomp", "script:zelda-64-recompiled", "v1.2.1", "", "linux-arm64", java.io.File("/z")))
val newer = mapOf("zelda64recomp" to com.droiddeck.launcher.runtime.RecompInstaller.Release("v1.2.2", "", "", "", null))
com.droiddeck.launcher.store.RecompsState.show(list, installed, states, newer)
}
Launcher("recomps")
}
@DroidDeckPreviews @Composable private fun RecompsTabPreview() = RecompsTab()
@@ -0,0 +1,92 @@
package com.droiddeck.launcher.runtime
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.content.pm.PackageInstaller
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import android.widget.Toast
import com.droiddeck.launcher.R
import com.droiddeck.launcher.core.FileUtils
import com.droiddeck.launcher.update.SelfInstaller
import java.io.File
object RecompAndroid {
const val ACTION_STATUS = "com.droiddeck.launcher.recomps.INSTALL_STATUS"
private const val RECORDS = "recomps-android"
@Volatile private var registered = false
@Volatile var onChanged: () -> Unit = {}
private fun record(context: Context, pkg: String) = File(File(context.filesDir, RECORDS), pkg)
fun installed(context: Context, entries: List<RecompCatalog.Entry>): Map<String, RecompInstaller.Installed> {
val pm = context.packageManager
return entries.mapNotNull { e ->
val pkg = e.android?.pkg ?: return@mapNotNull null
runCatching { pm.getPackageInfo(pkg, 0) }.getOrNull() ?: return@mapNotNull null
val lines = FileUtils.readString(record(context, pkg))?.lines().orEmpty()
e.id to RecompInstaller.Installed(e.id, "android:$pkg", lines.getOrNull(0)?.takeIf { it.isNotEmpty() },
lines.getOrNull(1), RecompCatalog.Platform.ANDROID.key, record(context, pkg))
}.toMap()
}
// Runs on a worker thread. The APK must carry the package name and signing certificate the catalog
// names, so a replaced release asset cannot install as, or over, a different app.
fun install(context: Context, entry: RecompCatalog.Entry, build: RecompCatalog.Build, release: RecompInstaller.Release, apk: File): String? {
val pkg = build.pkg ?: return context.getString(R.string.recomps_apk_mismatch)
if (!SelfInstaller.canInstall(context)) {
context.startActivity(SelfInstaller.permissionIntent(context).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
return context.getString(R.string.recomps_allow_installs)
}
val flags = if (Build.VERSION.SDK_INT >= 28) PackageManager.GET_SIGNING_CERTIFICATES else @Suppress("DEPRECATION") PackageManager.GET_SIGNATURES
val info = context.packageManager.getPackageArchiveInfo(apk.path, flags) ?: return context.getString(R.string.recomps_apk_mismatch)
if (info.packageName != pkg) return context.getString(R.string.recomps_apk_mismatch)
if (build.signer != null && build.signer !in SelfInstaller.archiveSignerDigests(info)) return context.getString(R.string.recomps_apk_mismatch)
listen(context)
FileUtils.writeString(record(context, pkg).apply { parentFile?.mkdirs() }, "${release.tag}\n${release.published}\n")
SelfInstaller.install(context, apk, pkg, ACTION_STATUS)
return null
}
fun launch(context: Context, pkg: String): Boolean {
val intent = context.packageManager.getLaunchIntentForPackage(pkg) ?: return false
return runCatching { context.startActivity(intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)) }.isSuccess
}
fun uninstall(context: Context, pkg: String) {
record(context, pkg).delete()
runCatching {
context.startActivity(Intent(Intent.ACTION_DELETE, Uri.parse("package:$pkg")).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
}
}
private fun listen(context: Context) {
if (registered) return
registered = true
val app = context.applicationContext
val receiver = object : BroadcastReceiver() {
override fun onReceive(c: Context, intent: Intent) {
when (val status = intent.getIntExtra(PackageInstaller.EXTRA_STATUS, PackageInstaller.STATUS_FAILURE)) {
PackageInstaller.STATUS_PENDING_USER_ACTION -> {
val confirm = if (Build.VERSION.SDK_INT >= 33) intent.getParcelableExtra(Intent.EXTRA_INTENT, Intent::class.java)
else @Suppress("DEPRECATION") intent.getParcelableExtra(Intent.EXTRA_INTENT)
confirm?.let { SelfInstaller.safeConfirmIntent(app, it) }?.let { runCatching { app.startActivity(it) } }
}
PackageInstaller.STATUS_SUCCESS -> onChanged()
else -> {
val message = SelfInstaller.describeFailure(app, status, intent.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE))
Toast.makeText(app, message, Toast.LENGTH_LONG).show()
onChanged()
}
}
}
}
val filter = IntentFilter(ACTION_STATUS)
if (Build.VERSION.SDK_INT >= 33) app.registerReceiver(receiver, filter, Context.RECEIVER_NOT_EXPORTED)
else app.registerReceiver(receiver, filter)
}
}
@@ -0,0 +1,235 @@
package com.droiddeck.launcher.runtime
import android.content.Context
import android.util.Log
import com.droiddeck.launcher.core.FileUtils
import org.json.JSONObject
import java.io.File
import java.net.HttpURLConnection
import java.net.URL
// The list is Recomp Launcher's and Recompa's own catalogs, read as their apps publish them. DroidDeck keeps
// no catalog of its own: it caches each feed, revalidates it with its ETag, and merges them by GitHub repo.
object RecompCatalog {
private const val TAG = "RecompCatalog"
private const val MAX_AGE_MS = 6L * 60 * 60 * 1000
class Feed(val id: String, val name: String, val url: String)
val RECOMP_LAUNCHER = Feed("recomp-launcher", "Recomp Launcher", "https://recomplauncher.com/pc-catalog.json")
val RECOMPA = Feed("recompa", "Recompa", "https://recompa.app/index.json")
val FEEDS = listOf(RECOMP_LAUNCHER, RECOMPA)
enum class Platform(val key: String) {
LINUX_ARM64("linux-arm64"), LINUX_X64("linux-x64"), WINDOWS_X64("windows-x64"), ANDROID("android");
companion object {
fun of(key: String) = entries.firstOrNull { it.key == key }
}
}
// Native arm64 Linux first, then an Android APK, then x86-64 Linux through FEX, then Windows through Proton.
val PREFERENCE = listOf(Platform.LINUX_ARM64, Platform.ANDROID, Platform.LINUX_X64, Platform.WINDOWS_X64)
class Build(
val platform: Platform, val asset: Regex, val entry: String = "",
val file: String? = null, val sha256: String? = null, val url: String? = null,
val pkg: String? = null, val signer: String? = null, val tag: String? = null, val published: String = "",
)
enum class DataKind { ROM, DUMP, NONE }
class Data(val kind: DataKind, val label: String, val sha1: List<String> = emptyList(), val note: String = "")
class Entry(
val id: String, val name: String, val game: String, val origin: String, val type: String,
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,
) {
fun build(platform: Platform) = builds.firstOrNull { it.platform == platform }
fun preferred(): Build? = PREFERENCE.firstNotNullOfOrNull { build(it) }
val android get() = build(Platform.ANDROID)
val pc get() = origin.equals("PC", ignoreCase = true)
}
@Volatile private var cached: List<Entry>? = null
fun load(context: Context, refresh: Boolean = false): List<Entry> {
if (!refresh) cached?.let { return it }
val dir = File(context.filesDir, "recomps").apply { mkdirs() }
val bodies = FEEDS.associateWith { feed -> runCatching { fetch(feed, dir, refresh) }.onFailure { Log.w(TAG, "${feed.id}: $it") }.getOrNull() }
val list = merge(
bodies[RECOMP_LAUNCHER]?.let { runCatching { fromRecompLauncher(JSONObject(it)) }.getOrNull() }.orEmpty(),
bodies[RECOMPA]?.let { runCatching { fromRecompa(JSONObject(it)) }.getOrNull() }.orEmpty(),
)
if (list.isNotEmpty()) cached = list
return list
}
private fun fetch(feed: Feed, dir: File, force: Boolean): String? {
val file = File(dir, "${feed.id}.json")
val etag = File(dir, "${feed.id}.etag")
if (!force && file.isFile && System.currentTimeMillis() - file.lastModified() < MAX_AGE_MS) return file.readText()
val conn = (URL(feed.url).openConnection() as HttpURLConnection).apply {
connectTimeout = 15_000; readTimeout = 60_000
setRequestProperty("User-Agent", "DroidDeck")
if (file.isFile) FileUtils.readString(etag)?.trim()?.takeIf { it.isNotEmpty() }?.let { setRequestProperty("If-None-Match", it) }
}
return try {
when (conn.responseCode) {
HttpURLConnection.HTTP_NOT_MODIFIED -> { file.setLastModified(System.currentTimeMillis()); file.readText() }
HttpURLConnection.HTTP_OK -> {
val body = conn.inputStream.bufferedReader().use { it.readText() }
val tmp = File(dir, "${feed.id}.json.part")
tmp.writeText(body)
tmp.renameTo(file)
conn.getHeaderField("ETag")?.let { FileUtils.writeString(etag, it) }
body
}
else -> file.takeIf { it.isFile }?.readText()
}
} catch (e: Exception) {
Log.w(TAG, "${feed.id}: $e")
file.takeIf { it.isFile }?.readText()
} finally {
conn.disconnect()
}
}
private val ORIGINS = mapOf(
"pc" to "PC", "n64" to "N64", "x360" to "Xbox 360", "xbox360" to "Xbox 360", "xbox" to "Xbox", "ps1" to "PS1", "ps2" to "PS2",
"ps3" to "PS3", "ps4" to "PS4", "switch" to "Switch", "switch2" to "Switch 2", "snes" to "SNES", "nes" to "NES", "gc" to "GameCube",
"wii" to "Wii", "gba" to "GBA", "nds" to "DS", "ds" to "DS", "3ds" to "3DS", "arcade" to "Arcade", "dreamcast" to "Dreamcast",
"saturn" to "Saturn", "genesis" to "Genesis", "psp" to "PSP", "vita" to "Vita", "gb" to "Game Boy", "gbc" to "Game Boy Color",
)
private val ARCHIVE = Regex("\\.(zip|7z|tar|tgz|tar\\.(gz|xz|bz2|zst)|appimage|exe)$", RegexOption.IGNORE_CASE)
private val REPO = Regex("[\\w.-]+/[\\w.-]+")
private val SHA256 = Regex("[0-9a-f]{64}")
private val SHA1 = Regex("[0-9a-f]{40}")
private val PACKAGE = Regex("[A-Za-z][\\w]*(\\.[A-Za-z][\\w]*)+")
private val GITHUB = Regex("^https?://github\\.com/([\\w.-]+/[\\w.-]+?)(?:\\.git)?/?$")
private val HUBS = setOf("io.github.kalasyan.recompa")
private fun origin(code: String) = code.lowercase().let { ORIGINS[it] ?: if (it == "other") "" else it.uppercase() }
private fun safeName(s: String?) = s?.takeIf { it.isNotEmpty() && '/' !in it && it != "." && it != ".." }
private fun sha256(s: String?) = s?.lowercase()?.takeIf { SHA256.matches(it) }
internal fun globRegex(glob: String) =
Regex("^" + glob.split('*').joinToString(".*") { Regex.escape(it) } + "$", RegexOption.IGNORE_CASE)
private fun JSONObject.str(key: String) = optString(key).takeIf { it.isNotEmpty() && it != "null" }
internal fun fromRecompLauncher(json: JSONObject): List<Entry> {
val apps = json.optJSONArray("apps") ?: return emptyList()
return (0 until apps.length()).mapNotNull { i -> runCatching { recompLauncherApp(apps.getJSONObject(i)) }.getOrNull() }
}
private fun recompLauncherApp(a: JSONObject): Entry? {
if (a.optBoolean("archived") || a.optBoolean("soon")) return null
if ((a.str("host") ?: "github") != "github") return null
val repo = a.str("repo")?.takeIf { REPO.matches(it) } ?: return null
val boot = a.optJSONObject("boot") ?: JSONObject()
if (boot.str("kind") in setOf("installer", "not-a-game", "source")) return null
val assets = a.optJSONObject("assets") ?: return null
val files = a.optJSONObject("files") ?: JSONObject()
val tag = a.str("tag")
val published = a.str("released_at").orEmpty()
val builds = listOf("linux", "windows").mapNotNull { os ->
val glob = assets.str(os) ?: return@mapNotNull null
if (glob.contains("flatpak", ignoreCase = true) || !ARCHIVE.containsMatchIn(glob)) return@mapNotNull null
val platform = when {
os == "linux" && Regex("aarch64|arm64", RegexOption.IGNORE_CASE).containsMatchIn(glob) -> Platform.LINUX_ARM64
os == "linux" -> Platform.LINUX_X64
Regex("arm64|aarch64|win32|x86(?![_-]64)", RegexOption.IGNORE_CASE).containsMatchIn(glob) -> return@mapNotNull null
else -> Platform.WINDOWS_X64
}
val start = if (os == "linux") boot.str("start_linux") else boot.str("start")?.takeIf { it.endsWith(".exe", ignoreCase = true) }
val pin = files.optJSONObject(os)
val file = safeName(pin?.str("name")) ?: safeName(glob.takeIf { '*' !in it && tag != null })
Build(platform, globRegex(glob), safeName(start).orEmpty(), file, sha256(pin?.str("sha256")), tag = tag, published = published)
}
if (builds.isEmpty()) return null
val what = boot.optJSONObject("files")?.str("what") ?: a.str("needs")
val steps = a.optJSONArray("setup_steps")
val id = a.str("id") ?: return null
val setup = if (!a.optBoolean("setup_required")) null
else (0 until (steps?.length() ?: 0)).take(2).joinToString(" ") { steps!!.getString(it) }.ifEmpty { "" }
return Entry(
id, a.str("name") ?: id, a.str("game") ?: a.str("name") ?: id, origin(a.str("origin").orEmpty()),
if ("recomp" in (id + repo).lowercase()) "recomp" else "port", repo, a.str("license").orEmpty(),
"https://github.com/$repo", a.str("icon") ?: a.str("cover"), builds,
if (what != null) Data(DataKind.DUMP, what, note = a.str("blurb").orEmpty()) else Data(DataKind.NONE, ""),
listOf(RECOMP_LAUNCHER.id), a.optLong("downloads"), setup,
)
}
internal fun fromRecompa(json: JSONObject): List<Entry> {
val ports = json.optJSONArray("ports") ?: return emptyList()
return (0 until ports.length()).mapNotNull { i -> runCatching { recompaPort(ports.getJSONObject(i)) }.getOrNull() }
}
private fun recompaPort(p: JSONObject): Entry? {
val req = p.optJSONObject("requirements") ?: JSONObject()
val abi = req.optJSONArray("abi")
if (abi != null && abi.length() > 0 && (0 until abi.length()).none { abi.getString(it) == "arm64-v8a" }) return null
if (req.optInt("min_sdk", 0) > android.os.Build.VERSION.SDK_INT) return null
val forks = p.optJSONArray("forks") ?: return null
val fork = (0 until forks.length()).map { forks.getJSONObject(it) }.filter { f ->
val asset = f.optJSONObject("release")?.optJSONObject("asset")
sha256(asset?.str("sha256")) != null && sha256(f.str("signer_sha256")) != null &&
f.str("package")?.let { PACKAGE.matches(it) } == true && asset?.str("url")?.startsWith("https://") == true
}.maxByOrNull { it.optLong("downloads") } ?: return null
if (fork.getString("package") in HUBS) return null
val release = fork.getJSONObject("release")
val asset = release.getJSONObject("asset")
val android = Build(
Platform.ANDROID, Regex("^" + Regex.escape(asset.getString("name")) + "$"), "", safeName(asset.str("name")),
sha256(asset.str("sha256")), asset.getString("url"), fork.getString("package"), sha256(fork.str("signer_sha256")),
release.str("tag"), release.str("published_at").orEmpty(),
)
val platform = p.str("original_platform").orEmpty()
val needs = p.optJSONArray("assets")?.optJSONObject(0)
val data = if (needs == null) Data(DataKind.NONE, "") else {
val accepted = needs.optJSONArray("accepted")
Data(
if (platform == "pc" || platform == "other") DataKind.DUMP else DataKind.ROM, needs.str("label").orEmpty(),
(0 until (accepted?.length() ?: 0)).mapNotNull { accepted!!.optJSONObject(it)?.str("sha1")?.lowercase()?.takeIf { s -> SHA1.matches(s) } },
needs.str("instructions_md")?.replace(Regex("[`*_#>\\[\\]]"), "")?.trim()?.lineSequence()?.firstOrNull().orEmpty(),
)
}
val repo = p.str("upstream")?.let { GITHUB.find(it)?.groupValues?.get(1) } ?: fork.str("repo")?.takeIf { REPO.matches(it) } ?: return null
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,
listOf(RECOMPA.id), fork.optLong("downloads"),
)
}
// Recomp Launcher's entry wins every field it sets; a Recompa port of the same repo (or id) adds its APK.
internal fun merge(launcher: List<Entry>, recompa: List<Entry>): List<Entry> {
val out = LinkedHashMap<String, Entry>()
val byRepo = HashMap<String, String>()
for (e in launcher + recompa) {
val base = (byRepo[e.repo.lowercase()] ?: e.id.takeIf { it in out })?.let { out[it] }
if (base == null) {
out[e.id] = e
byRepo.putIfAbsent(e.repo.lowercase(), e.id)
continue
}
val builds = base.builds + e.builds.filter { b -> base.builds.none { it.platform == b.platform } }
out[base.id] = Entry(
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, if (base.data.kind == DataKind.NONE) e.data else base.data,
(base.sources + e.sources).distinct(), maxOf(base.popularity, e.popularity), base.setup,
)
}
return out.values.toList()
}
}
@@ -0,0 +1,70 @@
package com.droiddeck.launcher.runtime
import android.content.Context
import com.droiddeck.launcher.stores.CatalogItem
import com.droiddeck.launcher.stores.Store
import com.droiddeck.launcher.stores.StoreInstallRoot
import com.droiddeck.launcher.stores.StoresState
import com.droiddeck.launcher.stores.steam.SteamClient
import com.droiddeck.launcher.stores.steam.SteamLibraryFolders
import java.io.File
// The catalogs name the game a PC port needs but not its store ids, so ownership is matched by title against
// the player's own libraries. Console recomps need a dump, which no store sells, and are never matched.
object RecompData {
sealed class State {
object NotNeeded : State()
class BringYourOwn(val data: RecompCatalog.Data) : State()
class Found(val store: Store, val host: File, val guest: String) : State()
class Owned(val store: Store, val item: CatalogItem?) : State()
}
class Install(val store: Store, val title: String, val host: File, val guest: String)
class Owner(val store: Store, val title: String, val item: CatalogItem?)
class Inputs(val installs: List<Install>, val owned: List<Owner>)
private val EDITION = Regex(
"\\b(game of the year|goty|definitive|enhanced|complete|classic|gold|anniversary|special|deluxe|ultimate|remastered)( edition)?\\b|\\bedition\\b",
)
internal fun titleKey(title: String): String =
title.lowercase().replace(Regex("[™®©]"), "").replace(Regex("[:\\-–—_'’.,!?&()\\[\\]]"), " ")
.replace(EDITION, " ").replace(Regex("^the "), "").filter { it.isLetterOrDigit() }
fun inputs(context: Context, steamOwned: Collection<Pair<Int, String>>): Inputs {
val root = LinuxRuntime.rootDir(context)
val installs = mutableListOf<Install>()
StoresState.installed.forEach { game ->
installs += Install(game.sidecar.store, game.sidecar.title, game.folder, guestPath(context, root, game.folder))
}
runCatching {
SteamLibraryFolders.installed(SteamClient.libraries(context)).forEach { (_, app) ->
val dir = app.installDir ?: return@forEach
installs += Install(Store.STEAM, app.name, File(app.library.host, "steamapps/common/$dir"),
"${app.library.guest.trimEnd('/')}/steamapps/common/$dir")
}
}
val owned = StoresState.library.flatMap { (store, list) -> list.filter { it.accessible }.map { Owner(store, it.title, it) } } +
steamOwned.map { (_, name) -> Owner(Store.STEAM, name, null) }
return Inputs(installs, owned)
}
private fun guestPath(context: Context, root: File, host: File): String {
val r = root.absolutePath.trimEnd('/')
val h = host.absolutePath
return if (h.startsWith("$r/")) h.removePrefix(r) else StoreInstallRoot.guestPath(context, host)
}
fun resolve(entry: RecompCatalog.Entry, inputs: Inputs): State {
if (entry.pc) {
val key = titleKey(entry.game).takeIf { it.length >= 3 }
if (key != null) {
inputs.installs.firstOrNull { titleKey(it.title) == key }?.let { return State.Found(it.store, it.host, it.guest) }
inputs.owned.firstOrNull { titleKey(it.title) == key }?.let { return State.Owned(it.store, it.item) }
}
}
return if (entry.data.kind == RecompCatalog.DataKind.NONE) State.NotNeeded else State.BringYourOwn(entry.data)
}
}
@@ -0,0 +1,245 @@
package com.droiddeck.launcher.runtime
import android.content.Context
import android.system.Os
import com.droiddeck.launcher.R
import com.droiddeck.launcher.core.Downloader
import com.droiddeck.launcher.core.FileUtils
import com.droiddeck.launcher.core.Hashes
import com.droiddeck.launcher.frontend.AddedGames
import com.droiddeck.launcher.frontend.GameExePicker
import com.droiddeck.launcher.stores.StoreInstallRoot
import org.json.JSONArray
import java.io.File
import java.io.RandomAccessFile
object RecompInstaller {
const val META_ID = "recomp-id"
const val META_TAG = "recomp-tag"
const val META_PUBLISHED = "recomp-published"
const val META_PLATFORM = "recomp-platform"
const val WRAPPER = "droiddeck-recomp"
private const val WINDOWS_DIR = "Recomps"
private const val NESTED_LIMIT = 2
private val ARCHIVE = Regex("\\.(zip|7z|tar|tgz|tar\\.(gz|xz|bz2|zst))$", RegexOption.IGNORE_CASE)
class Release(val tag: String, val published: String, val asset: String, val url: String, val sha256: String?)
class Installed(val id: String, val appKey: String, val tag: String?, val published: String?, val platform: String?, val dir: File)
fun installed(context: Context): Map<String, Installed> {
val out = HashMap<String, Installed>()
fun scan(root: File, prefix: String) = root.listFiles()?.forEach { dir ->
val id = FileUtils.readString(File(dir, META_ID))?.trim()?.takeIf { it.isNotEmpty() } ?: return@forEach
out[id] = Installed(id, "$prefix:${dir.name}", read(dir, META_TAG), read(dir, META_PUBLISHED), read(dir, META_PLATFORM), dir)
}
scan(UserApps.root(context), "script")
AppImageManager.dir(context, "").parentFile?.let { scan(it, "appimage") }
windowsRoots(context).forEach { scan(it, "added") }
return out
}
private fun windowsRoots(context: Context): List<File> =
(AddedGames.roots(context).map { it.host } + StoreInstallRoot.installRoot(context)).map { File(it, WINDOWS_DIR) }.distinct()
private fun windowsTarget(context: Context, entry: RecompCatalog.Entry): File =
File(AddedGames.roots(context).firstOrNull()?.host?.takeIf { it.canWrite() } ?: StoreInstallRoot.installRoot(context), "$WINDOWS_DIR/${entry.id}")
fun remove(context: Context, installed: Installed) {
AddedGames.remove(context, installed.dir)
FileUtils.delete(installed.dir)
}
private fun read(dir: File, name: String) = FileUtils.readString(File(dir, name))?.trim()?.takeIf { it.isNotEmpty() }
// A feed that names the release file lets the install skip the releases API, which allows 60
// unauthenticated calls an hour per address, shared by every device on it.
fun pinned(entry: RecompCatalog.Entry, build: RecompCatalog.Build): Release? {
val tag = build.tag ?: return null
val file = build.file ?: return null
val url = build.url ?: "https://github.com/${entry.repo}/releases/download/${android.net.Uri.encode(tag)}/${android.net.Uri.encode(file)}"
return Release(tag, build.published, file, url, build.sha256)
}
fun latest(entry: RecompCatalog.Entry, build: RecompCatalog.Build): Release? {
val body = Downloader.downloadString("https://api.github.com/repos/${entry.repo}/releases?per_page=15") ?: return null
return pickRelease(body, build.asset, false)
}
internal fun pickRelease(body: String, asset: Regex, prerelease: Boolean): Release? {
val releases = runCatching { JSONArray(body) }.getOrNull() ?: return null
val candidates = (0 until releases.length()).mapNotNull { i ->
val r = releases.getJSONObject(i)
if (r.optBoolean("draft")) return@mapNotNull null
val assets = r.optJSONArray("assets") ?: return@mapNotNull null
val a = (0 until assets.length()).map { assets.getJSONObject(it) }.firstOrNull { asset.containsMatchIn(it.getString("name")) }
?: return@mapNotNull null
r.optBoolean("prerelease") to Release(r.optString("tag_name"), r.optString("published_at"), a.getString("name"),
a.getString("browser_download_url"), Hashes.githubSha256(a.optString("digest")))
}
return (candidates.firstOrNull { prerelease || !it.first } ?: candidates.firstOrNull())?.second
}
fun isNewer(release: Release, installed: Installed): Boolean =
installed.tag != null && release.tag != installed.tag && isAfter(release, installed)
private fun isAfter(release: Release, installed: Installed): Boolean =
if (!installed.published.isNullOrEmpty() && release.published.isNotEmpty()) release.published > installed.published
else release.tag != installed.tag
fun install(
context: Context, entry: RecompCatalog.Entry, build: RecompCatalog.Build, wanted: Release?, onProgress: (String, Int) -> Unit,
): String? {
val android = build.platform == RecompCatalog.Platform.ANDROID
if (!android && !LinuxRuntime.isInstalled(context)) return context.getString(R.string.user_apps_runtime_required)
val release = wanted ?: pinned(entry, build) ?: run {
onProgress(context.getString(R.string.user_apps_github_checking, entry.repo), -1)
val body = Downloader.downloadString("https://api.github.com/repos/${entry.repo}/releases?per_page=15")
?: return context.getString(R.string.user_apps_github_unreachable, entry.repo)
pickRelease(body, build.asset, false) ?: return context.getString(R.string.recomps_no_build, entry.repo)
}
val work = File(context.cacheDir, "recomps").apply { mkdirs() }
val download = File(work, release.asset)
val stage = File(work, "stage-${entry.id}")
try {
val label = context.getString(R.string.user_apps_downloading, release.asset)
val ok = Downloader.downloadFile(release.url, download, true, release.sha256) { f -> onProgress(label, if (f < 0) -1 else Math.round(f * 100f)) }
if (!ok) return context.getString(R.string.user_apps_download_failed)
val meta = mapOf(META_ID to entry.id, META_TAG to release.tag, META_PUBLISHED to release.published, META_PLATFORM to build.platform.key)
if (android) return RecompAndroid.install(context, entry, build, release, download)
val previous = installed(context)[entry.id]
val problem = if (build.platform == RecompCatalog.Platform.WINDOWS_X64) {
installWindows(context, entry, build, download, meta, previous, onProgress)
} else if (download.name.endsWith(".appimage", ignoreCase = true)) {
AppImageManager.import(context, download, entry.name, null, meta) { onProgress(it, -1) }
} else {
FileUtils.delete(stage)
stage.mkdirs()
onProgress(context.getString(R.string.recomps_unpacking, release.asset), -1)
unpack(context, download, stage)
val found = (if (build.entry.isEmpty()) guessEntry(stage, entry) else findEntry(stage, build.entry))
?: return context.getString(R.string.recomps_entry_missing, build.entry.ifEmpty { entry.name })
if (found.name.endsWith(".appimage", ignoreCase = true)) {
AppImageManager.import(context, found, entry.name, null, meta) { onProgress(it, -1) }
} else {
UserApps.addPrepared(context, entry.name, null, meta) { dir ->
val files = File(dir, "files")
if (!stage.renameTo(files)) throw IllegalStateException(context.getString(R.string.user_apps_failed))
markExecutables(files)
val rel = found.relativeTo(stage).invariantSeparatorsPath
FileUtils.writeString(File(files, WRAPPER), wrapper(rel))
File(files, WRAPPER).setExecutable(true, false)
WRAPPER
}
}
}
if (problem == null && previous != null && previous.dir != windowsTarget(context, entry)) FileUtils.delete(previous.dir)
return problem
} catch (e: Exception) {
return e.message ?: context.getString(R.string.user_apps_failed)
} finally {
download.delete()
FileUtils.delete(stage)
}
}
private fun installWindows(
context: Context, entry: RecompCatalog.Entry, build: RecompCatalog.Build, download: File, meta: Map<String, String>,
previous: Installed?, onProgress: (String, Int) -> Unit,
): String? {
val target = windowsTarget(context, entry)
if (previous?.dir == target) AddedGames.remove(context, target)
FileUtils.delete(target)
target.mkdirs()
onProgress(context.getString(R.string.recomps_unpacking, download.name), -1)
if (download.name.endsWith(".exe", ignoreCase = true)) download.copyTo(File(target, download.name), true)
else unpack(context, download, target)
val exe = (if (build.entry.isNotEmpty()) findEntry(target, build.entry) else GameExePicker.rank(target).exes.firstOrNull())
?: return context.getString(R.string.recomps_entry_missing, build.entry.ifEmpty { entry.name })
meta.forEach { (k, v) -> FileUtils.writeString(File(target, k), v) }
return when (AddedGames.addExe(context, exe)) {
is AddedGames.AddResult.Added, is AddedGames.AddResult.Existing, is AddedGames.AddResult.Switched -> null
else -> context.getString(R.string.recomps_add_failed)
}
}
private fun unpack(context: Context, archive: File, into: File) {
var file = archive
val binds = if (listOf(context.filesDir, context.cacheDir).any { into.absolutePath.startsWith(it.absolutePath + "/") }) null
else listOf(into.absolutePath)
repeat(NESTED_LIMIT) { depth ->
val tail = ArrayDeque<String>()
val code = GuestCommand.run(context, listOf("/usr/bin/bsdtar", "-xf", file.absolutePath, "-C", into.absolutePath),
logName = "recomps", extraBinds = binds, fastPath = true) { line ->
if (!line.startsWith("proot ")) { if (tail.size == 4) tail.removeFirst(); tail.addLast(line) }
}
if (code != 0) throw IllegalStateException(context.getString(R.string.recomps_unpack_failed, code) + tail.joinToString(" | ", ": "))
if (depth > 0) file.delete()
val only = into.listFiles()?.singleOrNull()?.takeIf { it.isFile && ARCHIVE.containsMatchIn(it.name) } ?: return
file = only
}
}
// Catalogs that do not name the program: an AppImage if there is one, else the executable ELF (not a
// shared library) whose name is closest to the project's, nearest the top, then the largest.
internal fun guessEntry(root: File, entry: RecompCatalog.Entry): File? {
val files = root.walkTopDown().maxDepth(4).filter { it.isFile && !java.nio.file.Files.isSymbolicLink(it.toPath()) }.toList()
files.filter { it.name.endsWith(".appimage", ignoreCase = true) }.minByOrNull { it.path.length }?.let { return it }
val words = listOf(entry.id, entry.name, entry.repo.substringAfter('/')).map { key(it) }.filter { it.isNotEmpty() }
return files.filter { !Regex("\\.so(\\.|$)").containsMatchIn(it.name) && isElf(it) && elfType(it) != SHARED_OBJECT_ONLY }
.sortedWith(compareByDescending<File> { f -> val n = key(f.name); words.count { w -> n.isNotEmpty() && (w.contains(n) || n.contains(w)) } }
.thenBy { it.relativeTo(root).path.count { c -> c == '/' } }
.thenByDescending { it.length() })
.firstOrNull()
}
private const val SHARED_OBJECT_ONLY = -1
private fun key(s: String) = s.lowercase().filter { it.isLetterOrDigit() }
// ET_DYN libraries without a program interpreter are shared objects, not programs.
private fun elfType(f: File): Int = runCatching {
RandomAccessFile(f, "r").use { raf ->
val head = ByteArray(64)
if (raf.read(head) < 64) return@use 0
val little = head[5].toInt() == 1
fun u16(o: Int) = if (little) (head[o].toInt() and 0xff) or ((head[o + 1].toInt() and 0xff) shl 8) else ((head[o].toInt() and 0xff) shl 8) or (head[o + 1].toInt() and 0xff)
val type = u16(16)
if (type != 3) return@use type
val bytes = raf.length().coerceAtMost(1L shl 16).toInt()
raf.seek(0)
val buf = ByteArray(bytes)
raf.readFully(buf)
if (String(buf, Charsets.ISO_8859_1).contains("/ld-linux")) type else SHARED_OBJECT_ONLY
}
}.getOrDefault(0)
internal fun findEntry(root: File, name: String): File? {
if (name.isEmpty()) return null
var level = listOf(root)
repeat(4) {
level.forEach { dir -> dir.listFiles()?.firstOrNull { it.isFile && it.name == name }?.let { return it } }
level.forEach { dir -> dir.listFiles()?.firstOrNull { it.isFile && it.name.equals(name, ignoreCase = true) }?.let { return it } }
level = level.flatMap { dir -> dir.listFiles()?.filter { it.isDirectory }?.sortedBy { it.name }.orEmpty() }
}
return null
}
private fun markExecutables(root: File) {
root.walkTopDown().maxDepth(6).filter { it.isFile && !java.nio.file.Files.isSymbolicLink(it.toPath()) && isElf(it) }
.forEach { runCatching { Os.chmod(it.path, 0b111_101_101) } }
}
private fun isElf(f: File): Boolean = runCatching {
RandomAccessFile(f, "r").use { val b = ByteArray(4); it.read(b) == 4 && b[0] == 0x7f.toByte() && b[1] == 'E'.code.toByte() && b[2] == 'L'.code.toByte() && b[3] == 'F'.code.toByte() }
}.getOrDefault(false)
private fun quote(s: String) = "'" + s.replace("'", "'\\''") + "'"
// The program starts from its own folder, as it would after unpacking the release by hand.
internal fun wrapper(entry: String): String {
val dir = entry.substringBeforeLast('/', "")
val enter = if (dir.isEmpty()) "" else "cd ${quote(dir)} || exit 127\n"
return "#!/bin/sh\n$enter" + "exec ./${quote(entry.substringAfterLast('/'))} \"\$@\"\n"
}
}
@@ -74,7 +74,7 @@ object UserApps {
class ScriptPlan(val folder: File, val copy: Boolean, val bytes: Long)
private fun root(context: Context) = File(LinuxRuntime.rootDir(context), GUEST_DIR.substring(1))
internal fun root(context: Context) = File(LinuxRuntime.rootDir(context), GUEST_DIR.substring(1))
private fun overrides(context: Context, flatpakId: String) = File(root(context), "$FLATPAK_OVERRIDES/$flatpakId")
@@ -247,6 +247,27 @@ object UserApps {
}
}
// [prepare] fills the new app folder's `files` and returns the entry's name there, or throws.
internal fun addPrepared(context: Context, name: String, icon: File?, meta: Map<String, String>, prepare: (File) -> String): String? {
if (!LinuxRuntime.isInstalled(context)) return context.getString(R.string.user_apps_runtime_required)
val base = root(context).apply { mkdirs() }
val dir = File(base, AppImageManager.idFor(name, base.list()?.toSet() ?: emptySet()))
return try {
dir.mkdirs()
val entry = prepare(dir)
FileUtils.writeString(File(dir, "entry"), entry)
FileUtils.writeString(File(dir, "name"), name)
if (icon != null && !saveIcon(icon, File(dir, "icon.png"))) Log.w(TAG, "icon ${icon.path} could not be read")
meta.forEach { (k, v) -> FileUtils.writeString(File(dir, k), v) }
writeScriptEntry(context, dir)
null
} catch (e: Exception) {
Log.e(TAG, "prepared $name", e)
FileUtils.delete(dir)
e.message ?: context.getString(R.string.user_apps_failed)
}
}
private fun writeScriptEntry(context: Context, dir: File) {
val id = dir.name
val icon = if (File(dir, "icon.png").isFile) "$GUEST_DIR/$id/icon.png" else "utilities-terminal"
@@ -0,0 +1,81 @@
package com.droiddeck.launcher.store
import android.content.Context
import android.os.Handler
import android.os.Looper
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import com.droiddeck.launcher.R
import com.droiddeck.launcher.runtime.RecompAndroid
import com.droiddeck.launcher.runtime.RecompCatalog
import com.droiddeck.launcher.runtime.RecompData
import com.droiddeck.launcher.runtime.RecompInstaller
object RecompsState {
private val main = Handler(Looper.getMainLooper())
var entries by mutableStateOf<List<RecompCatalog.Entry>>(emptyList())
private set
var installed by mutableStateOf<Map<String, RecompInstaller.Installed>>(emptyMap())
private set
var data by mutableStateOf<Map<String, RecompData.State>>(emptyMap())
private set
var updates by mutableStateOf<Map<String, RecompInstaller.Release>>(emptyMap())
private set
var loading by mutableStateOf(false)
private set
private var seq = 0
private var checked = false
private var lastSteam: List<Pair<Int, String>> = emptyList()
internal var fixed = false
private set
internal fun show(
list: List<RecompCatalog.Entry>, have: Map<String, RecompInstaller.Installed>, states: Map<String, RecompData.State>,
newer: Map<String, RecompInstaller.Release>,
) {
fixed = true
entries = list; installed = have; data = states; updates = newer; loading = false
}
fun refresh(context: Context, steamOwned: Collection<Pair<Int, String>>, reloadCatalog: Boolean = false) {
if (fixed) return
val app = context.applicationContext
lastSteam = steamOwned.toList()
RecompAndroid.onChanged = { main.post { refresh(app, lastSteam) } }
val n = ++seq
loading = entries.isEmpty()
Thread({
val list = runCatching { RecompCatalog.load(app, reloadCatalog) }.getOrDefault(emptyList())
val have = runCatching { RecompAndroid.installed(app, list) }.getOrDefault(emptyMap()) +
runCatching { RecompInstaller.installed(app) }.getOrDefault(emptyMap())
val inputs = runCatching { RecompData.inputs(app, steamOwned) }.getOrNull()
val states = list.associate { e -> e.id to (inputs?.let { RecompData.resolve(e, it) } ?: RecompData.State.BringYourOwn(e.data)) }
main.post {
if (n != seq) return@post
entries = list; installed = have; data = states; loading = false
}
if (!checked && have.isNotEmpty()) {
checked = true
val found = list.filter { it.id in have }.mapNotNull { e ->
val i = have.getValue(e.id)
val build = RecompCatalog.Platform.of(i.platform.orEmpty())?.let { e.build(it) } ?: return@mapNotNull null
val newest = (RecompInstaller.pinned(e, build) ?: runCatching { RecompInstaller.latest(e, build) }.getOrNull())
?.takeIf { RecompInstaller.isNewer(it, i) }
newest?.let { e.id to it }
}.toMap()
main.post { updates = found }
}
}, "recomps-refresh").start()
}
fun install(context: Context, entry: RecompCatalog.Entry, steamOwned: Collection<Pair<Int, String>>, release: RecompInstaller.Release? = null) {
val build = installed[entry.id]?.platform?.let { RecompCatalog.Platform.of(it) }?.let { entry.build(it) } ?: entry.preferred() ?: return
val done = if (build.platform == RecompCatalog.Platform.ANDROID) R.string.recomps_android_started else R.string.recomps_installed
UserAppsState.run(context, entry.name, done, after = {
updates = updates - entry.id
refresh(context, steamOwned)
}) { app, progress -> RecompInstaller.install(app, entry, build, release, progress) }
}
}
@@ -69,7 +69,7 @@ object UserAppsState {
UserApps.update(app, target, release, progress).also { if (it == null) main.post { updates = updates - target.key } }
}
private fun run(context: Context, label: String, done: Int, work: (Context, (String, Int) -> Unit) -> String?) {
internal fun run(context: Context, label: String, done: Int, after: () -> Unit = {}, work: (Context, (String, Int) -> Unit) -> String?) {
if (working != null) return
val app = context.applicationContext
working = label; stage = null; percent = -1; lastError = null
@@ -85,6 +85,7 @@ object UserAppsState {
if (problem == null) Toast.makeText(app, app.getString(done, label), Toast.LENGTH_SHORT).show()
refresh(app)
StoreState.refresh(app)
after()
}
}, "user-apps-work").start()
}
@@ -267,6 +267,10 @@ private fun Content(
SteamTabPage(selected, a, modifier.padding(horizontal = padH).padding(top = padV))
return
}
if (selected == "recomps") {
RecompsPage(s, a, onSelect, modifier.padding(horizontal = padH).padding(top = padV))
return
}
if (selected == "updates") {
UpdatesPage(s, a, modifier.padding(horizontal = padH).padding(top = padV))
return
@@ -56,6 +56,7 @@ import androidx.compose.material.icons.filled.Terminal
import androidx.compose.material.icons.filled.Apps
import androidx.compose.material.icons.filled.Settings
import androidx.compose.material.icons.filled.SdStorage
import androidx.compose.material.icons.filled.Memory
import androidx.compose.material.icons.filled.Movie
import androidx.compose.material.icons.filled.Sync
import androidx.compose.material.icons.filled.MoreHoriz
@@ -208,6 +209,7 @@ internal fun railLabelIcon(key: String): Pair<Int, ImageVector> = when (key) {
"sync" -> R.string.rail_sync to Icons.Filled.Sync
"decky" -> R.string.rail_decky to DeckyIcon
"boot-movies" -> R.string.rail_boot_movies to Icons.Filled.Movie
"recomps" -> R.string.rail_recomps to Icons.Filled.Memory
NavTabs.MORE -> R.string.rail_more to Icons.Filled.MoreHoriz
else -> R.string.rail_updates to updatesIcon(RunningBuild.kind())
}
@@ -26,10 +26,10 @@ internal object DeveloperTools {
internal object NavTabs {
const val MORE = "more"
val ALL = listOf("steam", "desktop", "games", "downloads", "setup", "updates", "stores", "soundtracks", "components", "storage", "sync", "decky", "boot-movies", "android-apps", "agent")
val DEFAULT_SHELVED = setOf("stores", "soundtracks", "components", "storage", "sync", "decky", "boot-movies", "agent")
val ALL = listOf("steam", "desktop", "games", "downloads", "setup", "updates", "stores", "soundtracks", "components", "storage", "sync", "decky", "boot-movies", "recomps", "android-apps", "agent")
val DEFAULT_SHELVED = setOf("stores", "soundtracks", "components", "storage", "sync", "decky", "boot-movies", "recomps", "agent")
val DEFAULT_HIDDEN = setOf("android-apps", "agent")
private val SHELVED_WHEN_NEW = setOf("storage", "sync", "decky", "boot-movies", "agent")
private val SHELVED_WHEN_NEW = setOf("storage", "sync", "decky", "boot-movies", "recomps", "agent")
private val OLD_ORDER = listOf("steam", "games", "soundtracks", "stores", "downloads", "desktop", "agent", "components", "android-apps", "storage", "sync", "setup", "updates")
private val OLD_SHELVED = setOf("soundtracks", "agent", "storage", "sync")
private const val LAYOUT_VERSION = 2
@@ -0,0 +1,294 @@
package com.droiddeck.launcher.ui
import android.content.Intent
import android.net.Uri
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.horizontalScroll
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.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
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.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import coil.compose.AsyncImage
import com.droiddeck.launcher.R
import com.droiddeck.launcher.frontend.Library
import com.droiddeck.launcher.runtime.RecompAndroid
import com.droiddeck.launcher.runtime.RecompCatalog
import com.droiddeck.launcher.runtime.RecompData
import com.droiddeck.launcher.runtime.RecompInstaller
import com.droiddeck.launcher.store.RecompsState
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 class RecompRow(
val entry: RecompCatalog.Entry, val data: RecompData.State, val installed: RecompInstaller.Installed?,
val update: RecompInstaller.Release?,
)
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
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.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 -> 2
else -> 3
}
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
@Composable
internal fun RecompsPage(s: FrontEndState, a: FrontEndActions, onSelect: (String) -> Unit, modifier: Modifier) {
val ctx = LocalContext.current
val steamOwned = s.steamGames.filter { it.source == Library.SOURCE_STEAM }.map { it.appId to it.name }
LaunchedEffect(steamOwned.size, StoresState.installed.size, StoresState.library.size) {
RecompsState.refresh(ctx, steamOwned)
UserAppsState.refresh(ctx)
}
val lifecycle = androidx.compose.ui.platform.LocalLifecycleOwner.current.lifecycle
androidx.compose.runtime.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 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"),
) {
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) } }
}
}
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)
}
}
}
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.NATIVE -> R.string.recomps_filter_native
})
@Composable
private fun buildLabel(platform: RecompCatalog.Platform?) = stringResource(when (platform) {
RecompCatalog.Platform.LINUX_ARM64 -> R.string.recomps_build_linux_arm64
RecompCatalog.Platform.LINUX_X64 -> R.string.recomps_build_linux_x64
RecompCatalog.Platform.WINDOWS_X64 -> R.string.recomps_build_windows_x64
RecompCatalog.Platform.ANDROID -> R.string.recomps_build_android
else -> R.string.recomps_build_none
})
private fun storeName(store: Store) = store.shortLabel
private fun sourceName(source: String): String? = when (source) {
else -> RecompCatalog.FEEDS.firstOrNull { it.id == source }?.name
}
@Composable
private fun dataLine(data: RecompData.State): Pair<String, Boolean>? = when (data) {
RecompData.State.NotNeeded -> null
is RecompData.State.Found -> stringResource(R.string.recomps_data_found, storeName(data.store)) to true
is RecompData.State.Owned -> stringResource(R.string.recomps_data_owned, storeName(data.store)) to false
is RecompData.State.BringYourOwn -> stringResource(R.string.recomps_data_bring, data.data.label.removePrefix("Your ").removePrefix("your ")) to false
}
@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,
) {
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 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())
}
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)
}
}
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) }
}
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
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:") -> 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 ->
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) }
}
}
}
+43
View File
@@ -4404,6 +4404,49 @@
<string name="decky_release_channel">Release channel</string>
<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_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_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_owned">You own it on %1$s. Install it first</string>
<string name="recomps_data_bring">Needs your own %1$s</string>
<string name="recomps_data_folder">Game folder: %1$s</string>
<string name="recomps_install">Install</string>
<string name="recomps_play">Play</string>
<string name="recomps_open_games">Open in Games</string>
<string name="recomps_update">Update to %1$s</string>
<string name="recomps_remove">Remove</string>
<string name="recomps_install_game">Install game</string>
<string name="recomps_project">Project page</string>
<string name="recomps_installed">%1$s installed</string>
<string name="recomps_removed">%1$s removed</string>
<string name="recomps_no_build">No release of %1$s has a build DroidDeck can run</string>
<string name="recomps_unpacking">Unpacking %1$s</string>
<string name="recomps_unpack_failed">Unpacking failed (exit %1$d)</string>
<string name="recomps_entry_missing">The download has no %1$s</string>
<string name="recomps_android_started">%1$s downloaded. Confirm the install.</string>
<string name="recomps_apk_mismatch">The APK isn\'t the app the catalog lists, so it wasn\'t installed</string>
<string name="recomps_allow_installs">Allow DroidDeck to install apps, then press Install again</string>
<string name="recomps_build_android">Android app</string>
<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_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>
<string name="decky_tab_zip">From ZIP</string>
@@ -0,0 +1,173 @@
package com.droiddeck.launcher.runtime
import com.droiddeck.launcher.stores.CatalogItem
import com.droiddeck.launcher.stores.Store
import java.io.File
import java.util.concurrent.TimeUnit
import org.json.JSONObject
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
@RunWith(RobolectricTestRunner::class)
class RecompsTest {
@get:Rule val temporary = TemporaryFolder()
private val launcherFeed = JSONObject("""{"apps":[
{"id":"zelda64recomp","name":"Zelda 64: Recompiled","game":"The Legend of Zelda: Majora's Mask","origin":"n64",
"repo":"Zelda64Recomp/Zelda64Recomp","tag":"v1.2.2","released_at":"2025-08-27T00:58:35Z","downloads":415396,
"assets":{"windows":"Zelda64Recompiled-*-Windows.zip","linux":"Zelda64Recompiled-*-Linux-X64.zip","macos":"Z-*-macOS.zip"},
"files":{"windows":{"name":"Zelda64Recompiled-v1.2.2-Windows.zip","sha256":"${"a".repeat(64)}"}},
"needs":"Your own copy of The Legend of Zelda: Majora's Mask","boot":{"kind":"portable","start":"Zelda64Recompiled.exe"}},
{"id":"ironwail","name":"Ironwail","game":"Quake","origin":"pc","repo":"andrei-drexler/ironwail","tag":"v0.8.2","downloads":10,
"assets":{"linux":"ironwail-*-linux-x64.tar.gz","windows":"ironwail-*-win32.zip"},"boot":{"start_linux":"ironwail"},
"needs":"Your Quake id1 folder"},
{"id":"otherm","name":"Other M","origin":"wii","repo":"o/otherm","tag":"1.0","assets":{"windows":"OtherM.zip","linux":"OtherM-Flatpak.zip"},
"setup_required":true,"setup_steps":["Run setup.bat once.","Then play."]},
{"id":"gone","name":"Gone","repo":"o/gone","archived":true,"assets":{"windows":"g.zip"}},
{"id":"tool","name":"Tool","repo":"o/tool","boot":{"kind":"not-a-game"},"assets":{"windows":"t.zip"}},
{"id":"lab","name":"Lab","repo":"git.example/x/y","host":"gitlab","assets":{"windows":"l.zip"}}
]}""")
private val recompaFeed = JSONObject("""{"ports":[
{"id":"zelda","name":"Majora","upstream":"https://github.com/Zelda64Recomp/Zelda64Recomp","original_platform":"n64",
"requirements":{"abi":["arm64-v8a"],"min_sdk":24},"forks":[
{"repo":"x/Zelda-Android","name":"Zelda Android","package":"com.z.mm","signer_sha256":"${"b".repeat(64)}","downloads":9,
"release":{"tag":"a1","published_at":"p","asset":{"name":"z.apk","url":"https://h/z.apk","sha256":"${"c".repeat(64)}"}}},
{"repo":"x/unsigned","package":"com.z.other","downloads":99,"release":{"tag":"t","asset":{"name":"u.apk","url":"https://h/u.apk"}}}]},
{"id":"sm64","name":"SM64","upstream":"https://github.com/o/sm64","original_platform":"n64","type":"decomp",
"assets":[{"label":"SM64 ROM","accepted":[{"sha1":"9BEF1128717F958171A4AFAC3ED78EE2BB4E86CE"}],"instructions_md":"Pick `sm64.z64`.\n"}],
"forks":[{"repo":"y/sm64","package":"com.y.sm64","signer_sha256":"${"d".repeat(64)}",
"release":{"tag":"r2","asset":{"name":"sm64.apk","url":"https://h/s.apk","sha256":"${"e".repeat(64)}"}}}]},
{"id":"x86only","upstream":"https://github.com/o/x","requirements":{"abi":["x86_64"]},"forks":[]},
{"id":"recompa-app","upstream":"https://github.com/kalasyan/recompa","forks":[{"repo":"kalasyan/recompa","package":"io.github.kalasyan.recompa",
"signer_sha256":"${"f".repeat(64)}","release":{"tag":"v1","asset":{"name":"r.apk","url":"https://h/r.apk","sha256":"${"f".repeat(64)}"}}}]}
]}""")
private val merged by lazy { RecompCatalog.merge(RecompCatalog.fromRecompLauncher(launcherFeed), RecompCatalog.fromRecompa(recompaFeed)) }
private fun entry(id: String) = merged.first { it.id == id }
@Test fun recompLauncherAppsBecomeRunnableBuildsAndTheRestIsLeftOut() {
assertEquals(listOf("zelda64recomp", "ironwail", "otherm", "sm64"), merged.map { it.id })
val z = entry("zelda64recomp")
assertEquals("N64", z.origin)
assertEquals(setOf(RecompCatalog.Platform.LINUX_X64, RecompCatalog.Platform.WINDOWS_X64, RecompCatalog.Platform.ANDROID), z.builds.map { it.platform }.toSet())
val win = z.build(RecompCatalog.Platform.WINDOWS_X64)!!
assertEquals("Zelda64Recompiled.exe", win.entry)
assertEquals("a".repeat(64), win.sha256)
assertTrue(z.build(RecompCatalog.Platform.LINUX_X64)!!.asset.matches("Zelda64Recompiled-v1.2.2-Linux-X64.zip"))
assertNull(z.build(RecompCatalog.Platform.LINUX_X64)!!.file)
assertNull(entry("ironwail").build(RecompCatalog.Platform.WINDOWS_X64))
assertEquals("ironwail", entry("ironwail").build(RecompCatalog.Platform.LINUX_X64)!!.entry)
val m = entry("otherm")
assertEquals(listOf(RecompCatalog.Platform.WINDOWS_X64), m.builds.map { it.platform })
assertEquals("OtherM.zip", m.builds.single().file)
assertEquals("Run setup.bat once. Then play.", m.setup)
assertEquals("Wii", m.origin)
}
@Test fun recompaPortsAddSignedApksAndTheirRomNeeds() {
val z = entry("zelda64recomp")
assertEquals(listOf(RecompCatalog.RECOMP_LAUNCHER.id, RecompCatalog.RECOMPA.id), z.sources)
assertEquals(RecompCatalog.Platform.ANDROID, z.preferred()?.platform)
val apk = z.android!!
assertEquals("com.z.mm", apk.pkg)
assertEquals("b".repeat(64), apk.signer)
val pin = RecompInstaller.pinned(z, apk)!!
assertEquals("https://h/z.apk", pin.url)
assertEquals("a1", pin.tag)
assertEquals("c".repeat(64), pin.sha256)
val s = entry("sm64")
assertEquals(listOf(RecompCatalog.RECOMPA.id), s.sources)
assertEquals(RecompCatalog.DataKind.ROM, s.data.kind)
assertEquals(listOf("9bef1128717f958171a4afac3ed78ee2bb4e86ce"), s.data.sha1)
assertEquals("Pick sm64.z64.", s.data.note)
}
@Test fun aNamedReleaseFileDownloadsWithoutTheApi() {
val m = entry("otherm")
assertEquals("https://github.com/o/otherm/releases/download/1.0/OtherM.zip", RecompInstaller.pinned(m, m.builds.single())!!.url)
assertNull(RecompInstaller.pinned(entry("ironwail"), entry("ironwail").builds.single()))
}
@Test fun theNewestStableReleaseWithAMatchingAssetIsPicked() {
val body = """[
{"tag_name":"v3","draft":true,"assets":[{"name":"Game-Linux-ARM64.zip","browser_download_url":"https://d/3"}]},
{"tag_name":"v2-rc","prerelease":true,"assets":[{"name":"Game-Linux-ARM64.zip","browser_download_url":"https://d/2"}]},
{"tag_name":"v1","published_at":"2026-01-01T00:00:00Z","assets":[
{"name":"Game-Windows.zip","browser_download_url":"https://d/w"},
{"name":"Game-Linux-ARM64.zip","browser_download_url":"https://d/1","digest":"sha256:${"a".repeat(64)}"}]}
]"""
val stable = RecompInstaller.pickRelease(body, RecompCatalog.globRegex("Game-Linux-ARM64.zip"), prerelease = false)!!
assertEquals("v1", stable.tag)
assertEquals("a".repeat(64), stable.sha256)
assertNull(RecompInstaller.pickRelease(body, Regex("macOS"), prerelease = false))
}
@Test fun pcPortsMatchOwnedGamesByTitleAndConsoleRecompsNever() {
val steam = RecompData.Install(Store.STEAM, "Quake", temporary.newFolder("Quake"), "/root/.local/share/Steam/steamapps/common/Quake")
val found = RecompData.resolve(entry("ironwail"), RecompData.Inputs(listOf(steam), emptyList()))
assertEquals("/root/.local/share/Steam/steamapps/common/Quake", (found as RecompData.State.Found).guest)
val item = CatalogItem(Store.GOG, "1", "Quake", null)
assertTrue(RecompData.resolve(entry("ironwail"), RecompData.Inputs(emptyList(), listOf(RecompData.Owner(Store.GOG, "Quake™ Classic", item)))) is RecompData.State.Owned)
assertTrue(RecompData.resolve(entry("ironwail"), RecompData.Inputs(emptyList(), listOf(RecompData.Owner(Store.GOG, "Quake II", item)))) is RecompData.State.BringYourOwn)
val majora = RecompData.Install(Store.STEAM, "The Legend of Zelda: Majora's Mask", temporary.root, "/x")
assertTrue(RecompData.resolve(entry("zelda64recomp"), RecompData.Inputs(listOf(majora), emptyList())) is RecompData.State.BringYourOwn)
assertEquals(RecompData.titleKey("The Elder Scrolls III: Morrowind® Game of the Year Edition"), RecompData.titleKey("Elder Scrolls III - Morrowind"))
}
@Test fun theWrapperStartsTheProgramFromItsOwnFolder() {
val files = temporary.newFolder("files")
File(files, "Game-1.0").mkdirs()
File(files, "Game-1.0/game").apply {
writeText("#!/bin/sh\necho \"cwd=\$PWD\"\nfor a in \"\$@\"; do echo \"arg=\$a\"; done\n")
setExecutable(true)
}
val wrapper = File(files, RecompInstaller.WRAPPER).apply { writeText(RecompInstaller.wrapper("Game-1.0/game")) }
val p = ProcessBuilder("/bin/sh", wrapper.name, "it's").directory(files).redirectErrorStream(true).start()
p.waitFor(10, TimeUnit.SECONDS)
val out = p.inputStream.bufferedReader().readLines()
assertEquals(listOf("cwd=${File(files, "Game-1.0").canonicalPath}", "arg=it's"), out.map { it.replace(files.path, files.canonicalPath) })
}
@Test fun theEntryIsFoundInsideAVersionedFolder() {
val root = temporary.newFolder("stage")
File(root, "ironwail-0.8.2-linux-x64").mkdirs()
File(root, "ironwail-0.8.2-linux-x64/ironwail").writeText("x")
assertEquals("ironwail-0.8.2-linux-x64/ironwail", RecompInstaller.findEntry(root, "ironwail")!!.relativeTo(root).path)
assertNull(RecompInstaller.findEntry(root, "missing"))
}
@Test fun anUnnamedProgramIsGuessedFromTheArchive() {
val root = temporary.newFolder("guess")
fun elf(path: String, size: Int, program: Boolean) = File(root, path).apply {
parentFile.mkdirs()
val bytes = ByteArray(size)
byteArrayOf(0x7f, 'E'.code.toByte(), 'L'.code.toByte(), 'F'.code.toByte(), 2, 1).copyInto(bytes)
bytes[16] = 3
if (program) "/lib/ld-linux-x86-64.so.2".toByteArray().copyInto(bytes, 64)
writeBytes(bytes)
}
val e = RecompCatalog.Entry("sonic-recomp", "Sonic Recompiled", "Sonic", "Xbox 360", "recomp", "o/SonicRecomp", "", "", null,
listOf(RecompCatalog.Build(RecompCatalog.Platform.LINUX_X64, Regex("x"))), RecompCatalog.Data(RecompCatalog.DataKind.NONE, ""), listOf("recompa"))
elf("Game/libSDL2.so", 4000, program = false)
elf("Game/lib/helper", 9000, program = false)
elf("Game/crashpad", 5000, program = true)
val main = elf("Game/SonicRecompiled", 3000, program = true)
assertEquals(main, RecompInstaller.guessEntry(root, e))
val image = File(root, "Game/Sonic.AppImage").apply { writeText("x") }
assertEquals(image, RecompInstaller.guessEntry(root, e))
}
@Test fun anInstalledAndroidPortWithoutARecordIsNeverOfferedAnUpdate() {
val unknown = RecompInstaller.Installed("z", "android:com.z.mm", null, null, "android", temporary.root)
assertTrue(!RecompInstaller.isNewer(RecompInstaller.Release("a2", "q", "", "", null), unknown))
val known = RecompInstaller.Installed("z", "android:com.z.mm", "a1", "p", "android", temporary.root)
assertTrue(RecompInstaller.isNewer(RecompInstaller.Release("a2", "q", "", "", null), known))
}
}
@@ -41,7 +41,7 @@ class NavTabsTest {
@Test fun aFreshInstallShowsTheDefaultBarMoreAndHiddenTabs() {
assertEquals(listOf("steam", "desktop", "games", "downloads", "setup", "updates", NavTabs.MORE), navigationKeys(state()))
assertEquals(listOf("stores", "soundtracks", "components", "storage", "sync", "decky", "boot-movies"), NavTabs.more(state()))
assertEquals(listOf("stores", "soundtracks", "components", "storage", "sync", "decky", "boot-movies", "recomps"), NavTabs.more(state()))
assertEquals(TabPlace.HIDDEN, NavTabs.place(state(), "android-apps"))
assertEquals(TabPlace.HIDDEN, NavTabs.place(state(), "agent"))
assertFalse(com.droiddeck.launcher.agent.AgentTab.shown)
@@ -72,7 +72,7 @@ class NavTabsTest {
@Test fun shelvedTabsLeaveTheBarAndAddMoreAtTheEnd() {
place("desktop", TabPlace.MORE)
val s = state()
assertEquals(listOf("desktop", "stores", "soundtracks", "components", "storage", "sync", "decky", "boot-movies"), NavTabs.more(s))
assertEquals(listOf("desktop", "stores", "soundtracks", "components", "storage", "sync", "decky", "boot-movies", "recomps"), NavTabs.more(s))
assertEquals(NavTabs.MORE, navigationKeys(s).last())
assertFalse("desktop" in navigationKeys(s))
}
@@ -101,7 +101,7 @@ class NavTabsTest {
NavTabs.load(ctx)
val s = state()
assertEquals(listOf("steam", "games", "desktop", "components", "setup", "updates", NavTabs.MORE), navigationKeys(s))
assertEquals(listOf("storage", "sync", "decky", "boot-movies"), NavTabs.more(s))
assertEquals(listOf("storage", "sync", "decky", "boot-movies", "recomps"), NavTabs.more(s))
listOf("stores", "downloads", "soundtracks", "android-apps", "agent").forEach { assertEquals(it, TabPlace.HIDDEN, NavTabs.place(s, it)) }
val prefs = ctx.getSharedPreferences("session", Context.MODE_PRIVATE)
assertFalse(prefs.contains("gameStoresEnabled"))
@@ -123,7 +123,7 @@ class NavTabsTest {
assertEquals(TabPlace.HIDDEN, NavTabs.place(state(), "stores"))
assertEquals(TabPlace.MORE, NavTabs.place(state(), "components"))
assertEquals(TabPlace.BAR, NavTabs.place(state(), "downloads"))
assertEquals(listOf("components", "storage", "sync", "decky", "boot-movies"), NavTabs.more(state()))
assertEquals(listOf("components", "storage", "sync", "decky", "boot-movies", "recomps"), NavTabs.more(state()))
}
@Test fun movingSwapsWithTheNextVisibleTabAndPersists() {
@@ -134,9 +134,9 @@ class NavTabsTest {
}
@Test fun tabsMissingFromASavedOrderSlotInAfterTheirDefaultNeighbour() {
assertEquals(listOf("updates", "stores", "soundtracks", "components", "storage", "sync", "decky", "boot-movies", "android-apps", "agent", "steam", "desktop", "games", "downloads", "setup"),
assertEquals(listOf("updates", "stores", "soundtracks", "components", "storage", "sync", "decky", "boot-movies", "recomps", "android-apps", "agent", "steam", "desktop", "games", "downloads", "setup"),
NavTabs.arrange(listOf("updates", "steam")))
assertEquals(listOf("games", "downloads", "steam", "setup", "stores", "soundtracks", "desktop", "components", "storage", "sync", "decky", "boot-movies", "android-apps", "agent", "updates"),
assertEquals(listOf("games", "downloads", "steam", "setup", "stores", "soundtracks", "desktop", "components", "storage", "sync", "decky", "boot-movies", "recomps", "android-apps", "agent", "updates"),
NavTabs.arrange(listOf("games", "steam", "setup", "stores", "desktop", "components", "android-apps", "updates", "bogus")))
}
@@ -145,7 +145,7 @@ class NavTabsTest {
.putString("navTabOrder", "steam,games,soundtracks,stores,desktop,agent,components,android-apps,setup,updates")
.putString("navTabShelved", "soundtracks").commit()
NavTabs.load(ctx)
assertEquals(listOf("soundtracks", "storage", "sync", "decky", "boot-movies"), NavTabs.more(state()))
assertEquals(listOf("soundtracks", "storage", "sync", "decky", "boot-movies", "recomps"), NavTabs.more(state()))
place("sync", TabPlace.BAR)
NavTabs.load(ctx)
assertTrue("sync" in navigationKeys(state()))
@@ -0,0 +1,29 @@
package com.droiddeck.launcher.ui
import com.droiddeck.launcher.runtime.RecompCatalog
import com.droiddeck.launcher.runtime.RecompData
import org.junit.Assert.assertEquals
import org.junit.Test
class RecompFiltersTest {
private fun row(id: String, origin: String, vararg platforms: RecompCatalog.Platform) = 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,
)
@Test fun nativeMeansTheBuildThatWouldInstallRunsWithoutFexOrProton() {
val rows = listOf(
row("arm", "N64", RecompCatalog.Platform.LINUX_ARM64, RecompCatalog.Platform.WINDOWS_X64),
row("apk", "N64", RecompCatalog.Platform.ANDROID, RecompCatalog.Platform.LINUX_X64),
row("fex", "PC", RecompCatalog.Platform.LINUX_X64),
row("wine", "Xbox 360", RecompCatalog.Platform.WINDOWS_X64),
)
assertEquals(listOf("arm", "apk"), rows.filter { it.matches(RecompFilter.NATIVE) }.map { it.entry.id })
}
@Test fun systemChipsListOriginsByCountAndSkipSingletonsAndBlanks() {
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))
}
}
+176
View File
@@ -0,0 +1,176 @@
# Recomps
The Recomps tab (More → Recomps, key `recomps`) lists PC builds of console and PC games made
by static recompilation, decompilation or engine reimplementation. It installs the build that
runs best on the device and links the game files the player already owns from a store
DroidDeck is signed in to. It never downloads ROMs, disc images or game files.
## The ecosystem (researched 2026-11-30)
- **Recomp Launcher** (`elripalda/RecompLauncher`, GPL-3.0; Xarishark is its most active
contributor). A Tauri desktop launcher for Windows, Linux x86-64 and macOS. It has no Android
or arm64 Linux build. Its catalog `https://recomplauncher.com/pc-catalog.json` lists about 2,270
apps, each with fields such as `repo, tag, assets{windows|linux|macos}, files{sha256}, needs,
setup_steps`. It never ships game data: "Easy Setup" asks for the player's disc or folder,
then runs the recomp's own prepare step. Recomps can describe that step in a
`recomplauncher.json` in their release (schema at
`https://recomplauncher.com/schema/recomplauncher.json`). The FAQ says it is free, has no ads
and keeps usage stats opt-in. The catalog data has no stated licence, and many `needs` lines
are machine-written.
- **Recompa** (`kalasyan/recompa`, GPL-3.0). An Android hub for recomps shipped as APKs. Its
`https://recompa.app/index.json` lists about 790 ports with Android package names, signer
hashes, ABIs and game-data requirements (accepted sha1s, conversions such as v64→z64, and
where the file goes). The data has no stated licence.
- **PortMaster** (`PortsMaster/PortMaster-New`, MIT). Its `ports.json` lists about 1,500 arm64
Linux ports. 266 of them link a Steam page and about 64 a GOG page, so they can be matched to
owned games. Ports expect PortMaster's runtime (`control.txt`, gptokeyb, gl4es).
- Most recomps need a console dump: N64 ROMs (Zelda64Recomp, Starfox64Recomp, BanjoRecomp, the
Ship of Harkinian family) or Xbox 360 files (XenonRecomp: UnleashedRecomp, MarathonRecomp).
The ones that fit DroidDeck's stores are source ports and engine reimplementations whose data
is sold on Steam or GOG: OpenMW (Morrowind), DevilutionX (Diablo, GOG), OpenRCT2, Fallout 1/2
CE, Quake ports, Xash3D (Half-Life), Julius/Augustus (Caesar III), VCMI and fheroes2 (Heroes
III and II), CorsixTH and OpenLoco.
- N64Recomp projects (Zelda, Starfox, Banjo), DevilutionX, Xash3D and fheroes2 publish **arm64
Linux** builds, which run natively in DroidDeck's runtime. Most others publish x86-64 Linux,
which runs through FEX, and Windows, which runs through Proton.
## Catalog
DroidDeck keeps no catalog. `RecompCatalog` downloads the two community catalogs, caches them in
`files/recomps/`, revalidates each with its ETag after 6 hours, and merges them on the device. Parsing
both takes about 0.4 s.
1. Recomp Launcher's `https://recomplauncher.com/pc-catalog.json` (about 2.4 MB gzipped) supplies
Windows and Linux builds:
- `assets` globs become patterns, and `files` names give pinned files and sha256s.
- `boot.start` / `start_linux` name the program, `boot.files.what` or `needs` the data, and
`setup_required` / `setup_steps` the setup note.
- Archived, `soon`, non-GitHub and `installer` / `not-a-game` / `source` entries are left out, as
are Flatpak bundles and 32-bit or arm64 Windows builds.
2. Recompa's `https://recompa.app/index.json` (about 1.2 MB gzipped) supplies Android APKs. Each port
uses its fork with the most downloads that has a sha256, a package and a signer. `assets[0]` becomes
the data requirement, with accepted sha1s. Ports without arm64, or needing a newer SDK, are left out,
as is Recompa's own app.
A Recompa port with the same GitHub repo (or id) as a Recomp Launcher app adds its APK to that app.
The card lists the catalogs an entry came from, and the README credits both. As of 2026-11-30 this
gives 2,646 entries:
| Build | Entries |
|---|---|
| Linux arm64 | 40 |
| Linux x86-64 | 1,141 |
| Windows x86-64 | 2,007 |
| Android | 768 |
82% of builds name their release file, so they download without the GitHub releases API. The others
are resolved through that API at install time, which allows 60 unauthenticated calls an hour per
address.
The build is chosen in the order linux-arm64 (native), android, linux-x64 (FEX), windows-x64
(Proton). When the catalog names no program, one is guessed after unpacking:
- Linux: an AppImage, else the executable ELF whose name is closest to the project's, nearest the top.
- Windows: `GameExePicker`'s best exe.
## Installing
`RecompInstaller.install`:
1. Downloads the asset, checking its sha256.
2. **Linux build:** `bsdtar` in the guest unpacks it into the app cache, keeping modes and
symlinks, and unpacks once more when the result is a single archive (Zelda's zip holds a
tar.gz). It then finds `entry` up to four folders down. An AppImage, whether downloaded
directly or found inside the archive, goes to `AppImageManager.import`. Anything else becomes
a user app (`UserApps.addPrepared`): the unpacked tree moves to
`/opt/droiddeck-apps/<id>/files`, and a `droiddeck-recomp` wrapper, which starts the program from
its own folder, becomes its entry.
`droiddeck-script-run` launches it, so `droiddeck-fex` decides between native and FEX from
the folder's ELFs, exactly as for any added Linux app. It also shows on the Desktop page.
3. **Windows build:** unpacks into `<first Games folder or the store install root>/Recomps/<id>`
and registers the exe with `AddedGames.addExe`. It then appears in the Library (Custom) and
runs through Proton.
4. **Android build:** checks the APK's package name and signing certificate against the catalog,
then installs it through `PackageInstaller` (`RecompAndroid`). The confirmation prompt comes from
the system. The install shows as Play and Remove on the card, and in the Apps tab. The installed tag
is kept in `files/recomps-android/<package>`.
5. Writes `recomp-id`, `recomp-tag`, `recomp-published` and `recomp-platform` beside the
install. `RecompInstaller.installed` finds installs by those files. An update installs the
new release first and then deletes the old folder.
## Game data
The catalogs name the game a PC port needs (`game`), but not its store ids. For PC ports,
`RecompData` compares that title with the player's installs (store sidecars and Steam client
libraries) and owned games (`StoresState.library` and the Steam page). Titles are compared without
case, punctuation, a leading "The", or edition words such as GOTY, Definitive, Enhanced or Complete.
- **Installed:** the card shows "Installed on Steam" and the guest folder to point the program at.
- **Owned:** the card offers "Install game".
- **Otherwise:** the card shows what the catalog says the game needs.
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.
## Tested
These device runs used the earlier hand-made list. Each recomp is still installed and launched by the
same code.
- **Retroid Pocket Duo:**
- Zelda 64: Recompiled v1.2.2 (linux-arm64) installed and reached its own Select ROM screen natively.
- Ironwail v0.8.2 (linux-x64) ran through FEX and asked for its `-basedir` (Quake's folder).
- Ship of Harkinian (Android, Recompa): the APK passed the package and signer checks, Android's
install prompt appeared, and after confirming it the card showed Play, which launched the app.
- Ports already installed were recognised.
- The top screen shows the page; the bottom screen's rail is labelled Recomps.
- **Pocket FIT Elite (portrait 1080×1920):**
- The More tile, the one-column page and installs work.
- A launch of an x86 Linux build stopped with exit 126: FEX needs the Steam Linux Runtime
(sniper), and that device had never opened Steam. This applies to every x86 Linux app in
DroidDeck.
- **Unit tests:** `RecompsTest` parses and merges sample feeds and covers pins, signed APKs, title
matching, release picking, program guessing and the wrapper (run under `/bin/sh`). `NavTabsTest`
covers the tab.
## Not done yet
- **Recompa delivery rules.** Hand a chosen ROM to an Android port the way Recompa's `delivery`
says: an in-app picker, a shared folder or an intent.
- **Recomp Launcher setup.** Run its `recomplauncher.json` `inputs` / `prepare` steps, so recomps that
build from the player's dump (Unleashed, Marathon, the `setup` entries) can be set up from DroidDeck.
Xarishark offered help on the DroidDeck Discord (2026-11-12).
- **Choosing a build.** Let the player choose another build when an entry has several (for example
the Android port instead of the FEX one).
- **Linking your own folder.** For data copied from a PC: a folder picker the card remembers.
- **Native builds the catalogs miss.** Recomp Launcher lists one Linux build per app, usually x86-64.
Several projects (Zelda64Recomp, Starfox64Recomp, BanjoRecomp, DevilutionX) also publish arm64
builds. Trying the arm64 sibling of a Linux asset first would run those natively instead of
through FEX.
- **ROM checks.** Hash a chosen ROM against `sha1` and say whether it is the right one.
- **x86 runtime hint.** A linux-x64 build needs Steam opened once so the FEX runtime (sniper) is
installed. Show that on the card, or fall back to the Windows build.
- **Steam ownership** relies on the Steam page's library or the Steam store sign-in. A game
installed by the Steam client counts as installed regardless. Title matching can miss renamed
editions.
- **Recomp setup steps.** Some recomps build themselves from the player's data with bundled
Python (Recompia). They need executable storage, so they must stay inside the Linux root, never
under `/media`; see the Discord thread on Recompia from 2026-11-15.