diff --git a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt index bed597d789..3c1f9707c7 100644 --- a/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt +++ b/app/src/main/java/com/droiddeck/launcher/SessionActivity.kt @@ -1388,24 +1388,40 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback, com.droidde onHudReset = { hudConfig = DroidDeckHudConfig.reset(this@SessionActivity); hud.applyConfig() }, onHudExport = { exportHudDiagnostics() }, onUpscaler = { m -> - SessionPrefs.setUpscaler(this@SessionActivity, m) + val target = effectsEditorTarget ?: screenEffectsTarget val activeProfileId = SessionPrefs.activeScreenEffectsProfileId(this@SessionActivity) - val activeEffects = - SessionPrefs.screenEffects(this@SessionActivity, activeProfileId) - val activeUpscaler = - SessionPrefs.screenEffectsUpscaler(this@SessionActivity, activeProfileId) - if ((effectsEditorTarget ?: screenEffectsTarget) == SCREEN_EFFECTS_TARGET_AUTO) { + if (target == SCREEN_EFFECTS_TARGET_AUTO && + activeProfileId != effectsEditorProfileId) { + Log.w(TAG, "Screen effects profile changed while editing; discarding stale upscaler edit") + observedScreenEffectsProfileId = activeProfileId + val activeEffects = SessionPrefs.screenEffects(this@SessionActivity, activeProfileId) + val activeUpscaler = SessionPrefs.screenEffectsUpscaler(this@SessionActivity, activeProfileId) effects = activeEffects upscaler = activeUpscaler - } + activeEffects.push(activeUpscaler) + } else { + val profileId = screenEffectsProfileIdForTarget(target) + SessionPrefs.setScreenEffectsUpscaler(this@SessionActivity, profileId, m) - WaylandCompositor.nativeSetUpscaler(activeUpscaler) - WaylandCompositor.nativeSetLookName( - ScreenEffectLooks.match(activeEffects, activeUpscaler)?.name - ) - activeEffects.push(activeUpscaler) + if (target == screenEffectsTarget) { + upscaler = m + if (screenEffectsUpscalerTargetAppliesToLiveOutput(target)) { + val liveProfileId = + SessionPrefs.activeScreenEffectsProfileId(this@SessionActivity) + val liveUpscaler = + SessionPrefs.screenEffectsUpscaler(this@SessionActivity, liveProfileId) + val liveEffects = + SessionPrefs.screenEffects(this@SessionActivity, liveProfileId) + WaylandCompositor.nativeSetUpscaler(liveUpscaler) + WaylandCompositor.nativeSetLookName( + ScreenEffectLooks.match(liveEffects, liveUpscaler)?.name + ) + liveEffects.push(liveUpscaler) + } + } + } }, onPresetUpscaler = { m -> val target = effectsEditorTarget ?: screenEffectsTarget diff --git a/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt b/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt index 71fc118f87..ef6549ac7e 100644 --- a/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt +++ b/app/src/main/java/com/droiddeck/launcher/session/SessionService.kt @@ -1537,8 +1537,11 @@ class SessionService : Service() { return } val accepted = gameId!! - pendingSteamPreviousGameId = SessionState.gameId - if (pendingSteamGameId != null) Log.i(TAG, "replacing a queued game launch with $accepted") + if (pendingSteamGameId == null) { + pendingSteamPreviousGameId = SessionState.gameId + } else { + Log.i(TAG, "replacing queued game ${pendingSteamGameId} with $accepted") + } pendingSteamGameExitWatchToken = ++gameExitWatchToken SessionState.gameId = accepted val effectsProfileId = SessionPrefs.screenEffectsProfileId(MODE_STEAM, accepted, null)