Commit Graph

15 Commits

Author SHA1 Message Date
e61aadda9f swizzle_search, tex_mode_probe: say numpy is missing in one line, as tile_probe does 2026-11-24 16:11:23 +01:00
59fae18000 Merge pull request #3075 from Marco Luzzaro 2026-11-22 15:14:36 -05:00
b46397dba9 Merge pull request #2996 from Vonsek 2026-11-22 15:13:54 -05:00
c9fc49c57e tex_mode_probe: report invalid texture indexes cleanly 2026-11-22 20:17:15 +01:00
ba8e78b2f6 fix(assets): report distinct texture probe placements
A single-mip texture puts the first and last candidates at the same offset. The duplicate was displayed as a second candidate, obscuring the distinction between actual alternatives.
2026-11-22 20:03:40 +01:00
2066459c82 fix(tools): size probed texture mips by their full tile grid
Rounding the linear byte count can undercount partially occupied tiles on both axes. Use the same tile shape for mip sizes and swizzled offsets.
2026-11-22 17:54:41 +01:00
fa4723c735 Merge pull request #1460 from Rafael 2026-11-22 06:38:09 -05:00
41c57974ba tex_mode_probe: read the whole GPU blob chain, and count skipped textures
The probe opened only the first carved file of a texture's GPU blob (`t["gpu"]`) and ignored
`gpu_chain`, which tex_export.py joins. A texture whose data runs into a later part fit no
candidate and was dropped from the ranking without a line. gpu_blob() now reads every part in
order, as tex_export does; a texture that still fits no candidate prints a "skipped" line, and the
run ends with "probed N of M textures; K skipped".

Real data (counts only), my 1.0.2.1 texture index, all textures of 256 px or more:
- BC1: main ranks 33 of 42 (23 of the 42 have a multi-part chain); this change ranks 42 of 42.
  The 9 added winners are 4K_S last x6, 4K_S first x2, 4K_S3 first x1.
- BC3: main 65 of 66, now 66 of 66.
Every row main printed is unchanged (33/33, 65/65).

Tests: test_probe_reports_available_candidates gains blobs split over 2 and 3 carved files
(main: no candidate, the texture vanishes); the expected output of the existing cases now ends
with the probed/skipped total.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 08:29:39 -03: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
81a07034da Fix tex_mode_probe reporting with a single candidate
Show 2nd n/a when only one layout/placement fits, and cover zero,
one, and two viable candidates with synthetic buffers.

AI-assisted (Codex).
Claim: https://github.com/ItsNotRexed/Leonida/issues/634#issuecomment-7073565207
2026-11-22 11:30:58 +08:00
0a36334401 tex_mode_probe.py: --n must be at least 1
--n was a plain int used as texs[: a.n]: --n 0 probed nothing and
printed "winners: []" as if it had run, and a negative --n silently
dropped the last textures. --n is now a positive whole number, an
argparse error otherwise, before the addrlib tables are loaded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:12:43 +01:00
d74b25bf4c tex_mode_probe: document and test format prefix filtering 2026-11-22 00:48:17 +01:00
286f365cc3 tex_mode_probe.py: reject formats without a supported color scorer 2026-11-22 00:20:29 +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