From 546574e982806a9ff8042987cbd6d18a7cbcf7ed Mon Sep 17 00:00:00 2001 From: XxJSONDeruloxX Date: Fri, 23 Oct 2026 20:58:25 -0400 Subject: [PATCH] fix(xbox): enable proot fast path in Xodus --- .../launcher/runtime/LinuxRuntime.java | 5 +++++ .../droiddeck/launcher/stores/xbox/Xodus.kt | 21 ++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/droiddeck/launcher/runtime/LinuxRuntime.java b/app/src/main/java/com/droiddeck/launcher/runtime/LinuxRuntime.java index 11be5bf9b4..6d17f2d75a 100644 --- a/app/src/main/java/com/droiddeck/launcher/runtime/LinuxRuntime.java +++ b/app/src/main/java/com/droiddeck/launcher/runtime/LinuxRuntime.java @@ -110,6 +110,11 @@ public final class LinuxRuntime { File root = rootDir(context); List binds = binds(context, sessionRoot, runtimeDir, externalStorage, extraBinds); if (sessionRoot != null) lastBinds = binds; + return commandWithBinds(context, root, binds, guestCommand); + } + + public static List commandWithBinds(Context context, File root, List binds, + List guestCommand) { List cmd = prootPrefix(context, root, "/root"); for (String spec : binds) bind(cmd, spec); cmd.addAll(guestCommand); diff --git a/app/src/main/java/com/droiddeck/launcher/stores/xbox/Xodus.kt b/app/src/main/java/com/droiddeck/launcher/stores/xbox/Xodus.kt index c7f706d268..94b8138253 100644 --- a/app/src/main/java/com/droiddeck/launcher/stores/xbox/Xodus.kt +++ b/app/src/main/java/com/droiddeck/launcher/stores/xbox/Xodus.kt @@ -5,6 +5,7 @@ import android.os.Environment import com.droiddeck.launcher.core.AddonPack import com.droiddeck.launcher.runtime.LinuxNetworkLinkComponent import com.droiddeck.launcher.runtime.LinuxRuntime +import com.droiddeck.launcher.runtime.ProotFastPath import com.droiddeck.launcher.session.SessionPrefs import com.droiddeck.launcher.stores.StoreInstallRoot import org.json.JSONObject @@ -80,11 +81,24 @@ internal object Xodus { networkLink.publish() networkLink.start() val runtime = (runtimeDirectory ?: File(app.filesDir, "xbox-runtime")).apply { mkdirs() } - val command = LinuxRuntime.command(app, null, null, Environment.getExternalStorageDirectory(), - StoreInstallRoot.externalBindSpecsForXodus(app), listOf( + val root = LinuxRuntime.rootDir(app) + val external = Environment.getExternalStorageDirectory() + val extraBinds = StoreInstallRoot.externalBindSpecsForXodus(app) + val binds = LinuxRuntime.binds(app, null, null, external, extraBinds) + val fastPathPreloaded = runCatching { + File(root, "etc/ld.so.preload").useLines { lines -> lines.any { it.trim() == ProotFastPath.LIBRARY } } + }.getOrDefault(false) + val fastPathKey = if (ProotFastPath.enabled(app) && fastPathPreloaded && + File(root, ProotFastPath.LIBRARY.removePrefix("/")).isFile) ProotFastPath.key(root, binds) else null + val guestCommand = mutableListOf( "/usr/bin/env", "HOME=/root", "XODUS_LOG=off", "RUST_LOG=off", "XDG_RUNTIME_DIR=${runtime.path}", "DROIDDECK_XBOX_CREDENTIAL_SOCKET=${credentials.name}", binary, - ) + args) + ) + fastPathKey?.let { key -> + guestCommand.addAll(guestCommand.lastIndex, ProotFastPath.guestEnv(root, binds, key)) + } + guestCommand.addAll(args) + val command = LinuxRuntime.commandWithBinds(app, root, binds, guestCommand) val builder = ProcessBuilder(command).directory(LinuxRuntime.rootDir(app)) if (launchDirectory != null) builder.environment()["TMPDIR"] = launchDirectory.path builder.environment().apply { @@ -92,6 +106,7 @@ internal object Xodus { put("PROOT_LOADER", LinuxRuntime.prootLoader(app).path) put("PROOT_TMP_DIR", LinuxRuntime.prootTempDir(app).path) if (SessionPrefs.prootNoSeccomp(app)) put("PROOT_NO_SECCOMP", "1") + fastPathKey?.let { ProotFastPath.hostEnv(it).let { (key, value) -> put(key, value) } } LinuxRuntime.prootLibraryPath(app).takeIf { it.isNotEmpty() }?.let { put("LD_LIBRARY_PATH", it) } } val digest = java.security.MessageDigest.getInstance("SHA-256")