XGameRuntime: prefix MoveFileExW paths with \\?\ past MAX_PATH (#722) #922
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!922
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/922/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?
@bigiello on GitHub · 2026-11-24 08:21 UTC · original
fix/gamesave-movefile-long-path→main· +145 −3 · 1 files · 1 commits · closed without mergingDraft pending
scripts/smoke.ps1regression blocks on a retail title (no local game files available; see Not tested).Fixes #722.
replace_fileincrates/xcl/src/hle/xgameruntime/gamesave.rspassed plain UTF-16 paths toMoveFileExW. Without the Win32 verbatim prefix (\\?\/\\?\UNC\),MoveFileExWrejects paths reachingMAX_PATH(260 UTF-16 units) withERROR_PATH_NOT_FOUND(3), even thoughstd::fs::File::createwrote the sibling temp file using a verbatim path. Saves into long container names (e.g., ~170–200 characters under%LOCALAPPDATA%\XCL\...) therefore failed withE_FAIL.What is in it
crates/xcl/src/hle/xgameruntime/gamesave.rs:verbatim_wide: resolvesstd::path::absolute, folds./..//before bypassing Win32 path normalization, preserves existing\\?\and\\.\prefixes as well as unpaired UTF-16 surrogates, and emits NUL-terminated\\?\or\\?\UNC\UTF-16 buffers.replace_file: encodes both source and destination paths viaverbatim_widebefore callingMoveFileExW.a_blob_past_max_path_is_saved(create, overwrite, temp-file cleanup, and publicXGameSaveC API round-trip pastMAX_PATH; failed withE_FAILbefore the fix) andverbatim_wide_normalizes_and_prefixes_win32_paths(drive, normalized..//,\\?\,\\.\, UNC, and unpaired surrogate cases).Tested
stable-x86_64-pc-windows-msvc(rustc 1.100.0), Windows SDK DXC 1.8.2502.11 (10.0.26100.0\x64).09940bb):cargo test -p xcl --lib -- a_blob_past_max_path_is_savedfailed withleft: -2147467259(E_FAIL).d2edf29):cargo test -p xcl --lib -- gamesave --nocapture: 12 passed, 0 failed.cargo test -p xcl --lib -- --test-threads=1: 677 passed, 0 failed, 21 ignored (2 GPU tests skipped:no wave64—gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware)..\scripts\test.ps1andcargo test --workspace --no-fail-fast -- --test-threads=4: all integration test binaries passed (console_dlls_e2e13 passed,console_shaders3 passed / 4 ignored,disasm_e2e1 passed,e2e3 passed,gpu_compute_e2e2 passed,gpu_pso_e2e7 passed,heap_probe0 passed / 4 ignored,pls_quota1 passed,predication_e2e1 passed,rpf_e2e2 passed,sparse_reinit1 passed,texture_states1 passed,xg_oracle6 passed / 12 ignored;xclmain /xcl-testtitle/ doc-tests: 0 tests). Under--test-threads=4,xcl --libhit the pre-existing#718timing flake inplaced_title_textures_share_vram_and_preserve_pixels(poisoningtransitions_apply_when_their_list_is_submittedandd32s8_targets_take_their_own_size_of_video_memory: 674 passed, 3 failed, 21 ignored); all 3 passed cleanly in 3.50s when run with--test-threads=1and in the full--test-threads=1run above.cargo clippy --workspace --all-targets: 0 errors, 0 new warnings on touched lines.rustfmt --check crates\xcl\src\hle\xgameruntime\gamesave.rs: 0 diffs on touched lines (cargo fmt --checkoverall exits 1 due to pre-existing formatting in untouched files).Not tested
\\?\UNC\formatting path is unit-tested inverbatim_wide_normalizes_and_prefixes_win32_paths, not exercised against a real network share).scripts/smoke.ps1 -Game <folder>(XCL_SAMPLE_*unset; no retail game files available locally).AI use
verbatim_wide, adding regression and path-normalization tests, running tests/clippy, and drafting this PR description. All diffs and test outputs verified locally.@iggyvilla on GitHub · 2026-11-24 10:13 UTC · original
Test report on
d2edf29(PR head), with its merge base09940bbfor the smoke pair (mainhas moved on to9aec53d; the PR changesgamesave.rsonly).Tested
x86_64-pc-windows-msvc; debug for the tests, release for the smoke runs.cargo test -p xcl --lib gamesave: 12 passed, 0 failed (includesa_blob_past_max_path_is_savedandverbatim_wide_normalizes_and_prefixes_win32_paths).cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4: 715 passed, 3 failed, 41 ignored, 0 SKIPPED lines (this adapter runs the wave64 tests). The three failures are inxcl --lib(674 passed, 3 failed, 21 ignored):placed_title_textures_share_vram_and_preserve_pixels(#470,3D 64x64x64 4 mips: subresource 2 mismatch), andtransitions_apply_when_their_list_is_submittedandd32s8_targets_take_their_own_size_of_video_memory, which fail withPoisonErrorafter it. Run alone, the two cascade tests each pass (1 passed), andplaced_title_textures_share_vram_and_preserve_pixelsfails alone the same way on the merge base09940bband on this head, so it is not this PR. All integration binaries passed (e2e3 passed aftercargo build --workspace).scripts/smoke.ps1 -Game <retail title>, 60 s each,XCL_NETWORK=0, one unmeasured warm-up run of the head first (the title was on a new disk), then head, base, base, head. All five runs: exit 0x0, 0 device removals, 0 crashes. Order and results (head =d2edf29, base =09940bb):head, first measured run:
base, first run:
The repeats agree: base second run 476 frames / 15269 MB, head second run 483 frames / 15143 MB.
Not tested
\\?\UNC\branch is covered by the unit test only).scripts/smoke.ps1was run on the PR head and its merge base, not on a merge with today'smain.AI use: Claude Code, Claude Sonnet 5.5, built both commits, ran the tests and the smoke runs and wrote this report; I did not write any of the PR's code.
@SlopTart on GitHub · 2026-11-24 10:37 UTC · original
Linux / AMD RDNA3 datapoint.
Merged state: head
d2edf29onto main02bfd1d, clean merge.Full suite,
cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 722 passed, 7 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows. MoveFileExW prefix-past-MAX_PATH green.Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.
Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross
x86_64-pc-windows-gnu,XCL_NETWORK=0, release profile,--test-threads=4. My Linux rows: #42 / #718.AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
Pull request closed