Commit Graph

6 Commits

Author SHA1 Message Date
9898deecbb instance_lists, world_interior_names: read the block number from 20 bits, as world_index and psin_data do
A 0DRP/PSIN pool pointer keeps the 1-based block number in its low 20 bits
and the byte offset above (docs/psin.md, docs/ped_catalogues.md, psin_data).
instance_lists and world_interior_names masked 12 bits, as docs/world.md
said, so a block number of 4,096 or more would have been read as a wrong block.

world_index.split_pointer is now the one decoder for the three tools, and
docs/world.md gives the 20-bit form. Over the 0x7a resources of levels.rpf,
story000.rpf, shared_minigame000.rpf and packs.rpf (232,846), the most blocks
one has is 1,760, and every non-null 0x52 array and 0x42 string pointer has
bits 12-19 at zero, so the counts the tools report don't change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 07:49:18 -05:00
b23779d6a9 tests: pass errors=replace to subprocess pipes capturing python -I tools 2026-11-23 00:42:37 +02:00
ae2db6d4dc instance_lists: validate RPF9 headers and preserve offset-0 schema members 2026-11-22 16:43:25 -03:00
c6b63b58d5 fix(tools): honor zero field offsets in grass schemas
The reporter read the built-in byte rather than a declared zero offset, counting unrelated fields when grass records used a different layout. Use the built-in layout only when the schema member is absent.
2026-11-22 17:09:55 +01:00
e9e02e7e23 vertex_types, instance_lists: --json can't overwrite an input archive
Both tools write their --json report after the whole scan, with no check
on the path. Given one of the input .rpf archives, the archive was
replaced by the report and the run exited 0; a directory, or a file in a
folder that doesn't exist, ended the scan in a traceback.

Now, before the scan, a --json that is a directory or the same file as an
input archive (for vertex_types also one found under an input folder) is
one error line with exit 2. The report's folder is created before
writing, and a write that still fails is one "cannot write" line (the
summary is already on stdout). Same checks as navmesh_decode's
same_report_path/_make_parent and bvh_index's same_output_path.

Synthetic archives only, no game files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:20:17 +05:30
55b2fb6e94 Tools: count and check instanced props and grass in map resources
Map resources can hold instance lists besides CEntityDef. Their struct names
are the case-sensitive joaat of the GTA V class names:

  0xBA049770 rage__fwPropInstanceListDef
  0xEA6B3A96 rage__fwPropInstanceListDef__InstanceData
  0x7C475B5D rage__fwGrassInstanceListDef
  0xED86F522 rage__fwGrassInstanceListDef__InstanceData

tools/instance_lists.py finds the 0x7a map resources as world_index.py does,
assembles each resource's virtual and physical streams from its block map,
reads every field through the resource's own schema member table (by name
hash), and writes counts only: schema agreement with the documented offsets,
prop matrices (orthonormal axes, handedness, scale, translation inside the
list's BatchAABB), grass instances (normal inside the unit disc, Scale vs
ScaleZ, RotationIdx range), and list fields (lodLevel, IsSLODList,
OrientToTerrain, ScaleRange order, InstanceLodDist <= lodDist).

tests/test_instance_lists.py builds a minimal resource with both lists and
runs the tool on it, also end to end through a fake archive.

AI-assisted (Claude). Tested: python -I tests/test_instance_lists.py (7 pass),
python -m compileall -q make_game.py tools tests; no GPU involved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 989900c44cbe31ceba5316c7bcc571fd4bb144cd)
2026-11-22 00:33:50 -05:00