Repository navigation
Save files: document JSAV/ASAV/SLAYER1 and add tools/saves.py (import into #279's XGameSave folder) - #345
Conversation
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 (ItsNotRexed#279) with the same %-encoding. tests/test_saves.py covers it on synthetic files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VictorJulianiR
left a comment
There was a problem hiding this comment.
save_slot overwrites payload for each recognized file in sorted order. For example, a folder with a valid slot1 and an older slot1.bak with the same JSAV signature silently imports only slot1.bak. The import plan and success report then describe the backup. Since this operation is defined for one save per folder, please reject ambiguous folders during planning and list the matching filenames. A synthetic folder with those two names should exercise this without relying on timestamps.
AI-assisted static review of 401b824. No project code was executed.
|
@VictorJulianiR good catch, thanks. That was a real silent-wrong-file case. Fixed in #502: |
|
Follow-up for the open question here about |
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>
Item: new item, save file format, claimed in #156 (comment).
Depends on: #279 (only for the
importlayout; the rest stands alone).What
docs/saves.md: the measured layout of the game's save containers, with confidence marked per field.JSAVv3 (story save): a 16-byte header and a 20-byte index entry per block (hash, flags, reserved, offset, size), then one UTF-8 JSON document{"CodeSaveBlocks":[…],"ScriptSaveBlocks":[…]}, padded to 16. The framing is confirmed by a byte-identical rebuild of two real saves. Blocks are hash-keyed JSON. The reserved keys ($x/$y/$z/$w,$content/$datatyped arrays,$key/$value,$type,$bits) are listed.ASAVv1: the 0x170 header (kind, unix time, UTF-16 title, ASCII slot name, payload offset and sizes). The checksum at +0x160 is unknown. The doc lists what it was tested against, and the advice is to copy the header verbatim.SLAYER1: the named wrapper around a packedASAV. Its body is high-entropy, so per AGENTS.md it's recorded and not decoded. Only its header (slot name, title) is read.tools/saves.py(stdlib only):info,extract,pack,verify,diff, andimport, which writes payloads intoLEONIDA_SAVE_DIR/local-user/<container>/<blob>with the same %-encoding asencode_name()in Runtime: offline xgameruntime services (user, saves, package, threads, offline answers) #279. The import uses the shim's~temp-file-then-rename pattern, refuses overwrites without--force, rejects two payloads that would collide case-insensitively, and writesimport-manifest.jsonwith each file's size and SHA-256.tests/test_saves.py: 16 tests, all on synthetic containers built inside the test. They cover the framing, the byte-exact rebuild, edge counts (0 code / 0 script blocks), extract → edit → pack, diff, the ASAV fields, unaligned SLAYER1 names, the import layout,--map,--dry-run,--force, collisions, and the encoding matching the shim.docs/README.md.Tested
python -I tests/test_saves.py: 16/16, also with-W error::ResourceWarning.python -m compileall -q make_game.py tools testsis clean.verifyrebuilt both story saves byte for byte, 82 blocks each, and every block parses as JSON on its own.importplaced 4 payloads (2 KB to 1.2 MB). A probe linked against Runtime: offline xgameruntime services (user, saves, package, threads, offline answers) #279'sxgameruntime_services.cpp(fc215d5, MSVC 19.44) enumerated the 4 containers and read all 4 blobs back throughXGameSaveReadBlobDatabyte-identical.VERIFY / open
--map. They need confirming from the executable'sXGameSaveCreateContainer/SubmitBlobWritecalls.ASAVchecksum algorithm and the hash function behind the$0x…keys. Both probably need the executable.ASAV/JSAVpayloads in a folder and optionally reads achives.jsonfolder label). If you'd rather drop that label handling, I can.No game data, keys or decryption; nothing online. AI-assisted (Claude Code wrote the code and tests; I ran and checked them).
🤖 Generated with Claude Code