Repository navigation
HLE/dstorage: VICTORY_DSTORAGE_ZERO_FAILED=1 zeroes the destination of a request that does not decode (damaged game copies; int3 at +0x4da6315) - #816
Closed
deepdev237 wants to merge 1 commit into
Conversation
…nation when its data does not decode Opt-in, off by default. When a DirectStorage request's zlib or BCPack data does not decode (damaged or missing source bytes), its destination is zeroed instead of keeping a partial decode over stale bytes. The title never reads a request's result, so it goes on to fix up the resource it asked for; over stale bytes that finds pointers outside the resource and the title stops on its own breakpoint (int3 at +0x4da6315 in 1.0.2.1). Zeros read as null pointers. The resource is still missing; this only changes how the title meets it. Meant for game copies with damaged archives. AI-generated: written by Claude Opus 5.5 (Anthropic) in Claude Code, and tested by it on an AMD Radeon RX 9060 XT. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Test report on real hardware: AMD RX 6950 XT (RDNA2), Windows 11, Rust 1.98.1, with a GPU present. I merged this PR's head AI-assisted (Claude Code); no game data. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
VICTORY_DSTORAGE_ZERO_FAILED=1(opt-in, off by default). When a DirectStorage request's zlib or BCPack data does not decode, the request's destination is zeroed instead of keeping a partial decode on top of whatever bytes were there before. The request still reports the failure exactly as before (hr=0x8007000d), and nothing changes when the switch is unset.Change: one file,
crates/victory-hle/src/modules/dstorage.rs, +31/−2. A newzero_failed_destination(request, size)writes zeros through the existinginto_destination(so plain and page destinations are both handled). It is called on the two decode-failure paths ofexecute: the final zlib/BCPack decode, and the zlib stage before BCPack.Why
Some copies of the game have archives with zero-filled regions (missing data). Requests whose source bytes lie in such a region fail to decode. The title never reads a request's result: it only polls for completion. So it goes on to pointer-fix the resource it asked for. Over stale bytes the fixup finds a pointer outside the resource's ranges and the title stops on its own breakpoint,
int3at+0x4da6315in 1.0.2.1. This is the routine described statically in xcl-dev/xcl#1164: it walks the resource map's chunks and traps when no chunk contains the pointer. Zeros read as null pointers, which that routine passes.This does not bring the missing data back. Whatever the resource was is still missing. It only stops stale bytes from being read as pointers. Copies without damaged archives never take this path.
Evidence (two runs, same save, same machine)
Both runs used the same save, which reaches the first gameplay scene of the prologue a few minutes after loading. Both had
VICTORY_WALLS_TRACE=1, which names each request's source file. The game copy here has a zero-filled region innavmeshes.rpfat[0x2caa7000, 0x2daa4000), among 11 damaged archives.Run 3, switch unset (build SHA-256
728DC6EE66335E33CBEF4C94082B4B567753AB4F04D62817C6D3D77C5A242F4D). Three navmesh requests fail, and 0.9 s later the title stops:The run ended at 197.5 s (
exitCode=0x80000003). Earlier runs on this copy stopped at the same address every time they got this far.Run 4,
VICTORY_DSTORAGE_ZERO_FAILED=1(build SHA-256C418BF2CB28A4632C4466B7F08A16EDFA3776F3D0A9FF13DFAAFD885629EB5D7; the only other difference from run 3's build is a shader-cache key change). The same three requests fail and are zeroed:68 requests were zeroed in this run (65 in TTDB texture archives, 3 navmesh), with no
int3at all.host GPU device removed after 1 submissions sent ahead ... 0x887A0005, with the relay on. That is being looked at separately.One run each, so this is evidence rather than proof.
Tests
cargo test -p victory-hle --profile diagon this branch (main310c6eb+ this commit): 96 + 1 passed, 0 failed.cargo build --profile diag -p victory --features diagnosticson this branch: builds.cargo clippyon this branch alone (mainitself currently fails clippy indraw.rs/indirect.rs, see GPU: clippy passes on main again #642).Full environment and run setup
x86_64-pc-windows-msvc;diagprofile withdiagnostics.levels.rpf(12),audio.rpf(3),pack/story000/story000.rpf(3),navmeshes.rpf(1) and sixdata/ttdb/*.ttpf.main310c6ebplus about 130 open PRs of this repository, with Shaders/structure: require masks in scc_some, active, and wave_any to vanish outside block reach #445 reverted. The list with every outcome isintegration-merge-log.tsvin https://gist.github.com/deepdev237/785e05b02d0dcece7aac1303f7fe4ba8. The PR branch itself is this commit alone onmain.VICTORY_BAKE_TEXTURES_MS=0 VICTORY_CARD_FETCH_INFLIGHT=1 VICTORY_NO_WATCHDOG=1 VICTORY_TEXTURE_NO_WAIT=1 VICTORY_RAGE_DEBUGINFO=30 VICTORY_WALLS_TRACE=1 VICTORY_SKIP_PIPELINES=c1eee35dbc50a9ef,f16876929fa64f9f,39f0e9aeb156a61c; run 4 also hadVICTORY_DSTORAGE_ZERO_FAILED=1. Relay at its default (stage 2).🤖 Generated with Claude Code