Skip to content

VFS: a console drive mount leaves the PC's own folders on that drive - #49

Merged
ivall merged 1 commit into
xcl-dev:mainfrom
gefydev:vfs-host-drive-paths
Nov 22, 2026
Merged

ivall merged 1 commit into
xcl-dev:mainfrom
gefydev:vfs-host-drive-paths

Conversation

@gefydev

@gefydev gefydev commented Nov 22, 2026

Copy link
Copy Markdown
Member

With the repository, a game or XCL's data on the PC's D: drive, the default D: mount (the package drive, for paths like d:\hunter\...) translated the PC's own paths too. On main, the e2e test fails for that reason when the repository is on D:. The host can't read the game's exe:

xcl: loading the game failed: reading D:\xcl-test\xcl\target\e2e\game\xcl_testtitle.exe: The system cannot find the path specified. (os error 3)

D:\xcl-test\...\game\xcl_testtitle.exe became <game>\xcl-test\...\game\xcl_testtitle.exe.

Two changes in vfs.rs:

  • A plain drive path that is already inside the game folder or the title's data folder is left alone. Console paths on that drive (D:\hunter\...) still go to the game folder.
  • An embedded console mount (<cwd>\GAME:\x, when a runtime treats GAME:\x as relative) is now looked for before the drive mounts. With only the first change, the test title ran on D: but one check still failed: with the current directory on D:, the D: mount took D:\...\GAME:\data\... first ([FAIL] files: console paths G:\ and GAME: read from the game folder: ... (os error 123)).

One ambiguity is left: a console path that happens to land inside the game folder's real location (a game installed at D:\hunter reading D:\hunter\x) is now taken as the PC path. I don't think that's worth more logic.

Validation

  • New test a_console_drive_mount_leaves_the_pcs_own_folders_on_that_drive mounts the drive that holds the test folders. On main it fails on both cases above.
  • Windows 11, MSVC, release, GTX 1650, repository on D:. cargo test --workspace --release --no-fail-fast:
    • main (055b0ad): test_title_runs_and_game_folder_is_untouched fails with the error above. Everything else passes.
    • This branch: everything passes, e2e included. The lib has 339 passed and 14 ignored.
  • cargo test -p xcl --lib on Windows GNU under Wine passes too.

The default "D:" mount (the package drive, XDefiant's d:\hunter\...)
translated every path on the PC's D: drive. With the game or XCL's data
on D:, the host could not read the game's exe: D:\games\x\game.exe
became <game>\games\x\game.exe ("loading the game failed: ... os error
3"). The e2e test fails this way when the repository is on D:.

- A plain drive path that is already inside the game folder or the
  title's data folder is left alone. Console paths on that drive
  ("D:\hunter\...") still go to the game folder.
- An embedded console mount ("<cwd>\GAME:\x", "GAME:\x" made relative
  by a runtime) is looked for before the drive mounts. With the current
  directory on D:, the "D:" mount took it first and the title's
  GAME:\ reads failed with ERROR_INVALID_NAME.
@ivall

ivall commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Thanks, merged! This is the third fix for this bug (#33 and #35 had their own takes inside bigger PRs), and the smallest and clearest one. Checking for an embedded GAME: before the drive mounts is a good catch too.

I tested it on top of current main with the MSVC toolchain on Windows: all tests pass, 339 lib tests with your new one, the e2e test title, and the GPU tests. My games and the repository are on C: and E:, so the D: mount doesn't overlap here. Still, every file the title opens goes through classify, so I also ran two of the heaviest file readers:

  • Fortnite (Unreal paks through CreateFile2) reaches its title screen;
  • Unicorn Overlord (.cpk archives through CreateFileA) shows its title screen.

Neither had a file error in the log.

The ambiguity you mention is fine by me: a console path that happens to equal the game folder's real location on the same drive.

CalvyPZ pushed a commit to CalvyPZ/xcl that referenced this pull request Nov 24, 2026
The Agility SDK probe (gpu::agility, is_file and fs::read of
<dir>\D3D12Core.dll) runs after the VFS hooks are installed. When
XCL_D3D12_DIR, <exe dir>\D3D12 or <exe dir> is on a drive letter a
console mount names (G:, D:, S: in the report), the hooked file APIs
translate the host path to the game folder, the DLL is not found there,
and the SDK is reported as unavailable.

host.rs now registers each candidate's D3D12Core.dll as one of XCL's
own paths before the hooks go in, the mechanism xcl-dev#49 and xcl-dev#331 use for
the game folder, the data folder and the shader cache. It registers
the files, not their directories: the exe directory can be a drive
root (D:\xcl.exe), and a root among the own folders would take the
whole drive from the console mount. CreateDeviceFactory loads the DLL
through the loader, which is not hooked.

The test registers what agility::sdk_files returns for the env
override, the exe dir and a drive-root exe dir, and checks that each
DLL path passes while the rest of the drive, beside the SDK and at its
root, stays the console's. Registering the directories instead fails
it at the drive-root check; registering nothing fails it too.

Fixes xcl-dev#595

Assisted-by: Claude Code (Claude Opus 4.6 found the cause and wrote the first version; Claude Opus 5.5 narrowed it to the DLL files and rewrote the test)
CalvyPZ pushed a commit to CalvyPZ/xcl that referenced this pull request Nov 24, 2026
…PC descriptors

The command list's console xcl-dev#53 / xcl-dev#54 (ClearUnorderedAccessViewUint /
Float) were remapped straight to PC xcl-dev#49 / xcl-dev#50 (`console_remap`) with no
override, so a title's call reached the PC method with its handles as
they were. Console code takes its descriptor handles from heap xcl-dev#9 / xcl-dev#10,
which give it the address of its console heap slots in unified memory
(`console_heap::start`), not PC descriptor handles: the PC clear got a
GPU handle outside the bound shader-visible heap and a CPU handle
pointing at T# words. Only the opt-in console-list replay
(XCL_CONSOLE_LISTS=1) translated them.

xcl-dev#53 / xcl-dev#54 now go to `list_x::clear_uav_uint_x` / `clear_uav_float_x`
(same arguments as the PC methods): two console slots become their PC
UAVs (GPU: `pc_gpu_uav`, in the heap lists bind; CPU: `pc_uav`, in the
title's CPU-only heap), as the replay does; two PC handles go through as
they are; a mix, or a slot without a shader-visible UAV, is skipped and
logged once.

Test on WARP: an R32_UINT buffer UAV in a CPU-only and a shader-visible
console heap, xcl-dev#53 with the console handles and 0xDEADBEEF. With the
handles passed through (the old path) the test process dies with
STATUS_ACCESS_VIOLATION in the PC clear; with the translation the buffer
reads back 0xDEADBEEF.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
emirduran707 added a commit to emirduran707/xcl that referenced this pull request Nov 25, 2026
…PC descriptors

The command list's console xcl-dev#53 / xcl-dev#54 (ClearUnorderedAccessViewUint /
Float) were remapped straight to PC xcl-dev#49 / xcl-dev#50 (`console_remap`) with no
override, so a title's call reached the PC method with its handles as
they were. Console code takes its descriptor handles from heap xcl-dev#9 / xcl-dev#10,
which give it the address of its console heap slots in unified memory
(`console_heap::start`), not PC descriptor handles: the PC clear got a
GPU handle outside the bound shader-visible heap and a CPU handle
pointing at T# words. Only the opt-in console-list replay
(XCL_CONSOLE_LISTS=1) translated them.

(same arguments as the PC methods): two console slots become their PC
UAVs (GPU: `pc_gpu_uav`, in the heap lists bind; CPU: `pc_uav`, in the
title's CPU-only heap), as the replay does; two PC handles go through as
they are; a mix, or a slot without a shader-visible UAV, is skipped and
logged once.

Test on WARP: an R32_UINT buffer UAV in a CPU-only and a shader-visible
console heap, xcl-dev#53 with the console handles and 0xDEADBEEF. With the
handles passed through (the old path) the test process dies with
STATUS_ACCESS_VIOLATION in the PC clear; with the translation the buffer
reads back 0xDEADBEEF.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
theaustinayers added a commit to theaustinayers/xcl that referenced this pull request Nov 25, 2026
A ClearUnorderedAccessView* recorded on a console-recorded list
(XCL_CONSOLE_LISTS) is replayed into the PC list when the list closes.
The replay passed the title's resource, the depth buffer, together with
the slot's PC UAV, which with XCL_DEPTH_UAV_TWIN=1 is a view of the
buffer's twin: the invalid view/resource pair the direct list's clear
no longer makes. The first run with the twins on would have met it on
such a list, and the twin would have kept stale values.

The direct list's rule moves into list_x::uav_clear_resource and the
replay uses it as well: the twin when the slot's view names it, nothing
(counted as skipped) when what the view names is not known. The plan
left this to a later commit; it is taken now because that run uses the
switch.

The GPU test of the clear also checks what the PC method receives: it
calls the console method on a stand-in of the list whose PC xcl-dev#49 notes
its resource and goes on to the list's own. Before, it counted XCL's
decision only, and the readback would pass with the depth buffer as the
resource too, because the clear goes through the slot's descriptor. A
clear through the buffer's depth-plane UAV, a null view, is not done
and reaches nothing.

Tested: real::depth_uav_twin_tests::gpu_clear_uav_of_a_stencil_uav_clears_the_twin
(WARP, child process; run on its own it made twin #1 and printed no
SKIPPED line). The replay itself is not driven by a test: a console
list closes only with unified memory open on a GPU.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants