Commit Graph

26 Commits

Author SHA1 Message Date
b13b6b3d3f Merge remote-tracking branch 'upstream/main' into HEAD 2026-12-01 19:17:10 +08:00
c28b21aa61 rpf9dump: harden segment bounds and CLI option validation (RPF9DUMP-SEGMENTS-AND-CLI) 2026-11-24 19:05:56 +08:00
031bab29f8 Repair zero-byte DDS files on TTPF resume
Require a non-empty file before the manifest or exporter considers a DDS complete. Rebuild empty outputs through the atomic writer and cover skipped rows and surviving siblings with synthetic tests.
2026-11-24 00:38:33 -05:00
c8ab834e03 Preserve TTPF texture depth and dimension in pool manifests (#6838)
Squash-merged after diff review of PR #6838 - ASSET-579: Preserve TTPF texture depth and dimension in pool manifests
2026-11-23 09:51:11 -06:00
c646bf8367 Speed up make_game by overlapping stages and showing progress. (#1797)
Squash-merged after diff review of PR #1797
2026-11-23 09:32:22 -06:00
c4cd71bed7 rpf9dump: guard --start/--length bounds and <64-byte sources in models/textures (#6344)
Squash-merged after review of PR #6344 - rpf9dump: guard --start/--length bounds and <64-byte sources in models/textures
2026-11-23 08:14:58 -06:00
20960a0112 Merge pull request #4636 from Michael
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:16:41 -05:00
046de42647 rpf9dump: reject a missing or non-file source before creating the output folder
A mistyped source path, or a directory passed as one, created <out>/<name> and then failed in FileInfo.Length with an unhandled FileNotFoundException and exit -532462766. Check the source after the argument checks and before Directory.CreateDirectory, print one line to stderr, and exit 2 like the other input errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016Nsrb3M85XUG34gwsU9emJ
2026-11-22 20:33:59 -07:00
60868f0ebd rpf9dump: reject an unknown mode before touching the source or output
An unknown first argument fell through every mode branch: it created <outdir>/<source>, printed ok=0 fail=0 skip=0 and exited 0, which make_game reads as a finished stage. Check the mode first, print one usage listing all five modes (audio and xma were missing) and exit 2.
2026-11-22 16:06:38 -06:00
5fe5687694 Merge pull request #3064 from jaybeebabageyus 2026-11-22 15:14:30 -05:00
78f92bcf2e rpf9dump: rescan instead of exporting from a partial index cache
rpf9dump shares %LOCALAPPDATA%\RpfPreview\Indexes with the rpf9-explorer GUI, which saves its model index
while it is still indexing and when a scan is cancelled, with IsComplete=false. rpf9dump trusted any cache that
loaded, so after a stopped GUI scan it exported only what had been indexed so far, published the manifest and
exited 0, and make_game.py never redid the step. A cached index now stands in for a full scan only when it is
marked complete or carries rpf9dump's own coverage text; otherwise rpf9dump scans again. Its own full scans are
saved with the complete mark, which the cache file already had a field for.

Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ABh36DZ2sZNq3ChN6EZJs
2026-11-22 23:02:25 +03:00
54bb91389d rpf9dump: fix the write-failure fixture's page-count overlap; count embedded, directory and read-I/O failures as write failures
The fixture wrote the resource page counts at 0x88/0x89, which is the
texture descriptor's width field (t+0x38 at t=0x50): width read 257 and
Parse rejected the record (layout 20480 vs allocation 4096), so no entry
reached Export and the committed test failed before any DDS write. Move
the page-count pointer to 0x40 (counts at 0x48, below the descriptor);
the same binary now recovers one texture, hits the blocked DDS write,
withholds manifest.json and exits 1. The test also asserts the DDS is
absent, not only the return code.

Review gaps closed: embedded-texture DDS writes are no longer swallowed
by catch {} (decode failures count like the textures branch, write
failures count into writeFail and fail the run); dictionary-directory
and models _tex directory creation failures return WriteFail=1; a
retryable IOException while reading a resource or decoding (CreateDds)
also counts as a write failure, so a locked source no longer publishes
a manifest with missing files; marker withdrawal goes through
WithdrawMarker, which clears a read-only attribute first and turns any
remaining delete failure into a one-line error with exit 1 instead of a
traceback.

Verified offline: Program.cs compiles 0 warnings/0 errors against the
real Core sources with a BCnEncoder stub (BCnEncoder.Net is not cached
offline, so the DLL build runs in CI); a Python mirror of Recover/
RecoverAtOffsets/TryInflate/LooksLikeDictionary/Parse/ComputeLayout
recovers the committed fixture 1/1 (system 208 B, graphics 4096 B,
pages 1/1, texture 'probe' 4x4, allocation 4096) through both scan
paths, and rejects the pre-fix bytes with the reported mismatch
(layout 20480 != allocation 4096). python -I skip path: 2 skipped, OK.
2026-11-22 20:52:44 +01:00
01e27846e4 rpf9dump: a per-item write failure in models/textures must fail the run and withhold manifest.json 2026-11-22 20:15:40 +01:00
e6ab90d6d4 rpf9dump: export a window of a file, and per-geometry counts in the models manifest
Models and textures no longer open the archive document. The entry list comes from this run's
scan or from the index cache, and every resource is read from its own compression blocks
(tools/rpf9dump/Segments.cs), which mirrors the checks ArchiveReader.ReadResourceData makes. That
makes a raw slice of an archive exportable: a window cut out of levels.rpf has no 9FPR header, so
there was nothing to open before, and the mode simply failed on it.

--start/--length scan one window instead of the whole file. A sub-range is never written to the
index cache, which is keyed by the file rather than by the window; the manifest records
Scan.Start and Scan.Length for it.

The manifest gains MeshTris, MeshModels and MeshGeoms: the per-geometry triangles and the
(model, geometry) pair the decoder puts in each mesh name, in the order of the OBJ's `o` groups.
A dehydrated BLAS leaf stores that pair as its geometry index (docs/bvh.md 4a), so a matching tool
can filter candidates on the manifest instead of reading every OBJ.

Measured: one 1 GiB slice of levels.rpf scans, recovers, decodes and exports 1,228 models in about
2 s. The project builds clean with no warnings; tests/Rpf9DumpDiagnostics covers the segment reader
(compressed and raw blocks, a block past the end, a short block, an entry without blocks) and the
mesh key parsing, and still passes.
2026-11-22 18:49:28 +01:00
62eedd84b1 rpf9dump: use every core for scan validation, model/texture export, texture pools and audio
Each mode ran on one thread, so the assets stage left the rest of the CPU idle (levels.rpf models took 46 min
on a 16-thread machine). Core's readers open their own read handle per call (ReadResourceData, RecoverAtOffsets,
TtpfReader.CreateDds, AwcInfo.Inspect, AwcRecovery.WriteXmaWave), so the work splits across threads:

- scan validation: 32-offset chunks in parallel, indexes reassigned in offset order as before
- models/textures: entries decoded and written in parallel in batches of 1,024; rows, counters and failure
  messages are taken in list order, so the manifest and the log match a one-thread run
- ttpf, xma, audio manifest rows: per texture / bank in parallel, rows kept in source order

Outputs are byte-identical to the one-thread build (diff -r on shared_minigame000 models and textures, and a
texture pool). models shared_minigame000: 34 s -> 7 s; ttdb_terrain_image_based: 8 s -> 1 s.
2026-11-22 12:30:10 +01:00
c833ae6d48 ASSET-44: Bump rpf9-explorer for C# BCPack BC1/BC3/BC4/BC5 decode 2026-11-22 06:57:22 -03:00
7e196840c4 rpf9dump xma: exit 1 when a stream write fails, so make_game retries it
make_game writes audio/xma.done after rpf9dump xma exits 0. The xma branch
counted failed writes but fell through to the final return, which only
fails for ttpf, so a failed stream was never written on a later run.
2026-11-22 12:04:43 +05:30
b7ec22e798 Merge pull request #890 from nicolas 2026-11-22 00:33:00 -05:00
ed784a2300 Report incomplete texture pool exports and retry missing DDS files 2026-11-21 21:10:28 -07:00
9e0d871d76 rpf9dump: record scan-level candidate and recovery counts
Candidates that RecoverAtOffsets rejects never reach the per-item loop,
so ModelDecodeFailures stays empty even when candidates are missing.
Write Scan { Candidates, Recovered, NotRecovered, Entries } into the
manifest and print the shortfall. Recovered counts resources (distinct
candidate offsets): since the 917e9b9 pin a drawable dictionary yields
one entry per child, so Entries can exceed Candidates.

On a cached run the candidate count comes from the index cache's coverage
text, which rpf9dump now writes with invariant digits; older caches with
grouped digits still parse. The count is null when another tool wrote the
cache.

Suggested by Kam471 in the review of #30; that follow-up commit was pushed
after #30 had been merged, so it is resubmitted here on current main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 03:38:39 +00:00
3816356e05 third_party: bump rpf9-explorer to 917e9b9 and decode packs.rpf dictionary children
The 48557ea pin predates the merged model-layout recovery, the packs.rpf drawable-dictionary roots, the TTPF compact/array/cubemap/volume layouts and the external skeleton reader. Re-pin to upstream 917e9b9.

rpf9dump now passes e.ResourceDrawableOffset to RageModelDecoder.Decode; without it every dictionary child would decode as the first child. The manifest also records Drawable so a row can be traced to its dictionary offset.

Measured on the 1.0.2.1 package with .NET 8.0.428: a fresh packs.rpf scan recovers 24,034 models (23,720 dictionary children plus 314 fragments) from 23,838 candidates, against 314 at the old pin. docs/models.md keeps the 48557ea/c3708fb table as the control and adds the new packs.rpf result; docs/design.md notes the other archives were not re-counted at the new pin. Build: 0 warnings, 0 errors.
2026-11-22 01:35:02 +00:00
65d927b61a rpf9dump: write every output under a temporary name and rename it into place
make_game.py takes ttpf manifest.json and audio_manifest.json as proof that
a step finished, and every exporter skips a file that already exists. Both
were written in place, so a stopped run or a full disk could leave:

- a truncated manifest, after which make_game.py skips that texture pool
  or the audio banks on every later run, or
- a truncated .dds / .obj / .xma.wav under its final name, kept forever
  because the next run sees it exists.

All outputs (ttpf DDS + manifest, audio_manifest.json, XMA2 .xma.wav,
model .obj, embedded and dictionary .dds) now go through Util.WriteAtomic:
written to <path>.partial, then File.Move'd over the final name; the
temporary is removed on failure, and a stale one from a stopped run is
deleted first (WriteXmaWave opens its target with FileMode.CreateNew).
The models manifest already worked this way.

Util moves to its own file so tests/Rpf9DumpDiagnostics can link it; the
diagnostics program gains four checks for WriteAtomic.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:22:35 +03:00
58cb83df2c Report model decode failure reasons in rpf9dump 2026-11-22 01:35:55 +08:00
1da3c7d2aa Audio: XMA2 streams via rpf9dump xma + ffmpeg (all 1,818 decode)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 22:32:47 -05:00
0082ad5365 rpf9dump: stream manifests (levels.rpf ran out of memory); docs: wave64 and mesh-shader findings
Rows held lazy projections that kept every decoded model alive; 149,811 models on levels.rpf exhausted
memory at the final serialization. Rows are now written as they are produced, to a .partial file renamed
when complete. Design notes record that most shaders are wave64 (32-wide subgroups on NVIDIA) and that
mesh shaders are NGG wave64 with the merged-shader SGPR layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 19:04:06 -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