Commit Graph

2 Commits

Author SHA1 Message Date
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