Commit Graph

28 Commits

Author SHA1 Message Date
1ca436c86d tools/hashdict: write --out atomically, use shared report_paths guard, and accept UTF-8 BOM in --lookup (HASHDICT-ATOMIC-JSON-AND-PATH-GUARD) 2026-11-25 20:36:32 +01:00
4c1eae0055 fix: report unreadable hashdict extra inputs (HASHDICT-EXTRA-READ-ERROR) 2026-11-24 12:44:53 -05:00
15121735d9 hashdict: --archives ignores spaces and refuses an archive the carve does not have 2026-11-24 07:31:12 +05:30
28f86537a3 hashdict: harvest a carved stream with the streams that continue it (#6631)
Squash-merged after diff review of PR #6631
2026-11-23 11:11:22 -06:00
577b19cc55 hashdict: read a carve index.json saved with a UTF-8 BOM (EGEN-HASHDICT-INDEX-BOM) (#6871)
Squash-merged after diff review of PR #6871 - hashdict: read a carve index.json saved with a UTF-8 BOM (EGEN-HASHDICT-INDEX-BOM)
2026-11-23 09:48:43 -06:00
540aa64438 Merge pull request #4186 from Markas
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:12:07 -05:00
87d142cf69 hashdict: report unreadable --extra directories 2026-11-22 23:48:00 +00:00
128e0960a6 hashdict: report missing --extra inputs 2026-11-22 23:30:16 +00:00
0ee35fba67 hashdict: diagnose invalid carve index fields 2026-11-22 18:10:07 +01:00
d04fca2433 Merge pull request #2027 from Kadthicu 2026-11-22 10:40:33 -05:00
7938efb484 docs(hashdict): document protection of harvested input data 2026-11-22 20:11:26 +05:00
d117d4caec fix(hashdict): reject --out aliases of harvested blob files 2026-11-22 20:06:38 +05:00
00452cfaa3 Merge pull request #1615 from Ewann 2026-11-22 09:48:04 -05: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
46d1ab3bf0 hashdict.py: harvest one archive's carve folder instead of writing an empty dictionary
A carve folder with its own index.json (<work>/carve/common, the folder the
gamedata_* tools take) matched no <carve>/<archive>/index.json, so the run
printed "0 strings -> 0 hashes" and exited 0. Treat such a folder as that one
archive; the --out-is-an-input check covers its index.json too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:00:17 +01:00
1e225e8550 Merge pull request #1589 from undeadhuman37 2026-11-22 07:38:24 -05:00
ea10e03898 hashdict.py: refuse an --out that names one of its inputs
The dictionary is written after the harvest, so `--out` naming an `--extra`
file or a carve folder's `index.json` replaced that input. Refuse it before
scanning with one ERROR line; os.path.samefile also catches a case-only
difference on Windows and macOS. Synthetic regression test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:29:13 +03:00
64fb22ab3b Merge pull request #1498 from bbareth 2026-11-22 07:07:55 -05:00
a8973abc24 hashdict.py: honor minimum lengths below three 2026-11-22 12:45:38 +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
84b1f3fd07 fix(tools): close file handles with context managers in tools
Closes unmanaged open() calls in tools/tex_export.py, tools/tex_mode_probe.py,
tools/shader_disasm.py, tools/hashdict.py, and tools/d3d12_xs_surface.py to avoid
leaking file descriptors and ResourceWarning under Python 3.12+. Expands
tests/test_resource_hygiene.py to cover these tools.
2026-11-22 15:27:46 +05:30
9f95b08df9 hashdict: a string longer than 201 characters is not cut into fragments
The harvest pattern ended a match after 201 characters and the next match
started in the middle of the same run, so a truncated prefix and a fragment
were added as names and the path component across the cut was lost. The
whole run is matched now and split into its parts as before; a run or a
part longer than 201 characters is not added as a name, which keeps the
longest entry the dictionary could ever hold. Parts are found one at a time,
so a very long run does not build a list of all of them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 14:13:26 +07:00
48ad23f026 hashdict: a non-object dictionary or a bad archive index is one ERROR line (#1034, #1043)
--lookup called .get on whatever the dictionary file held, so a JSON array ended in an AttributeError; the build
read each <carve>/<archive>/index.json with a bare json.load(f)["files"], so a malformed one aborted the run with a
traceback after earlier archives were processed. Both now print one ERROR line naming the file and exit 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:29:37 -05:00
d9a76decd0 BUILD: create the hashdict --out parent directory before writing 2026-11-21 23:01:17 -06:00
51bb8734ab hashdict.py: bad carve folders, missing blobs and bad --lookup values are one line
A missing or non-folder carve ended in a traceback from os.listdir. A
carved .bin that an index.json lists but that is gone from disk stopped
the whole build with FileNotFoundError, so a long harvest wrote no
dictionary at all. --lookup died on a value that isn't hex, after
printing the values before it, and on a missing or broken dictionary.

The carve folder is now checked first (exit 2, one line). A listed blob
that can't be read is skipped, counted and named in one warning, and
the dictionary is still written from everything else. --lookup checks
every value before it prints anything (a usage error, exit 2) and
names a dictionary it can't read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:44:49 +01:00
803b57d651 hashdict.py: require inputs for build and lookup 2026-11-22 00:23:40 +01:00
3fc2a44190 hashdict.py: make generated dictionaries reproducible 2026-11-21 22:44:11 +01: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