Skip to content

rpf9dump: record scan-level candidate and recovery counts - #853

Merged
ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
cxchhh:codex/rpf9dump-scan-counts
Nov 22, 2026
Merged

ItsNotRexed merged 2 commits into
ItsNotRexed:mainfrom
cxchhh:codex/rpf9dump-scan-counts

Conversation

@cxchhh

@cxchhh cxchhh commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #30. Kam471 suggested this in the review, but I pushed the commit after #30 was merged, so here it is again on current main.

Why

Candidates that RecoverAtOffsets rejects never reach the per-item loop. ModelDecodeFailures stays empty and the summary prints fail=0, even when candidates are missing. The scan-level shortfall was not recorded anywhere.

Change

The manifest gets a Scan object:

Field Meaning
Candidates Page-scan candidates
Recovered Resources recovered, counted as distinct candidate offsets
NotRecovered Candidates - Recovered: rejected before decoding
Entries Manifest items

Entries and Recovered are separate because since the 917e9b9 pin, a drawable dictionary yields one entry per child at the same offset. rpf9dump also prints the shortfall.

On a cached run, the candidate count is read back from the index cache's coverage text. rpf9dump now writes that text with invariant digits, and older caches with grouped digits (2,313) still parse. The count is null if another tool wrote the cache.

Tested

Tested on Linux x64 with .NET SDK 8.0.428, CPU only (no GPU involved).

AI-assisted: an AI agent (Claude, Anthropic) did the code and tests on the author's behalf. No game data is included.

🤖 Generated with Claude Code

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 ItsNotRexed#30; that follow-up commit was pushed
after ItsNotRexed#30 had been merged, so it is resubmitted here on current main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kotorvr

kotorvr commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Reviewed 9e0d871: 1 finding

  • tools/rpf9dump/ScanCounts.cs:16: the separator class [0-9.,'   ] misses group separators that .NET 8 N0 really writes, so an older cache from those cultures reads back as Candidates: null instead of the count. With .NET 8.0.34 (ICU), I formatted the old coverage text under every culture and ran it through ScanCounts.Candidates: 75 cultures return null. Examples: de-CH, de-LI and en-CH (183’801, U+2019), all ar-* (U+066C), ff-Adlm (U+2E41), nqo (U+060C). New caches are fine because they use invariant digits. One fix: allow any punctuation or space between the digits, for example ([0-9][0-9\p{P}\p{Zs}]*).

Ran: dotnet build tools/rpf9dump/rpf9dump.csproj -c Release (0 warnings, 0 errors); dotnet run --project tests/Rpf9DumpDiagnostics -c Release (all three groups pass); a scratch console app that links ScanCounts.cs and loops over CultureInfo.GetCultures(AllCultures). No game files, so I didn't run models on a real archive. Windows 11, .NET SDK with the 8.0.34 runtime.
Review was AI-assisted (Claude Code).

The old coverage text used N0, whose group separator is not always one of
. , ' or a space: de-CH writes U+2019, ar-* U+066C, nqo U+060C, ff-Adlm
U+2E41. Accept any punctuation or space between the digits. With ICU, the
old pattern failed for 77 of 852 cultures and the new one for none; the
diagnostics test now checks every culture.

Reported by kotorvr in the review of ItsNotRexed#853.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cxchhh

cxchhh commented Nov 22, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for checking this. It's fixed in eea3677: the pattern now accepts any punctuation or space between the digits ([0-9][0-9\p{P}\p{Zs}]*).

The diagnostics test now formats the old coverage text under every culture and requires 183,801 back. On Linux x64 with .NET 8.0.428 and ICU (852 cultures), the old pattern failed for 77 and the new one for none. You saw 75 on 8.0.34, so the count depends on the ICU data. dotnet build tools/rpf9dump gives 0 warnings, and all four test groups pass.

AI-assisted.

ItsNotRexed added a commit that referenced this pull request Nov 22, 2026
@kotorvr

kotorvr commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Reviewed eea3677: looks good. My finding from 9e0d871 is fixed. The new loop over every culture in tests/Rpf9DumpDiagnostics passes, and with 9e0d871's ScanCounts.cs put back it fails, so it catches the old bug. Ran: dotnet build tools/rpf9dump/rpf9dump.csproj -c Release (0 warnings, 0 errors) and dotnet run --project tests/Rpf9DumpDiagnostics -c Release (all three groups pass). Windows 11, .NET 8.0.34. Review was AI-assisted (Claude Code).

@ItsNotRexed
ItsNotRexed merged commit 0b8b134 into ItsNotRexed:main Nov 22, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants