Repository navigation
Recognize fragments with null optional header pointers - #8
Merged
breadbbbb merged 2 commits intoNov 22, 2026
Merged
Conversation
LooksLikeFragment required +16, +32 and +40 to be system pointers and the 16-bit fields at +48..+54 to form two equal count/capacity pairs. Neither holds across the fragments in the archives: +16, +32 and +40 are null together in about a fifth of them, +50 can exceed +48, and +54 is usually larger than +52. Those fragments never became scan candidates. Keep the page map, drawable and name pointers required, accept null for the three optional pointers, and check only the ranges of the four fields and the +52 <= +54 order. Decoding still validates the embedded drawable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main now ignores Tests/. The fixture is in the pull request description instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 22, 2026
This was referenced Nov 22, 2026
Contributor
Author
|
A downstream measurement, in case it helps with review. Leonida's placement-driven world build (ItsNotRexed/Leonida#1183) resolves each map placement to an exported model. In a 700 m × 700 m downtown box of
The names resolve either way, and every match is confirmed by the 64-bit archetype key. The missing ~1,800 archetypes are all |
This was referenced Nov 22, 2026
Merged
This was referenced Nov 22, 2026
Merged
2 tasks done
AAyberkU
pushed a commit
to AAyberkU/Leonida
that referenced
this pull request
Nov 22, 2026
…ft headers (PROC-121) breadbbbb/rpf9-explorer#8 (null optional header pointers, range-checked 16-bit fields) and ItsNotRexed#10 are both ancestors of Leonida's pin e2939175, so the pinned explorer accepts the fragment headers the sentence said it rejects. Say that, keep the 41.3% as the figure at the earlier pin 917e9b9, and note that the 99.96% was measured on 917e9b9 with ItsNotRexed#8/ItsNotRexed#10 applied, not recounted at e2939175.
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
LooksLikeFragmentrequires the pointers at+16,+32and+40to be system pointers. It also requires the four 16-bit fields at+48..+54to form two equal count/capacity pairs. Neither rule holds for most fragments in the package. Fragments that fail the check never become scan candidates, so no change to recovery or decoding can reach them.Measured over every resource in
levels.rpfthat an independent carving index (SixNG, which types resources by their recovered.#ft/.#drnames) labels as a fragment (50,802):+8,+24,+168are system pointers+16,+32,+40all system pointers+16,+32,+40all null+48 == +50and+52 == +54+48in 1..4096,+50≤ 4096,+52≤+54≤ 4096+50can be larger than+48(642 fragments), and+54is often larger than+52, so these fields are not count/capacity pairs.Change
+8(page map),+24(drawable) and+168(name) required.+16,+32and+40. A non-null value must still be a system pointer.+52 <= +54order.Decoding still validates the embedded drawable at
+24, so a looser header check costs at most a rejected decode. Over all 326,112 resources inlevels.rpf, the new rule matches no resource the index types as a drawable, texture dictionary or anything else (0 false positives). Drawables are tested before fragments, as before.Results
Measured against current
main(917e9b9, which includes #1 and drawable dictionaries).Across the ten archives that Leonida scans, each decoder using its own scanner, as resources recovered / candidates:
917e9b9917e9b9+ this PRdata.rpfpack/shared_minigame000pack/core_restofworldpacks.rpfpack/story000levels.rpftextures.rpf,story000_restofworldThe candidates that do not recover at
917e9b9are mostly texture dictionaries; #9 removes them.A drawable dictionary counts once in this table, however many drawables it holds. The difference comes entirely from fragments:
levels.rpf: 28,743 more fragments decode, all with real geometry: about 98M vertices and 99M triangles. About 23,000 of them have more than 100 triangles. On the 50,802 resources that an independent carving index (SixNG, which types resources by their recovered.#ftnames) labels as fragments, recovery goes from 21,497 to 50,241 (98.9%).data.rpf: 594 more fragments decode, all with real geometry.packs.rpf: every fragment there decodes to the same 25-vertex, 32-triangle mesh, so the 2,551 extra fragments there add no real geometry. poke900310-lgtm noted this in Track model layout recovery in Leonida ItsNotRexed/Leonida#29; the real geometry of those fragments is elsewhere.The remaining 561 fragments in
levels.rpfare rejected later, inReadMesh, and this PR does not change them:Tests
mainignoresTests/, so the test project is not part of this PR. The code is below so it can be run locally: copy both files toTests/FragmentHeaderSmoke/and rundotnet run --project Tests/FragmentHeaderSmoke -c Release.The test builds a fragment around a one-triangle embedded drawable. It covers:
+50 > +48with+52 < +54;+52 > +54, of+48 = 0, of a non-null+32that is not a system pointer, and of a null drawable pointer.Without the fix, the test fails at "fragment with null +16, +32 and +40". With the fix, it passes on
917e9b9. The fixture is generated in code and contains no game data.Tests/FragmentHeaderSmoke/FragmentHeaderSmoke.csprojTests/FragmentHeaderSmoke/Program.csTesting 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 (App, .NET 10 Windows) on this machine, and this PR does not touch it.AI-assisted: an AI agent (Claude, Anthropic) did the investigation, code, tests and measurements on the author's behalf. No game data is included here.
🤖 Generated with Claude Code