From 76ba054a84f667ba822b135ef169eb32cb2cc216 Mon Sep 17 00:00:00 2001 From: The412Banner Date: Wed, 23 Sep 2026 06:35:38 -0400 Subject: [PATCH] added games: bind the chosen Games folder into the session at /root/Games, so a folder on an SD card or anywhere else is seen (it was skipped unless it sat inside internal storage, the ROMs folder or the app's own SD library) --- .../java/com/steamdeck/launcher/frontend/AddedGames.kt | 9 +++++++++ .../com/steamdeck/launcher/session/SessionService.kt | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/app/src/main/java/com/steamdeck/launcher/frontend/AddedGames.kt b/app/src/main/java/com/steamdeck/launcher/frontend/AddedGames.kt index 76d645c8f9..8a6204a53b 100644 --- a/app/src/main/java/com/steamdeck/launcher/frontend/AddedGames.kt +++ b/app/src/main/java/com/steamdeck/launcher/frontend/AddedGames.kt @@ -39,8 +39,17 @@ object AddedGames { ) /** Where a host path appears inside the session, or null when the session cannot see it. */ + /** Where the chosen Games folder itself is bound inside the session, wherever it is on the device. */ + const val GUEST_DIR = "/root/Games" + fun guestPath(context: Context, host: File): String? { val path = host.absolutePath + // The Games folder is bound on its own, so a folder anywhere - an SD card, a USB drive - + // works without being inside one of the other binds. + SessionPrefs.addedGamesDir(context).takeIf { it.isNotEmpty() }?.let { dir -> + if (path == dir) return GUEST_DIR + if (path.startsWith("$dir/")) return "$GUEST_DIR/" + path.removePrefix("$dir/") + } val storage = Environment.getExternalStorageDirectory().absolutePath if (path.startsWith("$storage/")) return "/root/Storage/" + path.removePrefix("$storage/") SessionPrefs.romsDir(context).takeIf { it.isNotEmpty() }?.let { roms -> diff --git a/app/src/main/java/com/steamdeck/launcher/session/SessionService.kt b/app/src/main/java/com/steamdeck/launcher/session/SessionService.kt index 9e054bb982..a9b4064fd6 100644 --- a/app/src/main/java/com/steamdeck/launcher/session/SessionService.kt +++ b/app/src/main/java/com/steamdeck/launcher/session/SessionService.kt @@ -394,6 +394,16 @@ class SessionService : Service() { } else { Log.i(TAG, "game storage: internal only") } + // The user's own games folder (the Steam cog's "Added games"), bound at a fixed place so + // the shortcuts the app writes point somewhere whatever storage the folder is on. + val games = SessionPrefs.addedGamesDir(this).takeIf { it.isNotEmpty() }?.let { File(it) } + if (games != null && games.isDirectory && games.canRead()) { + File(home, "Games").mkdirs() + binds.add(games.path + ":" + com.steamdeck.launcher.frontend.AddedGames.GUEST_DIR) + Log.i(TAG, "added games: $games -> ${com.steamdeck.launcher.frontend.AddedGames.GUEST_DIR}") + } else if (games != null) { + Log.w(TAG, "added games: $games is not a readable folder this session") + } val roms = SessionPrefs.romsDir(this).takeIf { it.isNotEmpty() }?.let { File(it) } if (roms != null && roms.isDirectory && roms.canRead()) { File(home, "ROMs").mkdirs()