Skip to content

Deck: a game's start waits for its save, and its play is told to the daemon - #109

Open
Omar-VF wants to merge 2 commits into
dev-publicfrom
fix/deck-launch-sync
Open

Omar-VF wants to merge 2 commits into
dev-publicfrom
fix/deck-launch-sync

Conversation

@Omar-VF

@Omar-VF Omar-VF commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Needs a test on a Steam Deck before merging. The launch hold uses Steam client functions that only exist in Game Mode, so CI can't exercise them.

The problem. The panel synced a game when Steam reported it running, alongside the game starting. So a game could open its old save while the newer one was still arriving, and playing on it led to a conflict at the next sync. The daemon also had to spot the game among running programs every ten seconds, which under Proton it may not, so "After playing" snapshots could be missed.

A game's start waits for its save. When a tracked Steam game is launched, the plugin cancels Steam's launch (RegisterForGameActionStart → CancelGameAction), syncs the save, then starts the game again (RunGame).

  • If a sync of that game is already running, it waits for that one.
  • At most 30 seconds. A slower sync carries on alongside the game, and a toast says so.
  • The game is started again whatever the sync did.
  • A toast shows only if the wait passes about 1.5 seconds. With no other device online, the wait ends at once.
  • A new toggle, "Wait for the save before starting" (on by default), turns the hold off and goes back to syncing alongside the launch.
  • Which games to hold comes from a list of tracked games by App ID, refreshed every minute and with the panel, because the decision has to be made the moment Steam reports the launch.

The daemon is told when a game starts and stops (POST /api/games/{id}/session). Ending a session takes the "After playing" snapshot and syncs it. The exit sync still runs afterwards, for sessions too short to count and to say how it went.

Not covered: non-Steam shortcuts (emulators) still don't sync on launch and exit; nothing maps a shortcut to a tracked game yet.

Tests:

  • tests/test_main.py: the session calls reach the daemon with the right body, and a refusal is reported rather than raised.
  • TestDeckyPluginContract now also pins /api/games/{id}/session and the appId and autoSync fields the plugin reads.
  • Type-check, build and all plugin tests pass locally.

To test on a Deck (Decky → developer mode → install from zip):

  1. Change the save on the PC, then launch the game on the Deck. It should start a moment later, with the PC's save.
  2. With the PC off, the game should start almost at once, with no toast.
  3. Quit after a minute or more of play. An "After playing" snapshot should appear, and the save should reach the PC.
  4. Turn the new toggle off and launch again. The game should start immediately, as before.
  5. Launch an untracked game. Nothing should change.

…daemon

The panel synced a game when Steam reported it running, alongside the
game starting, so the game could open its old save while the newer one
was still arriving, and playing on it led to a conflict at the next
sync. Now, when a tracked Steam game is launched, the launch is held
(Steam's game action is cancelled), the save is synced - waiting for a
sync already under way if there is one - and the game is started again.
At most 30 seconds: a slower sync carries on alongside the game, and
the toast says so. The game is started again whatever the sync did. A
toggle, "Wait for the save before starting", on by default, turns the
hold off and goes back to syncing alongside.

The daemon is also told when the game starts and stops
(/api/games/{id}/session). It otherwise has to spot the game among
running programs every ten seconds, which under Proton it may not; a
session ended from here takes the "After playing" snapshot and syncs it
before the exit sync runs.

Which games to hold is decided from a list of tracked games by App ID,
refreshed every minute and with the panel, because the hold has to be
decided the moment Steam reports the launch.
@vercel

vercel Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
open-save Ready Ready Preview Oct 23, 2026 5:37pm UTC

A session the plugin begins is only ended by the plugin, when Steam says
the game stopped. A reload of the plugin, or of Steam, while a game ran
lost the session, and its stop was missed: the session stayed open in
the daemon until it restarted, and with a game's save held back from
syncing while it is played, that is a save that does not sync.

The sessions begun here are kept in localStorage. When the plugin loads,
one whose game is not running is ended; one still running is kept, and
its stop ends it as usual. A session is forgotten only once the daemon
has taken its end, so an end the daemon did not get is tried again at
the next load.

This branch was successfully deployed

1 active deployment
Preview — 0c8189ed Deployed Oct 23, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant