mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 08:19:56 -04:00
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:
13
runtime/fs.h
13
runtime/fs.h
@@ -61,3 +61,16 @@ int fs_save_busy(void); // a save is being wr
|
||||
// or save data changed in the last 3 s and not committed
|
||||
void fs_save_flush(void); // wait for a save Commit still running in the background;
|
||||
// every exit path calls it before the process ends
|
||||
// A shared save (save_share.c). fs_save_export: visit(ctx, path below the save with '/', bytes, size) for every file of
|
||||
// the save the game would load next, under the commit lock; visit returns 0 to fail. The number of files (0: no save
|
||||
// yet), -1 when one could not be read or visit failed.
|
||||
typedef int (*FsSaveVisit)(void *ctx, const char *rel, const uint8_t *data, size_t n);
|
||||
int fs_save_export(FsSaveVisit visit, void *ctx);
|
||||
// The menu's import: count files (relative '/' paths, bytes) become <profile>/save-import, which the next start makes
|
||||
// the save, backing up the save it replaces; one waiting already is replaced. 0 on success.
|
||||
int fs_save_import_stage(int count, const char *const *rel, const uint8_t *const *data, const size_t *size);
|
||||
int fs_save_import_waiting(void); // 1 while an import waits for the next start (0 before
|
||||
// the first storage use)
|
||||
int fs_save_import_cancel(void); // drops it; 0 on success
|
||||
const char *fs_save_import_done(void); // the backup of the save an import replaced at this start,
|
||||
// "-" when there was none, "" when no import ran
|
||||
|
||||
Reference in New Issue
Block a user