Repository navigation
Probe: accept the geometry and renderer list counts that Decode accepts - #11
Merged
Merged
Conversation
ProbeRequiredExtents capped a model's geometry count at 256, while Decode allows MaxMeshes (1,024) and the probe's running total already stops at MaxMeshes. Models with 257 to 1,024 geometries were never recovered. Renderer list 4 was capped at 4,096 entries, but its count was never used for sizing (the probe covered 1 byte). Its entries are 80 bytes; cover count * 80 instead and drop the cap for that list. A ushort count covers at most 5.2 MiB, well under MaxSystemBytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 22, 2026
This was referenced Nov 22, 2026
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
ProbeRequiredExtentsrejects two kinds of resources thatDecodereads without trouble:RageModelDecoder.cs:351), whileDecodeallowsMaxMeshes(1,024,:535) and the probe's own running total already stops atMaxMeshes(:358).:387). That count was never used for sizing: the probe covered 1 byte of the list (:388), so the cap only rejected.Both fail as "probe returned null on every split", so recovery never asks for the next block and the candidate is dropped. They are the 29 candidates left in #9's table that are models: 28 in
levels.rpfand 1 inpack/story000.917e9b9917e9b9→ this PRlevels.rpf¹pack/story000/story000.rpfpacks.rpfdata.rpfpack/shared_minigame000pack/core_restofworld¹ One
levels.rpfblock on the machine I measured fails its zlib checksum because of a single flipped bit in my local copy (flipping it back restores the stored Adler-32). It is the same candidate in both columns, so a clean copy has one more recovered candidate and model on each side; #9 reports 205,944 formain.The 29 new candidates hold 41 models: 8,467 meshes, 3,390,847 vertices and 3,246,156 triangles. The largest has 377 meshes. Every candidate was recovered and fully decoded with
mainand with this PR, and the outputs were compared candidate by candidate: name, mesh, vertex and triangle counts, and a hash over positions, indices and texture coordinates. Only the 29 rows change; none of the 238,227 candidates recovered onmainin these six archives is lost or decodes differently. Every scan, recovery and decode was run on the 1.0.2.1 package.Change
:351: the per-model geometry cap isMaxMeshes, the same asDecode.:387–:388: list 4 is no longer capped at 4,096, and the probe coverscount * 80bytes of it instead of 1. The entries are 80 bytes: in 553 of 555 sampled drawables the list's span divided by its count is exactly 80, and the two dictionaries this recovers hold exactly 5,078 × 80 and 5,461 × 80 bytes. Covering the whole list changes no result in any archive (checked against a variant that only drops the cap). A ushort count covers at most 5.2 MiB, well underMaxSystemBytes.Lists 0 to 3 keep their 4,096 cap and 4-byte entries. This PR does not touch the lines changed by #8, #9 or #10.
Tests
mainignoresTests/, so, as in #9, the fixture is below rather than in the PR. It builds a one-entry drawable dictionary whose model has N one-triangle geometries, and optionally a renderer with a long list 4. It checks:On
mainit fails at "the probe accepts 300 geometries". With only the:351change, it fails at "the probe accepts 5,000 entries in renderer list 4". The fixture is generated in code and contains no game data.Copy both files to
Tests/ProbeCapsSmoke/and rundotnet run --project Tests/ProbeCapsSmoke -c Release.Tests/ProbeCapsSmoke/ProbeCapsSmoke.csprojTests/ProbeCapsSmoke/Program.csTesting environment
Tested on Linux x64 (CachyOS) 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, tests and measurements on the author's behalf, and a second model (Gemini) reviewed the findings independently. No game data is included here.
🤖 Generated with Claude Code