Let players export their save into one zip for a bug report and import a save someone shared, in the launcher and in the game's menu.

The launcher's home has a Saves screen: Export Save writes NX2navi-save-<date>_<time>.zip into Downloads (or a chosen folder) with a manifest, the save the game would load next and, for a bug report, the game's latest log and nx2navi.ini, never a key file; Import a Save checks a zip's manifest, game, paths and CRCs, backs the current save up into the saves folder and replaces it while the game is not running. The game's Game tab has the same exports and an import that waits in profile/save-import and becomes the save at the next start, since the running game would write its progress back over a save replaced under it.

The zip code (runtime/save_zip.c) and the import at start are checked without game files by tests/save_zip_check.py and tests/save_share_check.py; the launcher side by its test suite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-09 13:13:43 -05:00
parent cb234fade1
commit b2074499de
26 changed files with 2974 additions and 78 deletions

View File

@@ -237,6 +237,13 @@ With `--romfs <extracted RomFS folder>` it draws the game's interface textures a
both decode the game's files, so they run with `.venv-py314\Scripts\python` (`compression.zstd` and numpy). What they
write is decoded game data: keep it under `build/`.
A change to the shared save (`runtime/save_zip.c`, `runtime/save_share.c`, the save import in `runtime/fs_host.c`)
passes `python tests\save_zip_check.py` and `python tests\save_share_check.py`. The first builds `save_zip.c` alone
and checks its deflate, inflate, zip writer and reader against Python's zlib and zipfile both ways, and that the
launcher imports a zip it wrote. The second builds `fs_host.c` and `save_share.c` with the rest of the runtime stubbed
and runs each step as a start of the game on a profile it makes: the export, an import from a zip the launcher
exported, its backup and swap at the next start, the zips it refuses and Cancel. No game files.
A change to the button prompts (`tools/make_romfs_patches.py --prompts`, `tools/button_icons.py`) passes
`.venv-py314\Scripts\python tests\romfs_prompts_test.py`, which runs the tool on a RomFS it makes itself (no game
files); a change to the settings passes `nx2navi.exe --probe-cfg`.

View File

@@ -40,8 +40,9 @@ identity (`NX2navi.Launcher`), so the taskbar groups and pins it under NX2navi r
Screens (`launcher/ui/app.py`): first run (dump, install folder, Desktop Shortcut, Check for Updates at Start,
Update Channel, Begin Installation); the steps of an install, update or rebuild with their progress, the build log's
last lines and Cancel, and after a failure Try Again and Copy Report; home (Play, Updates, Game Folder, Import Saves,
Rebuild the Game, Settings); settings (update check, Install Updates Automatically, Hide Launcher While Playing, Keep
last lines and Cancel, and after a failure Try Again and Copy Report; home (Play, Updates, Game Folder, Saves,
Rebuild the Game, Settings); saves (Export Save, Add Log and Settings, Export To, Import a Save, Import a Save Folder,
Open Saves Folder, Back); settings (update check, Install Updates Automatically, Hide Launcher While Playing, Keep
Build Cache, Update Channel, the folders, Open Logs Folder, Uninstall, Back); uninstall (keep or remove the built game).
A screen with more rows than the window holds draws them closer together (`fit_rows`).
@@ -67,7 +68,7 @@ toolchain/msys64/ucrt64 MSYS2's clang and libraries, downloaded from the MSYS2
toolchain/pkgs/ the downloaded package files
data/launcher.json settings; data/logs/launcher.log (and crash.log); data/cache/fonts
game/ the built game, unless another folder was chosen (its layout: README-BuildKit.md), with
saves/ for saves to import (below)
saves/ for saves to import and the backups imports make (below)
```
A path the Windows ANSI code page cannot hold breaks the MSYS2 tools, so the toolchain then goes to
@@ -207,15 +208,53 @@ When the new version fails to start (exit code 86 from `start.pyw`, or any error
runs. Keep Build Cache off deletes the lifted C and the objects (about 5 GB) after each build but keeps
`build-cache/state.json`, so updates still rebuild without the dump (compiling everything).
## Importing a save
## Sharing a save
Import Saves (home, under Game Folder; `launcher/saves.py`) makes another save the game's own. The game folder has
a `saves` folder with a README for it: a save put there (its files, or the folder that holds them) is taken first,
and the row then reads "From the Saves Folder"; otherwise selecting the row asks for the folder. It recognises a
Switch save backup (the save's files), an emulator's save folder (nested folders named by user and title ids), and
another NX2navi game folder or its profile folder (the account folder inside). A folder with `progress.sav` at its
top is one save slot: it replaces that slot (`slot_00` to `slot_05`, by the folder's name, else `slot_00`) and the rest
of the current save stays. A folder with more than 4,000 files or 1 GB is refused as picked by mistake.
A bug report from a place in the game the developer has not reached yet is quickest to reproduce with the reporter's
save. Saves (home, under Game Folder; `launcher/saves.py`) and the Saves rows of the game's settings menu (Game tab;
`runtime/save_share.c`) write and read the same zip.
**Export.** Export Save writes `NX2navi-save-<date>_<time>.zip` into the Downloads folder (Export To chooses another
folder) and opens the folder with the zip selected, ready to drag into a bug report. With Add Log and Settings on (the
default) it is `...-bug-report.zip` and also holds the game's latest log and its `nx2navi.ini`. In the game, Export
save and Export save for a bug report write the same two zips into Downloads; the second holds the log of the run in
progress. The zip:
```
manifest.json format "nx2navi-save", format_version 1, the game, its title id and version (1.1.1), the NX2navi
version, the export time (UTC), exported_by (launcher or game), the number of save files, bug_report
save/ the save the game would load next (a finished commit still waiting in profile/save-tx, else
profile/save/<account>): account.sav, option.sav, slot_00 to slot_05
bug-report/ nx2navi.log and nx2navi.ini, in a bug report
```
Key files (any `*.keys`, also one left in a save folder) and game files never go in.
**Import.** Import a Save takes such a zip: put it into the game folder's `saves` folder (the row then reads "From the
Saves Folder", and the home's Saves row "Import Waiting") or select the row and choose it. Before anything changes it
checks the manifest (the format, a format version it knows, the game's title id: a newer NX2navi's zip or another
game's save is refused), every path (inside the save, no links), the size (4,000 files, 256 MB), that the save is
this game's (`account.sav`, `option.sav` or a `slot_NN/progress.sav`), and each file's CRC as it unpacks. Then the
zip's save replaces the whole save, every slot, as a save folder does (below): the save the game would load now goes
to `saves/backup <date time>` first. It refuses while the game runs. A zip taken from the saves folder moves to
`saves/imported <date time>`.
The game's menu imports at the next start instead of at once: the game keeps its progress in memory and writes it back
at its next save, over files replaced under it, and the save's working copy is made when the game mounts its save.
Import a save checks the zip as the launcher does and puts its save in `profile/save-import`; the row then reads "at
next start", and Cancel the import drops it. The next start (the menu's Restart, or quitting and starting again)
copies the current save to `saves/backup <date time>` and makes the import the save before the game reads it
(`runtime/fs_host.c` `import_pending`), and the menu says where the old save went. An import in the launcher replaces
one still waiting from the menu.
## Importing a save folder
Import a Save Folder (Saves) makes another save the game's own. A save put into the game folder's `saves` folder (its
files, or the folder that holds them) is taken first by Import a Save; otherwise this row asks for the folder. It
recognises a Switch save backup (the save's files), an emulator's save folder (nested folders named by user and title
ids), and another NX2navi game folder or its profile folder (the account folder inside). A folder with `progress.sav`
at its top is one save slot: it replaces that slot (`slot_00` to `slot_05`, by the folder's name, else `slot_00`) and
the rest of the current save stays. A folder with more than 4,000 files or 1 GB is refused as picked by mistake.
The game keeps its save in `profile/save/<account>`, named after `profile/account.uid` (made as the game would when
it never ran). The import copies the save the game would load now (a finished commit still waiting in
@@ -311,7 +350,10 @@ makes no other step run), the button art a release copies and the packages and t
the compile step's object cache with the system's C compiler and its
largest-first order, its windres call under folders with spaces in their names, CLANG64's clang in the lock and the
install, the save import (the account folder, the save folders it recognises, backup, the commit journal, the saves
folder, refusals), the install job with a fake
folder, refusals), the shared save's zip (export of the save the game would load, the bug report files, no key
files, the import of a zip with its backup, a zip in the saves folder, the menu's waiting import dropped, the zips it
refuses: no manifest, another format or game, a newer format, paths outside the save, links, damage), the install
job with a fake
`make_game.py` (with and without the prompts row), and the window's selftest when a display is there.
## Requirements and limits

9
docs/releases/v0.6.2.md Normal file
View File

@@ -0,0 +1,9 @@
Draft notes for the release after 0.6.1. The version number is not decided yet.
## New
- Share a save: *Saves* in the launcher (*Export Save*, *Import a Save*) and *Saves* on the Game tab of the settings
menu write your save into one zip in your Downloads folder, with the game's log and settings for a bug report, and
import a zip someone shared. Attach the bug report zip to a report from a place in the game, so it can be reached
and checked quickly. An import copies your current save to the `saves` folder of the game folder first; in the game
it takes effect at the next start.