mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 12:28:40 +00:00
feat: Show the drawer's game settings when a game starts without Steam (#1113)
* feat: Show the drawer's game settings when a game starts without Steam A session started without the client has no Steam overview to read the current title from, so the drawer's game profile group stayed empty and the per-game settings, FEX preset, environment and unfolded controls were hidden. The launch already knows which game it starts, so carry its id into the session and fall back to it when Steam has nothing to report. * fix: Pass the game id into the service start, and keep the unfolded toggle to Steam SessionActivity.surfaceCreated() hands the mode, program and args to SessionService.start(), which builds the service intent. EXTRA_GAME_ID was only put on the activity intent, so a new no-Steam session never received it and the drawer fallback stayed empty. Pass it through. The unfolded-controls toggle also went out for direct sessions, but applyUnfoldedControls() still requires Steam mode and a Deck pad, neither of which a direct session sets up. Keep the toggle to Steam. * fix: hide Steam controls in direct session drawer --------- Co-authored-by: xXJsonDeruloXx <danielhimebauch@gmail.com> Co-authored-by: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com>
This commit is contained in:
5 files changed
+16
-3
No files matched your search
@@ -598,6 +598,7 @@ class FrontEndActivity : ComponentActivity() {
|
||||
.putExtra(SessionService.EXTRA_MODE, SessionService.MODE_RUN)
|
||||
.putExtra(SessionService.EXTRA_PROGRAM, command.program)
|
||||
.putExtra(SessionService.EXTRA_PROGRAM_ARGS, command.args.toTypedArray())
|
||||
.putExtra(SessionService.EXTRA_GAME_ID, com.droiddeck.launcher.session.NoSteamLaunch.scope(game))
|
||||
when {
|
||||
!SessionState.running -> startSessionOrWait(next)
|
||||
SessionState.stopRequested -> android.widget.Toast.makeText(this, R.string.game_link_session_busy, android.widget.Toast.LENGTH_LONG).show()
|
||||
|
||||
@@ -294,6 +294,9 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
private var drawerDefaultProton by mutableStateOf<String?>(null)
|
||||
private val drawerComponentMenu by lazy { ComponentsMenu(this, uiHandler) }
|
||||
private var drawerGameProfileId by mutableStateOf<Long?>(null)
|
||||
|
||||
private fun noSteamSession(): Boolean = SessionState.mode == SessionService.MODE_RUN &&
|
||||
SessionState.program in setOf(com.droiddeck.launcher.session.NoSteamLaunch.PROTON_RUN, com.droiddeck.launcher.session.NoSteamLaunch.EPIC)
|
||||
private val drawerGameInventory = GameProfileInventoryCache<Library.SteamGame>()
|
||||
private var drawerGameInventoryRevision = 0L
|
||||
private var drawerGameFexPresetSaving by mutableStateOf(false)
|
||||
@@ -906,6 +909,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
)
|
||||
SessionDrawer(drawerOpen, drawerPage, drawerControllerActive, onPageChange = { drawerPage = it }, a = DrawerActions(
|
||||
steam = SessionState.mode == SessionService.MODE_STEAM,
|
||||
direct = noSteamSession(),
|
||||
title = if (SessionState.mode == SessionService.MODE_RUN)
|
||||
com.droiddeck.launcher.frontend.Library.nameForProgram(SessionState.program) ?: getString(R.string.session_title_game) else null,
|
||||
isHomeApp = isHomeApp,
|
||||
@@ -1373,6 +1377,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
val activeAppId = AgentGuest.activeSteamAppId(this, installedAppIds)
|
||||
val selectedSteamAppId = runCatching { AgentGuest.selectedSteamAppId(this) }
|
||||
AgentGuest.selectedOrActiveInstalledSteamAppId(selectedSteamAppId, activeAppId, installedAppIds)
|
||||
?: SessionState.gameId?.toLongOrNull()
|
||||
?: refresh.requestedAppId
|
||||
} else {
|
||||
refresh.requestedAppId
|
||||
@@ -1861,6 +1866,7 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
intent.getStringExtra(SessionService.EXTRA_STEAM_UI),
|
||||
intent.getStringExtra(SessionService.EXTRA_STEAM_URL),
|
||||
intent.getStringArrayExtra(SessionService.EXTRA_PROGRAM_ARGS),
|
||||
intent.getStringExtra(SessionService.EXTRA_GAME_ID),
|
||||
sessionActivityDisplayId,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -349,6 +349,7 @@ class SessionService : Service() {
|
||||
pipTask = false
|
||||
SessionState.program = intent?.getStringExtra(EXTRA_PROGRAM)
|
||||
SessionState.programArgs = intent?.getStringArrayExtra(EXTRA_PROGRAM_ARGS)?.toList().orEmpty()
|
||||
SessionState.gameId = intent?.getStringExtra(EXTRA_GAME_ID)
|
||||
SessionState.steamUi = intent?.getStringExtra(EXTRA_STEAM_UI)
|
||||
SessionState.steamUrl = intent?.getStringExtra(EXTRA_STEAM_URL)
|
||||
com.droiddeck.launcher.stores.battlenet.BattleNetClient.clearRequests(LinuxRuntime.sessionRoot(this))
|
||||
@@ -2084,6 +2085,7 @@ class SessionService : Service() {
|
||||
fun start(
|
||||
context: Context, mode: String = MODE_STEAM, program: String? = null,
|
||||
steamUi: String? = null, steamUrl: String? = null, programArgs: Array<String>? = null,
|
||||
gameId: String? = null,
|
||||
displayId: Int = Display.DEFAULT_DISPLAY,
|
||||
) {
|
||||
SessionState.activityDisplayId = displayId
|
||||
@@ -2094,6 +2096,7 @@ class SessionService : Service() {
|
||||
if (programArgs != null) intent.putExtra(EXTRA_PROGRAM_ARGS, programArgs)
|
||||
if (steamUi != null) intent.putExtra(EXTRA_STEAM_UI, steamUi)
|
||||
if (steamUrl != null) intent.putExtra(EXTRA_STEAM_URL, steamUrl)
|
||||
if (gameId != null) intent.putExtra(EXTRA_GAME_ID, gameId)
|
||||
if (Build.VERSION.SDK_INT >= 26) context.startForegroundService(intent)
|
||||
else context.startService(intent)
|
||||
}
|
||||
|
||||
@@ -59,6 +59,8 @@ object SessionState {
|
||||
@Volatile
|
||||
var programArgs: List<String> = emptyList()
|
||||
@Volatile
|
||||
var gameId: String? = null
|
||||
@Volatile
|
||||
var steamUi: String? = null
|
||||
@Volatile
|
||||
var steamUrl: String? = null
|
||||
|
||||
@@ -193,6 +193,7 @@ private class DrawerFocus {
|
||||
|
||||
class DrawerActions(
|
||||
val steam: Boolean,
|
||||
val direct: Boolean = false,
|
||||
val title: String? = null,
|
||||
val isHomeApp: Boolean,
|
||||
val androidApps: List<HomeApp.LaunchableApp>,
|
||||
@@ -433,7 +434,7 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
|
||||
if (a.pipSupported) SteamActionPill(
|
||||
stringResource(R.string.pip_title), Icons.Outlined.PictureInPictureAlt, focus.track(page, "pip"),
|
||||
) { host.open = null; a.onPip() }
|
||||
if (a.onSteamMenu != null && a.onQam != null) {
|
||||
if (a.steam && a.onSteamMenu != null && a.onQam != null) {
|
||||
val qamInteraction = remember { MutableInteractionSource() }
|
||||
var qamStartedOnPress by remember { mutableStateOf(false) }
|
||||
LaunchedEffect(qamInteraction) {
|
||||
@@ -640,11 +641,11 @@ internal fun SessionDrawer(open: Boolean, requestedPage: SessionDrawerPage, cont
|
||||
steamVr = { SteamVrRow(a) })
|
||||
}
|
||||
SessionDrawerPage.GAMES -> {
|
||||
if (a.steam) SelectedGameProfileGroup(host, a) { key -> focus.track(page, key) }
|
||||
if (a.steam || a.direct) SelectedGameProfileGroup(host, a) { key -> focus.track(page, key) }
|
||||
Text(stringResource(R.string.fex_next_launch), fontSize = 12.sp,
|
||||
color = colors.onSurfaceVariant, modifier = Modifier.padding(horizontal = 14.dp, vertical = 8.dp))
|
||||
TextureFilteringGroup(host, a) { key -> focus.track(page, key) }
|
||||
if (a.steam) SettingsGroup(stringResource(R.string.game_settings_title)) {
|
||||
if (a.steam || a.direct) SettingsGroup(stringResource(R.string.game_settings_title)) {
|
||||
DrawerFexPresetRow(host, a, focus.track(page, "fex"))
|
||||
DrawerNoSteamRow(host, a, focus.track(page, "no-steam"))
|
||||
GameEnvironmentRow(
|
||||
|
||||
Reference in new issue
Block a user