Skip to content

skin_streams: recognize fragments with null optional header pointers - #2379

Merged
ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
sds-228:build173-skin-streams-fragment-header
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ItsNotRexed:mainfrom
sds-228:build173-skin-streams-fragment-header

Conversation

@sds-228

@sds-228 sds-228 commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: new BUILD item (ID pending) — #2078 (comment)

What and why

tools/skin_streams.py::resource_kind classifies resource headers before the skin-stream census can walk them. Its fragment branch still uses the pre-#8 rule: all of +8/+16/+24/+32/+40 had to be system pointers, and the u16 pairs at +48/+50 and +52/+54 had to be equal. The pinned rpf9-explorer decoder (e293917) accepts null optional pointers (+16/+32/+40) and only range-checks the four u16 fields, as measured in breadbbbb/rpf9-explorer#8 over 50,802 fragments in levels.rpf (0 false positives across 326,112 resources). The stale Python rule made skin_streams.py silently skip those fragments.

This changes the fragment branch to match the pinned decoder: required pointers at +8/+24/+168, +16/+32/+40 may be null or a system pointer, +48 in 1..4096, +50 <= 4096, +52 <= +54 <= 4096. Drawables and dictionaries are still checked first.

Tested

  • python -I tests/test_skin_streams.py — 30 tests pass, including 7 new synthetic tests; I watched the 3 positive ones fail before the fix.
  • python -m compileall -q make_game.py tools tests — clean.
  • dotnet build tools/rpf9dump/rpf9dump.csproj -c Release — clean (no submodule change).
  • python -m unittest discover -s tests/semantic — 1,671 tests, OK (2 skipped).
  • node --test tests/test_viewer_streaming.cjs — 36 pass.
  • Full stdlib sweep: 193 test files, 2 pre-existing failures (tests/test_cf_ref.py, tests/test_docs_design_rows.py), reproduced on clean 4eb6155d.
  • Counts-only run on my own data.rpf copy: 2,322 → 2,916 resources, +594 fragments, matching upstream CI: Dependabot for GitHub Actions and the rpf9-explorer submodule #8's +594. No bytes, names or offsets from the package are included here.
  • CPU only; no GPU or driver involved.

AI-assisted: OpenCode (Big Pickle model). No game data in the diff.

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • No new translator rule; this is a resource-header classifier. docs/design.md already records the pinned decoder's model counts.

@leoleahy

Copy link
Copy Markdown
Contributor

Tested 918e8256 on Windows 11 x64, Python 3.14.8 (CPU-only, no game files): pass. Code review looks clean: len(b) < 192 at the top of resource_kind() keeps u64(b, 168) in bounds, optional pointers at +16/+32/+40 allow 0 or sys_ptr, and the 7 new unit/scan tests cover both positive and negative cases.

Ran:

  • python -m compileall -q make_game.py tools tests (exit 0)
  • python -I tests/test_skin_streams.py -v (30/30 OK)
  • python -I tests/test_text_write_line_endings.py (2/2 OK)

AI-assisted.

@mrp1no

mrp1no commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Real-data check of 918e825648b52ebc4ed82d58e0e8d655eaf0133f on my own Xbox Series 1.0.2.1 copy (Windows 11 Pro 26300, Python 3.15.2, CPU only): pass. On packs.rpf the relaxed fragment rule finds 2,521 more skinned resources and loses none.

python -I tools/skin_streams.py packs.rpf --json <local> with this PR and with main 49475796's tool:

main this PR
candidates 23,838 26,389
resources read 23,783 26,304 (+2,521)
skipped 55 85
unclassified 0 0
skin meshes 45,854 48,375 (+2,521)
vertices 60,142,591 60,205,616 (+63,025)
4 influences, 8-bit 4,831 meshes 7,352 meshes
4 influences packed / 8 influences 8-bit / 8 packed 1,202 / 23,772 / 16,049 identical

All the new meshes are 4-influence 8-bit ones, about 25 vertices each. The other three layouts don't change by a single mesh or vertex. Note that the sampled validation (the first 64 meshes per layout) comes out identical on both sides, 0 out-of-range components and every weight sum 255, so it doesn't reach the new meshes. 30 more candidates are skipped, too.

python -I tests/test_skin_streams.py: OK. Nothing from the package is attached. AI-assisted (Claude Code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants