Repository navigation
TEST-608: resolve stored SGD5 technique passes to shader carve offsets - #3036
Conversation
Walk both native databases and resolve effect-local pass selections to the exact shader carve offsets. Include synthetic coverage and an opt-in package census for TEST-608. Refs: ItsNotRexed#2519, ItsNotRexed#2891
Allow a local package owner to identify both names before querying a stored pass. Expose duplicate effect records and technique rows, including effects with no techniques. Refs: ItsNotRexed#3036
Accept the shader hash emitted by rpf9dump, retain every matching effect, and expose its techniques and stored passes even when it has no named compute program. Refs: ItsNotRexed#2519, ItsNotRexed#3036
|
Tested 0029eba on Windows 11, Python 3.12.10: pass
AI-assisted (Claude Code). |
Kam471
left a comment
There was a problem hiding this comment.
Verified on the PR head: python -I tests/test_sgd5_effects.py -> 6 tests: 5 pass, 1 skip; with LEONIDA_GAME_DIR set, 6/6 pass. test_tool_startup 2/2. Against the real 1.0.2.1 package: 932 effects, 913 named, 25,037 techniques, 28,798 passes; all 26,503 program records resolve into the shader_carve index (24,795 at the same offset, 1,708 at +1 byte, matching the body). Selectors are one-based: 3,094 values equal the effect-list length, 0 are out of range. The three measured records from #2519 reproduce exactly (213 techniques / 217 passes / 404 refs; first-pass ordinals 11017/10943, 9143/8925, 9089/8835). No game data or absolute paths. Approve.
Caveat: the offsets are pinned to 1.0.2.1, and the opt-in game-data test is the only path that exercises the real archive.
… the effect census reproduced With @jeremygold02's tools/sgd5_effects.py (ItsNotRexed#3036, 0029eba) on the same shaders.rpf: 932 effect records with distinct name hashes, 913 technique tables, 25,037 techniques and 28,798 passes, and the data.rpf materials' 18 hashes (3,340 slots) each matching exactly one record. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Follow the post-pass tables through the counted string pool and next record. Check both database terminators and keep opaque payload contents out of structural matching. Refs: ItsNotRexed#2519, ItsNotRexed#3036
…ItsNotRexed#3036 c043996) The table-location caveat is gone: tests/test_sgd5_effects.py passes against this package. The u32 after an effect name stays open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the effect census reproduced With @jeremygold02's tools/sgd5_effects.py (ItsNotRexed#3036, 0029eba) on the same shaders.rpf: 932 effect records with distinct name hashes, 913 technique tables, 25,037 techniques and 28,798 passes, and the data.rpf materials' 18 hashes (3,340 slots) each matching exactly one record. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ItsNotRexed#3036 c043996) The table-location caveat is gone: tests/test_sgd5_effects.py passes against this package. The u32 after an effect name stays open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Implements TEST-608. Coordination claim
Depends on: #2519 (format research). This tool runs independently on current main.
What it does
python -I tools/sgd5_effects.py <path-to-shaders.rpf>prints aggregate counts for each shader database in the Xbox 1.0.2.1 package. Use--list-effectsto discover effect names locally and--effect NAMEto list the techniques in each matching effect. Add--effect NAME --technique NAMEto get the passes stored under that pair and the exact program references for each pass. You can also enter the material hash exported by rpf9dump with--shader-hash HEXand optionally--technique NAME. Repeated names or colliding hashes return every matching effect.The reader walks the six program groups, verifies the declared effect count, and reaches each technique count by skipping an 80-byte header and four counted tables with row widths 16, 24, 68, and 36 bytes. From the end of the pass table it walks a counted word array, a marker, two length-prefixed byte blocks and a packed entry table. The following string-pool length leads to the next effect. The final cursor must land on the terminal word and zero padding in each database. The reader validates ordinal ranges, string-pool name offsets, pass counts and one-based selectors. Payloads stay in place. The CLI prints JSON and writes no files.
A program's native record offset and its
shader_carveindex offset can differ. On this package, 24,795 offsets are equal and 1,708 carve offsets are one byte later. The named lookup returns both. All 26,503 reported carve offsets independently matched the carver's existing scan pattern.Forward traversal coordination claim
Verification
LEONIDA_GAME_DIRset, the tenth test reproduces 932 effects, 913 effects with named techniques, 25,037 techniques and 28,798 passes across the two databases. Runpython -I tests/test_sgd5_effects.py -vto repeat it.tests/test_shader_carve.pytests pass.AI-assisted. Tested on Windows 11 (build 26200), Python 3.12.10, on an Intel Core Ultra 7 265K. The package reads and synthetic fixtures ran on the CPU. The workstation has an NVIDIA GeForce RTX 5070 (621.01) and integrated Intel Graphics (32.0.101.9150). Which technique the original executable selects during gameplay remains unverified.