After the merge the tree held this branch's older states of files main maintains. Run against main's code,
tests/test_acphal_abi.py and 11 of the 15 translator tests that differed failed, and the C++ runtime would have
been built from two generations of its sources. So that the merge cannot break what main builds and tests:
- runtime/ is main's, file for file (68 files only this branch had are not carried over);
- every file under tools/, tests/ and docs/ that both sides have is main's (80 files);
- ten translator tests only this branch has, which test rules main's translator does not have, and their
fixtures are left out.
What main gains: d3d12/ (the Rust D3D12 runtime), its launchers and helpers (Launcher.bat, scripts/play*.ps1,
play-linux.sh, port_ctl.py, smooth-motion.ps1, fetch_vkd3d_proton.py, sync_victory.py), mods/example_lua, eleven
notes under docs/, seven tools and the tests that pass with main's code, the README's sections and credits, and
the "Runtime traps" section of AGENTS.md. Everything left out here is on the branch port/d3d12-nvidia.
Checked: compileall; make_game.py --help; check_no_game_data.py over every file this adds to main; the
line-ending, docs-encoding, CI-registration and docs tests; each test file that differs from main, on its own.
Not run: the whole translator suite, the C++ build, cargo over d3d12/ after the merge (d3d12/ is byte for byte the
branch's), CI.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Brings the D3D12 runtime branch (d3d12/, its launcher scripts and notes, and the pull requests reviewed and applied
on it) together with mandy's main.
Conflicts (67 files, none under d3d12/): docs/, make_game.py, runtime/, scripts/build_runtime.ps1, tests/ and
tools/. Every one takes main's side: main is where that code is maintained, and this branch's copies were older
states of the same files or the same pull requests in another form. tests/test_fspx_unpack.py is main's too, as it
tests main's tools/fspx_unpack.py. Nothing under d3d12/ is changed by the merge.
Checked before pushing: python -m compileall over make_game.py, tools and tests; make_game.py --help;
scripts/check_no_game_data.py over the files this adds to main; tests/test_text_write_line_endings.py. The
translator suite, the C++ runtime build and CI have not run on the result.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Apply published_mode(destination) in _staged_entity_report before atomic replacement,
and restore write permission (0o600) before unlinking in finally block
when replace fails, preventing Windows PermissionError [WinError 5] and
stranded temporary files.
agent: yes
AI-assisted: yes
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>
Use the map root reference array to retain entity ordinals across mixed classes and select the ordinary terrain parent map. Keep physical row order and optional metadata for incomplete inputs.
Refs: #3047, #3087
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.
csv.writer and csv.DictWriter default to lineterminator="\r\n", and every
one of these tools opens its report with newline="", which turns that into
CRLF on Windows and LF elsewhere: the same archive gave different report
bytes depending on the machine that exported it. awc_manifest and awc_shorts
already pin "\n" and bink_index documents why its stdout writer needs it, so
this brings the remaining 16 writers onto the same convention. A structural
test keeps new writers on it, and three tools are run end to end to check the
bytes.
Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
os.path.normcase folds case only on Windows, so on macOS's default
case-insensitive APFS volume `--out out/R.json --csv out/r.json` passed
_check_report_paths and the CSV replaced the JSON summary. New report paths
now fold case and Unicode normalization when the volume that will hold them
is case-insensitive (pathconf _PC_CASE_SENSITIVE); case-sensitive volumes
keep two distinct reports.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scan_rpf appends the next contiguous zlib stream while a 0DRPz resource still needs a continuation
(a large resource keeps its system page in one stream and the rest in the next). The directory
branch of scan_path parsed each carved file alone, so those resources were lost: on a 1.0.2.1
copy, `world_index.py data.rpf` finds 15,768 resources (docs/world.md) and the data.rpf carve
folder found 15,756.
In a carve folder the same rule now applies: a file is joined with the next one when
rpf9_carve.py's index.json shows that stream started at the 16-byte boundary right after it (as
scan_rpf checks in the archive), up to two continuations, within max_inflate. Without an index
the files are parsed one by one, as before. The data.rpf carve folder now gives 15,768.
Tests: a carve folder with a resource split over two files plus a second resource must list the
joined resource once with its full size (fails on main: the map row is missing), and two streams
that weren't contiguous must not be joined.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
world_build placed every model at its own coordinates or in rows; it never read the CEntityDef records.
- world_index.py --entities-out writes one JSON line per complete entity: archetype hash and 64-bit key,
position, stored rotation, scales and LOD fields.
- world_build.py --placements matches each selected entity to an exported model the way world_names.py does
(lower-cased joaat of the manifest name, confirmed by the Murmur3-64 key when the row has one). It then
scales by (scaleXY, scaleXY, scaleZ), rotates by the conjugate of the stored quaternion, translates and
converts to glTF Y-up. Normals use the inverse-transpose; a mirroring scale flips the winding.
--lod-levels (default 0,5) and --region select the entities. world.json reports the count of each outcome
in stats.placements.
- tests/test_world_place.py: 15 synthetic tests.
- docs/world.md: "Building a placed world", with measurements on a 700 m downtown box.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scan_rpf looked for the next continuation at the first stream's start plus
the streams' lengths, leaving out the padding between them. Once two gaps
add up to 16 bytes or more that lands inside the second stream, so the
third was never joined and the row lost its CMapData. Track the last
joined stream's real end, as world_census.assemble and
instance_lists.resource_buffers do.
An entity block whose start lies past the inflated bytes (for example beyond
--max-inflate) got off = None and was skipped, so its entities were neither
aggregated nor counted as incomplete_entities. They are now reported as
incomplete. The parse_resource docstring describes how collect is used.
Found in review of #954. Whole levels.rpf (1.0.2.1) re-run with this change:
incomplete_entities 0, archetype counts and keys identical to the run
published in docs/world_names.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
scan_rpf() used `min(size, pos + limit) if limit else size`, so
--limit 0 scanned the whole archive. --start and --limit were plain
ints: a negative --limit gave an end before the start (an empty scan
reported as a normal run), a negative --start searched from the top of
the file, and a --start inside the RPF9 header or past the end was used
as given. --start must now be 0 or more and --limit at least 1
(argparse errors), and a --start outside an archive's data area is one
line and exit 2, before any report is written.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.