mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
fix: open game Components on the game's profile (#1146)
This commit is contained in:
1 parent
aa5e9c3e91
commit
8ccd771059
7 files changed
+145
-16
No files matched your search
@@ -124,6 +124,7 @@ class MainActivity : ComponentActivity() {
|
||||
private var steamController by mutableStateOf(SessionPrefs.CONTROLLER_DECK)
|
||||
private var showComponents by mutableStateOf(false)
|
||||
private var focusComponentsContent by mutableStateOf(true)
|
||||
private var componentsGameKey by mutableStateOf<String?>(null)
|
||||
private var showMapping by mutableStateOf(false)
|
||||
private var saveBusy: String? = null
|
||||
private var onSavePicked: ((File) -> Unit)? = null
|
||||
@@ -922,6 +923,7 @@ class MainActivity : ComponentActivity() {
|
||||
},
|
||||
onProtons = { openProtons() },
|
||||
onComponents = { focusContent -> openComponents(focusContent) },
|
||||
onGameComponents = { game -> openComponents(gameKey = game.profileKey) },
|
||||
onComponentsTab = { tab -> openComponents(focusContent = true, tab = tab) },
|
||||
onSaveImport = { sg -> importSaves(sg.name) { GameSaves.game(sg) } },
|
||||
onSaveExport = { sg, layout -> exportSaves(sg.name, layout) { GameSaves.game(sg) } },
|
||||
@@ -1434,8 +1436,9 @@ class MainActivity : ComponentActivity() {
|
||||
)
|
||||
}
|
||||
|
||||
private fun openComponents(focusContent: Boolean = true, tab: String? = null) {
|
||||
private fun openComponents(focusContent: Boolean = true, tab: String? = null, gameKey: String? = null) {
|
||||
focusComponentsContent = focusContent
|
||||
componentsGameKey = gameKey
|
||||
if (tab != null) components.compComp = tab
|
||||
showPerformance = false
|
||||
showMapping = false
|
||||
@@ -1484,6 +1487,7 @@ class MainActivity : ComponentActivity() {
|
||||
onImport = { pickComponent.launch(InAppFilePicker.buildIntent(this, WCP_EXT, getString(R.string.comp_pick_wcp))) },
|
||||
onBack = { if (!com.droiddeck.launcher.ui.Hops.back { showComponents = false }) showComponents = false },
|
||||
games = steamGames,
|
||||
initialGameKey = componentsGameKey,
|
||||
generalFexPreset = fexPreset,
|
||||
onGeneralFexPreset = { id -> SessionPrefs.setFexPreset(this, id); fexPreset = id },
|
||||
gpu = drivers.state(),
|
||||
|
||||
@@ -151,6 +151,7 @@ fun ComponentsPage(
|
||||
onImport: () -> Unit,
|
||||
onBack: () -> Unit,
|
||||
games: List<Library.SteamGame> = emptyList(),
|
||||
initialGameKey: String? = null,
|
||||
generalFexPreset: String = "",
|
||||
onGeneralFexPreset: (String) -> Unit = {},
|
||||
requestInitialFocus: Boolean = true,
|
||||
@@ -169,7 +170,7 @@ fun ComponentsPage(
|
||||
val layer = if (comp in LAYERS) comp else GPU_TAB
|
||||
BackHandler(onBack = onBack)
|
||||
var scopeMenu by remember { mutableStateOf(false) }
|
||||
var selectedGameKey by remember { mutableStateOf<String?>(null) }
|
||||
var selectedGameKey by remember(initialGameKey) { mutableStateOf(initialGameKey) }
|
||||
var fexMenu by remember { mutableStateOf(false) }
|
||||
var gameProtonMenu by remember { mutableStateOf(false) }
|
||||
var gameProtonId by remember { mutableStateOf<String?>(null) }
|
||||
|
||||
@@ -189,6 +189,7 @@ class FrontEndActions(
|
||||
val onImportLossless: () -> Unit,
|
||||
val onProtons: () -> Unit,
|
||||
val onComponents: (focusContent: Boolean) -> Unit,
|
||||
val onGameComponents: (Library.SteamGame) -> Unit = { onComponents(true) },
|
||||
val onComponentsTab: (String) -> Unit = {},
|
||||
val onSaveImport: (Library.SteamGame) -> Unit = {},
|
||||
val onSaveExport: (Library.SteamGame, com.droiddeck.launcher.session.GameSaves.Layout) -> Unit = { _, _ -> },
|
||||
|
||||
@@ -523,8 +523,9 @@ internal fun LaunchSettings(s: FrontEndState, a: FrontEndActions, host: MenuHost
|
||||
val back = stringResource(R.string.hop_from_games)
|
||||
SettingCard(stringResource(R.string.setup_card_components), stringResource(R.string.setup_card_components_hint), "card:components", m.hopSource("card:components")) {
|
||||
val at = Hops.sources["card:components"]
|
||||
if (at == null) a.onComponents(true)
|
||||
else Hops.go(HopOrigin("games", HOP_SURFACE_GAMES, null, "card:components", at, back, dest = "components", page = "components")) { a.onComponents(true) }
|
||||
val open = { if (game == null) a.onComponents(true) else a.onGameComponents(game) }
|
||||
if (at == null) open()
|
||||
else Hops.go(HopOrigin("games", HOP_SURFACE_GAMES, null, "card:components", at, back, dest = "components", page = "components"), open)
|
||||
}
|
||||
}
|
||||
add { m ->
|
||||
|
||||
Reference in new issue
Block a user