Commit Graph

31 Commits

Author SHA1 Message Date
2cb6ed8821 world_names: restore write mode before unlink on replace failure and publish mode (WORLD-NAMES-STAGE-CLEANUP)
When writing dictionary JSON atomically in _write_json, apply published_mode
to the staged file and reset os.chmod to 0o600 before exiting TemporaryDirectory
if os.replace fails, ensuring cleanup does not fail with PermissionError on
Windows when replacing a read-only file.

agent: yes
AI-assisted: yes
2026-11-24 17:22:00 +03:00
feb51c6cfa Require matching XML end tags when extracting world names 2026-11-23 20:55:18 +01:00
c25b9f280e world_names: join parent maps across input reports (#6766)
Squash-merged after diff review of PR #6766 - world_names: join parent maps across input reports
2026-11-23 10:02:28 -06:00
369a76fa9d Merge pull request #4627 from Teerth1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:16:36 -05:00
6b907a294d Merge pull request #4471 from Leo Leahy
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:15:02 -05:00
bdc5c3a348 world_names: skip overflowing archetype counts 2026-11-22 22:24:45 -05:00
63e1f44deb world_names: refuse build --out overwriting an input 2026-11-22 22:35:56 -03:00
5130144867 Fail world name builds on incomplete manifest discovery 2026-11-23 00:25:40 +01:00
1476045e51 Merge pull request #3133 from Marco Luzzaro 2026-11-22 15:15:01 -05:00
f20d2f5290 Merge pull request #3082 from kapitche 2026-11-22 15:14:40 -05:00
ad1e9aa297 BUILD-906: reject unrelated archetype reports 2026-11-22 20:28:33 +01:00
305b863c68 world_names: skip a name with a lone surrogate instead of aborting the build 2026-11-22 14:19:34 -05:00
b3ee0ee2e8 Merge pull request #2524 from Ayinaki 2026-11-22 13:15:54 -05:00
0a8c08a564 audio_config, world_names: hash a name as the pinned latin-1 joaat does
audio_config hashed the lowercased UTF-8 bytes, and world_names encoded to UTF-8
before lower-casing the bytes, so both gave a different 32-bit hash for any
non-ASCII name than hashdict.py and awc_names.py, which hash the lowercased
latin-1 bytes that tests/test_hashdict.py pins. A title with an accent then
produced a stream id no AWC bank stores. Both copies now use the dictionary
form, and a cross-tool test holds every joaat copy in tools/ to it.
2026-11-22 17:21:26 +00:00
acde130fb6 Merge pull request #2195 from Vonsek 2026-11-22 11:42:40 -05:00
4c44d9ef67 fix(tools): count parent-map links only to map rows
Resource tables can contain non-map names, which inflated the link totals even when the target map was absent. Build the name set and the report from the same map rows.
2026-11-22 17:15:28 +01:00
9f2086e6de tools/report_paths.py: one same_report_path for seven tools instead of seven copies (BUILD-589)
same_report_path was copied into ten tools, and each new "refuse an output that overwrites an input" change added
another copy or a variant. Four copies (anim_index, gamedata_index, gamedata_xml, navmesh_decode) also folded case and
accents on a case-insensitive macOS volume (through _path_key), the other six did not, so the same report pair was
refused by one tool and written by another.

tools/report_paths.py holds one version (the stricter one: realpath, normcase, case-folded NFD on a case-insensitive
volume, then os.path.samefile) and awc_manifest, gamedata_index, gamedata_xml, navmesh_index, rpf_probe, tile_probe
and world_names import it. The tools keep exposing the name same_report_path. On Windows and Linux nothing changes;
on macOS the five tools that lacked the case/accent step now refuse a case-only alias of a report that doesn't exist
yet, as the other five already did.

anim_index, navmesh_decode and world_lights_paths keep their copy for now because open pull requests edit them
(#2051, #2050, #2052, #2107); tests/test_report_paths.py fails if any other tool adds a copy.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SAjLH2L6R72dBvVaRG8hka
2026-11-22 16:09:57 +00: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
d233ad26f9 world_names: print --out overwrite paths as written, so Windows paths match
The resolve check used !r, which doubles backslashes on Windows, so
test_resolve_out_refuses_to_overwrite_an_input failed there (Linux CI
paths have none). Other errors in this file already print paths plainly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:16:17 +01:00
2afc15de85 world_names.py: refuse a resolve report that aliases an input 2026-11-22 13:20:10 +01:00
89cf18645e Merge pull request #1428 from Dominik 2026-11-22 06:38:01 -05: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
6f83550233 world_names.py: diagnose malformed dictionary tables 2026-11-22 12:16:25 +01:00
4c85973eea world_names: isolate JSON report staging files 2026-11-22 05:05:17 -03:00
83d9537a70 Merge pull request #986 from bbareth 2026-11-22 01:08:10 -05:00
2067e91a49 world_names.py: an unterminated comment ends at the next XML declaration; strict XML unescaping (review)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 06:41:15 +01:00
57540ad2a1 Merge pull request #986 from bbareth 2026-11-22 00:33:24 -05:00
8e60787e78 world_names.py: XML names are unescaped, and names inside comments are ignored
add_xml() matched <filename> and <name> elements with regexes on the raw
text, so an escaped name was hashed as written ("A&amp;B", not "A&B") and an
element inside an XML comment was added as a real name. Comments are now
removed first (CDATA and processing instructions are kept), and values are
unescaped with html.unescape, which never raises on a stray reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 06:29:34 +01:00
8fa6b89f4c World names: whole-archive coverage, --archetypes-out and --rpf9-names
docs/world.md and docs/world_names.md said ~96% of archetypeName hashes stay
unresolved. That was a name-source limit of the two sampled windows: the
names are in levels.rpf, and rpf9_names.py already lists them. With its
name.#dr/name.#ft list as the dictionary, 99.85% of the 1,670,435 placement
entities resolve (99.94% with --max-inflate 256 MiB), every match verified by
the entity's 64-bit key.

- world_index.py --archetypes-out writes the aggregate archetype file that
  world_names.py resolve --archetypes reads (entity count and 64-bit key per
  hash); nothing in the repo produced it before. Entities of a resource that
  needs a continuation stream are counted once.
- world_names.py build --rpf9-names reads rpf9_names.py index JSON.
- docs: whole-archive coverage table, the four commands that reproduce it,
  and the corrected statements in world.md and docs/README.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:10:01 -05:00
5fd107b18a world_names.py: reject an unrecognized map report 2026-11-22 00:16:37 +01:00
5bc48f20b7 world_names: resolve placement/archetype hashes with 32-bit joaat and Murmur3-64
Measured on Xbox 1.0.2.1:
- archetypeName, map name and parent are lower-cased joaat.
- per-archetype +0x20 and map +0x10 keys are MurmurHash3 x64 128 low 64 (seed 0).
- +0x08 is a per-entity id, not a per-archetype hash.

A 79,738-name local dictionary resolves 5,107/24,105 distinct
archetype hashes (8,263/203,799 entities) in two bounded windows,
all confirmed by the 64-bit key; one 32-bit-only candidate is
rejected. Map names resolve 5/23,535 and parents 1/2,089.

Adds tools/world_names.py, synthetic tests, world_names.md, and
map_name64 to world_index output.
2026-11-21 22:36:32 +00:00