The list of Elysium characters, sw_elysium.txt at the saves root (one name
per line, dm_elysium.c), was left behind by the import, so an imported
Elysium character came back as a normal one. It is now set from the backup
for the characters the import adds, and only for them: a name in the
backup's list is added to the phone's list, a name that is not there is
removed (a deleted character of the same name may have left it). The
phone's other names stay, a character skipped because its name is taken is
not touched, and the list is restored if the import fails.
Tested on a OnePlus 13: with the Elysium character yyc moved off the phone,
importing it from a backup brought it back with its list entry, and in game
it entered as an Elysium character. SaveTransferTest: 71 checks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The items stored in the Chronicle stash live in a side file at the
saves root, <shared stash name>.swvault (dm_vault.c), not inside the
stash folder. The export copies the whole save folder, so backups had
it, but the import only took folders (characters, shared stash,
Settings). After an export, reinstall and import, the Chronicle still
listed the entries but every stored item was gone ("recorded, not
stored").
The import now takes that file too:
- the phone has none: it is copied in. When the game loads the vault
it already drops any item whose bytes are in a save, so nothing is
doubled;
- the phone has a different one: it goes into the merge inbox with the
shared stash, at the pack path dm_cloudmerge.c already reads
(<stash>.swvault), and the backup's items the phone doesn't have come
back to the inventory in game. Not for a backup from this same phone,
as for the stash;
- the same contents: nothing to do.
A save-import holding only that file is accepted, so a player who lost
the items can restore them from the old export. Without a side file
the merge digest is the same as before, so earlier inbox entries still
count as merged.
SaveTransferTest: 60 checks (was 40). Against the unfixed
SaveTransfer.java the new part fails at the first check ("vault: fresh
import result lists the vault"). docs/ANDROID.md and the Chinese
version describe the file and the restore.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Two points from the review of #213:
- A save-import holding only Settings/ was not recognised as saves and was renamed
save-import.rejected-*. looksLikeSaves now counts a Settings/ folder too, so it goes
through the usual add-only rule: imported while the phone has no settings, otherwise
reported as already on the phone.
- If a multi-character import failed halfway (a copy error, a full disk), the characters
already added stayed while the message said the saves were unchanged. importFrom now
remembers what it placed and deletes it again on failure; everything it places was
absent before (add-only), so the saves are exactly as before and the message is true.
save-import keeps its name, so the next start tries again. Only if that cleanup fails
too (rare) does the result become IMPORT_PARTIAL, with a new message
(dmAndroidSaveImportPartial, 6 languages) naming what was already added.
- Items are imported in name order, so a retry behaves the same way.
SaveTransferTest: 40 checks (was 34). The new Settings-only and halfway checks fail
against main's SaveTransfer.java and pass with this change. docs/ANDROID.md and the
Chinese version describe both cases.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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: Yuechuan Yang <22333122+yyan160@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>