#305
Android: opt-in "replace" import (save-import-replace) for playing one character on two devices
@jhaizhou-ops, a proposal from #243. @shasen1235 plays the same character on an RP5 and a Quest 3 and syncs through a NAS. Import is add-only by design (SaveTransfer.java), which suits moving saves once but not syncing:
- a character whose name is already on the phone is skipped, so the newer copy never comes in;
- an existing shared stash is merged through
_cloudinboxon every import. The same-phone rule doesn't catch this, because the backup comes from the other device, so each round trip adds the stash's items and gold again.
Proposal: a separate folder name, save-import-replace. Plain save-import stays add-only.
- Back up first. Before touching anything, the phone's current saves are exported to
save-export/<date-time>-before-replace/, the same as anexport, so nothing can be lost. - Characters. A backup character replaces the phone's character of the same name (the whole folder). Other characters on the phone stay, and new ones are added.
- Shared stash. The stash folders and their Chronicle side files (
*.swvault) are replaced, not merged, and no_cloudinboxentry is made. The Elysium list is set from the backup for the imported characters, as now. - Settings. The phone keeps its own, since the layout is device-specific.
- Failure and reporting. The same rollback as today if it fails halfway. The folder is renamed
save-import-replace.done-<date-time>, and the on-screen message lists replaced and added characters.
The rule for players: the last device to export wins, so play on one device at a time.
OK to implement this?
@jhaizhou-ops An alternative that fits @shasen1235's case better than a replace import: folder sync on Android, reusing
dm_cloudsync.c. Its core only syncs "the local save directory ↔ one cloud directory" (the iOS side just supplies the iCloud Drive folder, andt_cloudsync.calready uses a local folder). On Android:cloud-sync/folder, or through a Custom-page toggle if you prefer.dm_cloud_sync(save, "<game folder>/cloud-sync", allow_down=1)at start-up, before the saves are mounted (whereSaveTransferruns today), andallow_down=0after each save commit, as on iOS._cloudinboxand is merged in game; replaced copies go to backups; Settings stay per device.It makes the replace import in this issue unnecessary for multi-device play. Which would you prefer? I'd lean towards folder sync.