Repository navigation
Accept bone-palette hint 2 when vertex bone indices are 16-bit - #10
Merged
Merged
Conversation
ReadMesh required hint 0 for every bone palette without the constant- binding flag. A non-constant hint is 2 exactly when the vertex bone index (slot 20) is a single R16_UINT, which models with more than 256 bones use: 822 of 822 such meshes in levels.rpf, with no other combination. Hint 0 goes with R8_UINT, R8G8B8A8_UINT and R16G16B16A16_UINT (9,836). Accept hint 2 in that case only; constant binding keeps hint / 2 as the bone, and every palette entry is still checked against the bone count. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Same downstream measurement as on #8 (#8): in a 700 m downtown box, the share of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
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+ #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