The import's default blob name was the payload's file name (SLOT0, Player,
story) on a guess the docs carried as a VERIFY. The executable settles it:
XGameSaveSubmitBlobWrite takes a literal at both call sites -- "Save Game
Header" first, 0x128 bytes, then "Save Game Data" with the payload -- and
the read path matches exactly those two names, keeping the header only when
its size is 0x128. A container the title wrote therefore holds a 296-byte
header blob and a data blob, so a payload imported under any other name is
never read back.
Write the payload as "Save Game Data" (the existing %-encoding turns it into
Save%20Game%20Data on disk) and leave --map for both halves. The container
name is still unmeasured: neither CreateContainer call passes a literal, both
take [state + 0x288] + index * 0x2c + 2, a table the title fills at run time,
so the default stays the ASAV slot name and the docs say so instead of
guessing.
docs/saves.md records what was measured and what was not and drops the
VERIFY; the import-manifest note says the same; the layout test pins the new
name. tools/exe_checklist.py goes from 17 notes to 16 on dde82f27e.
The offline XGameSave lists any folder, but the game opens a container by name,
and the runtime refuses names against the documented rule (E_GS_INVALID_CONTAINER_NAME),
so such an import could never be loaded. Same rule as xgameruntime_gamesave.cpp;
the warning names the --map to fix it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A GDK title opens its save provider at boot; QueryApiImpl now serves
XGameSaveImpl (IXGameSaveImpl..3, 33 slots from xgameruntime-docs' layout,
signatures and error codes from the public GDK reference). Saves are files
in LEONIDA_SAVE_DIR\local-user\<container>\<blob> (default
%LOCALAPPDATA%\Leonida\saves), %-encoded: the layout tools/saves.py import
already writes. Updates are buffered and committed by write-then-rename;
container names follow the documented rule; the 16 MB update limit, the
documented E_GS_* codes, async variants through XAsync, and the
XGameSaveFiles folder/quota slots. Assumptions (quota, blob-name length,
nullptr blob list) are marked in the source and docs.
xgameruntime_gamesave_test drives every slot (50 checks). The two tests that
used XGameSaveImpl's id as "a class not served" now use a made-up id.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- docs/saves.md: document 1,644-byte ASAV profile record (kind 3) layout: 112-byte active header and setting fields starting with u32 10, u32 3, followed by 1,532 bytes of zero padding.
- tools/saves.py: implement parse_profile and build_profile to decode version, kind, active dwords, account identifier and verify zero-padding cleanliness; update info and extract commands to report profile metadata and write profile.json.
- tests/test_saves.py: add unit tests for profile record decoding, extraction, info reporting and invalid version/kind rejection.
test_destination_symlinks_update_the_target_and_remain_links compared
os.readlink(link) with the path the link was created from. On Windows
os.readlink returns an absolute target with a \?\ prefix, so the two
absolute subtests failed where the account can create symbolic links,
although saves.pack had left the link alone.
The test now reads the stored target before packing and checks that it
is the same afterwards.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
parse_asav read the fixed fields at absolute offsets (timestamp at 0x20, the
checksum at 0x160, the size at 0x168) without checking the file was long enough,
and asav_payload sliced at a declared payload offset that could be past the end.
A truncated save aborted the parser with "unpack_from requires a buffer of at
least 32 bytes", which says nothing about the save, and a lying offset returned
an empty payload as if the file were fine.
Validate both and raise ValueError with the same shape as the JSAV parser
(#923): "header is only N bytes, an ASAV header is 368", and "payload offset
0x... is past the end of a N-byte file". The CLI line that turns this into one
ERROR and exit 2 is #923's guard; this is the parser half of #980.
Tests: three cases in tests/test_saves.py, including the byte counts from the
issue's reproduction.
🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
import took the last ASAV/JSAV file in sorted order, so a folder holding
"slot1" and an older "slot1.bak" silently imported the backup. Reject such
folders while planning and list the matching names (review of #345 by
@VictorJulianiR). New synthetic test covers it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs/saves.md records the measured layout of the game's save containers:
JSAV v3 (20-byte index + one JSON document of CodeSaveBlocks/ScriptSaveBlocks,
rebuilt byte-for-byte), the ASAV header (checksum at 0x160 still unknown) and
the SLAYER1 wrapper, whose packed body is noted and not decoded.
tools/saves.py (stdlib only): info, extract, pack, verify, diff, and import
into the offline XGameSave folder layout of xgameruntime_services.cpp (#279)
with the same %-encoding. tests/test_saves.py covers it on synthetic files.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>