From dcbfc0bb069baf62f4f906d538a88a05d15a1cb0 Mon Sep 17 00:00:00 2001 From: The412Banner Date: Sat, 26 Sep 2026 15:36:23 -0400 Subject: [PATCH] First Steam session: place Valve's ARM64 Proton before the client first starts The runtime setup now also fetches Proton Experimental (ARM64) and its appmanifest from a catalog of their own (steam-seed.json) and unpacks them where the client keeps them. At the first sign-in the compatibility tool is already installed and the default, with no install dialog, no download and no client restart; the client adopts the manifest and updates it like any other app. Done once: an install the client fetched itself, or one the user removed, is left alone. A failed fetch stops nothing - the session asks the client for it after sign-in, as before. --- .../com/droiddeck/launcher/SessionActivity.kt | 34 ++++++++++++++++--- .../launcher/runtime/DesktopCatalog.kt | 19 +++++++++-- 2 files changed, 46 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt index 2fb957f21c..e000581a20 100644 --- a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt @@ -237,7 +237,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { val needRuntime = com.droiddeck.launcher.runtime.LinuxRuntimeInstaller.installedVersion(this) == null val needDesktop = intent.getStringExtra(SessionService.EXTRA_MODE) == SessionService.MODE_DESKTOP && !com.droiddeck.launcher.runtime.DesktopCatalog.desktopInstalled(this) - if (needRuntime || needDesktop) installThenStart(needRuntime, needDesktop) + val needProton = intent.getStringExtra(SessionService.EXTRA_MODE) == SessionService.MODE_STEAM && + com.droiddeck.launcher.runtime.DesktopCatalog.protonSeedNeeded(this) + if (needRuntime || needDesktop || needProton) installThenStart(needRuntime, needDesktop, needProton) } hud = PerfHud(this) hud.onPresentingWindowChanged = { @@ -512,17 +514,23 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { * First Play (or Desktop) on a fresh install: the runtime, and for the desktop its package, * are downloaded and unpacked here, on the loading screen's own line and bar, and the session * starts when they are in. Nothing else changes. + * + * The first Steam session also gets Valve's ARM64 Proton here, before the client has ever + * started, so the compatibility tool is installed and the default at sign-in with no install + * dialog, download or client restart. Not being able to fetch it stops nothing: the session + * then asks the client for it after sign-in, as it always has. */ - private fun installThenStart(runtime: Boolean, desktop: Boolean) { + private fun installThenStart(runtime: Boolean, desktop: Boolean, proton: Boolean = false) { if (SessionState.stopRequested) return installingRuntime = true - SessionState.installing = if (runtime) "runtime" else "desktop" + SessionState.installing = if (runtime) "runtime" else if (desktop) "desktop" else "proton" SessionEvents.transition( SessionPhase.INSTALLING_RUNTIME, - if (runtime) "runtime.installing" else "desktop.installing", + "${SessionState.installing}.installing", mapOf("component" to SessionState.installing), ) - loading.step = if (runtime) "downloading the Linux runtime" else "downloading the desktop" + loading.step = if (runtime) "downloading the Linux runtime" else if (desktop) "downloading the desktop" + else "downloading Proton Experimental (ARM64)" loading.percent = -1 Thread({ var failedComponent: String? = null @@ -537,6 +545,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { problem = installDesktop() if (problem == null) SessionEvents.record("desktop.ready") else failedComponent = "desktop" } + if (problem == null && proton && !SessionState.stopRequested) { + SessionState.installing = "proton" + SessionEvents.transition(SessionPhase.INSTALLING_RUNTIME, "proton.installing", mapOf("component" to "proton")) + val protonProblem = installProton() + if (protonProblem == null) SessionEvents.record("proton.ready") + else SessionEvents.record("proton.skipped", mapOf("reason" to protonProblem)) + } uiHandler.post { installingRuntime = false SessionState.installing = null @@ -602,6 +617,15 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback { return problem?.let { "The desktop did not install ($it). Check the connection and press Desktop again." } } + /** Null when the ARM64 Proton is in, else why not; the session goes on either way. */ + private fun installProton(): String? { + uiHandler.post { loading.percent = -1; loading.step = "downloading Proton Experimental (ARM64)" } + val catalog = com.droiddeck.launcher.runtime.DesktopCatalog + val entry = catalog.fetch(catalog.STEAM_SEED_URL)?.firstOrNull { it.id == catalog.PROTON_SEED_ID } + ?: return "catalog unreachable" + return catalog.install(this, entry, progressFor("Proton Experimental (ARM64)", entry.size / 1_000_000)) + } + override fun surfaceCreated(holder: SurfaceHolder) { if (installingRuntime || SessionState.stopRequested) return if (!SessionState.running) { diff --git a/app/src/main/java/com/droiddeck/launcher/runtime/DesktopCatalog.kt b/app/src/main/java/com/droiddeck/launcher/runtime/DesktopCatalog.kt index 2de78f99c6..cda22eb178 100644 --- a/app/src/main/java/com/droiddeck/launcher/runtime/DesktopCatalog.kt +++ b/app/src/main/java/com/droiddeck/launcher/runtime/DesktopCatalog.kt @@ -18,6 +18,12 @@ import java.io.File object DesktopCatalog { private const val TAG = "DesktopCatalog" const val CATALOG_URL = "https://raw.githubusercontent.com/The412Banner/winlator-contents/main/desktop.json" + /** + * Valve's Proton Experimental (ARM64) with its appmanifest, laid out as the client keeps it. + * In a catalog of its own so it never shows among the packages a user picks from. + */ + const val STEAM_SEED_URL = "https://raw.githubusercontent.com/The412Banner/winlator-contents/main/steam-seed.json" + const val PROTON_SEED_ID = "proton-arm64" class Entry( val id: String, val name: String, val tier: Int, val version: String, val kind: String, @@ -26,8 +32,8 @@ object DesktopCatalog { val icon: String, val category: String, ) - fun fetch(): List? { - val body = Downloader.downloadString(CATALOG_URL) ?: return null + fun fetch(url: String = CATALOG_URL): List? { + val body = Downloader.downloadString(url) ?: return null return try { val json = JSONObject(body) val arr = json.getJSONArray("packages") @@ -57,6 +63,15 @@ object DesktopCatalog { fun installed(context: Context, id: String): String? = FileUtils.readString(marker(context, id))?.trim()?.takeIf { it.isNotEmpty() } + /** + * True until the ARM64 Proton has been placed once. Its appmanifest counts too, so an install + * the client fetched itself is never overwritten; after the first placement the client owns it + * and updates it like any other app, and a user who removes it is not given it back. + */ + fun protonSeedNeeded(context: Context): Boolean = + installed(context, PROTON_SEED_ID) == null && + !File(LinuxRuntime.rootDir(context), "root/.local/share/Steam/steamapps/appmanifest_4427310.acf").isFile + // labwc comes with the hosted desktop package itself (its launcher is staged by the app at // every session, so it cannot tell whether the package is there); SessionFiles uses the same test. fun desktopInstalled(context: Context): Boolean =