Commit Graph

23 Commits

Author SHA1 Message Date
2a384e13f7 gamedata_maps: support UTF-8 BOM index.json, validate row fields, and write JSON atomically (GAMEDATA-MAPS-INDEX-AND-ATOMIC-IO) 2026-11-25 04:26:19 +01:00
e68c5c9c9b docs: point gamedata_maps at its --help usage line (#6565)
Squash-merged after diff review of PR #6565
2026-11-23 12:43:13 -06:00
ec0e01c598 gamedata_maps: name a source with no index.json, and exit 2 (EGEN-GAMEDATA-MAPS-NOINDEX) (#6684)
Squash-merged after diff review of PR #6684 - gamedata_maps: name a source with no index.json, and exit 2 (EGEN-GAMEDATA-MAPS-NOINDEX)
2026-11-23 10:03:53 -06:00
8ce588721e gamedata_maps: name the index in a malformed-carve error (#6723)
Squash-merged after diff review of PR #6723 - gamedata_maps: name the index when its files list is missing
2026-11-23 10:02:20 -06:00
0bc0c5ab0b Merge pull request #4368 from Alpaca-exe
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:14:05 -05:00
9581acf057 Merge pull request #4219 from Jeremy Goldberg
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:12:28 -05:00
bf9a2633df gamedata_sps1: decode common.rpf SPS1 shader-preset table and join SGD5 effects 2026-11-23 02:05:27 +01:00
b318c73e9c docs(gamedata): describe the PAMH tile coordinate label bit
ASSET-346. Derive tile coordinates from their bounds and document why different cells can share the seven-byte label.

Refs: #787, #4084
2026-11-22 19:05:22 -05:00
d1490e359e BUILD-1046: missing inputs exit 2; image_query_probe help before oracle
Eleven tools treated a nonexistent input folder as a failed run (1). They now print one ERROR line and return 2, while real read failures keep exit 1. image_query_probe imports the hardware oracle only for a GPU run, so --help stays prompt. A table-driven subprocess test covers all eleven; existing expectations are updated.
2026-11-22 21:11:07 +00:00
ec8ec4c9a4 Fix what the round-40 merges broke
- docs: one row per topic again in design.md (59 topics merged sentence by sentence, keeping every
  number) and README.md (the current models/character rows); one Other languages line.
- docs/i18n: the two Spanish quickstarts had been concatenated; keep #1912's, drop #2277's row.
- make_game: the shader fingerprint covers spirv_asm.py and its tables; LF settings write.
- tools: pe_shader_containers, gamedata_maps and anim_rigs use report_paths.same_report_path (BUILD-589);
  stdout guard on five tools; LF text writes in three; user_sgpr_census tolerates an unreachable --json.
- tests: fspx stage fakes write real carve/unpack indexes (c7408a1f); typed f16 stores round toward zero
  (SHADER-358); test_ci_registration's helper is no longer collected as a test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:55:07 -05:00
c1d9a92f54 Merge pull request #2193 from Rafael 2026-11-22 11:42:39 -05:00
52d70c4b60 gamedata_index, gamedata_maps: a resource continues after any whole number of 64 KiB blocks (BUILD-599)
Both tools joined a following stream only after an exactly 65,536-byte one, the rule #2129 fixed in
text_tables. A resource's first stream can be 128 or 192 KiB (docs/page_directory.md).
- gamedata_index: only the headed `other` branch (0DRP pages and the MAGIC kinds) now continues after
  any nonzero multiple of 64 KiB. Binary, text and XML runs keep the exact rule, since nothing proves a
  continuation there; applying the multiple rule to them too folded 26,284 payloads into 25,000.
- gamedata_maps: the join is already bounded by the header's declared size, so any whole number of
  64 KiB blocks may continue.

Real data (counts only), data.rpf: 0DRP pages keep 15,768 payloads and gain the 50 continuation streams
(15,877 -> 15,927). Those 50 streams stop being separate payloads (43 `binary`, 7 `text`), so the
payloads go 26,284 -> 26,234; psin/rbf0 unchanged. gamedata_maps on two carves without heightmaps:
identical output.

Tests: test_a_resource_continues_after_any_whole_number_of_64k_blocks (a 128 KiB 0DRP page joins its
continuation, a 128 KiB binary run does not) and test_groups_a_continuation_after_a_128k_first_stream
(main: all fail).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:14:33 -03:00
6079e80392 gamedata_maps: report paths create their folder and cannot overwrite inputs
Validate --json before scanning <carve_dir> (and again against index.json rows): refuse existing directories and paths colliding with <carve_dir>, <carve_dir>/index.json, or any carved .bin stream (including symlinks, hard links, Windows verbatim prefixes, and macOS APFS/NFD case-only variants). Create missing parent folders before writing JSON with LF line endings. Adds unit tests in tests/test_gamedata_maps.py. No game files.
2026-11-22 16:51:34 +01:00
ec9b6cf22b tools: text reports are written with LF line ends on every platform (BUILD-468)
open(path, "w") without newline= turns each \n into \r\n on Windows, so the same JSON report, manifest or assembly
listing was CRLF there and LF elsewhere. 91 text-mode writes (open, os.fdopen, Path.write_text) under tools/, scripts/,
make_game.py and runtime/test/shaders/ now pass newline="\n". tests/test_text_write_line_endings.py reads the source
with ast and fails for a writer that forgets it; CONTRIBUTING.md names the convention.

AI-assisted (Claude), on behalf of dev-ewann.
2026-11-22 14:20:30 +00:00
ec2bfdec9a gamedata_maps.py: reject non-finite grid bounds 2026-11-22 13:02:23 +01:00
f698bf2206 tools: a path outside the console's code page no longer crashes a tool's output
On Windows a redirected stdout uses the console's ANSI code page, and python -I ignores PYTHONUTF8 and
PYTHONIOENCODING, so a caller path with a character outside that code page ended a run with
UnicodeEncodeError as soon as a tool printed it. #1406 fixed make_game.py; every CLI tool in tools/ now starts
its __main__ block the same way (stdout errors="replace").

tests/test_tool_stdout_encoding.py checks every tool's __main__ block and reruns two measured crashes
(analyze_4240_full.py, meshlet_page.py) with a private-use-named input. Found by @abilliontokens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:27:00 +00:00
62495a34cd gamedata_maps: a wrong-typed index "files" is an error, not a traceback
read_payloads() raises TypeError when the carve index's "files" is a
string or null, and main()'s except tuple caught only OSError, ValueError,
KeyError and struct.error. Add TypeError so those shapes print the tool's
one-line error and exit 1 instead of a traceback.

New tests/test_gamedata_maps_bad_index.py covers five malformed index
shapes plus a valid empty carve; main's tool fails the two TypeError
cases as the negative control.
2026-11-22 18:39:09 +08:00
e49d2a440d gamedata_maps: report JSON output write errors 2026-11-22 04:39:35 -03:00
cd6ade80c9 Gamedata: PAMH 0x08 is padding, add a tile census (ASSET-58) 2026-11-22 00:06:28 -03:00
c9ef98d7ae Gamedata: identify the MHIU 0x28 field as the default height (ASSET-48)
Byte 0x28 is a u8 default height: 23 in both MHIU payloads, the value the
empty rows hold, and the value the encoder crops each row by (0 of 6,902
span ends are 23 although 23 is 82% of cells). The decoder now reads the
default from the header, reports the three following bytes as pad_29 and
counts span ends on the default. A scan of all 12 archives finds 2 MHIU
payloads, both in common.rpf.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:26:40 +00:00
739ef5df1e Decode the MHIU and PAMH heightmaps: row tables, max/min arrays and Z mapping
Both common.rpf payloads are heightmaps, not square/u16 grids. MHIU is a 2048x2048 single-layer map: u16 width@0x06, height@0x08, then height 8-byte row headers {u16 start, u16 count, i32 offset} and packed u8 heights with a measured default of 23. The two measured payloads fill 1,724/1,727 rows and their spans cover the packed bytes with 0 gaps and 0 overlaps; the old zero prefix is the empty rows' headers. PAMH is the GTA HMAP layout stored little-endian (version 1.2): a row table, width*height max u8 rows and width*height min u8 rows. The old u16 reading interleaved the two arrays. Both scale as min.z + value/255 * (max.z - min.z). Cross-check: MHIU vs PAMH max correlates at r=0.861 and r=0.870 in the natural orientation, with land-mask IoU 0.61. The MHIU 0x28 word is still unidentified and is not called a checksum. Tests are synthetic and cover the row table, the default fill, negative offsets, the max/min split and the 64 KiB stream join.
2026-11-22 01:24:54 +00:00
c813181bcb gamedata_maps.py: stop joining at the declared map length 2026-11-22 00:16:37 +01:00
bd27a74315 Decode the MHIU and PAMH map arrays
Add a stdlib reader for the two MHIU headers and square byte grids and the PAMH row table plus u16 grid, with synthetic tests and measured header notes. The checksum and the MHIU prefix remain unknown.
2026-11-21 22:27:43 +00:00