Commit Graph

26 Commits

Author SHA1 Message Date
5821c15ea2 rtti_scan: ask report_paths for the report-path guard 2026-12-01 19:44:42 -05:00
d2569e17d9 Merge pull request #798 from trigger337/fix/rtti-scan-stage-cleanup
rtti_scan: restore write mode before unlink on replace failure (RTTI-SCAN-STAGE-CLEANUP)
2026-11-28 20:34:13 +01: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
b87abdef57 Merge mandy's main into port/d3d12-nvidia
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>
2026-11-27 17:50:37 -05:00
8082919d3e PR #1229: rtti_scan: ask report_paths for the report-path guard (RTTI-SCAN-SHARED-REPORT-PATH)
From https://github.com/ProjectLeonida/mandy/pull/1229 (head 8bde265e5a01), 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:22 -05:00
7da8f09a9e PR #798: rtti_scan: restore write mode before unlink on replace failure (RTTI-SCAN-STAGE-CLEANUP)
From https://github.com/ProjectLeonida/mandy/pull/798 (head a6ff1f4d32), applied as a reviewed patch.

Co-authored-by: trigger337 <trigger337@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-27 15:42:13 -05:00
a6ff1f4d32 rtti_scan: restore write mode before unlink on replace failure (RTTI-SCAN-STAGE-CLEANUP)
agent: yes
AI-assisted: yes
2026-11-24 16:58:39 +03:00
558b1b4e89 rtti_scan: scan the last aligned qword of a section for a COL pointer
The vtable scan stopped at hi - 8 (exclusive), so the qword at hi - 8, the
last one that fits in the section, was never read. The bound is hi - 7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 05:51:32 -05:00
fa33dd1616 Merge pull request #3647 from Kam471 2026-11-22 17:03:11 -05:00
16a081a217 Merge pull request #3357 from kotorvr 2026-11-22 17:01:39 -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
9e41b6924b rtti_scan: review fixes for conversion operators, nested function pointers, array sizes, lone '@'
- A conversion operator in a local scope is named after the type it returns
  ('Obj::operator int'), so two conversions of one class no longer collapse.
- A pointer or reference to a function pointer or to an array goes inside the
  declarator's brackets: 'void (**)(int)', not 'void (*)(int) *'.
- An array with a negative dimension count or size is not read; the name is
  returned mangled.
- A string that ends with one '@' counts as a type descriptor only when its
  outermost scope is a function ('...Z@', '..._E@') or a back-reference; a
  plain name followed by a lone '@' is not counted.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 20:39:37 +00:00
08b7920b64 rtti_scan: read template, back-referenced and local class names; find classes local to a function
simple_name split the mangled name on '@', so a template's arguments came out
as namespaces ('.?AV?$Pool@H@mem@@' was reported as 'mem::H::?$Pool'), and a
back-reference digit or an anonymous namespace as a scope name. It now reads
the name: scopes, templates and their arguments, back-references, anonymous
namespaces and classes local to a function. A form it does not read (a pointer
to a member, an address as a template argument) is reported mangled, unchanged,
instead of as a made-up scope chain.

The type-descriptor pattern also required the name to end with '@@'. A class
declared inside a function ends with that function's 'Z@', so its descriptor,
the class and its vtables were not found at all. Union descriptors ('.?AT')
are matched too.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 20:13:36 +00:00
e4fbfa3f46 rtti_scan: validate CHD signature/RVA and align vtable scan up to section start 2026-11-22 19:33:03 +01:00
ef6139ddb3 tools: newline= on text-mode temp files and Path.open too (BUILD-468)
#1615's detector read the mode only at position 1, so Path.open(mode)
and tempfile.NamedTemporaryFile(mode) were not seen: three atomic report
writes (rbf0_tree, rtti_scan, world_build) still get CRLF on Windows.
They now pass newline="\n".

The test now reads the mode where each call takes it: open, io/gzip/
bz2/lzma.open and os.fdopen at position 1, Path.open and the tempfile
classes at position 0 (binary by default). It accepts only real mode
strings, and skips codecs, os, tarfile, zipfile and webbrowser opens.
Found by @undeadhuman37 in their review of #1615.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:54:01 +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
e0228f4748 Merge pull request #1319 from FarhatFIN 2026-11-22 05:37:40 -05:00
9c7f928435 fix(rtti): refuse report paths that alias the input image
The --out option could replace the PE being analyzed with JSON. Reject identical paths and hard links before scanning, and cover both refusal and separate-output success with synthetic CLI tests.
2026-11-22 17:08:55 +07:00
b6d4ac879b fix(rtti): stop vtable slot counting at the section boundary
Raw padding beyond a section's virtual size can contain executable-looking pointers. Bound slot scanning to the section holding the vtable and cover both sides of that boundary with a synthetic PE.
2026-11-22 16:41:49 +07:00
430265a0ed file_mode: find a new file's mode with a probe file, not by flipping the umask
glb_writer._output_mode and rtti_scan._report_mode read the umask with
os.umask(0) then os.umask(mask). The umask is process-wide, so any thread
creating a file in that window got mask 0. A probe file created with mode
0666 gives the same bits (and honours a directory's default ACL) without
changing anything. Raised by kapitche on #750 and #728.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 10:39:11 +05:30
d0ca262e7c rtti_scan: the swapped-in report keeps the old report's permission bits
NamedTemporaryFile creates its file 0600, so a new report lost the umask
default (0644 under umask 022) and a replaced 0640 report lost group read
(found by @VictorJulianiR on Ubuntu). The temp file now gets the old report's
mode, or 0666 minus the umask for a new report, before os.replace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:54:59 +00:00
d0f0a510f3 rtti_scan: keep the old report when a write fails; mark mad denormals as not modelled
Follow-ups to review points on three merged PRs.

#658 (@VictorJulianiR): rtti_scan.py opened the report in place, so a write
that failed after the open (full disk, locked range) left a 0-byte file and
the previous report was gone. The report is now written to a temp file next to
it and swapped in with os.replace; on failure the temp file is removed.

#627 (@Caasares): three subnormal cases pinned the translator's result as if
it were RDNA2's. v_mad_f32, v_mac_f32 and v_mad_legacy_f32 flush f32
denormals on RDNA2 (LLVM SIISelLowering.cpp, isFMADLegal). They move to
DenormalDivergenceTests, which pins the translator result and records the RDNA2
one; docs/design.md lists the flush as not modelled. No translator change.

#645 (@esteban-dcp): crosslane_fuzz.py still called permlane FI=0
unmeasured; comments now point at the measurement and at #580.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:30:20 +00:00
ea2c6a91ad rtti_scan.py: an output it can't write is one line
The report was written outside the try that turns read and scan errors
into one ERROR line, so an --out in a missing folder (or the default
<image>.rtti.json next to a read-only image) ended in a traceback after
the whole scan. It now prints ERROR: <path>: <reason> and exits 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:35:59 -03:00
ab5e88950e tools, tests: add stdlib paths for tex_headers and rtti_scan and un-skip CI tests 2026-11-21 17:18:04 -03:00
851b0eb079 tests: rtti_scan imports pefile only in its CLI; mark the wave64 vcc-half bcnt1 case as a known gap
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 13:56:08 -05:00
db0dc8bd5e Initial commit: Leonida, build-it-yourself PC port groundwork
Shader pipeline (carve, FSSM unpack, gfx1013 disassembly, RDNA2 to SPIR-V),
asset export via rpf9-explorer's Core (submodule), PE loader and shim
skeleton, and make_game.py, which builds from the user's own copy of the game.
No game data, keys or executables are included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 15:22:16 -05:00