DirectStorage: a damaged game file says so by name, cut short (#1250) or not unpacking (#3335) #815

Open
github-bot wants to merge 2 commits from github-bot/gh-815 into main AGit
Owner

@⁠kibagami-nc on GitHub · 2026-11-28 06:48 UTC · original
kibagami-nc:dstorage/failed-request-names-its-file → main · +128 −7 · 1 files · 2 commits · open

Two commits on main (716a0c99). The first commit of this PR (a failed request names its file) is already in main and v2026.11.29.01. These two make a damaged game file say so, once, by name:

  • #1250, the file is cut short: a read past the file's end.
  • #3335, the file is damaged: a zlib block that does not unpack.

What happens

The title asks DirectStorage for blocks of its archives at the offsets its archive tables name. When the file's bytes there are not the package's, the request fails, and the title goes on without the data and stops later at an address of its own. Until now, nothing in the log said the file was the cause:

  • #1250: a 630-byte read at 20,022,473,968 in pack\story000\story000.rpf, which was shorter than that (0x80070026, end of file). The title trapped at +0x29defb1 two minutes later. Such a file still starts with 9FPR, so the header check passes. A complete copy is 20,022,508,672 bytes.
  • #3335: levels.rpf was of the right size (76,155,065,056 bytes), but over part of it held the bytes 16 further on, after an extraction that went wrong. A zlib request there failed with 0x8007000d, and the title stopped at +0x4da6315 four milliseconds later. Five runs gave the same stop. A zlib block starts with 0x78; the damaged copy read 25 42 31 b4 there.

The change

The first such failure of a file logs one error line. Main's warn with the request's details stays as it is.

dstorage: a game file is shorter than the title reads: it is cut short, and the game goes on without what is missing; a complete copy of this file is needed path=… on_disk=… read_to=…
dstorage: a game file holds bytes that do not unpack where the title reads a zlib block (it does not start like one): the file is damaged, often by an extraction that did not finish; a complete copy of this file is needed path=… offset=… first_bytes=[25, 42, 31, b4]
  • Where each is called: File::cut_short from read_into, where it already returns END_OF_FILE. File::damaged from both zlib paths in execute, plain and before BCPack, on INVALID_DATA from a file only (a memory source has no file to name).
  • What File keeps: a flag for each, beside main's name and path.

Nothing else changes: same requests, same results, same error record.

Tests

  • a_read_past_the_end_tells_once_that_the_file_is_cut_short: a read inside the file says nothing; a read past its end fails with END_OF_FILE and is told, only once.
  • a_block_that_does_not_unpack_says_the_file_is_damaged_once: #3335's bytes where a block starts fail with INVALID_DATA and are told, only once. A memory source fails the same way, with no file.
  • cargo test -p victory-hle --locked: 425 passed, including main's a_request_names_the_file_it_reads and a_failed_request_is_in_the_error_record.
  • cargo clippy -p victory-hle --all-targets: nothing in dstorage.rs.
**@⁠kibagami-nc** on GitHub · 2026-11-28 06:48 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/815) `kibagami-nc:dstorage/failed-request-names-its-file` → `main` · +128 −7 · 1 files · 2 commits · open **Two commits on main (716a0c99).** The first commit of this PR (a failed request names its file) is already in main and v2026.11.29.01. These two make a damaged game file say so, once, by name: - **#1250, the file is cut short:** a read past the file's end. - **#3335, the file is damaged:** a zlib block that does not unpack. ## What happens The title asks DirectStorage for blocks of its archives at the offsets its archive tables name. When the file's bytes there are not the package's, the request fails, and the title goes on without the data and stops later at an address of its own. Until now, nothing in the log said the file was the cause: - **#1250:** a 630-byte read at 20,022,473,968 in `pack\story000\story000.rpf`, which was shorter than that (`0x80070026`, end of file). The title trapped at `+0x29defb1` two minutes later. Such a file still starts with `9FPR`, so the header check passes. A complete copy is 20,022,508,672 bytes. - **#3335:** `levels.rpf` was of the right size (76,155,065,056 bytes), but over part of it held the bytes 16 further on, after an extraction that went wrong. A zlib request there failed with `0x8007000d`, and the title stopped at `+0x4da6315` four milliseconds later. Five runs gave the same stop. A zlib block starts with `0x78`; the damaged copy read `25 42 31 b4` there. ## The change The first such failure of a file logs one error line. Main's `warn` with the request's details stays as it is. ``` dstorage: a game file is shorter than the title reads: it is cut short, and the game goes on without what is missing; a complete copy of this file is needed path=… on_disk=… read_to=… dstorage: a game file holds bytes that do not unpack where the title reads a zlib block (it does not start like one): the file is damaged, often by an extraction that did not finish; a complete copy of this file is needed path=… offset=… first_bytes=[25, 42, 31, b4] ``` - **Where each is called:** `File::cut_short` from `read_into`, where it already returns `END_OF_FILE`. `File::damaged` from both zlib paths in `execute`, plain and before BCPack, on `INVALID_DATA` from a file only (a memory source has no file to name). - **What `File` keeps:** a flag for each, beside main's `name` and `path`. Nothing else changes: same requests, same results, same error record. ## Tests - `a_read_past_the_end_tells_once_that_the_file_is_cut_short`: a read inside the file says nothing; a read past its end fails with `END_OF_FILE` and is told, only once. - `a_block_that_does_not_unpack_says_the_file_is_damaged_once`: #3335's bytes where a block starts fail with `INVALID_DATA` and are told, only once. A memory source fails the same way, with no file. - `cargo test -p victory-hle --locked`: 425 passed, including main's `a_request_names_the_file_it_reads` and `a_failed_request_is_in_the_error_record`. - `cargo clippy -p victory-hle --all-targets`: nothing in `dstorage.rs`.
A request that failed was logged with its options, offset, sizes, tag
and debug name, but not with its file. In #812, every chunk of two
entries failed to inflate, and only the order of the log told which
archive they came from. The file object now keeps the path the title
opened it by, and the warning gives it as `path`. A request whose
source is memory gives none.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 06:52:25 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-28 07:06 UTC · original · approved these changes

LGTM — verified on Windows:

  • cargo test -p victory-hle --lib dstorage passed (19/19, including a_request_names_the_file_it_reads)
  • 0 new compiler warnings in touched files
  • cargo xtask policy passed (294 files ok)

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-28 07:06 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/815#pullrequestreview-6096396798) · **approved these changes** LGTM — verified on Windows: - `cargo test -p victory-hle --lib dstorage` passed (19/19, including `a_request_names_the_file_it_reads`) - 0 new compiler warnings in touched files - `cargo xtask policy` passed (`294 files ok`) Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
github-bot changed title from DirectStorage: a failed request names the file it read (#812) to DirectStorage: a failed request names its file; a read past a file's end says it is cut short (#812, #1250) 2026-11-29 03:28:11 +00:00
github-bot force-pushed github-bot/gh-815 from 96270e51da to 51e45cb9b5 2026-11-29 03:28:13 +00:00 Compare
Author
Owner

@⁠trustno1-coder on GitHub · 2026-11-29 08:28 UTC · original

Thank you! An earlier version of this pull request was merged into main with its original commits and is part of v2026.11.29.01, where you are credited. GitHub does not show it as merged because new commits were pushed here after that merge. It stays open so those newer commits can be looked at next.

**@⁠trustno1-coder** on GitHub · 2026-11-29 08:28 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/815#issuecomment-7253123696) Thank you! An earlier version of this pull request was merged into main with its original commits and is part of [v2026.11.29.01](https://github.com/trustno1-coder/VIctory-NVIDIA/releases/tag/v2026.11.29.01), where you are credited. GitHub does not show it as merged because new commits were pushed here after that merge. It stays open so those newer commits can be looked at next.
github-bot changed title from DirectStorage: a failed request names its file; a read past a file's end says it is cut short (#812, #1250) to DirectStorage: a read past a file's end says the file is cut short (#1250) 2026-11-29 20:40:28 +00:00
github-bot force-pushed github-bot/gh-815 from 51e45cb9b5 to b091e6b9ad 2026-11-29 20:40:29 +00:00 Compare
github-bot changed title from DirectStorage: a read past a file's end says the file is cut short (#1250) to DirectStorage: a damaged game file says so by name, cut short (#1250) or not unpacking (#3335) 2026-11-29 22:40:38 +00:00
A zlib request whose bytes do not unpack failed with INVALID_DATA and only a
warning. In #3335 a levels.rpf of the right size held, over part of it, the
bytes 16 further on (an extraction gone wrong); the title stopped at
+0x4da6315 four milliseconds after the refusal, which looked like a game bug.
The first such block of a file now says, at error level, that the file is
damaged, with its path, the offset and its first bytes (a zlib block starts
with 0x78).
This pull request has changes conflicting with the target branch.
  • crates/victory-hle/src/modules/dstorage.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/815/head:github-bot/gh-815'
git switch 'github-bot/gh-815'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-815'
git switch 'github-bot/gh-815'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-815'
git switch 'github-bot/gh-815'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-815'
git switch 'main'
git merge --squash 'github-bot/gh-815'
git switch 'main'
git merge --ff-only 'github-bot/gh-815'
git switch 'main'
git merge 'github-bot/gh-815'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!815
No description provided.