fix(xbox): games run from their own folder on the short drive, not the drive root (#1804)

* fix(xbox): keep the game in its own folder on the short drive instead of at the drive root

* fix(xbox): SD card Xbox games can read their own package files

Xodus mounts a store library on the selected SD card at /mnt/droiddeck-stores/<card> and links the launch view to it, but game sessions only bound that library as /mnt/droiddeck-sd. The links were dangling inside the game, so MicrosoftGame.Config, appxmanifest.xml and XCurl.dll could not be read and GDK games stopped with "Failed to initialize GDK". Game sessions now bind the same store roots Xodus uses.

* fix(xbox): give the SD Steam library its own store path when another store root shares the card

externalRootsForXodus added the selected Steam library's Games folder with the card's guest path even when another store root on the same card already used it, so both bound to one destination. It now takes a path-derived suffix in that case, the same way externalRoots separates its own roots.
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-10-30 10:10:23 -04:00
1 parent 6ffe675a57
commit d31f234f74
5 files changed
+46 -18

No files matched your search

@@ -1036,7 +1036,7 @@ class SessionService : Service() {
Log.w(TAG, "added games: ${root.host} is not a readable folder this session")
}
}
for ((host, guest) in com.droiddeck.launcher.stores.StoreInstallRoot.externalRoots(this)) {
for ((host, guest) in com.droiddeck.launcher.stores.StoreInstallRoot.externalRootsForXodus(this)) {
if (host.isDirectory && host.canRead()) {
File(LinuxRuntime.rootDir(this), guest.removePrefix("/")).mkdirs()
binds.add(host.path + ":" + guest)
@@ -137,10 +137,7 @@ object StoreInstallRoot {
.filter { !isInternal(context, it) && (library == null || !it.absolutePath.startsWith("$library/")) }
.map { root ->
val base = guestFor(context, root)
val guest = if (used.add(base)) base else {
val suffix = "%08x".format(CRC32().apply { update(root.absolutePath.toByteArray()) }.value)
"$base-$suffix".also { used.add(it) }
}
val guest = if (used.add(base)) base else "$base-${pathKey(root)}".also { used.add(it) }
root to guest
}
}
@@ -168,15 +165,20 @@ object StoreInstallRoot {
/** 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 roots = externalRoots(context)
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
?.takeUnless { isInternal(context, it) } ?: return roots
return withSelectedLibrary(roots, selectedLibrary, guestFor(context, selectedLibrary))
}
internal fun withSelectedLibrary(roots: List<Pair<File, String>>, library: File, base: String): List<Pair<File, String>> {
if (roots.any { it.first.absolutePath == library.absolutePath }) return roots
val guest = if (roots.none { it.second == base }) base else "$base-${pathKey(library)}"
return roots + (library to guest)
}
private fun pathKey(root: File): String = "%08x".format(CRC32().apply { update(root.absolutePath.toByteArray()) }.value)
fun externalBindSpecs(context: Context): List<String> = externalBindSpecs(externalRoots(context), LinuxRuntime.rootDir(context))
fun externalBindSpecsForXodus(context: Context): List<String> =
@@ -192,7 +194,7 @@ object StoreInstallRoot {
private fun guestFor(context: Context, root: File): String {
val sm = context.getSystemService(StorageManager::class.java)
val uuid = runCatching { sm?.getStorageVolume(root)?.uuid }.getOrNull()?.takeIf { it.isNotBlank() }?.replace(Regex("[^A-Za-z0-9-]"), "")
val key = uuid ?: "%08x".format(CRC32().apply { update(root.absolutePath.toByteArray()) }.value)
val key = uuid ?: pathKey(root)
return "$GUEST_EXTERNAL/$key"
}