fix(fex): show which preset Use Default resolves to (#2225)

* fix(fex): show which preset Use Default resolves to and rename FEX defaults to Stock FEX

* test(components): the FEX preset chip names its resolved preset instead of Use Default

* fix(fex): the game settings menu keeps Use Default beside the inherited preset

* fix(fex): inherited preset chip follows the current Default preset
This commit is contained in:
Kurt Himebauch authored and GitHub committed 2026-11-07 14:22:00 -05:00
1 parent 875f8e3ce2
commit ffb76240fd
5 files changed
+13 -8

No files matched your search

@@ -1183,6 +1183,7 @@ private fun GameComponentOverrides(
open = fexMenu,
enabled = config != null && !busy,
allowInheritance = true,
generalPreset = generalFexPreset,
onToggle = { onFexMenu(!fexMenu) },
onDismiss = { onFexMenu(false) },
onPick = onFexPreset,
@@ -1349,15 +1350,16 @@ internal fun FexPresetChip(
onDismiss: () -> Unit,
onPick: (String?) -> Unit,
allowInheritance: Boolean = false,
generalPreset: String = preset,
modifier: Modifier = Modifier,
) {
val chosen = FexPreset.all.firstOrNull { it.id == preset }
val chosen = FexPreset.all.firstOrNull { it.id == if (inherited) generalPreset else preset }
val label = when {
preset == GameEnvironment.CUSTOM_FEX_PRESET -> stringResource(R.string.comp_game_fex_custom)
chosen == null -> stringResource(FexPreset.byId("").label)
inherited -> stringResource(R.string.comp_game_use_general)
else -> stringResource(chosen.label)
}
val general = FexPreset.all.firstOrNull { it.id == generalPreset }
Box {
ValueChip(label, open, enabled = enabled, modifier = modifier.widthIn(max = 260.dp), onClick = onToggle)
AnchoredMenu(open && enabled, onDismiss = onDismiss, title = stringResource(R.string.fex_preset_title)) { first ->
@@ -1365,6 +1367,7 @@ internal fun FexPresetChip(
MenuItem(
stringResource(R.string.comp_game_use_general),
checked = inherited,
detail = general?.let { stringResource(it.label) },
focusRequester = first,
) { onPick(null); onDismiss() }
}
@@ -833,6 +833,7 @@ internal fun GameSettingsMenus(host: MenuHost, game: com.droiddeck.launcher.fron
)
val appSync = syncLabels[com.droiddeck.launcher.session.SessionPrefs.syncBackend(appContext)]
val useDefault = stringResource(R.string.comp_game_use_general)
val generalFex = com.droiddeck.launcher.core.FexPreset.byId(com.droiddeck.launcher.session.SessionPrefs.fexPreset(appContext))
val custom = stringResource(R.string.comp_game_fex_custom)
val customSync = stringResource(R.string.game_sync_custom)
val resetDone = stringResource(R.string.comp_game_reset_done, game.name)
@@ -847,7 +848,7 @@ internal fun GameSettingsMenus(host: MenuHost, game: com.droiddeck.launcher.fron
MenuItem(
stringResource(R.string.fex_preset_title), checked = false, enabled = ready,
detail = when {
fex == null -> useDefault
fex == null -> "$useDefault · ${stringResource(generalFex.label)}"
chosen == null -> custom
else -> stringResource(chosen.label)
},
@@ -879,7 +880,7 @@ internal fun GameSettingsMenus(host: MenuHost, game: com.droiddeck.launcher.fron
}
}
AnchoredMenu(host.open == fexKey, onDismiss = { if (host.open == fexKey) host.open = null }, title = stringResource(R.string.fex_preset_title)) { first ->
MenuItem(useDefault, checked = fex == null, enabled = ready, focusRequester = first) {
MenuItem(useDefault, checked = fex == null, enabled = ready, detail = stringResource(generalFex.label), focusRequester = first) {
host.open = key
save { com.droiddeck.launcher.session.GameEnvironmentStore.setGameFexPreset(it, scope, null) }
}
@@ -1239,6 +1239,7 @@ private fun DrawerFexPresetRow(host: MenuHost, a: DrawerActions, modifier: Modif
}
},
allowInheritance = appId != null,
generalPreset = a.fexPreset,
modifier = modifier,
)
}
+2 -2
View File
@@ -130,8 +130,8 @@
<string name="fex_preset_title">FEX preset</string>
<string name="fex_next_launch">Applies on the next game launch.</string>
<string name="game_settings_title">Games</string>
<string name="fex_default_label">FEX defaults</string>
<string name="fex_default_detail">Uses FEX defaults.</string>
<string name="fex_default_label">Stock FEX</string>
<string name="fex_default_detail">No FEX tuning applied.</string>
<string name="fex_stability_label">Stability</string>
<string name="fex_stability_detail">Safest, slowest settings.</string>
<string name="fex_compatibility_label">Compatibility</string>
@@ -168,8 +168,8 @@ class ComponentsPageProfileTest {
compose.onNodeWithText(context.getString(R.string.gpu_system_powervr)).assertIsNotEnabled()
compose.onNodeWithText(context.getString(R.string.cmgr_powervr_dxvk_managed)).assertExists()
val inheritedChoices = compose.onAllNodesWithText(context.getString(R.string.comp_game_use_general))
inheritedChoices.assertCountEquals(4) // FEX preset, FEX package, Proton and VKD3D remain selectable.
repeat(4) { inheritedChoices[it].assertIsEnabled() }
inheritedChoices.assertCountEquals(3) // FEX package, Proton and VKD3D remain selectable.
repeat(3) { inheritedChoices[it].assertIsEnabled() }
val runtimeOptions = compose.onAllNodesWithText(context.getString(R.string.comp_game_runtime_options))
runtimeOptions.assertCountEquals(2)
repeat(2) { runtimeOptions[it].assertIsEnabled() }