Copy-back undoes title writes and can lose shader writes: findings and source patch #690
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork#690
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Speartone on GitHub · 2026-11-25 04:34 UTC · original
Source patch and findings. Author: Speartone. Based on
c96b4f2; the patch's second half is in the first comment.copy_back,relay_merge,card_mergeandcard_merge_relayread a stretch of title memory, merge what shaders changed and write the whole stretch back. Two losses follow, both reproduced with synthetic data onc96b4f2:With the patch only changed bytes are stored. A store that faults ends at that page. A lock from the read to the store keeps the runtime's mappings and the title's VirtualFree, UnmapViewOfFile and XMemFree out.
VICTORY_EXACT_BACK=0gives the old path.Based on Marvisak/VIctory#721 and Marvisak/VIctory#1024 (Dufftwt), which cover copy_back; the other three paths exist only in this fork.
Tests (synthetic), this patch on an RTX 5080: victory-gpu 126 and victory-hle 98 pass. The same copy-back code beside a page-write change: victory-gpu 126 on AMD RDNA2; WARP 125, with one failure (
depth_bounds_pipeline_...) the base has too; victory-shader 214; stress 0 title writes undone and 0 shader bytes lost (base: 23,709-80,993 and 622-1,460 per path); 34 of 34 mutations that change behaviour caught. Three existing tracker tests now tell the tracker before they unmap.Cost (Ryzen 7 7700X, 1,000 pieces of 64 KiB): -3 to +33 %; about twice without AVX-512 where changed and unchanged bytes alternate.
Limits: frees by direct system call or inside the host's heaps cannot crash it, but the address can be reused within microseconds. A title exception handler installed ahead of ours sees our store's fault first. Actual GTA VI gameplay has not been tested; whether this affects the missing walls is unknown.
AI-assisted: analysis, code, tests and text by Claude Code (Claude Opus 5.5). No game data.
Patch, part 1 of 2
🤖 Generated with Claude Code
@Speartone on GitHub · 2026-11-25 04:34 UTC · original
Part 2 of 2 of the patch (apply both; AI-assisted, as above).
Patch, part 2 of 2