fix(xbox): mount selected SD library in Xodus

This commit is contained in:
XxJSONDeruloxX authored and Kurt Himebauch committed 2026-10-23 23:56:24 -04:00
1 parent 2c8ae3753c
commit 4a0eb14d1f
5 files changed
+34 -3

No files matched your search

@@ -104,8 +104,22 @@ object StoreInstallRoot {
.map { it to guestFor(context, it) }
}
/** Xodus has its own PRoot mount table and cannot see the selected Steam library's SD bind. */
fun externalRootsForXodus(context: Context): List<Pair<File, String>> {
val roots = externalRoots(context).toMutableList()
val selectedLibrary = GameStorage.effective(context)?.let { File(it.path, ON_VOLUME) }
?.takeUnless { isInternal(context, it) }
if (selectedLibrary != null && roots.none { it.first.absolutePath == selectedLibrary.absolutePath }) {
roots += selectedLibrary to guestFor(context, selectedLibrary)
}
return roots
}
fun externalBindSpecs(context: Context): List<String> = externalBindSpecs(externalRoots(context), LinuxRuntime.rootDir(context))
fun externalBindSpecsForXodus(context: Context): List<String> =
externalBindSpecs(externalRootsForXodus(context), LinuxRuntime.rootDir(context))
internal fun externalBindSpecs(roots: List<Pair<File, String>>, guestRoot: File): List<String> =
roots.mapNotNull { (host, guest) ->
if (!host.isDirectory || !host.canRead()) return@mapNotNull null
@@ -128,6 +142,9 @@ object StoreInstallRoot {
fun guestPath(context: Context, host: File): String = externalGuestPath(context, host) ?: host.path
fun guestPathForXodus(context: Context, host: File): String =
externalGuestPath(host, externalRootsForXodus(context)) ?: host.path
internal fun externalGuestPath(host: File, roots: List<Pair<File, String>>): String? {
val path = host.absolutePath
for ((root, guest) in roots.sortedByDescending { it.first.absolutePath.length }) {
@@ -39,7 +39,7 @@ internal class XboxInstaller(private val app: Context, private val item: Catalog
var sequence = -1L
try {
val source = if (content) selected else item.id
val guestFolder = StoreInstallRoot.guestPath(app, folder)
val guestFolder = StoreInstallRoot.guestPathForXodus(app, folder)
val selection = if (content) emptyList() else listOf("--selected-content-id", selected)
Xodus.start(app, listOf("streaming", source, guestFolder, "--market", market,
"--progress-json", "--control-stdin") + selection).use { process ->
@@ -46,7 +46,7 @@ internal object XboxRuntime {
val market = game.second.extra["market"]?.takeIf { it.matches(Regex("[A-Z]{2}")) } ?: Xodus.market()
val directory = views.create(app.filesDir)
val process = try {
Xodus.start(app, listOf("run", StoreInstallRoot.guestPath(app, game.first), "droiddeck:prepare", "--exe", game.second.exe,
Xodus.start(app, listOf("run", StoreInstallRoot.guestPathForXodus(app, game.first), "droiddeck:prepare", "--exe", game.second.exe,
"--materialize-chain", "--market", market), launchDirectory = directory, credentialGeneration = credentials)
} catch (e: Exception) { XboxLaunchViews.remove(directory); throw e }
if (!launches.attach(token, process)) { process.close(); error("Xbox launch was cancelled") }
@@ -81,7 +81,7 @@ internal object Xodus {
networkLink.start()
val runtime = (runtimeDirectory ?: File(app.filesDir, "xbox-runtime")).apply { mkdirs() }
val command = LinuxRuntime.command(app, null, null, Environment.getExternalStorageDirectory(),
StoreInstallRoot.externalBindSpecs(app), listOf(
StoreInstallRoot.externalBindSpecsForXodus(app), listOf(
"/usr/bin/env", "HOME=/root", "XODUS_LOG=off", "RUST_LOG=off",
"XDG_RUNTIME_DIR=${runtime.path}", "DROIDDECK_XBOX_CREDENTIAL_SOCKET=${credentials.name}", binary,
) + args)