mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-25 07:46:01 +00:00
fix(storage): warn when game storage is formatted as FAT32 (#2883)
* fix(storage): warn when game storage is formatted as FAT32 FAT32 cannot hold files over 4 GB, so Steam games with larger files fail to install and Steam reports 'Not enough disk space'. Warn when such a card is chosen as game storage. * fix(storage): translate the FAT32 warning into Russian * fix(storage): warn about FAT32 for Automatic, extra libraries and store folders Show the FAT32 note in the Second library menu while the effective card is FAT32, so the default Automatic choice is covered, and warn when an additional Steam library or a store install folder is added. * fix(storage): shorten the FAT32 warning and warn on reselecting a saved folder * fix(storage): warn for the resolved store target and keep the SD note --------- Co-authored-by: Dennis Zabolotny <15849186+zdennisz@users.noreply.github.com>
This commit is contained in:
1 parent
64647e0d99
commit
76e0460064
7 files changed
+50
-2
No files matched your search
@@ -637,6 +637,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
}
|
||||
private var storageDiagnostics by mutableStateOf(false)
|
||||
private var storageOptions by mutableStateOf<List<GameStorage.Option>>(emptyList())
|
||||
private var storageFat32 by mutableStateOf(false)
|
||||
private val pickGameStorage = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { r ->
|
||||
if (r.resultCode == RESULT_OK) InAppFilePicker.pickedPath(r.data)?.let { path -> setGameStorage(path, GameStorage.labelFor(this, path)) }
|
||||
}
|
||||
@@ -652,6 +653,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
private fun addSteamLibrary(path: String) {
|
||||
Thread({
|
||||
val result = SteamLibraries.add(this, path)
|
||||
val fat32 = result is SteamLibraries.AddResult.Added && GameStorage.isFat32(result.entry.path)
|
||||
ui.post {
|
||||
steamLibraries = SteamLibraries.list(this)
|
||||
refreshFoundSteamLibraries()
|
||||
@@ -662,6 +664,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
result is SteamLibraries.AddResult.Added && result.entry.path != path ->
|
||||
android.widget.Toast.makeText(this, getString(R.string.libraries_used_inner, result.entry.label), android.widget.Toast.LENGTH_LONG).show()
|
||||
}
|
||||
if (fat32) android.widget.Toast.makeText(this, R.string.main_storage_fat32, android.widget.Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}, "steam-library-add").start()
|
||||
}
|
||||
@@ -2668,6 +2671,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
mic = if (mode == SessionService.MODE_STEAM) mic else null,
|
||||
gameStorage = if (mode == SessionService.MODE_STEAM) gameStorage else null,
|
||||
storageOptions = storageOptions,
|
||||
storageFat32 = storageFat32,
|
||||
steamLibraries = steamLibraries,
|
||||
foundSteamLibraries = foundSteamLibraries,
|
||||
allFilesAccessMissing = allFilesAccessMissing,
|
||||
@@ -3090,10 +3094,12 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
Thread({
|
||||
drivers.refreshDrivers()
|
||||
val storage = GameStorage.options(this)
|
||||
val fat32 = GameStorage.effective(this)?.path?.let(GameStorage::isFat32) == true
|
||||
val deckyInstalled = if (mode == SessionService.MODE_STEAM) DeckyManager.installed(this) else null
|
||||
val deckySupervisor = mode == SessionService.MODE_STEAM && DeckyManager.supervisorEnabled(this)
|
||||
ui.post {
|
||||
storageOptions = storage
|
||||
storageFat32 = fat32
|
||||
if (mode == SessionService.MODE_STEAM) {
|
||||
decky.deckyInstalled = deckyInstalled
|
||||
decky.deckySupervisor = deckySupervisor
|
||||
@@ -3115,6 +3121,8 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
}
|
||||
SessionPrefs.setGameStorage(this, path, label)
|
||||
gameStorage = path
|
||||
storageFat32 = GameStorage.effective(this)?.path?.let(GameStorage::isFat32) == true
|
||||
if (storageFat32) android.widget.Toast.makeText(this, R.string.main_storage_fat32, android.widget.Toast.LENGTH_LONG).show()
|
||||
checkUsbLink()
|
||||
if (settingsMode == SessionService.MODE_STEAM) refreshFoundSteamLibraries()
|
||||
}
|
||||
|
||||
@@ -43,6 +43,17 @@ object GameStorage {
|
||||
}
|
||||
}
|
||||
|
||||
fun isFat32(path: String): Boolean = runCatching { isFat32(path, File("/proc/mounts").readText()) }.getOrDefault(false)
|
||||
|
||||
/** Android mounts FAT32 as vfat and exFAT as exfat; /storage is a FUSE view, so the lookup uses the raw mount. */
|
||||
internal fun isFat32(path: String, mounts: String): Boolean {
|
||||
val raw = UsbLink.rawPath(path)
|
||||
return mounts.lineSequence().map { it.split(' ') }
|
||||
.filter { it.size >= 3 }
|
||||
.filter { val point = it[1].replace("\\040", " "); raw == point || raw.startsWith("${point.trimEnd('/')}/") }
|
||||
.maxByOrNull { it[1].length }?.get(2) == "vfat"
|
||||
}
|
||||
|
||||
fun effective(context: Context): Option? {
|
||||
val pref = SessionPrefs.gameStorage(context)
|
||||
return when {
|
||||
|
||||
@@ -78,6 +78,7 @@ class ModeSettings(
|
||||
val mic: Boolean?,
|
||||
val gameStorage: String? = null,
|
||||
val storageOptions: List<com.droiddeck.launcher.session.GameStorage.Option> = emptyList(),
|
||||
val storageFat32: Boolean = false,
|
||||
val steamLibraries: List<com.droiddeck.launcher.session.SteamLibraries.Entry> = emptyList(),
|
||||
val foundSteamLibraries: List<com.droiddeck.launcher.session.SteamLibraries.Found> = emptyList(),
|
||||
val allFilesAccessMissing: Boolean = false,
|
||||
@@ -455,7 +456,7 @@ fun ModeSheetRows(s: ModeSettings, a: ModeSettingsActions, tab: String, extras:
|
||||
ValueChip(options.firstOrNull { it.path == s.gameStorage }?.chip ?: "-", open) { host.open = if (open) null else "storage" }
|
||||
AnchoredMenu(
|
||||
open, onDismiss = { if (host.open == "storage") host.open = null }, title = stringResource(R.string.mode_second_library),
|
||||
note = stringResource(R.string.mode_storage_note),
|
||||
note = stringResource(R.string.mode_storage_note).let { if (s.storageFat32) stringResource(R.string.main_storage_fat32) + "\n" + it else it },
|
||||
) { firstItemFocus ->
|
||||
options.forEachIndexed { index, choice ->
|
||||
MenuItem(choice.label, checked = choice.path == s.gameStorage, focusRequester = if (index == 0) firstItemFocus else null) {
|
||||
|
||||
@@ -83,6 +83,7 @@ import androidx.compose.ui.unit.sp
|
||||
import coil.compose.AsyncImage
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.files.InAppFilePicker
|
||||
import com.droiddeck.launcher.session.GameStorage
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import com.droiddeck.launcher.storage.Bucket
|
||||
import com.droiddeck.launcher.storage.CleanItem
|
||||
@@ -179,6 +180,10 @@ private fun DefaultStorageGroup() {
|
||||
val customLabel = SessionPrefs.defaultStorageFolderLabel(ctx).ifBlank {
|
||||
customPath.takeIf { it.isNotBlank() }?.let { File(it).name }.orEmpty()
|
||||
}
|
||||
fun warnIfFat32() {
|
||||
val target = StoreInstallRoot.externalTarget(ctx) ?: return
|
||||
if (GameStorage.isFat32(target.root.path)) Toast.makeText(ctx, R.string.main_storage_fat32, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
val pickFolder = rememberLauncherForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
|
||||
if (result.resultCode != Activity.RESULT_OK) return@rememberLauncherForActivityResult
|
||||
val path = InAppFilePicker.pickedPath(result.data) ?: return@rememberLauncherForActivityResult
|
||||
@@ -192,6 +197,7 @@ private fun DefaultStorageGroup() {
|
||||
value = SessionPrefs.DEFAULT_STORAGE_EXTERNAL
|
||||
revision++
|
||||
open = false
|
||||
warnIfFat32()
|
||||
}
|
||||
fun chooseFolder() {
|
||||
open = false
|
||||
@@ -250,6 +256,7 @@ private fun DefaultStorageGroup() {
|
||||
SessionPrefs.clearDefaultStorageFolder(ctx)
|
||||
pick(SessionPrefs.DEFAULT_STORAGE_EXTERNAL)
|
||||
revision++
|
||||
warnIfFat32()
|
||||
}
|
||||
}
|
||||
if (customPath.isNotBlank()) {
|
||||
@@ -261,7 +268,12 @@ private fun DefaultStorageGroup() {
|
||||
if (free >= 0) stringResource(R.string.storage_default_folder_free, gb(free))
|
||||
else stringResource(R.string.storage_default_folder_missing)
|
||||
} ?: stringResource(R.string.storage_default_folder_missing),
|
||||
) { if (customTarget != null) pick(SessionPrefs.DEFAULT_STORAGE_EXTERNAL) else chooseFolder() }
|
||||
) {
|
||||
if (customTarget != null) {
|
||||
pick(SessionPrefs.DEFAULT_STORAGE_EXTERNAL)
|
||||
warnIfFat32()
|
||||
} else chooseFolder()
|
||||
}
|
||||
}
|
||||
MenuItem(
|
||||
stringResource(R.string.storage_default_choose_folder), checked = false,
|
||||
|
||||
@@ -1648,6 +1648,7 @@
|
||||
<string name="main_pick_game_storage">Выберите папку хранилища игр</string>
|
||||
<string name="main_pick_decky_zip">Выберите ZIP-файл плагина Decky</string>
|
||||
<string name="main_storage_not_usable">Нельзя использовать: %1$s</string>
|
||||
<string name="main_storage_fat32">FAT32 не поддерживает файлы больше 4 ГБ, поэтому часть игр не установится. Отформатируйте в exFAT.</string>
|
||||
<string name="main_running_program">Программа</string>
|
||||
<string name="main_removing_runtime">Удаление среды выполнения Linux</string>
|
||||
<string name="main_settings_main_screen">Не удалось открыть настройки на нижнем экране; они открыты на главном экране.</string>
|
||||
|
||||
@@ -1841,6 +1841,7 @@
|
||||
<string name="main_pick_game_storage">Choose the game storage folder</string>
|
||||
<string name="main_pick_decky_zip">Choose a Decky plugin ZIP</string>
|
||||
<string name="main_storage_not_usable">Not usable: %1$s</string>
|
||||
<string name="main_storage_fat32">FAT32 cannot hold files over 4 GB, so some games will fail to install. Reformat as exFAT.</string>
|
||||
<string name="main_running_program">Program</string>
|
||||
<string name="main_removing_runtime">Removing Linux runtime</string>
|
||||
<string name="main_settings_main_screen">Could not open Settings on the bottom screen; opened it on the main screen.</string>
|
||||
|
||||
Reference in new issue
Block a user