Accept bone-palette hint 2 when vertex bone indices are 16-bit #10
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/breadbbbb--rpf9-explorer!10
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/10/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@cxchhh on GitHub · 2026-11-22 04:32 UTC · original
cxchhh:codex/bone-palette-wide-indices→main· +6 −1 · 1 files · 1 commits · merged 2026-11-22 09:44 UTCWhy
In a bone-palette index header (
0x40000000set),ReadMeshreads the hint field at bits 16..28. With the constant-binding flag (0x20000000),hint / 2is the one bone. Without that flag,ReadMeshrequireshint == 0. Inlevels.rpfof the 1.0.2.1 package, 504 fragments fail only on that check.A census of all 74,335 bone-palette geometries in
levels.rpfshows that a non-constant hint is either 0 or 2, and that the value follows the per-vertex bone index format in vertex slot 20:R8_UINT(62)R8G8B8A8_UINT(30)R16G16B16A16_UINT(12)R16_UINT(57)Hint 2 occurs with a single
R16_UINTindex in 822 of 822 cases, and with nothing else. Every one of those 822 geometries belongs to a model with 257–425 bones, more than an 8-bit index can address. Constant-binding geometries (63,677) have no slot 20.Change
Without the constant-binding flag, accept hint 2 when slot 20 is a single
R16_UINT. Hint 0 still works for every format, and any other value is still rejected. Constant binding is unchanged, and every palette entry is still checked against the model's bone count.Results
Measured on the 1.0.2.1 package, each decoder using its own scanner, over the ten archives that Leonida scans:
main(917e9b9) + this PRmain+ breadbbbb/rpf9-explorer#8 + this PR, compared withmain+ #8levels.rpf)All 504 affected meshes are fragments whose headers the current
LooksLikeFragmentrejects, so onmainthey never reachReadMesh, and this PR changes nothing there. Together with #8, 491 of the 504 decode. The other 13 still fail otherReadMeshchecks, and this PR does not change them. No archive loses a resource, model, vertex or triangle in either configuration. The two changes do not conflict.Tests
mainignoresTests/, so there is no test project in this PR. The census above is the evidence. The geometry checks inReadMeshstill apply to the newly accepted meshes: vertex references, cluster tables, and part bounds within tolerance.Testing environment
Tested on Linux x64 with .NET SDK 8.0.428, CPU only.
Corebuilds with warnings as errors. I could not build the Windows app on this machine, and the app code is unchanged.AI-assisted: an AI agent (Claude, Anthropic) did the investigation, code and measurements on the author's behalf. No game data is included here.
🤖 Generated with Claude Code
@cxchhh on GitHub · 2026-11-22 08:09 UTC · original
Same downstream measurement as on #8 (#8): in a 700 m downtown box, the share of
levels.rpfHD placements that find a recovered model goes from 36.7% at917e9b9to 99.9% with #8 and this PR applied. This PR's part is the 491 large-rig fragments (257–425 bones), mostly vehicles, that #8 alone still rejects at the bone-palette check.