Skip to content

Never pass devicectl's --remove-existing-content: it deleted game data on the device - #266

Merged
v0lumehi merged 1 commit into
mainfrom
v0lumehi/devicectl-no-wipe
Oct 30, 2026
Merged

v0lumehi merged 1 commit into
mainfrom
v0lumehi/devicectl-no-wipe

Conversation

@v0lumehi

@v0lumehi v0lumehi commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

What and why

Data loss. xcrun devicectl device copy to ... --remove-existing-content true does not only clear the destination folder, it also deletes the destination's siblings. The launcher passed the flag on two copies to the device:

Since when. Main has had this since #66 (2026-10-27), shipped in v0.6.0 to v0.7.2. The cheats push came with #218.

How it was found. @Tiomehsh tested #260 on a real iPhone 16 Pro and iPad Pro (see #250). After the UI transfer both devices had lost Documents/romfs.img and Documents/env.txt. They then reproduced it in an isolated devicectl temporary folder: copying a directory to probe/save with --remove-existing-content true also deleted the sibling probe/root.txt, and without the flag it stayed. Our fake DeviceControl only modelled removing the destination, so the tests could not see it. Thank you, this was an excellent catch.

Fix. The flag is never passed. SaveTransfer.copyToCommand (used by the save push and, through CheatTransfer.copyCommand, by the cheats push) now merges the Mac's files into the destination folder and deletes nothing, like the install's archiveCopy already did. devicectl has no command to delete a single file (copy has only to and from, info files only lists), so one trade-off remains: a file the Mac no longer has can stay in the device's save or cheats folder. That is far safer than wiping game data, and the existing backup of the device save before a push is unchanged. Backups and confirmation behaviour are unchanged, and no string changed.

Tests: the fake devicectl now behaves like the real one (the flag deletes every entry in the destination's parent, without it the folder is merged and overwritten). New tests check that a save push leaves Documents/romfs.img, Documents/env.txt, Documents/games/<id>/romfs.img, aoc/ and cheats/ in place, that a cheats push leaves romfs.img, aoc/ and the save in place, and that the flag is never passed. The old assertion that it was passed is inverted. A test on the stand-in itself shows it would catch a regression.

For @LNPANDY: this affects shipped releases (v0.6.0 to v0.7.2). It probably warrants a quick patch release, plus a warning in the release notes: players who pushed a save or cheats from the Mac to a device may have lost their game data on the device (romfs.img, env.txt, DLC) and need to copy it to the device again. Their saves are not lost, the Mac keeps them and a backup is made before each push. #260 gets the same fix.

Refs #250 (the data loss part, the rest is #260).

Checked

  • Tests: cd frontend && swift build && swift test (477 tests, 0 failures, 15 skipped as before), python3 scripts/patches.py check ok. No Qt change (no string changed, Qt has no devicectl code).
  • Run on a device or Mac: not run. devicectl was not run against any device here. The behaviour of the flag is @Tiomehsh's reproduction on real devices.

Scope

  • No vendored file is edited directly
  • Not an engine or game profile change
  • No keys, game files or data extracted from a game in the change or the attachments

On a real device the flag deletes the destination's siblings too, not only
its contents. A save push to Documents/games/<id>/save removed the game's
romfs.img, and a cheats push removed what sits beside Documents/games/<id>/cheats.

The copies now merge into the destination and delete nothing. A file the Mac
no longer has can stay in the device's folder, which is far safer than wiping
game data (devicectl has no command to delete a single file). The stand-in
devicectl in the tests now wipes the parent's entries when the flag is passed,
and the tests assert the flag is never passed and that game data stays.

Found and reproduced on real devices by Tiomehsh (#250).

Co-authored-by: Tiomehsh <[email protected]>
@v0lumehi v0lumehi added bug Something isn't working launcher The NX2Apple launcher app ios iPhone or iPad labels Oct 30, 2026
@v0lumehi
v0lumehi merged commit 56c7db3 into main Oct 30, 2026
10 checks passed
@v0lumehi
v0lumehi deleted the v0lumehi/devicectl-no-wipe branch October 30, 2026 17:59
@v0lumehi

Copy link
Copy Markdown
Collaborator Author

@LNPANDY merged, CI was green. Since v0.6.0 to v0.7.2 can delete a device's game data when a player pushes a save or cheats, I'd suggest a patch release soon, with a line in the notes: players who used Saves or Cheats with a device may need to copy their game data to the device again (Install or Manage → game data).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ios iPhone or iPad launcher The NX2Apple launcher app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant