Loader: stage prepared images in per-writer files #560
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!560
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/560/head"
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?
@Quat3rnion on GitHub · 2026-11-24 04:56 UTC · original
Quat3rnion:victory-image-publication→main· +79 −7 · 3 files · 1 commits · merged 2026-11-25 00:20 UTCWhat
write_if_changedstaged every prepared image into the same<hash>.tmpfile. Two cold launches of the same title could truncate eachother's staged bytes, or the second rename could fail after the first had
already published a correct image. Publication now lives in a portable
module that stages under a name unique to the process and call, and removes
the staging file if the rename fails. The Windows loader path delegates to
it; the file content and cache layout are unchanged.
An AI tool wrote part of this change.
Tested
cargo test --workspace: 166 passed, 0 failed, 3 ignored. Two hermetic tests: concurrent publishers of the same destination both succeed with the exact bytes and leave no staging files, and a failed publication leaves none behind.cargo check --target x86_64-pc-windows-gnu --workspace --testspasses. No Windows host here, so the actualLoadLibraryExWstep was not exercised.cargo xtask policypasses (151 files ok). No game files or data from them were added.Checklist
cargo xtask policypasses. No game files or data from them were added.@sebastianspicker on GitHub · 2026-11-24 11:02 UTC · original
Tested
49df7e1applied ontomainffe310e(macOS, Rust 1.98.1). Both new tests pass, 5 out of 5 runs, and Windows-target clippy (x86_64-pc-windows-msvc, plain and--all-features) is clean. Three things:publishis only used by tests, socargo clippy -p victory-loader --all-targets -- -D warningsfails on Linux and macOS:static NEXT_STAGING is never usedandfunction write_if_changed is never used.cargo testpasses because it doesn't deny warnings, but a Linux lint job (like the one in #112) would go red.#[cfg(any(windows, test))]onmod publish;would fix it.LoadLibraryExW. Replacing a file that's mapped as a loaded DLL is refused, even though its bytes are already correct. I can't run that here. A cheap fallback would be: if the rename fails andpathnow reads back equal tobytes, remove the staging file and returnOk.std::fs::write(&staging, bytes)fails partway (a full disk), the staging file stays behind. The rename branch already removes it, so the write could do the same.Also,
publish.rsisn't rustfmt-clean (two hunks with rustfmt 1.98.1), thoughmainisn't either yet.AI-assisted.