Advance scene_records cursor by consumed deflate bytes only #232

Merged
alexander-src merged 1 commit from upstream-pr/235 into main 2026-11-21 19:12:28 +00:00
alexander-src commented 2026-11-21 18:54:52 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by alexander-src on 2026-11-21T18:54:52Z.


Change

Update scene_records() in tools/resource_inventory.py to advance the scan cursor by stored - len(stream.unused_data) instead of the full declared stored span.

When a record's declared stored and repeated lengths exceed the raw-DEFLATE stream length, stream.eof is still true and any following record sits inside stream.unused_data. Advancing by stored skipped that next record, matching the issue fixed in tools/extract_shaders.py in #192. trailing_byte_counts still records len(stream.unused_data) as before.

Add regression coverage in tests/dxcontainer_part_offsets_check.py for both normal trailing padding (tail=b"pad") and oversized spans whose unused_data holds a following valid shader record.

Verification

Commit a9382b8 on Linux (Python 3.14):

  • python3 -B tests/dxcontainer_part_offsets_check.py -v: ran 7 tests, all passed.
  • Negative control against main:tools/resource_inventory.py: test_scene_records_advances_cursor_by_consumed_deflate_bytes failed on both oversized-span subtests (AssertionError: 1 != 2).
  • python3 -B tests/script_state_check.py, bcpack_check.py, resource_ranges_check.py, layout_chunks_check.py, dependency_paths_check.py, intake/paths_check.py, shader_probe_check.py, rdna2_tools_check.py, and gpu_report_format_check.py: all passed (rdna2_tools_check.py: 17 ran, 1 skipped without local LLVM_LIB).
  • Could not run tests/scene_records_check.py with root_probe.exe locally because this environment is Linux without the Windows build; verified the same scene_records() fixture assertions locally with synthetic containers and validator=None (passed).

Evidence and follow-up

All new test inputs are synthetic 32-byte minimal DXContainer fixtures generated in tests/dxcontainer_part_offsets_check.py. No game assets or external files are used.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted: yes.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6533028702 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/235). Originally posted by [alexander-src](https://github.com/alexander-src) on 2026-11-21T18:54:52Z. --- ## Change Update `scene_records()` in `tools/resource_inventory.py` to advance the scan cursor by `stored - len(stream.unused_data)` instead of the full declared `stored` span. When a record's declared `stored` and `repeated` lengths exceed the raw-DEFLATE stream length, `stream.eof` is still true and any following record sits inside `stream.unused_data`. Advancing by `stored` skipped that next record, matching the issue fixed in `tools/extract_shaders.py` in #192. `trailing_byte_counts` still records `len(stream.unused_data)` as before. Add regression coverage in `tests/dxcontainer_part_offsets_check.py` for both normal trailing padding (`tail=b"pad"`) and oversized spans whose `unused_data` holds a following valid shader record. ## Verification Commit `a9382b8` on Linux (Python 3.14): - `python3 -B tests/dxcontainer_part_offsets_check.py -v`: ran 7 tests, all passed. - Negative control against `main:tools/resource_inventory.py`: `test_scene_records_advances_cursor_by_consumed_deflate_bytes` failed on both oversized-span subtests (`AssertionError: 1 != 2`). - `python3 -B tests/script_state_check.py`, `bcpack_check.py`, `resource_ranges_check.py`, `layout_chunks_check.py`, `dependency_paths_check.py`, `intake/paths_check.py`, `shader_probe_check.py`, `rdna2_tools_check.py`, and `gpu_report_format_check.py`: all passed (`rdna2_tools_check.py`: 17 ran, 1 skipped without local `LLVM_LIB`). - Could not run `tests/scene_records_check.py` with `root_probe.exe` locally because this environment is Linux without the Windows build; verified the same `scene_records()` fixture assertions locally with synthetic containers and `validator=None` (passed). ## Evidence and follow-up All new test inputs are synthetic 32-byte minimal DXContainer fixtures generated in `tests/dxcontainer_part_offsets_check.py`. No game assets or external files are used. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted: yes.
upstream-sync closed this pull request 2026-11-24 06:41:56 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!232
No description provided.