Commit Graph

43 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
20c7188efd saves: reject JSON nested deeper than 512 levels explicitly
Python 3.14's json decoder is iterative, so a 100,000-level JSAV body no
longer raises RecursionError: parse_jsav accepted it, info printed
JSAV (...), verify said OK and extract died with a 1,027-line traceback
and exit 1 (json.dump recurses). The tests already expected a validation
error and noted that the C decoder's limit differs by platform; the tool
now checks the nesting depth itself (JSON_NESTING_LIMIT = 512, brackets
inside strings ignored) in parse_jsav, in verify's per-block check and in
the packed index, so a malformed save is one error line and exit 2 on
every Python.

(cherry picked from commit 79da3a9161fb0a238ddf4fd5179559bcd69c44a0)
2026-11-24 03:30:06 +02: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
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
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
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
5b45c99f87 Merge pull request #2853 from kapitche 2026-11-22 15:12:36 -05: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
f9a1be760a tools: pin encoding=utf-8 on five text writes, and test that no text-mode open omits it
rdna2spirv.py (two .spvasm writes), saves.py (index.json, header.json) and spirv_gs_to_compute.py (layout json) opened text files for writing with no encoding, so they used the locale code page (cp1252 on most Windows installs). CONTRIBUTING.md asks for encoding="utf-8". tests/test_text_encoding.py scans tools/, scripts/, make_game.py and runtime/test/shaders/ with ast, like test_text_write_line_endings.py, and runs directly with python -I.
2026-11-22 13:33:46 -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
19e7023217 Merge pull request #1849 from Vonsek 2026-11-22 09:48:44 -05:00
c51e308305 docs: the XGameSave shim is #279's, not main's; test backticked repo paths
docs/saves.md and the tools/saves.py docstring named
runtime/shims/xgameruntime_services.cpp as the runtime's save store; that file
is only in the open #279, and on main XGameSave* imports get the loader's
default answers. docs/shader_validation.md named spirv_mini_interp without
its .py. tests/test_docs_repo_paths.py checks that backticked tools/,
runtime/, tests/ and scripts/ paths in docs/ name tracked files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:32:24 +01:00
ec9b6cf22b tools: text reports are written with LF line ends on every platform (BUILD-468)
open(path, "w") without newline= turns each \n into \r\n on Windows, so the same JSON report, manifest or assembly
listing was CRLF there and LF elsewhere. 91 text-mode writes (open, os.fdopen, Path.write_text) under tools/, scripts/,
make_game.py and runtime/test/shaders/ now pass newline="\n". tests/test_text_write_line_endings.py reads the source
with ast and fails for a writer that forgets it; CONTRIBUTING.md names the convention.

AI-assisted (Claude), on behalf of dev-ewann.
2026-11-22 14:20:30 +00: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
78aa083431 Merge pull request #1515 from bbareth 2026-11-22 07:08:00 -05:00
5b6f7e558b saves.py: diagnose truncated SLAYER1 wrapper headers 2026-11-22 12:52:31 +01:00
f698bf2206 tools: a path outside the console's code page no longer crashes a tool's output
On Windows a redirected stdout uses the console's ANSI code page, and python -I ignores PYTHONUTF8 and
PYTHONIOENCODING, so a caller path with a character outside that code page ended a run with
UnicodeEncodeError as soon as a tool printed it. #1406 fixed make_game.py; every CLI tool in tools/ now starts
its __main__ block the same way (stdout errors="replace").

tests/test_tool_stdout_encoding.py checks every tool's __main__ block and reruns two measured crashes
(analyze_4240_full.py, meshlet_page.py) with a private-use-named input. Found by @abilliontokens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:27:00 +00:00
aeed3e0ba0 Merge pull request #1181 from Tayar 2026-11-22 03:14:23 -05:00
90ee341e02 Merge pull request #1149 from quackottu 2026-11-22 03:14:14 -05:00
bd772b0c19 saves: refuse an option where import expects a value 2026-11-22 05:03:16 -03:00
89277cdac0 saves import, anim_index --rigs: a missing value or unwritable path is an error line, not a traceback
saves.py import with --out or --map as the last argument raised
StopIteration; anim_index.py --rigs into a missing folder raised
FileNotFoundError. Both now give the tools' usual one-line error.
2026-11-22 13:10:26 +05:30
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