Squash-merged after review of PR #4881 - anim_clips: count clip windows; the clip timing rule over all 785,174 entries (was 4,471 in 300 sampled dictionaries)
From @ismailchaka1's check on #3341: types 4-8 have a {ptr, count} array at
+0x20 (null on type 4 and on 431 of 482 type-5 nodes; on every type-6/8 node,
items {u32, 0, u32, 0}). Counted as motion_node_pairs:<type>:<count|null> and
documented; the values are not decoded. Rechecked on anim.rpf.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of #3341: sample_k_is_child_k compared only each list's first child,
so [[0, 1], [1]] counted as identity; it now requires one item per list.
A malformed parameter node no longer resets a readable +0x70 time table to
None. Rechecked on anim.rpf: the totals in docs/animation.md are unchanged
(6,970 identity, all 17,247 time tables readable).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Parameter node types 3, 4, 5, 6 and 8 carry 1-5 axes ({u32 name hash, u16,
u16} at +0x10); types 4/5/6/8 keep their sample count at +0x90/+0x90/+0x50/
+0xA0, type 1 at +0x20. The .motion's +0x90 lists (one per node sample,
items {u32 child, f32, f32}) map each sample to a child: checked on all
8,932 one-node motions in anim.rpf. Counts only; synthetic tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Windows waits on a pool's workers with WaitForMultipleObjects, which takes
at most 64 handles. With --jobs 62 or more, awc_opus.py, awc_shorts.py,
world_lights_paths.py and world_build.py stopped with "ValueError:
max_workers must be <= 61" (ProcessPoolExecutor), and anim_clips.py
(multiprocessing.Pool) printed "ValueError: need at most 63 handles" from
a helper thread and never returned: 62 workers were killed after 60 s where
61 finish in 0.8 s (Windows 11, Python 3.12.5).
awc_opus.py and awc_shorts.py default --jobs to half the CPU count, and
make_game.py hands its own --jobs to awc_opus.py, so a machine with 124
logical CPUs reached this with no option given.
tools/pool_workers.py holds the limit, and the five pools are created with
process_workers(jobs): unchanged elsewhere, 61 at most on Windows. The
job count is lowered rather than refused so that a build with a large
--jobs keeps running. world_census.py, which refuses --jobs above 61, is
not changed.
tests/test_pool_workers.py runs each tool's own code: with the limit
patched in and a recording pool (every platform), the audio tools from the
command line with --jobs 62, and the real pool with 62 jobs on Windows.
8 of its 10 tests fail on the tools as they were.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
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>
.motion +0x70 holds one 0x28-byte item per child: the child's duration, its
duration in the blend and a (child time, blend time) curve. On anim.rpf the
first float is bit-for-bit the named .clip's duration for all 111,948 children
that name a .clip there; 158,991 of 159,584 curves are the identity and 402 are
monotonic time warps.
The parameter node is at +0x138 (+0x58 = 1) or at +0x18 of the block +0x120
points at (+0x58 = 2). Type 3 (10,171 of 17,247) is one sampled axis: a name
hash, (sample index, value) items sorted by value, min and max. 10 of the 88
axis name hashes resolve to joaat32 names such as yawangle and speed.
Also documents that the unlisted-last-page recovery needs the page map in a
listed stream (whattheflop's review on #1174): no anim.rpf root and no
story000 clip dictionary has its page map in such a tail. A synthetic test
keeps that layout unresolved.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 36 roots whose second system page is not the next listed stream have it
right after the first stream: a zlib stream inflating to 16-48 bytes, which
anim_index.py does not list (it keeps streams of 64 bytes or more), or a
16-byte raw page. group() now tries that page and joins it only when the
pages parse as a clip dictionary. All 36 join; 191,042 animations decode.
.motion clips list their children as {u64 0; u32 clip hash; u32 dictionary
hash} at +0x60, and the root's hash-only +0x70 references are dictionary
hashes. scan() joins both across the archive: 111,948 of the 114,925
children whose dictionary is in anim.rpf name a .clip of it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Windows time.monotonic() ticks at about 15 ms, so a zero budget read an
elapsed 0.0 and nothing was skipped (test_budget_skips_instead_of_blocking
failed in CI). Compare with >= instead of >.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/anim_clips.py groups the stream walk of anim_index.py into RAGE
resources via the page map at the +0x08 pointer, finds the clip
dictionaries (system-only, 1 or 2 pages) and decodes dictionary -> clips
-> packs -> animations -> sequences -> channels. Channel types 0-5, 7, 8
and the GTA VI type 10 (second-order delta coding) are decoded. Output is
counts and per-dictionary rows only; --decode prints one dictionary's
values to stdout for local use.
docs/animation.md gets a "Keyframe decoding" section with the layouts and
the measured full-archive counts, and the statements it makes stale are
updated: 0x98e1750c is joaat32("bonerotation"), the 2/3 packed streams
are second system pages of 0DRP resources, and keyframes are decoded for
the clip dictionaries. tests/test_anim_clips.py builds synthetic
resources, including a type-10 encoder for a round trip.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>