Commit Graph

37 Commits

Author SHA1 Message Date
95db9aa141 saves: import the payload as "Save Game Data", the name the title asks for
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.
2026-11-24 17:34:39 -06:00
014339880f saves: pack refuses an --out that names the index or a block file it reads (EGEN-SAVES-PACK-OUT) (#6823)
Squash-merged after diff review of PR #6823 - saves: pack refuses an --out that names the index or a block file it reads (EGEN-SAVES-PACK-OUT)
2026-11-23 09:54:14 -06:00
cf6aa32dff saves: name a --map value without '=' instead of a bare unpack error (#6804)
Squash-merged after diff review of PR #6804 - saves: name a --map value without '=' instead of a bare unpack error
2026-11-23 09:49:15 -06:00
f1d5105e8b saves: verify every file in a batch after individual failures (#6889)
Squash-merged after diff review of PR #6889 - saves: verify every file in a batch after individual failures
2026-11-23 09:41:50 -06:00
561b65a832 Merge remote-tracking branch 'origin/main' into triage-r44
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	.github/workflows/runtime.yml
#	tests/test_first_look_shim_report.py
2026-11-23 06:28:03 -05:00
d974c88a54 saves.py import: warn when a container name breaks XGameSaveCreateContainer's rule
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>
2026-11-23 01:01:24 -05:00
de67135246 Runtime: offline XGameSaveImpl (save provider, containers, blobs, updates)
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>
2026-11-23 00:38:01 -05:00
917926a1e6 Merge pull request #4346 from wxrrry
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:13:53 -05:00
1298f35974 Merge pull request #3983 from Maraco91
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:10:09 -05:00
c2aff9c45c tools/saves: decode ASAV profile record payload and document layout (ASSET-262)
- 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.
2026-11-23 03:55:51 +03:00
3db9613515 tests: test_saves compares a symlink with what it stored, not with its spelling
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>
2026-11-22 23:46:36 +01:00
5105216563 Merge pull request #3565 from Kosmabb8 2026-11-22 17:02:44 -05:00
f0a4b1016d Merge pull request #2779 from Kosmabb8 2026-11-22 16:59:47 -05:00
acffe1ba3e tests: use a portable pack-index nesting depth 2026-11-22 22:03:58 +01:00
bcc39e59a2 tests: overflow JSAV decoder limits on Linux too 2026-11-22 22:03:57 +01:00
5c4bce0aa0 saves: report excessive JSAV JSON nesting as an input error 2026-11-22 21:56:11 +01:00
89dc62fa75 saves: report excessively nested pack indexes cleanly 2026-11-22 21:40:32 +01:00
9dd63cea9b Merge pull request #2779 from Kosmabb8 2026-11-22 15:11:56 -05:00
adf2f7ade4 Merge pull request #2688 from Kosmabb8 2026-11-22 15:11:24 -05:00
0313e4d631 Merge pull request #2688 from Kosmabb8 2026-11-22 13:17:06 -05:00
e757222dd1 Merge pull request #2603 from Kosmabb8 2026-11-22 13:16:29 -05:00
c2ac2f3aba saves: validate editable pack indexes 2026-11-22 19:13:49 +01:00
8efaffa8e2 saves: preserve destination links during atomic packing 2026-11-22 19:10:53 +01:00
708269e5b4 saves: preserve packed output when writing fails 2026-11-22 18:52:10 +01:00
f1d4504b57 saves: bound entries by the parsed JSON document 2026-11-22 18:45:49 +01:00
24ac584b21 saves: reject JSAV blocks outside the JSON body 2026-11-22 18:37:06 +01:00
8644e26ae4 saves: probe file signatures before reporting a save folder 2026-11-22 18:16:35 +01:00
c6045cff5a Merge pull request #1556 from bbareth 2026-11-22 07:38:09 -05:00
d67e00e751 saves.py: probe save signatures without reading entire candidates 2026-11-22 13:13:56 +01:00
5b6f7e558b saves.py: diagnose truncated SLAYER1 wrapper headers 2026-11-22 12:52:31 +01:00
aeed3e0ba0 Merge pull request #1181 from Tayar 2026-11-22 03:14:23 -05:00
bd772b0c19 saves: refuse an option where import expects a value 2026-11-22 05:03:16 -03:00
778c4df1c8 BUILD: diff every save block, including duplicate group/hash pairs 2026-11-22 01:23:01 -06:00
f76fc2c9c5 saves: reject a truncated or lying ASAV header with a message, not a struct.error
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>
2026-11-21 23:58:05 -06:00
e65b15c11a BUILD: reject malformed JSAV saves with one clear error 2026-11-21 23:18:29 -06:00
58cda5bf1b saves.py: refuse a folder with more than one save payload
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>
2026-11-22 00:10:06 +00:00
401b824937 Save files: document JSAV/ASAV/SLAYER1 and add tools/saves.py
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>
2026-11-21 23:08:41 +00:00