Files: a title run by its file name alone gets its own folder as G: #133
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/133"
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?
Imported from Marvisak/VIctory. Originally posted by Dufftwt on 2026-11-24T00:49:05Z.
What's wrong
A natural way to start the game is from inside the game folder, giving only the file name:
run.rstakes the title's folder asexe.parent(). For a bare file name that is an empty path, not., and it gets mounted as the console'sG:drive.files.rsmakes each mounted folder absolute withstd::path::absolute, but an empty path can't be made absolute (it returns an error). The code then falls back to the empty path itself, soG:points at nothing:The game then can't find any of its own files when started this way. Passing a path with a folder in it (
victory run D:\Games\GTA6\GTA6.exe, or.\GTA6.exe) works, which makes the failure confusing.What the fix does
In
files.rs, the function that prepares a mounted folder (root_wide) now treats an empty folder as the current directory (.) before making it absolute. This is what an empty folder already means for every other use of it:Path::new("").join("MicrosoftGame.config")is a file in the current directory.The fix is in
files.rsrather thanrun.rs. That way it covers every caller ofmount/mount_at, and it stays clear of #12 and #112, which both edit those lines ofrun.rs.How it behaves after the fix
victory run GTA6.exefrom the game folder mounts that folder asG:, and the title finds its files.Tests
The new test
an_empty_root_is_the_current_directoryinfiles.rsmounts an empty path and checks thatX:\a.rpfis rewritten to<current directory>\a.rpf.I ran
cargo test --workspace --no-fail-faston GitHub'swindows-latestwith Rust 1.98.1 fromrust-toolchain.toml:victory-hlehas 82 passed and 0 failed.main: it fails.G:\a.rpfbecame\a.rpf, the root of the drive, instead ofD:\a\VIctory\VIctory\crates\victory-hle\a.rpf, the current directory on the runner.victory-gpu'sroot::tests::host_serialized_blobs_create_root_signatures. It fails the same way on themainthis branch starts from, and #36, now merged, fixes it.Not tested: a run of the game itself.
..in a title path stops at the virtual drive's root #182Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T04:32:21Z.
Tested head
01ae55a3ba04c39a0e8851cc00da16af7a49adbdwithcargo test -p victory-hle --lib files -- --test-threads=1: 7 passed, 0 failed (75 filtered). The fivemodules::files::tests::*cases cover empty-root fallback, rewriting only mounted-drive paths, long paths, kernel-buffer reads, and title-file calls reaching the host folder (files.rs). This is synthetic unit coverage; no title runtime was launched.Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T07:32:32Z.
Review: APPROVED
Tested
01ae55aon Windows 11, RTX 5070, MSVC:cargo test --workspace --no-fail-fastpasses (228 passed, 0 failed; the branch is based on an older main), includingan_empty_root_is_the_current_directory.Path::new("").parent()-style empty roots really do failstd::path::absolute, and the old fallback then turnedG:\x\yinto\x\y, the root of the current drive. Mapping an empty root to.beforeabsolutegives the current directory, which is whatexe.parent()meant for a bare file name. Non-empty roots are untouched.One thing to be aware of: the drive is resolved when it is mounted, so it captures the cwd at that moment. A later
SetCurrentDirectoryby the title won't moveG:. That is what you want here.No issues found.
AI-assisted (Claude Code).