feat(steam): Play goes through the tile when Steam is up, so the Deck's controller is a controller #151
No reviewers
Labels
No labels
area/build
area/install
area/saves
area/tooling
area/ui
area/updates
ci: approved
good first issue
gpu/amd
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
platform/linux
platform/steam-deck
platform/windows
priority
critical
priority
high
priority
low
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/LongshotLauncher!151
Loading…
Reference in a new issue
No description provided.
Delete branch "omgitsgela/LongshotLauncher:feat/play-through-steam-tile"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Status
Feature (fresh-install controller input), ready for review. Stacked on #130 (this forge will not take a cross-fork base, so the diff against main also carries #130's commits): review the routing commits,
a4cf225+d4e5545+6dcaf56+46ac7e7+d727c90,6bb9906, only. Merge #130 first and this PR's diff collapses to just those.Why
On a fresh Deck, Steam Input only treats Longshot as a game when Steam launched it. Play from the launcher's own button starts the game direct, and under a running Steam the Deck's buttons then run Steam's default desktop layout — mouse and keyboard — which is the usual fresh-install complaint (the game's own
host/steam_pads.hdeliberately hides Steam's virtual gamepads and re-adds the physical one only under a realsteam_inputdevice, which exists only for Steam-launched games). So make Play go through Steam whenever that layer is available, and never touch global settings, controller configs, or sudo.What changes
Core/SteamLaunchRoute.cs(new): the decision. Linux + outside a gamescope session + Steam up (SteamShortcuts.SteamUp, /proc scan) + our tile in its library (InLibrary) + that library loaded by the running Steam (LibraryLoaded: newest running Steam's start time vs the file's write time — Steam holds its library in memory from its own start, measured Deck 2026-11-15) → hand offsteam://rungameid/<64-bit form of the tile's CARRIED id>via xdg-open. Carried, not freshly computed: after a launcher update the library tile keeps its id (found by marker) and a URI naming the new path's id addresses a tile Steam has never loaded;TileAppIdalready draws that distinction. The id rule —(unsigned appid << 32) | 0x02000000— is the sameGridId64this class already uses for capsule names, verified working on the Deck by steam-for-linux#8580 and SteamTinkerLaunch#1117. Steam not up → direct (no Steam Input layer to want). Inside Game Mode → direct (desktop and gamescope are different seats). No tile yet / library not loaded → direct with a toast naming the reason. Refused URI → direct. Windows → direct.App/LauncherService.cs(PlayFolder): ask the route after the saves/settings prep, fall back to the sameGamePlay.StartInfolaunch as before.<launcher-home>/play-handoff/, one file per Play, named by arm time), naming the build this Play asked for. The launched instance claims the oldest arm by rename (exactly one winner) and starts THAT folder. While an earlier Play's arm is still outstanding, a second Play goes direct rather than arm an unmatchable URI (a second controller-mapped launch beats a wrong-build or doubled one). The tile's launch-option path (--play) arrives witharrived: trueand never routes, arm or no arm — the chain ends at an arrival by construction; only an open window's Play button routes. An explicit--play <folder>never consumes a pending handoff (it is the user's own request); a bare Play's arm carries no folder so the default stands, as before. Arms age out (5-minute ttl: the Deck's measured handoff arrived in seconds, but a cold AppImage on slow media mounts slower, and an arm that expires before its launch arrives would make that launch pick the wrong default build; the cost only lands when the opener silently failed, where staying direct is the safe side), a refused handoff clears what it armed, and a stranger's file in the same directory is never read as an arm (Ours). The arm must be published before the URI is ever asked: an arm that cannot be written (the review's probe: a plain file where the handoff directory goes) answers direct with the reason before the opener is consulted — an undispatchable URI is an unauditable launch. And the handoff directory must be the one the arriving instance will read: the tile starts the launcher file the library holds, under Steam's environment —LONGSHOT_LAUNCHER_HOMEis not inherited across Steam, and a portable AppImage keeps its data beside itself.ArrivalHomereads the tile's Exe through the same layout rules the arriving instance uses (without the sender's variable), andDeciderefuses routing unless the token names exactly that home's handoff — otherwise the routed launch comes up on a different registry's default (the review's actual-app probe: requested A, launched default C).OpenWith), nonzero → direct fallback. An opener still working after the bounded wait counts as dispatched, not failed — answering failed there is how a game starts twice when Steam answers late. A missing opener answers null (absence, not refusal); the caller falls back either way.--playarrives throughPlayWithoutWindow, which runs before the instance lock is taken (Program.cs), so the routed instance never fights the open window's lock and never pokes it; the window keeps its claim exactly as before this feature (an earlier shape of this commit released the lock — the review's P1 — this does not).Testing
python3 -I tests/test_launcher_core.py --dotnet ~/dotnet/dotnet: 1494 checks pass (24 new inRouteChecks: routed URI names the carried id inGridId64form, and after a launcher update it still names the tile's carried id rather than the freshly computed one;SteamGameId→ direct; inside a colon-separated gamescope session → direct (the guard recognizesgamescopeamong the colon-separated desktop ids, case-insensitively — a probe withgamescope:KDEreturned RunGameId before the fix); no tile → direct + reason; Steam down → direct, nothing asked; library written after Steam started → direct + "not loaded" note (LibraryLoadedreads authored /proc stat/uptime and the marker's first-seen time, and a later rewrite of the file — what Steam itself does for play time — does not flip a loaded tile; the same rewrite does not rescue a truly-not-loaded one; the load epoch counts only the library-owning Steam clients —steam/steamrt/steamrt64— a gamescope-session restart must not fake one, and a probe proved it did before the fix); refused URI → direct; a launch that arrived behind a nonzero exit is never answered with a second direct launch; a handoff that could not arm falls back direct and no URI is asked at all (asked == 0pinned);OpenWithagainst real processes — exit 0 true, exit 4 false, missing opener null; Windows → direct; each Play arms its own file naming the exact requested folder, claimed once by rename, oldest-first with two arms outstanding; a Play while another's arm is outstanding goes direct with a note; a--playarrival never routes arm or no arm; stale arm claimed away; a very late arrival for a dead arm answers nothing rather than stealing a younger Play's arm, and the younger arm waits for its own launch; refused handoff clears what it armed; a stranger's file in the directory never counts as an arm; a bare Play's arm carries no folder; the token must name the arrival home — a handoff under any other home is refused before the URI is asked, a sender whoseLONGSHOT_LAUNCHER_HOMEis overridden still arms where the tile would arrive, andArrivalHomeresolves the tile's own layout (pinned to the XDG default beside Steam).python3 -I tests/test_release.py: OK.dotnet build AppRelease: 0 warnings, 0 errors. The routing commits have been through four review rounds. The round againstd4e5545returned FIX with P1s — the shared-slot crossover, the unrelated--playthat took another Play's arm, the arrival that routed on, the mtime flip, the handoff armed where no arrival reads it, the URI dispatched over a failed arm, and the gamescope-faked load epoch — every one reproduced against the fixed Core and pinned in the suite. Against46ac7e7: one verification pass returned SHIP with two P2s (stale arms crossing the FIFO claim order, the arm ttl expiring mid-flight — both closed ind727c90), and a later adversarial pass returned FIX with three P1s: a.takenclaim casualty re-claimable by a second consumer (measured: 84 duplicate claims in 5,000 trials), an opener that dispatches then exits nonzero buying a second copy (real-app repro: launches A and DEFAULT on one save folder), and a URI dispatched over a failed arm (already closed ind727c90before that verdict landed). All closed in6bb9906: claim products (.taken/.playedreceipts) are never candidates again; with an arm in play a said-no opener falls back direct only on a proven standing arm, ambiguous stays routed; a foreign file at the handoff path is claimed once instead of wedging routing forever; plus that pass's P2 (a re-Add after Steam overwrote the entry away must not inherit the vanished tile's first-seen evidence) and P3 (a nonsense marker stamp crashed the load check — now clamped to the mtime fallback). A fourth adversarial pass againstd727c90is running and its findings will be pushed or answered in the thread.Deck end-to-end (2026-11-16, Deck LCD, SteamOS 3.8.28, build
6bb9906as the tile's Exe)Measured on real hardware, in desktop mode with Steam up:
xdg-open steam://rungameid/14308674106319437824(the 64-bit form of the tile's carried appid-963469494): Steam launched the tile —reaper SteamLaunch AppId=3331497802(same id, signed), the AppImage arrived with--playand SteamGameId, and the game started.play-handoff/was claimed exactly once (arm file gone,.playedreceipt standing), and the arrival launched the armed folder —/home/deck/longshot-nvme/rt-stack2/longshotwith cwd there — not the default buildrt-main. The folder-carry works end to end.Steam Deck Controller(Valve vendor 17f6) with motion controls and steamdeck button prompts;1 controller through SDL.SteamShortcuts.Add(marker under the carried id → Update path): Exe moved to the new AppImage, appid/grid art/controller settings untouched, and Steam's own rewrite after restart kept the tile. Steam stop/start on desktop goes through[email protected](Game Mode usessteam-launcher.service).Still unexercised: the GUI Play button path on the Deck's own screen (window → Decide → arm → URI), and Game Mode's controller layout under routing — next live pass.
Must be tested: Deck desktop mode (Test Farm: @Beanstalk steamdeck): launcher Play with Steam running → game runs as a game (buttons pad, not mouse); with Steam quit → still starts direct; the note appears when there is no tile.
Risks
xdg-open is best-effort: refused or absent → the previous direct launch. The 64-bit id rule comes from community issue threads, not Valve docs; it agrees with our own grid-id rule measured against a real Deck library, and a wrong id only means Steam declines and the direct fallback runs.
Stack updated: the tile branch's main-merge is merged in (head now
ea174fa). One real conflict, inPlayFolder's tail: main added thePerfReports/CrashReportsbefore-play ticks, this branch added the routingDecide— resolution keeps BOTH in order:Decideruns first, a routed Play returns before any direct launch or tick, and the direct path keeps main's ticks verbatim. The routed instance arrives through the samePlayFolder(arrived: true)path, so it runs the perf/crash tick itself on its own machine, where the settings live. Verified together: App Release 0W/0E, suite 1581 checks (this branch's routing checks plus main's newPerfChecks/BuildReportChecks). Live Deck evidence in the description is unchanged by the merge (it was run at6bb9906; the merge adds no routing behavior).Round-four adversarial review (against
d727c90, re-verified against this head before touching anything) returned two findings; both closed ata15ba24:P1 — symlinked tiles were real. The reviewer ran the exact AppImage runtime this repo pins and read its actual environment: for a
stable.AppImagealias whose target hasreal.AppImage.home, the runtime setsAPPIMAGE/HOMEoff the target — the runtime resolves the link before setting anything. OurArrivalHomeaskedalias+".home", saw none, predicted the XDG home, and would have armed where the arrival never looks (the same home-binding P1 class, entering through a door we hadn't tried). Fix:LauncherLayout.Ofnow resolves the link (final target) before portable detection and for the layout's own file; non-links and unreadable links pass through unchanged. Pinned: layout kind +PortableHomethrough the link, the alias standing in the library as the tile Exe, andArrivalHome == target's .home.P2 — reversing our own round-three answer on measured odds. The stop-at-dead rule answered null when the oldest claimed arm had aged out; the review's probe shows that sacrifices the next Play's real delivery when the old launch was silently lost (URI accepted, never launched — the common failure). The stolen-arm scenario it guarded needs an arrival >ttl (300 s) late; measured Deck handoffs arrive in seconds (live evidence in the description). TakeHandoff now sweeps the dead arm and keeps going to the younger one. Ordering pins rewritten to match.
Suite 1585 checks, App Release 0W/0E, release test OK; mutation probe: reverting the symlink resolve fails the pin exactly and only there.
Verdict: Request changes. Routing Play through the tile does fix the Deck's controller. But when Steam takes the link and launches nothing, the player gets no game and a notice saying it went through Steam. It also routes through whatever launcher file the tile points at, not this one. And it changes how the game starts on every Linux desktop with Steam running, with costs nobody measured (the overlay, Steam's environment).
What it does for players: on a Steam Deck in desktop mode with Steam up, Play starts the game through the Longshot tile, so Steam Input maps the Deck's controls as a gamepad rather than a mouse and keyboard. The handoff code is careful about races. It makes things better for Deck players whose controls hit that trap, though the description says that trap couldn't be reproduced on the test Deck. As written, it also costs desktop Linux players and adds failure modes that start no game.
Reviewed:
768eaa79(head) against721d39de, #130's head minus its last docs-only commitb5dda673(diffing fromb5dda673itself adds only that FontCheck comment). Read in full:Core/SteamLaunchRoute.cs; the changes toApp/LauncherService.cs,App/Program.cs,Core/LauncherLayout.csandCore/SteamShortcuts.cs(TileLauncherPath,MarkerFirstSeen,ClaimOf,Add,Same,LibraryLoaded), with the code they rely on (Locate,FindOurs,InLibrary,TileAppId,SteamUp,HomeViewModel.Play,Program.Main). Skimmed:tests/launcher_core/RouteChecks.cs(names and comments), the lock files. Nothing run (a code review).Fixed in this review: nothing.
Checked and fine:
TileAppId), not the fresh one, andGridId64is the same rule the grid art uses. #130's id bug doesn't reach the URI.Same()now compares the carried id. That fixes #130's Blocking 3 (#130 should take this fix, since the bug is #130's).--play <folder>never takes an arm, and an arrival never routes again, so there is no loop.GamePlay.StartInfoand the settings file, andpersistmakes a Play whose settings save failed go direct. The Intel options are per-PC and Windows-only, so they're unaffected.gamescopeinXDG_CURRENT_DESKTOP),SteamGameIdset, Steam down, no tile, library not reloaded, no opener, and a refusal with the arm still standing all fall back to the direct start./proc/<pid>/statparsing counts fields from the last), sostarttimeisrest[19].PlayWithoutWindowruns before the instance lock, so the window keeps its lock.LauncherLayout.Ofresolving a symlink changes nothing for the launcher's own layout (the runtime's$APPIMAGEis already the target).Blocking (to change before merge)
Steam takes the link, launches nothing, and the player is told it went through Steam (
Core/SteamLaunchRoute.cs:194).xdg-openexiting 0 only means thesteamscript passed the link on. Cases where nothing then starts:Locatepicks the newestuserdata/*/configfolder, which is not always the signed-in account (#130's suggestion). The tile is then in another account's library.SteamUpcounts gamescope, andLibraryLoadedanswers "loaded" when it finds no Steam process (Core/SteamShortcuts.cs:721).xdg-openthen cold-starts Steam, and the UI thread waits up to 15 s.In each case
PlayFolderreturnsViaTileNoteand the Home shows "Starting Longshot…" with no game. If Steam acts on the link later (after sign-in), the arrival starts a game anyway. Within 300 s it takes the stale arm, possibly next to the direct copy the player started by pressing Play again, which is the two-copies-on-one-save case the code works hardest to avoid. After 300 s it starts the default build.Fix: confirm the delivery. After dispatch, wait off the UI thread (about 20–30 s) for this arm's
.playedreceipt. If it doesn't come, cancel the arm by renaming it to a claim product. If that rename succeeds, nobody can claim the arm any more, so start direct with a note. If it fails, the arm was claimed, so the game is on its way. This also makes the 300 sOutstandingwindow and the late-arrival ordering unneeded. And don't count gamescope alone as Steam up for routing.Play goes through whatever launcher file the tile holds, not this launcher (
Core/SteamLaunchRoute.cs:132).InLibraryfinds the tile through the marker, which records the Exe the lastAddwrote. Take a player who downloads a new AppImage under a new name and opens it. Until a Ready screen re-points the tile (after #130's untick and portable fixes, maybe never), the tile still starts the old file.Decideonly checks that the old file's home matches the token. Then:Fix: route only when
TileLauncherPath(tile), links resolved, is the same file asLauncherPath. Otherwise go direct, with a note saying a Ready screen updates the tile.Every Linux desktop with Steam running now has its game started by Steam, and nothing measured what that costs (
Core/SteamLaunchRoute.cs:107). #130 adds the tile at every Ready screen on any Linux PC with Steam. With this PR, Play on those PCs goes through Steam whenever Steam is up, so:LD_PRELOADand its Vulkan layer);MANGOHUD,RADV_*,LONGSHOT_*) are dropped.The only Steam-routed run is on a Deck in desktop mode. Nobody measured frame time with the overlay layer, on the Deck or a desktop. A desktop player who wants a direct start can only delete the tile, and #130 brings it back.
Fix: route on the Steam Deck only, where the controller trap is (SteamOS, or the Valve board in
/sys/class/dmi/id/board_vendor). Keep desktops direct. Post a routed-against-direct frame-time run in one heavy area on the Deck.The new texts are in no catalog, and they talk about a Deck and a console on a desktop (
Core/SteamLaunchRoute.cs:40). The seven notes inDecideare bare English, withoutTr.T, sotranslations.pycan't even find them (#130 was held on missing translations).ViaTileNotegoes to the Home'sNoticeon every routed Play (App/LauncherService.cs:280). That is the panel with Dismiss and Copy report, so a launch that worked looks like a problem.NotLoadedNoterepeats #130's "restarting the console".Fix: wrap them in
Tr.T, add them to the 12 catalogs, say "Restart Steam", and drop the success note (the "Starting Longshot" toast already says it).The stack merge reverts main's lock files (
App/packages.lock.json:49). Mergeea174fatook the routing side'sApp/packages.lock.jsonandCore/packages.lock.json, so the head dropsMicrosoft.NET.ILLink.Tasksand thenet10.0/win-x64target that main's #158 added (and #130 keeps). The description doesn't mention it, and CI restores in locked mode. Take #130's or main's lock files.Suggestions
Decideruns on the UI thread fromHomeViewModel.Play.OpenWithwaits up to 15 s, and/procis scanned twice. Move it into a task (Blocking 1's wait needs that anyway).Same()carried-id fix and its check into #130, where the bug is.How it relates to #130's review
ArrivalHomehandles a portable home correctly.Same(): fixed here (see above).Testing:
6bb9906: arungameidlaunch of the tile, a handoff claimed once with the armed folder started, no re-route on arrival, and the controller seen as a Steam Deck pad.768eaa79is waiting to start.Overlaps and merge order: stacked on #130, which has changes requested. #130 merges first, then this PR is rebased onto main so its diff is only the routing commits. This PR doesn't merge with main as it stands.
@ -252,0 +277,4 @@handoff: fromHandoff, folder: folder, arrived: arrived,persist: arrived ? null : TrySaveSettings);if (route.Route == SteamLaunchRoute.Kind.RunGameId)return said == null ? route.Note : said + " " + route.Note;ViaTileNoteends up in the Home'sNotice(the problem panel, with Dismiss and Copy report) on every routed Play, so a launch that worked looks like a problem. The "Starting Longshot" toast is enough. Returnsaidonly.@ -47,12 +47,6 @@"NWayland": "0.11.0"}},Merge
ea174fatook the routing side's lock files here and inCore/packages.lock.json, which dropsMicrosoft.NET.ILLink.Tasksand thenet10.0/win-x64target that main's #158 added (and #130 keeps). Take #130's lock files.@ -0,0 +37,4 @@/// it was armed. TakeHandoff reads and consumes it; there is one handoff per Playpublic sealed record Handoff(string? Folder, long ArmedUnix);public const string ViaTileNote = "The game was started through Steam's tile, so the Deck's controller works as a controller.";These notes, and the five in
Decide, are bare English with noTr.T, so they are in no catalog. They also say "the Deck's controller" and "restarting the console" on a desktop. "Restart Steam" covers both.@ -0,0 +104,4 @@// the environment saying SteamGameId: the fast path for the same factif (!string.IsNullOrEmpty(env("SteamGameId"))) return Decision.Direct();// no Steam running: direct, which is also what makes Steam's own runtime absentif (!SteamShortcuts.SteamUp(proc)) return Decision.Direct();This routes on every Linux PC with Steam running, not just the Deck. On a desktop the game then gets Steam's overlay (
LD_PRELOADand its Vulkan layer), Steam Input on PlayStation and Switch pads, and Steam's environment in place of the launcher's (MANGOHUD,RADV_*andLONGSHOT_*set at launch are dropped). None of that has been measured, and the only way back is deleting the tile, which #130 re-adds. Limit routing to the Deck (SteamOS, or the Valve board in/sys/class/dmi/id/board_vendor).@ -0,0 +191,4 @@TryClear(armedAt);return Decision.Direct("Steam refused the tile launch (the refusal said no outright), so the game started directly.");}return new Decision(Kind.RunGameId, uri, ViaTileNote);xdg-openexiting 0 means the link was handed on, not that a game started. If Steam is on its sign-in screen, a different account is signed in, the tile's file is gone, or only gamescope is up, this returnsViaTileNoteand no game starts. Once Steam acts on the link late, the stale arm starts a second copy next to a direct re-Play (within 300 s) or the default build (after). Wait off the UI thread for this arm's.playedreceipt. If it doesn't come, rename the arm to a claim product: if the rename succeeds nobody can claim it, so start direct; if it fails, the arm was claimed.@ -0,0 +129,4 @@// that does not name that home's handoff cannot be matched, so: directif (token != null){var arrival = ArrivalHome(tile, env);This checks the tile's home but not that the tile starts this launcher. After a new AppImage under a new name, and until a Ready screen re-points the tile, the tile still runs the old file. An old launcher from before this PR ignores the arm and starts the default build, and a deleted file starts nothing. Route only when
TileLauncherPath(tile)(links resolved) is the same file asLauncherPath.@ -0,0 +718,4 @@var started = boot.AddSeconds(start / hz);if (started > best) best = started;}if (best == DateTime.MinValue) return true; // (Steam-like but no start time readable: optimistic)With only gamescope running (
SteamUpcounts it), nosteamprocess is found, so this answers "loaded".Decidethen routes,xdg-opencold-starts Steam, and the UI thread waits up to 15 s. For routing, no Steam client process should mean Steam is not up.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.