Fix data loss and crash cases from an audit; Series S card buffers on 12 GB cards #491
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
needs-logs
old-names
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/TaynanGT--Vice-Tay!491
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-491"
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?
@kozzy-bit on GitHub · 2026-12-01 10:41 UTC · original
kozzy-bit:fix/audit-data-loss-and-crashes→main· +273 −107 · 15 files · 7 commits · openFixes from an audit of
main(324dd38e; rebased on65b9beaa). Each one has a concrete failing case; none changes what a run does when nothing goes wrong.Saves: an unreadable old-layout blob no longer gets deleted (
vice-tay-hle/src/modules/xgamesave.rs)migrateskipped a blob whose read failed (filter_map(.. read(..).ok()?)), committed v1 without it, then removed the old folder. A blob held open without read sharing at the firstXGameSaveInitializeProvider(antivirus, a backup tool) was lost for good. Now any read failure stops the move; the old folder stays and the next start tries again. New test:an_unreadable_old_blob_keeps_the_old_layout.Shaders: short loose metadata no longer aborts the process (
vice-tay-shader/src/native.rs)loose_metadatachecked only that the size field agrees with the length;loose_computethen sliced&meta[0x10..](v2) or&meta[0x38..](v3). A 12-byte v2 blob with size 0 passes the check and panics insideextern "system" fn unknown_pipeline, where a panic can't unwind: the game ends without a message. Now refused as malformed; two cases added toloose_metadata_reads_both_versions.F1 settings: a file that can't be read is no longer rewritten from nothing; saves are atomic (
vice-tay-gpu/src/host/menu.rs,apps/vice-tay/src/play.rsoffer_mfg)Both read with
read_to_string(..).unwrap_or_default(). A settings file saved as ANSI by an editor (any non-ASCII byte) read as empty, and the next F1 change wrote a file holding only that change. Now only NotFound counts as empty, the text is read lossily, any other read error refuses the save ("COULD NOT READ THE SETTINGS FILE"), and the file is written aside and renamed over. The shadow-lift test now starts from an ANSI file and checks an earlier setting survives every save.Restarts: typographic quotes are doubled too (
menu.rsrestart_as,play.rsquoted)PowerShell ends a single-quoted word at ‘ ’ ‚ ‛ as well. #563 fixed
VICE_TAY_MENU_PLAYby passing it through a variable, butown_command(save import) still quotescurrent_exe(), andrestart_argsquotes--setvalues:D:\Bob’s Games\vice-tay.exebroke the restart after the game had already been ended. New test:typographic_quotes_are_doubled_too.get-dlss: no unchecked NVIDIA DLLs left behind (
scripts/get-nvidia-sdks.ps1)bin\x64, and the signature check ran only after everything succeeded. A dropped connection after some were written left them unchecked, andhas_streamline(onlysl.interposer.dll) loaded them at the next start. On any failure the eight DLLs are now removed before the error is passed on.NVIDIAanywhere in the subject; nowCN=NVIDIA Corporation,*(checked against the 2.14.16 files: all eight areCN=NVIDIA Corporation, OU=…).-LiteralPathfor paths that may hold[.\or a..part is refused (it would be written outside the folder).Pipeline library: flushed to disk before the rename (
vice-tay-gpu/src/pipeline/library.rs)The library was written through a mapping (or
fs::write) and renamed over the old one with no flush. A system crash or power cut shortly after a save could leave a renamed file of zeros, which the module's own notes link toDXGI_ERROR_DRIVER_INTERNAL_ERROR. NowFlushViewOfFile+sync_all(orwrite_all+sync_all) before the rename. Saves run on their own thread.Dead code:
translation_fingerprintremoved (vice-tay-shader/src/emit/mod.rs)No callers; a second, drifted copy of the shader cache key (
shader_cache::buildis the real one, and differs: it has nodebug_assertions/diagnosticsbytes). Someone adding a translation input there would get stale shaders served. The doc link incost.rsnow points at the real key.Shader cache key: test-only files no longer count (
vice-tay-gpu/build.rs,vice-tay-shader/build.rs)vice-tay-shader/build.rscarefully lefttests.rs,*_tests.rsand*_tests/out of its source hash so that "a change to them keeps the cached translations", but that hash (VICE_TAY_SHADER_SOURCE_HASH) was only read by the deadtranslation_fingerprint. The real key (VICE_TAY_TRANSLATOR,vice-tay-gpu/build.rs) hashed every file, so editing a test threw every cached translation away. The filter now lives in the gpu build script, and the unused hash is gone from the shader one (every_switch_of_the_translator_is_in_the_keycaught the leftover name). All those files are only compiled undercfg(test).Windows' helpers by full path (
apps/vice-tay/src/play.rs,menu.rsrestart_as)Command::new("powershell.exe")/("reg")look beside vice-tay.exe first, and the README puts vice-tay.exe in the game's folder (often under Downloads): apowershell.exeorreg.exedropped there ran onget-dlss/get-fsr/get-d3d12, the hardware probe at every start, and the F1 restart (CreateProcessW with no application name, which also searches the current folder). Now by their System32 path.Loader: unaligned IAT slots refused (
vice-tay-loader/src/windows.rs)The parser checks an IAT slot lies inside the image but not its alignment; a damaged
FirstThunksuch as0x2004made thewrite_volatileunaligned (undefined behaviour). Now a clear "damaged image" error.Series S start: card buffers on 10 to 19 GB cards (
play.rsrun_series_s)play --series-sran the Series S build withSERIES_S_SETTINGSalone, so a 12 GB card kept the title's buffers in the PC's memory, where every shader access crosses the bus. The earlier launcher's-Machine 4070setVICTORY_CARD_BUFFERS_MB=1536/VICTORY_CARD_WINDOWS_MB=1024for such cards, asmachine_settingsstill does for the Series X. Prolog, RTX 5070 12 GB, Ryzen 7 5700X, 32 GB, warm cache, 44 intervals of 5 s: 3.1 fps and 142 ms a frame on the card without them, 8.9 fps and 32 ms with them (VICTORY_PIPELINE_WAIT_MS=0, 3 pipeline workers andVICTORY_PLACED_ORDER=1on top changed nothing measurable: 7.6 and 8.6).READ_BOUNCE: the title's event is set (
files.rsbounced_read)The bounced read used an OVERLAPPED of its own, so the kernel never set the event in the title's: a title waiting on it (rather than on the handle) hung. Opt-in only.
One
reg.exeless per start (play.rs)play.rshad its ownwindows_buildthat ranreg.exetwice at every start, besidemain.rs'sRtlGetVersionone. The build now comes fromcrate::windows_build();ProductName(LTSC) is asked only on AMD, the only place it is used.Series X start: a hint where RAM is under 48 GB (
play.rsseries_s_hint)On 32 GB the Series X took about 29 GB and ran the prologue at 0.1–3 fps (#492). Where RAM is below the test PC's 48 GB and the Series S build is beside the program, the start now says
vice-tay play --series-sruns with less. It still starts the Series X.Startup priorities: the latest ask is given back (
kernel.rsSetThreadPriority)With
VICE_TAY_STARTUP_PRIORITIESandVICE_TAY_TITLE_PRIORITIES=0, only raised calls were recorded. A thread that asked for LOWEST (raised to below normal) and later HIGHEST (not raised, not recorded) was set back to LOWEST when the window ended. Each call now drops the same thread's earlier entry. Opt-in only. New test:a_later_ask_replaces_the_one_to_give_back.CI: the Series S build is checked (
.github/workflows/ci.yml)series-s/is excluded from the workspace and nothing built it, so a break there would first show on a player's PC.Note: the
native.rsandemit/mod.rschanges change the translator's source hash, so the shader cache is rebuilt once.Testing:
cargo clippy --workspace --all-targets --locked -- -D warnings(with and without--all-features) andcargo test --workspace --lockedpass on Windows 11, RTX 5070.🤖 Generated with Claude Code
@Aniseto on GitHub · 2026-12-01 10:59 UTC · original
Ran the three named unit tests of the audit fixes at
c37be6a5on an NVIDIA Blackwell desktop part with 16 GB of VRAM.Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, debug build, detached worktree at the exact PR head, own
CARGO_TARGET_DIR, no local patches. Thevice-taybinary test needed the localdelayimp-fixat link time; the two lib tests did not.All three named cases pass here. The description's full workspace suite and clippy runs were not repeated.
Not tested: the full workspace suite, clippy, a title run, the Series S memory advice path on this 64 GB PC, Wine, AMD adapters, release profile, game data.
AI-assisted (OpenCode), model: MiMo-V2.6-Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
@Aniseto on GitHub · 2026-12-01 11:16 UTC · original
This is a new response on the same thread as my report at
c37be6a5(#491); the head moved tod32e2f4c(a startup-priority commit was added), so I am not editing that comment.Ran the three named unit tests at
d32e2f4con an NVIDIA Blackwell desktop part with 16 GB of VRAM.Environment: Windows 11 Pro build 26200 x64, NVIDIA GeForce RTX 5070 Ti (Blackwell, 32-lane waves only, 16 GB, mesh shaders) driver 32.0.16.2140 (621.40), Intel Core i5-12400F, 64 GB RAM, rustc 1.98.1 (48a229cea 2026-09-01), MSVC 14.44.35207, debug build, detached worktree at the exact PR head, own
CARGO_TARGET_DIR, no local patches. Thevice-taybinary test needed the localdelayimp-fixat link time; the two lib tests did not.All three named cases still pass at the new head. The added startup-priority commit was not otherwise exercised.
Not tested: the full workspace suite, clippy, a title run, the Series S memory advice path on this 64 GB PC, Wine, AMD adapters, release profile, game data.
AI-assisted (OpenCode), model: MiMo-V2.6-Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.