Game storage: a second Steam library on an SD card or a chosen folder

The runtime already knew how to register /mnt/bannerlator-sd with the client; the app never
bound anything there, so the client only ever saw internal storage. The Steam cog's Game storage
section offers every removable volume (through the app's own folder on it, the one place a card
lets a targetSdk-28 app write) and any folder from the File Manager, proven writable first. The
session binds the choice and names it (BL_LIBRARY_LABEL); bannerlator-steam-library registers it,
or forgets it when nothing is bound. The client does the rest: asks where to install, shows both
on Storage, moves games between them. device.txt records the choice.
This commit is contained in:
The412Banner committed 2026-09-22 08:18:20 -04:00
1 parent 2cbd015d80
commit fa25451766
8 files changed
+171 -3

No files matched your search

@@ -50,6 +50,7 @@ import com.steamdeck.launcher.ui.RomsDialog
import com.steamdeck.launcher.files.InAppFilePicker
import com.steamdeck.launcher.session.SessionArtifacts
import com.steamdeck.launcher.session.SessionState
import com.steamdeck.launcher.session.GameStorage
/**
* The whole app outside a session: is the runtime installed, is there a newer one, frame
@@ -121,6 +122,11 @@ class MainActivity : ComponentActivity() {
private var touchMode by mutableStateOf(SessionPrefs.TOUCH_AUTO)
private var oscMode by mutableStateOf(SessionPrefs.OSC_AUTO)
private var renderer by mutableStateOf("pixman")
private var gameStorage by mutableStateOf("")
private var storageOptions by mutableStateOf<List<Pair<String, String>>>(emptyList())
private val pickGameStorage = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { r ->
if (r.resultCode == RESULT_OK) InAppFilePicker.pickedPath(r.data)?.let { path -> setGameStorage(path, GameStorage.labelFor(this, path)) }
}
private var emulators by mutableStateOf<List<Pair<String, String>>>(emptyList())
private var showEmulatorHelp by mutableStateOf(false)
private var romsDir by mutableStateOf<String?>(null)
@@ -204,6 +210,8 @@ class MainActivity : ComponentActivity() {
directAudio = if (mode == SessionService.MODE_STEAM) directAudio else null,
mic = if (mode == SessionService.MODE_STEAM) mic else null,
renderer = if (mode == SessionService.MODE_DESKTOP) renderer else null,
gameStorage = if (mode == SessionService.MODE_STEAM) gameStorage else null,
storageOptions = storageOptions,
),
ModeSettingsActions(
onResolution = { cap -> SessionPrefs.setResolutionCap(this, mode, cap); resolutionCap = cap },
@@ -228,6 +236,10 @@ class MainActivity : ComponentActivity() {
}
},
onRenderer = { r -> SessionPrefs.setDesktopRenderer(this, r); renderer = r },
onGameStorage = { path, label -> setGameStorage(path, label) },
onPickGameStorageFolder = {
pickGameStorage.launch(InAppFilePicker.buildDirIntent(this, "Choose the game storage folder", gameStorage.ifEmpty { null }))
},
onDismiss = { settingsMode = null },
),
)
@@ -367,9 +379,24 @@ class MainActivity : ComponentActivity() {
directAudio = SessionPrefs.directAudio(this)
mic = SessionPrefs.micEnabled(this)
renderer = SessionPrefs.desktopRenderer(this)
gameStorage = SessionPrefs.gameStorage(this)
storageOptions = GameStorage.options(this).map { it.label to it.path }
settingsMode = mode
}
/** A second Steam library, proven writable first; "" = internal only. */
private fun setGameStorage(path: String, label: String) {
if (path.isNotEmpty()) {
val problem = GameStorage.prepare(path)
if (problem != null) {
android.widget.Toast.makeText(this, "Not usable: $problem", android.widget.Toast.LENGTH_LONG).show()
return
}
}
SessionPrefs.setGameStorage(this, path, label)
gameStorage = path
}
private fun refreshDrivers() {
val lm = LinuxVulkanDriverManager(this)
linuxRows = LinuxVulkanDriver.optionValues(this).map { id ->