victory prebuild (cargo prebuild): the warm-up step finds the title's files itself #3095
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!3095
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3095"
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?
@0xkn0wh3r3 on GitHub · 2026-11-26 07:32 UTC · original
0xkn0wh3r3:tools/cargo-prebuild→main· +432 −6 · 5 files · 4 commits · openThe README's warm-up step names four files of the game folder by hand, one of them the title's executable, whose name the user has to fill in. This PR adds
victory prebuild [game dir]and its aliascargo prebuild, which find those files themselves.What it reads, from the configured game folder or the one given:
shaders.rpf, which holds the shader pack the pipelines come from;MicrosoftGame.confignames, else the folder's only.exe;It then runs
translate --cache --pipelineson them, unchanged.--shaders-onlyskips the pipelines, and--jobs Nlimits the threads astranslatedoes.Where it writes: it prints the config file, the shader cache folder and the pipeline library folder.
runreaches the same two folders through the same configuration:cache_subdir("shaders")with the same build key, andpipelinesbeside it. The config isvictory.tomlin the folder a command is started from, orVICTORY_CONFIG. So if there is novictory.tomlwhereprebuildstarts, it says so: a run started from somewhere else could otherwise read a different cache. The alias builds in release, like the run the README shows.The README's run steps now use
cargo prebuildin place of the longtranslateline.Tests
title_filestests: the manifest's executables are found, while<ExecutableList>and attributes such asOverrideDisplayNameare not taken for them. A temporary folder gives its archive, the named executable and its DLLs. With no manifest it gives its only.exe, and with two.exefiles and no manifest it gives an error.cargo test -p victory,cargo clippy -p victory --all-targets -- -D warningsandcargo fmt --checkall pass.cargo prebuildon a stand-in folder (empty files and a minimal manifest, cache in a temporary folder). It found the executable through the manifest, filled<cache>\shaders\<build>and<cache>\pipelines, and reported that there was no shader pack to pre-build.Not verified: not run on the game's own folder, as I have no game data here.
@Marvisak on GitHub · 2026-11-26 08:20 UTC · original
Automated triage for the maintainers.
Needs work: needs the maintainer's decision. The PR adds a
prebuildalias to.cargo/config.toml, and changes under.cargo/need the maintainer's decision.What I checked:
victory prebuild(apps/victory/src/title_files.rs) gathers the files and calls the existingtranslate::warmunchanged, and it readsMicrosoftGame.configthe wayrunalready does (apps/victory/src/run.rs). Two points to address:title_filespasses every top-level.dllin the game folder totranslate, while the README step it replaces named onlyXboxBvhBuilder.dllandamd_fidelityfx_upscaler_xbox.dll. Please say whether translating every DLL there is intended. If it is not, limit the list to the DLLs the title loads.a_game_folder_gives_its_archive_executable_and_dllsbuilds a folder understd::env::temp_dir()by hand and does not clean up if it fails partway. Atempfile::tempdir(), as the loader tests use, would avoid that, providedtempfileis already a dev-dependency ofapps/victory(adding it would be another dependency change).CI: passing.
Generated by Claude Code
@0xkn0wh3r3 on GitHub · 2026-11-26 08:27 UTC · original
Thanks for the triage. Fixed in
4c2a381d.LoadLibrary(kernel.rs→runtime::load_title_dll), and no import table names those. One is the FidelityFX upscaler DLL that the old README step listed, which its loader DLL opens. Taking only the imported DLLs would miss its shaders. A DLL with no shaders costs one read and a scan for containers.title_files's doc comment now says this.apps/victoryhas notempfiledev-dependency, so rather than add one, the test now holds its folder in a guard that removes it when dropped. That covers a failure partway through too..cargo/config.tomlalias: your call. Without it,victory prebuildworks on its own (cargo run --release -p victory -- prebuild), and I can drop the alias and its README line if you prefer.@fuzeofficlal on GitHub · 2026-11-26 08:56 UTC · original · requested changes
Verified
4c2a381dlocally on Windows 11 x64:cargo clippy --all-targets --locked -- -D warnings: clean (2.33s).cargo test -p xtask --locked policy::tests::repository_passes_policy: 1 passed, 0 failed (0.34s).cargo test -p victory --lockedand--all-features: 20 passed, 0 failed (4.90s/5.00s).rustfmt --edition 2024 --checkon touched files: clean.The added doc rationale for scanning adjacent DLLs and the
FolderDropguard in the test look good. Three file-discovery/manifest bugs remain inapps/victory/src/title_files.rs:<Executable(title_files.rs:92-125):manifest_exesusesfind("<Executable")without XML structure awareness, so a commented-out<!-- <Executable Name="Crash.exe"/> -->appearing before the real entry wins if that file exists, and XML character entities inName(e.g.A&B.exe) are not unescaped.title_files.rs:61-72):game_dir.join(name)checks onlyis_file(), allowing../Other.exe, absolute paths, or non-.exefiles to be chosen as the executable.title_files.rs:54-87vsapps/victory/src/run.rs:68, 118): for a valid nested manifest entry likesub/Title.exe,title_filesstill scansgame_dirroot for DLLs whilerun.rsloads DLLs beside the executable (exe.parent()).Please parse actual
<Executable>elements under<ExecutableList>, constrain candidates to relative.exepaths insidegame_dir, scan DLLs from the selected executable's parent directory, and add regression cases for these paths.@0xkn0wh3r3 on GitHub · 2026-11-26 09:01 UTC · original
@fuzeofficlal thanks for the review. All three points are fixed in
2ce7e432.victory_hle::runtime::manifest_executables. It readsGame/ExecutableList/Executableelements with the same readerTitle::from_manifestalready uses forrun, so comments, CDATA and declarations are skipped and entities are decoded. That reader now keeps each element's attributes, and only a whole attribute name matches, soOverrideDisplayNameis not taken forName..exeinside the game folder, with no root, drive,..or.parts. Otherwise it falls back to the folder's only.exe, as before.runtreats as the title folder (exe.parent()). Previously they came from the top of the game folder.New tests cover these cases:
<ExecutableList>; an attribute that only ends inName; and&in a name.title_files: a nested executable brings the files beside it; entries that go outside the folder, are absolute, or are not a.exeare skipped.cargo test -p victory -p victory-hleandcargo clippy -p victory -p victory-hle --all-targets -D warningsboth pass, and rustfmt is clean on the changed files.@fuzeofficlal on GitHub · 2026-11-26 10:17 UTC · original · reviewed
2ce7e432cleanly resolves the previous issues: comment skipping, exact attribute-name matching, and discoveringshaders.rpfand DLLs fromexe.parent()for nested manifest executables all work as expected, and formatting/clippy/tests pass.Two edge cases worth tightening:
crates/victory-hle/src/runtime.rs):decode()unescapes the five named entities (<,>,",',&), so a valid numeric reference such asName="Game Title.exe"is looked up literally on disk and fails discovery (and prevents single-.exefallback if another.exeexists in the folder). Decoding decimal/hex character references in a single pass while keeping&lt;as<would handle valid manifests cleanly..components and link containment (apps/victory/src/title_files.rs):Path::components()normalizes away interior.segments (sobin/./Title.exepassesinside()despite the doc comment disallowing.parts), andpath.is_file()follows directory junctions/symlinks outsidegame_dir. Aligning the check with the documented containment rule (or narrowing the comment) would avoid surprises.Verified locally on Windows 11 x64 (
2ce7e432):rustfmt --edition 2024 --check apps/victory/src/main.rs apps/victory/src/title_files.rs crates/victory-hle/src/runtime.rs: cleancargo run --locked -p xtask -- policy: passedcargo clippy -p victory -p victory-hle --all-targets --locked -- -D warnings(default and--all-features): cleancargo test -p victory --locked(default and--all-features): 21 passed, 0 failed on bothcargo test -p victory-hle --lib --locked runtime::tests: 5 passed, 0 failed@0xkn0wh3r3 on GitHub · 2026-11-26 10:35 UTC · original
Thanks, both fixed in
11689986.decodenow handles&#NN;and&#xHH;along with the five named entities, all in one pass, so&lt;still comes out as<. A reference that is malformed (A,&#x;,&#+65;) or names no character (�) is left as written. The new test ischaracter_references_decode_in_one_pass.inside()now checks the raw text for empty,.and..parts, in addition to thePath::componentscheck, sobin/./Title.exeandbin//Title.exeare rejected. It also canonicalizes both the entry and the game folder and requires the entry to stay under the folder, so an entry reached through a junction or link that leads outside is skipped. Two new tests cover this; the junction test usesmklink /J, which needs no privilege.fmt, clippy (
-D warnings) and the tests are clean.@fuzeofficlal on GitHub · 2026-11-26 18:11 UTC · original · approved these changes
Looks good — both follow-up edge cases are cleanly addressed in
11689986.Verified on
main(63bcca43) on Windows 11 x64:decode()/reference()(crates/victory-hle/src/runtime.rs:158-195) decode named entities and decimal/hex character references in a single pass while rejecting malformed, NUL, and non-scalar references.inside()(apps/victory/src/title_files.rs:92-107) rejects empty and interior./..components on the raw text and enforces canonical containment against junctions/links leavinggame_dir.cargo xtask policy(192 files ok),rustfmt --edition 2024 --checkon touched files,cargo clippy --locked -p victory -p victory-hle --all-targets -- -D warnings(default and--all-features),cargo test --locked -p victory(23/23), andcargo test --locked -p victory-hle(156/156) all pass.&before valid entities (A&B&C), surrogate/out-of-range/overflowing numeric references (�,�,�), single-pass non-double-decoding (&lt;), drive-relative/rooted paths (C:Title.exe,\Title.exe), and manifest paths containing numeric space references (sub/Game Title.exe).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.