Add RetroArch save sync with the RomM server#112
Draft
gantoine wants to merge 1 commit into
Draft
Conversation
Implements the API-mode save sync flow from the RomM server PRs (#3137, #3479): register this machine as a RomM device once, POST /sync/negotiate to let the server decide upload/download/conflict/no_op per save, execute the returned operations, then complete the sync session. Conflicts are resolved most-recent-wins. Scope is RetroArch battery saves (.srm): the local save path is derived from retroarch.cfg (savefile_directory plus the sort_savefiles* options), with a recursive search fallback for sorted layouts. Saves are pulled down before launch (OnGameStarting) and pushed back after play (OnGameStopped), plus a "Sync saves with RomM" game-menu action. Gated behind a new "Enable save sync" setting; the server-assigned device id is persisted. Save content is hashed with MD5 to match the server's comparison. Pure parsing/path/hashing logic is unit-tested.
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.
Summary
Implements save synchronization between local games and the RomM server, per the save sync RFC, the server-side #3137, and the behaviour change in #3479.
Uses the server's API sync mode:
POST /api/devices, clientplaynite,sync_mode: "api"); the server-assigneddevice_idis persisted in settings.POST /api/sync/negotiate— report the local save (rom_id, file name, MD5content_hash,updated_at, size) and let the server decide per save:upload/download/conflict/no_op.POST/PUT /api/saves(multipartsaveFile),GET /api/saves/{id}/contentthenPOST /api/saves/{id}/downloaded.POST /api/sync/sessions/{id}/complete.Conflicts are resolved most-recent-wins (the RFC default), with the decision logged.
Scope & behaviour
.srm): the local save path is derived fromretroarch.cfg(savefile_directoryplus thesort_savefiles_enable/sort_savefiles_by_content_enableoptions and the:base-dir token), with a recursive-search fallback for sorted layouts.OnGameStarting), push after play (OnGameStopped), plus a "Sync saves with RomM" game-menu action.Files
Saves/SaveSyncService.cs(orchestration),Saves/RetroArchConfig.cs+Saves/SaveFileHash.cs(pure, unit-tested),Models/RomM/Save/*(wire models).RomM.cs(play hooks + menu item),Settings/Settings.cs+SettingsView.xaml(new toggle, persisted device id).RetroArchConfigTests,SaveFileHashTests.Testing
Open questions
extension.yamlversion bump and a README section for the new setting can follow if wanted.🤖 Draft opened for review.
Generated by Claude Code