feat(shortcuts): a Gaming mode tile for the game, made and reversed by the Ready screen (Steam Deck) #130
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
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/LongshotLauncher!130
Loading…
Reference in a new issue
No description provided.
Delete branch "omgitsgela/LongshotLauncher:feat/steam-gamemode-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?
Why this is needed
On a Steam Deck — where the launcher's Linux support is aimed — a game you cannot start from Gaming mode is a game you cannot start from the couch. Today the tile has to be added by hand through Steam's own dialog in Desktop mode. This makes the launcher's Ready screen offer the tile and, with the untick, take exactly that tile away again.
What it does
Core/SteamShortcuts.cs: writes and removes the tile inshortcuts.vdf, in the exact binary grammar Steam's own writer uses, and computes the tile'sappidthe way Steam does:crc32(Exe + AppName) | 0x80000000, read signed — the rule ChimeraOS, Heroic and SteamTinkerLaunch all write to. Keeping the id honest is what makes the tile the game's: Steam keys grid art, controller settings and play time off that id.--play, like the desktop and menu shortcuts, so "Play starts this version" holds in Gaming mode too.Add/Removework while Steam runs;takeDownexists for a caller that asked first, so a download is never cut. After a change made while Steam runs, the screen tells the user the one thing that does apply it: restart the console.The artwork: what the icon field is, and what the tile actually shows
An earlier revision of this description said the
iconfield draws the tile's art and that onelongshot.pngcovers all three shortcuts. A Deck with the tile installed and a blank tile in Gaming mode says otherwise, so the claim is retracted and the mechanism is now measured rather than inferred:iconfield is the small application icon — the overlay, not the poster. Desktop and applications-menu entries draw a.pnghappily; Steam's own tiles name an.ico, so the tile field names the embeddedlongshot.icoand only when that write actually landed (an icon field naming a file that isn't there is a blank square).userdata/<account>/config/grid/, keyed by the tile's appid read unsigned:<id>.pnglandscape 920x430,<id>p.pngportrait 600x900 (suffixp, no underscore — that one is the library tile),<id>_hero.png,<id>_logo.png. A bare tile with no capsules shows the blank default, which is precisely what happened on hardware.(appid << 32) | 0x02000000(Steam ROM Manager'slengthenAppId, Ice'sfilename_for_shortcut). Ground truth on the Deck: a working tile's landscape capsule sits byte-identical at2827843537.pngand12145495509653520384.png, and the second is exactly that formula. So both names get written; the two names are one slot seen by two UIs..jpgas readily as.png, so any file of any extension in a slot, under either name, means the user chose it and it stands. The check and the publish are one step (AtomicFile.WriteIfAbsent: temp, flush, publish without replace) because Steam's own UI can publish into that folder at any moment and an exists-then-overwrite sequence would rename straight over the user's choice. A half-written.tmpdoes not count as held: it is an interrupted publish, and treating one as the user's art would leave the tile blank on every launch afterwards. Temps are left on disk rather than deleted — same shape whatever wrote them, and clearing them could break a capsule Steam is mid-saving.The wordmark: the tile carries the name as well as the glyph
The shipped capsule art showed the weapon glyph alone; the emulator's own start-up screen (
gpu/vk/vk_menu.cppdraw_startup,gpu/vk/vk_ui.h) signs its picture with LONGSHOT under the glyph — Libertinus Serif Semibold (the fallback face the start-up screen itself uses; the game's own menu font is game data and cannot ship) in cream(246,232,204), letters spaced by 0.14 of their size, and the gold(214,170,96)flourish (faint rule, two mirrored bezier curls, centre diamond) under the word. The four slots now carry that same lockup: glyph top, name directly under it, flourish under the name.Not hand-painted, and not hand-editable either:
scripts/make_artwork.pycomposes the four slot files from the shipped pre-wordmark art, kept beside them assrc_<slot>.pngoriginals — the script reads only the originals and writes only the slots, because recomposing a recomposition doubles the glyph's soft glow into a fringe with every pass (a review pass caught exactly that in the first version). The capsules save RGB and the logo keeps real alpha: Steam scales with premultiplied alpha, and a capsule carrying a near-opaque alpha channel renders its dark edges wrong. The field the glyph sits on is sampled from the corners, never assumed. Re-running over unchanged originals reproduces the slot files byte for byte (md5-checked);App/Assets/steam/README-artwork.mdcarries the recipe and says a real artwork change means replacing thesrc_originals and re-running the script, with a look at the output as part of the change. The Libertinus OFL licence ships beside the font; thesrc_originals are build inputs and are excluded from the shipped binary (csproj).How Steam's library actually behaves (measured on a Deck LCD)
shortcuts.vdfwhen it starts and keeps the library in memory after that. A tile written while it runs is correct on disk and shows at Steam's next start — an earlier version of this description claimed Steam watches the file and reloads it, the way Heroic adds tiles; hardware says otherwise, and the code's comments now say so too.Removetakes Steam down before reading when the caller consented.grid/saw nothing across two Steam restarts, then the running UI requested the file. (A watcher that prints nothing is not evidence Steam never reads it — self-test the watcher first.)What was checked (game-free, in the suite)
tests/launcher_core/SteamChecks.csover fixtures fromtests/make_steam_vdf_fixture.py:-1467123759, quotedExewith spaces) comes out of the rule..icoonly when the logo actually landed; desktop and menu entries point at the.png; the appid does not move..jpgthe user put in a slot holds it under either name with no competing.pngbeside it; an interrupted.tmpdoes not hold a slot and is not deleted;GridId64reproduces the Deck's own working id pair.scripts/translations.py).launcher core: 1439 checks passed;test_release.pyOK (both re-run on the wordmark commits). (One check inBusyChecks.cshad gone stale against #121 and is fixed in the first commit — main's suite stops at it today.)Ground truth the format came from
A byte-faithful copy of this Deck's real
shortcuts.vdf(10 tiles, EmulationStation among them) parses with this code, and the referencevdfPython library — which round-trips that file byte for byte — parses the fixtures. The grammar detail the copy taught us: maps close on a lone0x08, not00 00.Hardware, on the Deck itself
longshot.desktop→~/.local/share/longshot/launcher/longshot.png), and the desktop library view renders the capsule. Crops of just the Longshot entries are attached; the full library is not, deliberately.--remote-debugging-port=8080) requestedcustomimages/2834237626p.pngfor our tile — our unsigned appid, our portrait capsule — the<img>reportedcomplete:trueat natural 600x900, and the served asset returned 200 with 131,186 bytes, md5-identical to this branch's embeddedcapsulep_600x900.png. That is the blank tile fixed, proven from inside Steam rather than from a screenshot. A readable Gaming-mode screenshot is still owed:spectaclesees nothing under gamescope,ffmpeg -f x11grab :0.0and a clipped CDP capture both return black, andGAMESCOPECTL_REQUEST_SCREENSHOTis not settable on this image.Not in this PR, on purpose
The uninstaller's reversal of the tile (the Ready screen's untick is the reversal today; an uninstall path for the tile itself belongs with the uninstall work), and Steam's own dialogs are never scripted.
Second delegated review pass; its findings are in
0464d74:Screenshots please!
WIP: feat(shortcuts): a Gaming mode tile for the game, made and reversed by the Ready screen (Steam Deck)to feat(shortcuts): a Gaming mode tile for the game, made and reversed by the Ready screen (Steam Deck)description rewritten after hardware: the icon field is only the small overlay icon, and the Gaming-mode tile's art is the capsule grid files under both the 32-bit appid name and (appid << 32) | 0x02000000. also documents the never-overwrite rules (any extension, either name, atomic publish, .tmp not counted as held) and the machine-proven Game Mode DOM evidence. latest head
8ed8f1b: 1435 checks.the desktop-mode library renders the same capsule files Gaming mode reads (one crop, only the Longshot entry):
merged launcher main into the branch (the DirectWrite fixes #134/#137 and the nightly note #133) — clean merge, no conflicts with the Steam tile work. Gate on the merged tree: 1439 checks (main added its own), test_release OK. head now
94d6e94.Reviewed the diff at
94d6e94against main (bfa2448). I readSteamShortcuts, the Ready screen's changes,AtomicFile.WriteIfAbsentand the checks.Run here (Windows 11, SDK 10.0.404):
dotnet build App/LongshotLauncher.csproj: 0 warnings, 0 errors.SteamChecks, run early: it stops at its first tile check on Windows (SteamChecks.cs:54, the quoted Exe on the test's Windows scratch path). The tile is Linux only, and main's full run on Windows already stops atShellLinkChecks, so I didn't chase it. Your Linux run is the one that counts.translations.py: each catalog lacks 2 more texts than on main. "Steam already has a shortcut called Longshot that this launcher did not make, …" and "The Steam shortcut could not be made: {0}" are missing from all 12 catalogs. The description says every new text is in every catalog.The vdf handling looks careful: other tiles come back byte for byte, a tile is matched by its id rather than its name, keys never repeat, and art is only written to an empty slot. No blockers from me, so this is a comment.
Worth fixing (inline):
Updatere-aims our tile and writes the new path's id intoappid. Steam keys the tile's controller layout, play time and the art the player picked by that id. All of those stay behind under the old id, and the new id gets our default art. Steam itself keeps the id when you change a tile's target in Properties, as the comment inFindOurssays. Keeping the id would need the marker to stop requiring that its id hashes from its Exe. (The launcher's own self-update replaces the AppImage in place, so it doesn't hit this.)Add. A player who unticked it after one build gets the tile back after the next. That matches the desktop and menu ticks. But this is a third program's library, on every Linux PC with Steam, not just the Deck. Worth HumanBean's call whether it should start on, or remember the player's untick.Locatepicks the account by the newestconfig/folder.config/loginusers.vdf'sMostRecentis Steam's own answer, if the account in use matters on a shared PC.Nits:
SteamTickVisibleis unused. The comment aboveLogoPathstill says the icon field is what the tile draws, which the description takes back.File.Move(..., overwrite: false)on Linux is .NET'slink()and thenunlink(), not "rename(2) with O_EXCL". It is still atomic where links work, but .NET falls back to check-then-rename on filesystems without them.Screenshots: HumanBean asked for screenshots. The library crop shows the art, but there's none of the Ready screen with its fourth tick. The row was already full at 960 wide with three ticks, and German's labels are longer.
Merges: #59 merges cleanly with this PR. #55 conflicts in
.gitignore, the csproj andBusyChecks.cs. #49 conflicts inAtomicFile.cs. #46 and #128 conflict in the 12 catalogs (all append at the end). The first commit'sBusyCheckschange is only a message now, since main already has thedeletingLeftoverscheck, so dropping it would clear #55's third conflict.@ -521,1 +521,3 @@bool desktop = true, menu = true;// the three shortcuts start ticked: an install should leave something to press. The Steam// one only shows where there is a Steam to add to (SteamShortcuts.Locate says so)bool desktop = true, menu = true, steam = true;This starts on for every Ready screen, so a tile the player removed by unticking comes back at their next build or update (
steamAskedis per screen). The desktop and menu ticks behave the same, but this one writes into Steam's library on every Linux PC that has Steam, Deck or not. Remembering the untick in settings, or starting it on only the first time, would respect the player's choice.@ -590,0 +594,4 @@/// The Deck and any Linux desktop with Steam: the tile that makes the game playable in Gaming/// mode. Found once, quietly: no Steam to add to means no tick and no fusspublic bool ShowSteamTick => steamPlacement != null;public bool SteamTickVisible => ShowSteamTick;Nit: unused (the view binds
ShowSteamTick).@ -622,0 +753,4 @@{steam = false;Raise(nameof(Steam));Main.ShowToast(Tr.T("Steam already has a shortcut called Longshot that this launcher did not make, so it stays exactly as you made it."));This text and "The Steam shortcut could not be made: {0}" (line 820) aren't in any catalog:
translations.pygives 28 missing per catalog here, 26 on main.@ -622,0 +770,4 @@// failure it should have seen instead: one toast shows at a time, and an error about// shortcuts that could not be written outranks a note about restartingif (wrote && SteamShortcuts.SteamUp() && !shortcutsFailed)Main.ShowToast(Tr.T("Restart the console to see Steam shortcut changes in Gaming mode."));On a Linux desktop there's no console to restart. "Restart Steam to see the Steam shortcut in its library." works on the Deck (a console restart restarts Steam) and on a PC.
@ -16,0 +35,4 @@{// overwrite:false: the rename fails if the target appeared since the check. On// Windows that is MoveFileEx without REPLACE_EXISTING, on POSIX rename(2) with// O_EXCL semantics — atomic either way, and no mutex needed for a non-replacementNit: on Unix, .NET's
File.Move(…, overwrite: false)islink()and thenunlink()(atomic: EEXIST if the target is there). On a filesystem without hard links it falls back to a check and thenrename(), which isn't atomic. This is fine for Steam's grid/ on ext4/btrfs; only the comment overstates it.@ -0,0 +58,4 @@{if (!ulong.TryParse(Path.GetFileName(dir), out _) || !Directory.Exists(Path.Combine(dir, "config"))) continue;var written = Directory.GetLastWriteTimeUtc(Path.Combine(dir, "config"));if (written > best) { best = written; account = dir; }The newest
config/folder is usually the account in use, but not always: any account's config can be touched, for example by a Steam client update.config/loginusers.vdf(text VDF) marks the signed-in account with"MostRecent" "1". Not urgent on a single-account Deck.@ -0,0 +166,4 @@}}// ---- the tile's logo: the entry's icon field is what Steam draws on the Gaming-mode tileNit: this still says the icon field is what Steam draws on the tile. The description and the art section above now say the capsules are the art.
@ -0,0 +502,4 @@static void Update(Vdf entry, Entry p){SetNum(entry, "appid", p.AppId);When
FindOursmatched through the marker (the launcher now runs from another path), this gives the tile the new path's id. Steam's per-tile data stays under the old id: the controller layout, play time and art the player chose. The new id gets our default capsules. Steam keeps the id when a target is changed in Properties, so keepingappidas it is here would behave like Steam. The marker would then record that id, andClaimOfwould need to check it against the tile rather thanSignedId(marker Exe).@ -0,0 +536,4 @@catch (IOException) { continue; } // the process ended mid-scancatch (UnauthorizedAccessException) { continue; }var name = Path.GetFileName(first);if (name is "steam" or "steamrt" or "steamrt64" or "gamescope") return true;gamescopeon its own isn't Steam: a desktop running gamescope for another game would get the restart toast. On the Deck, Steam runs inside gamescope anyway, sosteamalready covers it.The tiles now carry the name as well as the glyph:
e40bcbd.The Game Mode tile and the desktop capsule showed only the weapon glyph. The emulator's own
start-up screen signs its picture with LONGSHOT under the glyph (drawn in code,
gpu/vk/vk_menu.cppdraw_startup: Libertinus Serif Semibold — the fallback face thestart-up screen itself uses, since the game's own menu font cannot ship — cream
(246,232,204), 0.14 em tracking, a gold(214,170,96)flourish rule under the word). Thefour Steam slots now carry that same lockup: glyph top, word directly under it, flourish
under the word, on the same flat field the old capsules had.
The files are composed, not hand-painted:
scripts/make_artwork.pycuts the glyph from theshipped art (it samples the field colour instead of assuming one, and guards against the kind
of baked letterbox bars this set turned — by pixel probe — not to have), draws the word and the
flourish from the start-up screen's constants, and
App/Assets/steam/README-artwork.mdsaysthat a future artwork change means re-running the script and reviewing the output, not opening
a paint program. The Libertinus OFL licence ships beside the font.
Sizes and modes are unchanged (920x430 / 600x900 / 1920x620 / 998x323, RGBA, logo stays
transparent), so the slot machinery in this PR is untouched. Launcher suites on the merged
tree: core 1439 checks, release 34 tests, all green.
Description now carries the wordmark work: the four slots composed from committed src_ originals by scripts/make_artwork.py (
e40bcbd, then the review-driven fix5cfd398: originals as inputs so re-runs never recompose a recomposition, capsules save RGB under premultiplied scaling, byte-identical md5 on re-run). Suites re-run green on both commits: 1439 checks + 34 release tests. The DOM capsule proof stands for the pre-wordmark capsules; the wordmark capsules ride the same slots and are owed one hardware tick when a launcher build carrying them is installed.Review findings folded in as
ed14920(branch head now: artwork5cfd398+ this):The one the review caught by mutation — fixed. The capsule suite asked
TileAppIdwhere the fixture made the library id and the computed id equal, soTileAppId => p.Entry.AppIdpassed all 1439 checks (the reviewer demonstrated exactly that). The new check sits where they differ: a tile marked by this launcher, then the launcher renamed (the everyday AppImage-update case, and already the fixture's own moved-tile scenario) —renamed.Entry.AppId != carried && TileAppId(renamed) == carried. I re-ran the reviewer's mutation on the new suite: it aborts on this check (the bare-getter variant fails the suite with SIGABRT at the assertion), restored the file, suite green at 1440 checks + 34 release tests.The stale-icon minor — fixed.
steamPlacementwas cached with??=, so anEnsureLogoIcothat failed on one attempt and succeeded on a retry still offered an iconless tile (and an earlier success stayed offered after a later failure — harmless, the file is on disk). The offered entry's icon now follows the.icothat actually landed this time; the caching of the located account stays.The atomic-publish major and the foreign-format minor from that same review were already fixed earlier on this branch (
8ed8f1b/caeaf24) before the review's diff base ended; the reviewer independently re-derived the WriteIfAbsent shape. Its remaining non-blocking idea (tag app-dir modules with a marker in the diagnostic instead of dropping them) I'm not taking in this PR — it's a #123 follow-up if anyone wants it.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.