Commit Graph

47 Commits

Author SHA1 Message Date
711f566683 Validate RPF9 archive headers before scanning meshlet pages 2026-11-24 21:37:02 +01:00
eef19da441 meshlet_page: page walk over a 0-meshlet group terminates, guarded by a regression test 2026-11-24 07:31:41 +05:30
77caf525a0 meshlet_page: fix u16 running-sum wraparound, non-finite crashes, and 0-meshlet groups 2026-11-24 07:30:32 +05:30
a038637e82 Merge pull request #4151 from fromthemoonx
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:11:47 -05:00
7a4a1b566b Merge pull request #3806 from Alex Collini
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:08:34 -05:00
8d3a8336bc Merge pull request #3649 from wxrrry
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:08:07 -05:00
c77fa34768 Merge pull request #3584 from Jeremy Goldberg
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:07:54 -05:00
5cd470c76c Merge pull request #3170 from Tayar
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:06:53 -05:00
11ec5437b8 meshlet_page: stream block4240 plausibility checks and hoist summary vertex counts (BUILD-1050)
- tools/meshlet_page.py: in summarise_page, hoist the block4240 vertex-count set outside the generator expression to avoid rebuilding the set for every group.
- tools/meshlet_page.py: in block4240_checks, compute count statistics in a streaming pass over packed slot-0 positions instead of materializing full tuple lists, preserving positions_4240 for callers requiring coordinates.
- tests/test_meshlet_page.py: add test_block4240_checks_streaming_and_summary_counts.
2026-11-23 03:18:39 +03:00
3b68a58021 Reserve the carve manifest path in bink_index, meshlet_page and anim_index
Each tool refused a report at <source>/index.json only when a carve
manifest already existed there. A report written before the carve took
the name hashdict.py and the other tools read as the carve manifest.
Refuse that path whether or not the manifest exists yet, as #3156 does
for page_index and story_index. bvh_index is left to BUILD-454.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FXR27ZYP9qtZtN8SG7QPWW
2026-11-22 23:41:37 +00:00
30475df3ae Merge main aa2988cc into #3806 2026-11-22 23:22:14 +01:00
0e7d04bb5e Protect directory-scanned meshlet pages from report aliases 2026-11-22 19:17:07 -03:00
5f8531b7d8 chore(meshlet): merge main and preserve joint-index decoding
Refs: #3584
2026-11-22 17:07:42 -05:00
8851a685cc Merge pull request #3614 from Mulkku 2026-11-22 17:02:59 -05:00
5273ed4046 Merge pull request #3069 from Vonsek 2026-11-22 17:00:30 -05:00
9d62b6da69 meshlet_page: a block whose centre distance isn't finite can't win the pairing (ASSET-294)
Review fix (shdann on #3806): centre_distance returns None for a NaN or infinite sum, so min() never sees a NaN.
With no finite candidate the old choice stays, as on the merge base. Test with a NaN-bias block in both orders and
the all-non-finite case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 22:49:22 +01:00
4a1b7b61be meshlet_page: w2 bits 28-31 are an exponent, step 2^e/16 m (review by zzEmmazz)
e = 0..4 occur; the bit-28-only rule read the 157 minigame meshlets with e = 2
at 1/8 m, where their radius covers none of them (157 of 157 at 1/4 m).
centre_step takes the exponent, coarse_steps counts e > 0, tests cover e = 1..3,
and the docs/story.md tables are recounted.
2026-11-22 22:41:10 +01:00
f6fa3e36d1 meshlet_page: check a group against the 42 40 block its centres fit (ASSET-294)
When several 42 40 blocks in a page have a group's vertex count, summarise_page took the nearest one before the
group. Nothing in the page orders them (in Q0 Q1 G0 G1 pages G0 is built on either block), so it now takes the
block whose vertex boxes are closest to the group's stored centres (centre_distance), keeping the old choice on
a tie. New counters groups_4240_several_blocks and groups_4240_block_by_centres.

Over all of story000.rpf: 16,059 groups have several blocks and 8,668 change block; opposed neighbouring faces
fall from 518,113 to 16,408 of about 36.7 M shared edges, and faces within ~25 degrees rise from 90.8% to 92.7%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 22:40:40 +01:00
dc8827151d Trace auxiliary draw bindings and join short system pages 2026-11-22 23:06:30 +02:00
dbe76fd82d fix(meshlet): recognize joint-index streams in packed vertex blocks
Refs: #3381, #2787, #2859
2026-11-22 15:55:50 -05:00
fd3c38c759 Merge pull request #3148 from Vonsek 2026-11-22 15:15:11 -05:00
2ee952b5c1 Merge pull request #3069 from Vonsek 2026-11-22 15:14:32 -05:00
515584485c Merge pull request #3033 from Vonsek 2026-11-22 15:14:14 -05:00
f3617f1e74 Merge pull request #2991 from Vonsek 2026-11-22 15:13:52 -05:00
75d9c7b470 Merge pull request #2924 from Vonsek 2026-11-22 15:13:14 -05:00
46acac3e6b meshlet_page: stop at non-mesh data after the chunks; header shortcut for the position checks
story000.rpf has 256 KiB pages where texture-like data follows the mesh chunks
on a 256-byte boundary behind zero padding; the walk now stops there
(stopped_at_other_data) instead of rejecting the page. Anything else that
doesn't parse stays an error. The default position counts now come from the
header box when it lies inside 300 m (same totals, the default run back near
#2424's time; review on #2601).
2026-11-22 20:30:51 +01:00
bd1f962745 meshlet_page: meshlet record w2 bit 28 doubles the centre step (1/8 m, +-256 m)
1,732 large, far meshlets in the minigame archive set it; read at 1/16 m their
radius covers the farthest vertex in 0 of them, at 1/8 m in 98.0% (99.9% with
the rounding allowance). centre_step and meshlet_centre take the bit,
centre_agreement uses each meshlet's step and counts coarse_steps; the
docs/story.md tables are recounted (centres 50.1% / 71.8%, radius 96.5% /
98.7%). Also fixes the docstring sentence #3033 garbled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:16:26 +01:00
4c99e1dbae meshlet_page: meshlet record word +12 bits 14-30 are the normal cone
Axis octahedral 6+6 unorm (bits 14-19, 20-25), sin(half-angle) = (31 - f)/31
from bits 26-30, all-zero = no cone. Over the minigame archive (counts
only): 43,415 cones, axis within 25 degrees of the mean face normal for 82.0%,
every face inside within 0.05 for 97.8% (core_restofworld 74.9% / 99.7%).
meshlet_cone, cone_agreement under --cones, tests, docs/story.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:09:16 +01:00
8b600152bf meshlet_page: meshlet record word 0 bits 16-31 are the f16 bounding-sphere radius
Around the stored centre: it covers the farthest vertex in 95.3% of 142,613
minigame meshlets (97.5% allowing the centre's 1/16 m rounding) and 97.4% /
99.9% of 4,899 in core_restofworld; 99.9% are within 1.25x the tightest
radius (counts only). meshlet_radius, radius counts under --centres, tests,
docs/story.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:02:35 +01:00
38f893325a meshlet_page: 42 40 slots 11 and 18 are tangents (10:10:10, sign in bits 30-31)
Unit vectors perpendicular to the stored normal: 98.9% of 7,520,441 minigame
tangent words within |dot| < 0.05; bits 30-31 are 3 or 0 in every one
(+1 / -1). tangents_4240, tangent_agreement under --normals, a test, and
docs/story.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:55:13 +01:00
94a46f6311 meshlet_page: 42 40 slot-2 normals (octahedral 10+10 for type 1, 10:10:10 for type 7)
Checked against the summed face normals of the decoded positions (counts
only): 86.0% of 14.4M minigame vertices within 8 degrees, 1.5% opposed;
core_restofworld 66.3% / 11.3%, where 2% of groups are mostly inverted.
normals_4240 and normal_agreement, a --normals check, and docs/story.md with
the rule and the second-archive counts for positions, faces and centres.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:45:38 +01:00
4102dcfd08 Merge pull request #2745 from Vonsek 2026-11-22 13:17:30 -05:00
732f2d0a2a Merge pull request #2670 from Vonsek 2026-11-22 13:16:57 -05:00
97e5b79123 Merge pull request #2601 from Vonsek 2026-11-22 13:16:28 -05:00
eb17927c46 Merge pull request #2424 from Vonsek 2026-11-22 13:15:14 -05:00
a2ef9e8dc4 meshlet_page: the slot tag byte is (stride / 4) << 5 | type; +0x7C is the UV scale
rpf9-explorer's RageModelDecoder reads vertex slots this way; it sizes all
99,184 slot words of the minigame archive's 63 30 and 42 40 blocks (counts
only), so tag_stride replaces the per-tag table (for the six types seen) and
the archive walk gives identical totals. docs/story.md gets the tag/type
table, the +0x7C meaning (snorm16 UV scale, rpf9-explorer) and the slots
actually used (0-4, 11-15, 18; #2424 said 0-4 and 11-14).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:06:56 +01:00
1e5ac8a233 meshlet_page: meshlet record words +8/+12 are the meshlet's centre (1/16 m steps)
w2 bits 0-11, 12-23 and w3 bits 0-11 are x, y and z as (field - 2047) / 16.
meshlet_centre decodes them; --centres compares them with each meshlet's
vertex-box centre on 42 40 geometry: 49.8% of 427,839 axes in the same
1/16 m step and 71.4% within one over the minigame archive (counts only);
offset 2048, 1/8 m steps or swapped axes fit far worse. docs/story.md records
the rule, the controls, why the 63 30 test saw nothing (default words), and
what of the record is still open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:47:18 +01:00
bdc05cc840 meshlet_page: decode the 42 40 packed positions; +0x6C is the axis order
Slot 0 (tag 0x42, 8 bytes) is the (8, 16) position form rpf9-explorer's
RageModelDecoder already reads: bias f32x3 at +0x60, axis order at +0x6C,
scale f32x3 at +0x70; a = bits 8-31, b = bits 32-47 << 8 | bits 0-7,
c = bits 48-63. positions_4240 decodes it, the page checks count finite and
within-300 m positions, and --faces counts neighbouring-face agreement
(83.7% within ~25 degrees, 0.26% opposed over the minigame archive's
17.3M shared edges; counts only). The record key mode becomes axis.
docs/story.md gets the independent check and drops the open item.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:36:44 +01:00
188863b61e meshlet_page: read 42 40-led pages from a directory too (ASSET-146)
The directory prefilter admitted only 63 30 and group-led files, so a carved page
that starts with a 42 40 block was skipped before is_mesh_page saw it (found by
whattheflop in review). The directory/archive CLI test now has such a page and
fails without the fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:23:25 +01:00
4c06877f6e meshlet_page: size the 42 40 00 00 vertex blocks and walk past them (ASSET-146)
The 42 40 block has a 0x80-byte header with the same slot words; tag 0x42
streams are 8 bytes a vertex and tags 0x21/0x26/0x27/0x28 4 bytes. Over
shared_minigame000.rpf 14,671 headers fit exactly and every one is followed
by a recognised chunk. The walk used to stop at these blocks; it now reads
1,569 streams instead of 335 (159,387 meshlets, 16.9M triangles), 0 left
unparsed. A 63 30 block slot past 4 takes its tag's stride. Positions and
attributes are not decoded. Counts only in docs/story.md; synthetic tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:59:30 +01:00
6c4ab5b7e1 fix(tools): preserve meshlet page order in neighbor counts
A failed page used to connect the valid pages on either side and overstate the blocks available to adjacent meshlet groups.
2026-11-22 16:40:47 +01:00
4da4f943d4 meshlet_page: refuse report paths that overwrite source archives or carved inputs 2026-11-22 16:49:56 +05:30
c0e470dbc1 meshlet_page: report page-summary JSON write failures 2026-11-22 04:45:42 -03:00
8ea33a54e2 Merge pull request #1004 from tikD1337 2026-11-22 01:08:18 -05:00
02d771c5fb meshlet_page: accept vertex blocks without slot 2 (normals)
In data.rpf at offset 0x122771b0, a vertex block has slots 0 (float3 pos), 3 (float2 uv0), and 4 (float2 uv1), but no slot 2 (normals). Currently parse_block requires slot 2 and calculates vertex count as (slot 2 - slot 0) / 12. Only slot 0 is required: vertex count is determined by the span of slot 0 to the next slot in offset order, divided by 12. In block_checks, unpack normals only if slot 2 exists. Adds synthetic unit tests in tests/test_meshlet_page.py.
2026-11-22 06:37:09 +01:00
e038d28f0b Resolve meshlet draw bindings from geometry buffer pointers
(cherry picked from commit d462d3f3604ac2002bd09aa8e0442c84aaa77b8b)
2026-11-22 00:33:48 -05:00
a78d53cf8b ASSET-51: decode the 63 30 00 00 pages as vertex blocks and meshlet groups
The 45 shared_minigame000 streams that docs/story.md listed as undecoded float
records are mesh pages: 16-byte-aligned vertex blocks (a 0x60-byte header of
tagged slot offsets, then position/colour/normal/float2 streams) and meshlet
groups (<=128 vertices and triangles per meshlet, 7-bit packed triangles,
u16 vertex references). tools/meshlet_page.py walks them with layout checks
and writes counts only; tests build every page by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:31:58 +00:00