#305

Android: opt-in "replace" import (save-import-replace) for playing one character on two devices

Openyyan160opened 1d ago

@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 _cloudinbox on 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.

  1. Back up first. Before touching anything, the phone's current saves are exported to save-export/<date-time>-before-replace/, the same as an export, so nothing can be lost.
  2. 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.
  3. Shared stash. The stash folders and their Chronicle side files (*.swvault) are replaced, not merged, and no _cloudinbox entry is made. The Elysium list is set from the backup for the imported characters, as now.
  4. Settings. The phone keeps its own, since the layout is device-specific.
  5. 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?

Activity

1
yyan1601d ago

@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, and t_cloudsync.c already uses a local folder). On Android:

  • Opt-in: sync turns on when the game folder has a cloud-sync/ folder, or through a Custom-page toggle if you prefer.
  • When it runs: dm_cloud_sync(save, "<game folder>/cloud-sync", allow_down=1) at start-up, before the saves are mounted (where SaveTransfer runs today), and allow_down=0 after each save commit, as on iOS.
  • Behaviour: the same rules as iCloud: each character syncs on its own and the later write wins; a forked shared stash goes through _cloudinbox and is merged in game; replaced copies go to backups; Settings stay per device.
  • Players keep that folder in sync with whatever they use: a NAS, Syncthing, or Google Drive through a sync app. The app itself makes no network calls.

It makes the replace import in this issue unnecessary for multi-device play. Which would you prefer? I'd lean towards folder sync.