Repository navigation
Conversation
…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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).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.TestDeckyPluginContractnow also pins/api/games/{id}/sessionand theappIdandautoSyncfields the plugin reads.To test on a Deck (Decky → developer mode → install from zip):