Commit Graph

27 Commits

Author SHA1 Message Date
5175cc9188 vertex_types: ask report_paths for the report-path guard
The tool carried its own `same_output_path` (realpath, normcase, samefile) while it already imported `report_paths.path_key`, so it answered the report-path question two ways; CONTRIBUTING.md asks a report writer to ask `same_report_path` instead of deriving it again. The private copy also missed the helper's folding-volume probe, so on a Linux mount that ignores case (vfat/exFAT/CIFS) `--json R.json` and `--json r.json` were two paths and the second overwrote the first.
2026-12-01 19:44:40 -05:00
00131bb85e main keeps its own runtime, tools and tests; the branch's variants stay on port/d3d12-nvidia
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>
2026-11-27 17:58:38 -05:00
e1d0f481bd PR #1170: vertex_types: ask report_paths for the report-path guard (VERTEX-TYPES-SHARED-REPORT-PATH)
From https://github.com/ProjectLeonida/mandy/pull/1170 (head 89af92865bb0), applied as a reviewed patch.

Co-authored-by: breachato <breachato@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 15:42:19 -05:00
fd335571a0 vertex_types: count overlapping archive paths once (#6760)
Squash-merged after diff review of PR #6760 - vertex_types: count overlapping archive paths once
2026-11-23 10:04:55 -06:00
169a1f21ae Merge pull request #4417 from SebSilent
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:14:33 -05:00
b153c1db5f vertex_types: fail on an unlistable sub-folder instead of silently skipping its archives 2026-11-22 22:20:20 -03:00
cac5f5cb4e Merge pull request #2838 from Lucy 2026-11-22 16:59:51 -05:00
72e0d19e1f Merge pull request #2787 from Lucy 2026-11-22 16:59:47 -05:00
70628f3931 vertex_types: place the 0x27 functions before add() (clear of #2787's skin_checks)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 21:22:30 +00:00
0f31940248 Merge pull request #2746 from Lucy 2026-11-22 15:11:34 -05:00
abb55d06ea vertex_types: tag 0x27 is a second tangent frame (2_10_10_10 UNORM, xyz*2-1 along u, w the sign)
The mesh shaders fetch tag 0x27 as BUF_FMT_2_10_10_10_UNORM, map each component by v*2-1, transform xyz
like the normal and cross it with the normal scaled by w. tangent_0x27 is that read, and tangent27_checks
counts per 0x27 slot: unit length, perpendicular to the face normal, along dP/du of each 0x28 stream, and
the side w gives the bitangent. docs/restofworld.md records the counts (levels slot 11: 100% unit, 96.7%
along u of stream 4, w side 99.8%).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:25:53 +00:00
3c2ffa2df6 Merge pull request #2725 from Vonsek 2026-11-22 13:17:22 -05:00
8550b52a01 vertex_types: slots 6-9 of the 42 40 blocks are skin weights (0x26) and joint indices (0x25)
Where slot 8 holds tag 0x25, each 0x25 slot pairs with the 0x26 slot two below it. skin_checks counts the
skin reading per block: weight sums over the weight slots, descending order, distinct joints among the
non-zero weights, zero weights with index 0, the highest joint used, and the slot-1 colour stream's byte
sum as a control. docs/restofworld.md records the counts (core_restofworld: 95.6% of 212,564 vertices sum
to 255, 99.7% descending, 100% distinct; colour control 0).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:16:45 +00:00
abc0b7abcd vertex_types: note the shaders' bit-30 factor (-1.0 when set) beside the measured bitangent side
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:13:31 +00:00
502dc77f99 vertex_types: decode the tangent and bitangent sign in the rest of the tag 0x21 word
The mesh shaders build a tangent from the bits the normal leaves: with bit 31 set, bits 20-29 are an angle
(v * 2pi/1023 - pi) that turns a basis made from the normal alone; with bit 31 clear, bits 16-22 and 23-29
are a 7-bit octahedral tangent. Bit 30 is the bitangent sign. tangent_0x21 is that decode, and the tool
now counts each tangent against the texture-coordinate gradient dP/du of its triangles, with a randomly
turned tangent as the chance level, and bit 30 against the side of dP/dv. docs/restofworld.md records
the counts on two archive samples.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:07:39 +00:00
6b66d9494f fix(tools): clamp the packed SNORM10 negative endpoint
The two negative endpoint encodings represent the same component. Decoding them differently can bias the vertex probe direction and face agreement.
2026-11-22 19:01:12 +01:00
bf9db9feca vertex_types: decode tag 0x21 as the mesh shaders do (octahedral normal, 10-bit or 8-bit by bit 31)
The mesh shaders branch on the sign of the 0x21 word: with bit 31 set they unfold an octahedral normal from
unorm10 x/y in bits 0-9 and 10-19; with it clear, from unorm8 x/y in bytes 0-1. normal_0x21 is that decode,
scored as candidate oct_bit31_10_or_8. Scored by class on sampled blocks, each class matches the face normals
only under its own branch (levels: median 1.00 for both); docs/restofworld.md records the counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:58:12 +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
8d87e41d85 vertex_types.py: reject invalid RPF9 headers before reporting 2026-11-22 13:33:09 +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
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
6e05934117 vertex_types: measure every block of a back-to-back 42 40 run
A stream can hold several 42 40 00 00 blocks back to back, with their
meshlet groups after the whole run in the same order. find_group looked
for block 0's group right after its own last stream, found the next
block's header there and skipped the stream. Walk the run, pair group i
with block i (each pair still has to cover its block densely) and count
blocks left without a group under their own skip reason.
2026-11-22 14:41:54 +05:30
78b6f5c65f vertex_types: make recursive archive order deterministic 2026-11-22 04:50:19 -03:00
32ec7f2f15 Merge pull request #1085 from quackottu 2026-11-22 02:09:02 -05:00
1aef69e8cf vertex_types: group_edges keeps running sums past 65,535 references
group_edges read each meshlet's first vertex reference and triangle from
the record's u16 fields. parse_group checks those only modulo 2^16, so in a
larger group later meshlets mapped their triangles onto earlier meshlets'
references. Use running sums of vcount and tcount, as parse_group does.
2026-11-22 12:14:36 +05:30
494f8f985f vertex_types.py: sample 256 triangles per block for the slow tests
The face-normal (22 decodings x every triangle vertex) and UV mapping tests
made a full-corpus run take days (packs.rpf alone ran for hours). They now
use a fixed sample of up to 256 triangles per block from the tool's seeded
rng, so a rerun gives the same counts; the edge-wrap, per-byte and position
counts stay exhaustive.

data.rpf: 546 s -> 179 s. Same 1,857 blocks; edge-jump counts identical;
s16 mapping spread median 0.105 -> 0.106; face-normal medians within 0.002
(0x21 unorm10_xyz 0.513 both).

AI-assisted (Claude). Tested: python -I tests/test_vertex_types.py (10 pass),
data.rpf before/after on my own copy; no GPU involved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 06:27:25 +00:00
0378157a9f Tools: measure component types of 42 40 00 00 vertex streams (ASSET-57 follow-up)
ASSET-57 measured the bytes per vertex of each tag on 0x4042 blocks. This adds
tools/vertex_types.py, which takes each block's vertex count and triangles from
the following meshlet group (validated with meshlet_page.parse_group) and
scores candidate decodings with count-only checks:

- 0x28: signed vs unsigned u16 (edge-wrap test), half-float validity, the
  +0x7C header word, and how evenly each reading maps onto the positions
- 4-byte tags (0x21, 0x25, 0x26, 0x27): per-byte constancy and edge
  smoothness, and face-normal agreement for snorm8, unorm8, 10:10:10,
  octahedral and QTangent readings
- 0x42 slot 0: packed position decode (bias +0x60, scale +0x70), with the
  +0x6C axis word for model-space face normals

No value leaves the tool; it writes counts only. tests/test_vertex_types.py
builds a synthetic block, group and archive and runs the tool end to end.

AI-assisted (Claude). Tested: python -I tests/test_vertex_types.py (10 pass),
python -m compileall -q make_game.py tools tests; no GPU involved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 04:36:27 +00:00