Repository navigation
VFS: ReplaceFileW is redirected - #60
Merged
Merged
Conversation
ReplaceFileW (write a temporary file, then replace the save with it) was not hooked, so it failed on console paths (T:\, the PLS drive) and, on real paths into the game folder, replaced the game's own file instead of writing to the overlay. Console paths outside the game folder are now translated. When the game folder is involved, the backup and the replacement go through the CopyFileW and MoveFileExW hooks, so the write goes to the overlay.
gefydev
force-pushed
the
vfs-replace-file
branch
from
November 22, 2026 23:27
2703591 to
ab71385
Compare
ivall
added a commit
that referenced
this pull request
Nov 23, 2026
On Windows 11 kernel32's ANSI moves reach none of kernelbase's W move entries (measured with counting hooks: MoveFileW reaches MoveFileWithProgressW, the ANSI ones neither it nor MoveFileExW), so they are hooked in kernel32: paths become wide and go the MoveFileWithProgressW way. Checked with the real hooks and a VFS mounting T: / G: (T: does not exist on the PC): all six move entries move T:\a.txt to T:\b.txt, a move of a game file through MoveFileExA lands in the overlay and leaves the game folder intact; CopyFileW / A, CopyFileEx W / A, CopyFile2 and ReplaceFile W / A (also onto a game file, backup in the overlay) as in #59 / #60.
ivall
added a commit
that referenced
this pull request
Nov 23, 2026
Collaborator
|
Merged (533187c). Verified on Windows 11 with the real hooks: Tested on Windows 11 (RX 9070): |
Michael-Glaser
added a commit
to Michael-Glaser/xcl
that referenced
this pull request
Nov 24, 2026
…cl-dev#104) On newer GDK runtimes (QUEUE_SHIFTED), 20 command list console methods shift up by +2 via NEWER_LIST_SLOTS, leaving 11 older slots (xcl-dev#59, xcl-dev#60, xcl-dev#68, xcl-dev#69, xcl-dev#78, xcl-dev#81, xcl-dev#84, xcl-dev#88, xcl-dev#89, xcl-dev#93, xcl-dev#94) without another shifted method taking their old index. Those slots remained wired directly to the older layout's handlers, so a newer-layout call hit the wrong method. Wrap those orphaned slots in make_layout_split so newer-layout title calls go to a logged stub while older-layout titles keep the handler and non-title callers keep their PC target (including cl_execute_indirect at xcl-dev#59 and the original base-table stub for slots >= scanned). Slot xcl-dev#10 (Reset) stays Reset on both layouts and is not orphaned. Assisted-by: Antigravity (Gemini 4 Neon)
vincentes
added a commit
to vincentes/xcl-wasm
that referenced
this pull request
Nov 24, 2026
The null device becomes `win::d3d12x`, a device that does the memory side of D3D12.X for real and still renders nothing: - Unified memory, as on the console: a resource's GPU address is its address in the title's address space. Committed resources and heaps get graphics memory, placed resources lie in their heap, and CreatePlacedResourceX (xcl-dev#44) puts one on memory the title allocated; Map returns that address. Read-back buffers up to 64 MiB come from the fourth 4 GiB of the region, where XCL's Windows runtime keeps them. - Command lists record; a queue runs what it is given, in order, at every turn of the scheduler (`pump`): buffer copies, the console's memory commands (CopyMemoryToMemoryX xcl-dev#60, FillMemoryWith32BitValueX xcl-dev#61, Write32 / 64BitValue…X xcl-dev#69 / xcl-dev#70 / xcl-dev#89 with the GPU timestamp) and Wait32 / 64BitValueX (xcl-dev#71 / xcl-dev#72), which hold the queue until another thread writes the value. KickoffX (xcl-dev#93) starts a list before it is closed. A fence moves, and its events are signalled, when the queue gets to its Signal. - The console's layouts: device extensions from slot 44 (CreateCommandQueueX, CreateCommandListX with the DMA engine's own list interface, page pools, pipeline-state creation as objects, …), the graphics command list's console slots, AllocateUploadMemory (xcl-dev#148). - CheckFeatureSupport zeroes the whole structure; a raytracing acceleration structure view writes the console's descriptor words. Draws, pipelines, other views, PresentX and the frame clock do nothing or are missing. Dev builds optimise `xcl-emu` (the title test: 37 s → 3.3 s). Measured on macOS (aarch64): the test title passes 40 of its checks (9 of D3D12.X's 16); the 6 that fail before it aborts in its XG texture check need HLSL compilation and rendering, the frame clock, or DirectStorage. `cargo test -p xcl-guest`: 38 passed, 0 failed (the title test now checks every check by name; the staged tree was built and tested apart from the working tree). Inside the wasm64 module (1.2 MB, Node 24) the same run takes 4.4 s: 115 M instructions, most of them the 80 MiB upload check. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Michael-Glaser
added a commit
to Michael-Glaser/xcl
that referenced
this pull request
Nov 24, 2026
…vall#104) On newer GDK runtimes (QUEUE_SHIFTED), 20 command list console methods shift up by +2 via NEWER_LIST_SLOTS, leaving 11 older slots (ivall#59, ivall#60, ivall#68, ivall#69, ivall#78, ivall#81, ivall#84, ivall#88, ivall#89, ivall#93, ivall#94) without another shifted method taking their old index. Those slots remained wired directly to the older layout's handlers, so a newer-layout call hit the wrong method. Wrap those orphaned slots in make_layout_split so newer-layout title calls go to a logged stub while older-layout titles keep the handler and non-title callers keep their PC target (including cl_execute_indirect at ivall#59 and the original base-table stub for slots >= scanned). Slot ivall#10 (Reset) stays Reset on both layouts and is not orphaned. Assisted-by: Antigravity (Gemini 4 Neon)
rootw0rm
pushed a commit
to rootw0rm/xcl
that referenced
this pull request
Nov 27, 2026
The null device's plain lists ran the console memory slots (xcl-dev#60/xcl-dev#61/ xcl-dev#69-xcl-dev#72/xcl-dev#89/xcl-dev#93) as logging stubs, so the title's console_list_methods check read back 0x0 on the null backend while the identical immediate host writes already passed on Vulkan lists. The vtable now wires the same VulList_* functions into Kind::CommandList; GetDevice (xcl-dev#7), the UAV barrier (xcl-dev#146) and AllocateUploadMemory (xcl-dev#148) stay Vulkan-only with their slices (barrier/upload ride with raytracing, which still fails on null at the OPTIONS5 tail-zero assert). Failing-first: the new null_list_shares_the_console_memory_methods test fails pre-route (slot 69 stub writes nothing) and passes now (write32/fill/copy/timestamp land, pre-satisfied wait returns, kickoff is a silent no-op), mirroring the title's asserts. Gates: check -p xcl --tests EXIT 0; check --workspace EXIT 0; lib 797 passed/0 failed/1 ignored (--test-threads=4). Title e2e, fresh roots: null 12->11 FAILs (Write32 fixed, byte-identical remainder), Vulkan 9 unchanged with the real present (640x360 token 0x1 on Intel Arc). Retail HOLDS (SIGSEGV exe+0x2237320, exit 139, called_stubs 20, 0 d3d12).
rootw0rm
pushed a commit
to rootw0rm/xcl
that referenced
this pull request
Nov 27, 2026
…nd struct Device xcl-dev#60/xcl-dev#55 + PC10 stash the PSO's draw bytes (VS/PS ptr+len, RTV formats/DSV format, rasterizer + blend, PC graphics-desc layout) into PsoRecord at creation; derived blend PSOs (xcl-dev#55) inherit the base record (patch bytes for S3). List slot 25 SetPipelineState binds the record into ListDrawRecord. Store-only: no draw, no validation, no execute; triangle/bias FAILs stay failing. Linux reads title pointers directly like the other null shims (shader::readable is no-op false here); Windows capture path unchanged. Evidence: new draw_s1_pso_record_populated_pre_draw fails pre-change (9 unresolved record symbols) and passes post; full lib 805 passed, 0 failed, 1 ignored (one known parallel VFS flake, green serially + on rerun); both cargo checks clean; title null 3 FAILs (triangle, present, bias-xcl-dev#94) / Vulkan 2 (triangle, bias-xcl-dev#94), all D3D12.X GPU-only, 0 non-GPU, delta 0; retail HOLDS (exit 139 @ exe+0x2237320, SIGSEGV fault 0, 20 stubs, xgr XAsync/XNetworking/XUser, 0 d3d12).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ReplaceFileWis the usual way to save safely: writesave.tmp, then replacesave.datwith it, optionally keepingsave.bak.vfs_hooks.rsdoesn't hook it, so:T:\, the PLS driveS:\), the call goes to the PC's own drive and fails, leaving the old save and the temporary file.The new hook:
source_offor the two existing files,dest_offor the backup) and calls the original.CopyFileWand the replacement withMoveFileExW. Both go through their own hooks (the guard is dropped first), so the write lands in the overlay the same way a move does today.CopyFileWis only hooked in #59; without it the backup copy is still the right call, it just isn't redirected yet. The two PRs don't conflict.Validation
The hooks are process-wide and need an initialized VFS (a global
OnceLock), so this isn't a unit test. I ran a probe alone, with a VFS that mountsG:(the game) andT:on temp folders and the real hooks installed. Under Wine:mainReplaceFileW(T:\save.dat, T:\save.tmp, T:\save.bak)save.datstill old, no backup,save.tmpleftsave.datnew,save.bakold,save.tmpgoneReplaceFileW(G:\save.dat, T:\save.tmp, null)G:\save.datstill the originalG:\save.datreads the new data fromoverlay\save.dat; the file in the game folder is still the original (checked outside Wine)cargo test -p xcl --lib: 343 passed, 0 failed, on Windows GNU under Wine.