Files
Yuechuan YangandClaude Opus 5.5 cd225d16ce Android: back up and import saves with an export marker or a save-import folder; an imported stash is merged (#140, #174, #193)
Saves live in the App's internal files/save, which cannot be reached without root,
and uninstalling deletes them. Without adding any menu, as #140 proposes, the game
folder Download/S2X/D2R Mobile/ now takes two markers, handled at start before the
native library loads (the game has not mounted the saves yet):

- an `export` file (or folder): files/save is copied to save-export/<date-time>/
  (through a .part copy), then the marker is deleted;
- a `save-import` folder: the saves in it (one folder per character with
  <name>.d2s, as in an export; an export's own <date-time>/ level is accepted) are
  added to files/save. Nothing on the phone is replaced: a character whose name is
  taken is skipped, and Settings are only imported while the phone has none.
  A shared stash the phone lacks is copied in; one it has is merged: the backup's
  copy is packed into the in-game merge inbox (_cloudinbox/<ms>-import/mine.pack,
  the dm_cloudsync.c pack format, no base), and dm_cloudmerge.c -- the path iOS
  uses for forked iCloud stashes -- puts the items the current stash lacks into the
  inventory when the stash is opened and adds the gold. A digest per entry
  (import.sha256) stops the same stash from being merged twice, and a backup this
  phone exported itself is not merged back at all: exports carry this install's id
  (export-source.txt, kept in files/save-transfer-id from the first export on), and
  merging your own older stash would add its gold again and duplicate items taken
  out since. The softcore and hardcore stashes merge separately, each when a
  character of that kind opens the stash. Entries ending in
  -import get their own in-game notices (dmImportMergeBack / dmImportMergeFull)
  instead of the iCloud wording. save-import is then renamed
  save-import.done-<date-time>; a folder with no recognisable saves is left alone
  and renamed save-import.rejected-<date-time>.

Toasts say what was exported, imported, skipped or queued for merging (strings in
ui_text.tsv, 5 languages, header regenerated). SaveTransfer.java is plain Java with
a host test (dm/android/tests/SaveTransferTest.java, 34 checks); a Java-made pack
was read back by dm_cloudsync.c's dm_cloud_pack_each byte for byte. docs/ANDROID.md
and the Chinese version explain both steps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 11:20:37 +13:00
..