tools: check a game folder's archives for the holes a preallocating downloader leaves, before spending a run #634

Open
opened 2026-11-28 17:49:15 +00:00 by AnastasisKon · 0 comments
AnastasisKon commented 2026-11-28 17:49:15 +00:00 (Migrated from github.com)
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T17:49:15Z.


What

A game folder that is still downloading looks complete. A preallocating client leaves every archive at its full length with the parts it has not downloaded reading as zeros, so GetFileSizeEx, the RPF9 header and the tail piece all look right and the shader data in the middle is absent. #632 measured exactly that on a folder that looked valid: shaders.rpf held 3 of its 25 pieces while being 411,695,600 bytes long.

Nothing in the repository says so before a run is spent, and the run it costs is not obviously a data problem: the title ends in the int3 at image+0x1330a44.

Fix

tools/macos/check-game-data.sh [--samples N] <game folder>: samples 4 KiB blocks spread over every .rpf, reports per archive how many samples were holes, names the archives that are missing data, and exits 1 when any is. 4 KiB blocks come from a sparse read, so a 142 GB folder takes about a second. tools/macos/tests/check-game-data.sh covers it with fixtures (complete, holey, header-and-tail only, small archive, sample count, no archive, missing folder, bad arguments, several folders, --help), and CI runs that test beside the other script regressions.

One sentence in README.md's "Run the game" points at it.

Not claimed

That holes are the only reason a folder fails to boot, and nothing about the host: the check reads the game folder and never writes to it.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6669183155 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/634). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T17:49:15Z. --- ## What A game folder that is still downloading looks complete. A preallocating client leaves every archive at its full length with the parts it has not downloaded reading as zeros, so `GetFileSizeEx`, the `RPF9` header and the tail piece all look right and the shader data in the middle is absent. `#632` measured exactly that on a folder that looked valid: `shaders.rpf` held 3 of its 25 pieces while being 411,695,600 bytes long. Nothing in the repository says so before a run is spent, and the run it costs is not obviously a data problem: the title ends in the int3 at `image+0x1330a44`. ## Fix `tools/macos/check-game-data.sh [--samples N] <game folder>`: samples 4 KiB blocks spread over every `.rpf`, reports per archive how many samples were holes, names the archives that are missing data, and exits 1 when any is. 4 KiB blocks come from a sparse read, so a 142 GB folder takes about a second. `tools/macos/tests/check-game-data.sh` covers it with fixtures (complete, holey, header-and-tail only, small archive, sample count, no archive, missing folder, bad arguments, several folders, `--help`), and CI runs that test beside the other script regressions. One sentence in `README.md`'s "Run the game" points at it. ## Not claimed That holes are the only reason a folder fails to boot, and nothing about the host: the check reads the game folder and never writes to it.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
LakshanSivakumar/Native-Victory-macOS#634
No description provided.