tools(macos): say which archives a downloader has not filled in yet #635

Open
AnastasisKon wants to merge 277 commits from upstream-pr/635 into main
AnastasisKon commented 2026-11-28 17:51:09 +00:00 (Migrated from github.com)

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


Closes #634.

What

A 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 valid and the data in the middle is absent. #632 measured that shape on this Mac — shaders.rpf holding 3 of its 25 pieces while being 411,695,600 bytes long — and the cost of not knowing is a run that ends in the int3 at image+0x1330a44, which reads as a host problem.

tools/macos/check-game-data.sh [--samples N] <game folder> samples 4 KiB blocks spread over every .rpf, prints per archive how many samples were holes, names the ones that are missing data, and exits 1 when any is (2 for a folder with no archive or a bad argument). The blocks come from a sparse read, so the 142 GB folder here takes about a second and a half:

levels.rpf                     70.9 GiB  16 samples,  9 holes (56% of what was read)  MISSING DATA
shaders.rpf                   392.6 MiB  16 samples, 14 holes (87% of what was read)  MISSING DATA
textures.rpf                  183.7 MiB  16 samples, none a hole  ok

tools/macos/tests/check-game-data.sh covers it with fixtures, and the CI macos-scripts job runs it beside the other script regressions. One sentence in README.md's "Run the game" points at the script.

Testing

  • /bin/bash tools/macos/tests/check-game-data.sh — 10 PASS lines (complete folder, a hole named, a file with only its header and tail filled in, a small archive read block by block, the sample count, no archive, a missing folder, bad arguments, several folders including one with spaces, --help).
  • nice -n 10 sh tools/macos/verify.sh full — == gate PASSED == (suite-hle 554, suite-shader 593, suite-gpu 493, policy, clippy-win).
  • Run against the real folder at /Volumes/Anastasis' SSD/GTA6.Xbox.v1.0.2.1-CYBERLEEK: 142 GB allocated, 12 archives, exits 1, and the archives it clears (anim, audio, data, common, script, textures, appdata0) are the ones the torrent's piece map also reports complete.
  • Bash 3.2 only, no declare -A, no Python; writes nothing outside $TMPDIR in the test.

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:5543003332 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/635). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T17:51:09Z. --- Closes #634. ## What A 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 valid and the data in the middle is absent. `#632` measured that shape on this Mac — `shaders.rpf` holding 3 of its 25 pieces while being 411,695,600 bytes long — and the cost of not knowing is a run that ends in the int3 at `image+0x1330a44`, which reads as a host problem. `tools/macos/check-game-data.sh [--samples N] <game folder>` samples 4 KiB blocks spread over every `.rpf`, prints per archive how many samples were holes, names the ones that are missing data, and exits 1 when any is (2 for a folder with no archive or a bad argument). The blocks come from a sparse read, so the 142 GB folder here takes about a second and a half: ``` levels.rpf 70.9 GiB 16 samples, 9 holes (56% of what was read) MISSING DATA shaders.rpf 392.6 MiB 16 samples, 14 holes (87% of what was read) MISSING DATA textures.rpf 183.7 MiB 16 samples, none a hole ok ``` `tools/macos/tests/check-game-data.sh` covers it with fixtures, and the CI `macos-scripts` job runs it beside the other script regressions. One sentence in `README.md`'s "Run the game" points at the script. ## Testing - [x] `/bin/bash tools/macos/tests/check-game-data.sh` — 10 `PASS` lines (complete folder, a hole named, a file with only its header and tail filled in, a small archive read block by block, the sample count, no archive, a missing folder, bad arguments, several folders including one with spaces, `--help`). - [x] `nice -n 10 sh tools/macos/verify.sh full` — `== gate PASSED ==` (suite-hle 554, suite-shader 593, suite-gpu 493, policy, clippy-win). - [x] Run against the real folder at `/Volumes/Anastasis' SSD/GTA6.Xbox.v1.0.2.1-CYBERLEEK`: 142 GB allocated, 12 archives, exits 1, and the archives it clears (`anim`, `audio`, `data`, `common`, `script`, `textures`, `appdata0`) are the ones the torrent's piece map also reports complete. - [x] Bash 3.2 only, no `declare -A`, no Python; writes nothing outside `$TMPDIR` in the test. ## 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.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/635:upstream-pr/635'
git switch 'upstream-pr/635'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/635'
git switch 'upstream-pr/635'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/635'
git switch 'upstream-pr/635'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/635'
git switch 'main'
git merge --squash 'upstream-pr/635'
git switch 'main'
git merge --ff-only 'upstream-pr/635'
git switch 'main'
git merge 'upstream-pr/635'
git push origin 'main'
Sign in to join this conversation.
No reviewers
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!635
No description provided.