XGameRuntime: accept XGameSave blob paths past MAX_PATH #777

Closed
github-bot wants to merge 1 commit from gh-pr/777/head into gh-pr/777/base
Owner

@⁠ldeep98154deep-jpg on GitHub · 2026-11-24 05:09 UTC · original
ldeep98154deep-jpg:fix/gamesave-long-path → main · +73 −3 · 1 files · 1 commits · closed without merging

Fixes #722.

MoveFileExW refuses XGameSave blob paths longer than MAX_PATH unless they use the extended-length form. The temporary file is written through std::fs, which supplies that form itself, so writes succeeded and only the final atomic replace failed with ERROR_PATH_NOT_FOUND; XGameSaveSubmitUpdate returned E_FAIL. XCL now encodes both paths before the replace.

What is in it

  • crates/xcl/src/hle/xgameruntime/gamesave.rs: helper that emits absolute, NUL-terminated UTF-16 paths with \\?\ (or \\?\UNC\ for shares) and uses it for both sides of the atomic replace.
  • Same file: regression test for a blob path past 260 characters, plus a unit test covering local, UNC and already-verbatim path forms.

Tested

  • Windows 11 Home Single Language build 26200, Intel64 Family 6 Model 154 CPU, Intel(R) Iris(R) Xe Graphics (driver 32.0.101.7088, 128 MiB VRAM). Rust 1.100.0, debug.
  • cargo test -p xcl --lib hle::xgameruntime::gamesave::tests -- --nocapture (GNU fallback): 12 passed, 0 failed, 0 ignored. The new regression test fails with E_FAIL (-2147467259) on unmodified main before the fix.
  • cargo +stable-x86_64-pc-windows-gnu build --workspace: finished successfully.
  • cargo +stable-x86_64-pc-windows-gnu test --workspace -- --test-threads=4 --skip pe::tests::parses_own_test_binary_tls --skip test_title_runs_and_game_folder_is_untouched: 701 passed, 0 failed, 41 ignored, 2 filtered out.
  • The two skipped tests also fail on unmodified upstream/main with the GNU fallback toolchain: pe::tests::parses_own_test_binary_tls (no TLS directory in GNU-linked binaries) and e2e::test_title_runs_and_game_folder_is_untouched (TLS-based stub report is empty). No test printed SKIPPED <test>.

Regression run

  • Not run: no game title is available in this environment, so scripts/smoke.ps1 could not produce the required main and head-commit xcl-smoke blocks.

Not tested

  • MSVC toolchain: not built or tested; this machine has no Visual Studio link.exe, so verification used the GNU fallback toolchain.
  • scripts/smoke.ps1 with a real title; a real UNC data folder; AMD or NVIDIA GPUs.

AI use

  • OpenCode with Big Pickle: selected the issue, wrote the fix and tests, and ran the verification above.
**@⁠ldeep98154deep-jpg** on GitHub · 2026-11-24 05:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/777) `ldeep98154deep-jpg:fix/gamesave-long-path` → `main` · +73 −3 · 1 files · 1 commits · closed without merging Fixes #722. `MoveFileExW` refuses XGameSave blob paths longer than `MAX_PATH` unless they use the extended-length form. The temporary file is written through `std::fs`, which supplies that form itself, so writes succeeded and only the final atomic replace failed with `ERROR_PATH_NOT_FOUND`; `XGameSaveSubmitUpdate` returned `E_FAIL`. XCL now encodes both paths before the replace. **What is in it** - `crates/xcl/src/hle/xgameruntime/gamesave.rs`: helper that emits absolute, NUL-terminated UTF-16 paths with `\\?\` (or `\\?\UNC\` for shares) and uses it for both sides of the atomic replace. - Same file: regression test for a blob path past 260 characters, plus a unit test covering local, UNC and already-verbatim path forms. **Tested** - Windows 11 Home Single Language build 26200, Intel64 Family 6 Model 154 CPU, Intel(R) Iris(R) Xe Graphics (driver 32.0.101.7088, 128 MiB VRAM). Rust 1.100.0, debug. - `cargo test -p xcl --lib hle::xgameruntime::gamesave::tests -- --nocapture` (GNU fallback): 12 passed, 0 failed, 0 ignored. The new regression test fails with `E_FAIL` (`-2147467259`) on unmodified `main` before the fix. - `cargo +stable-x86_64-pc-windows-gnu build --workspace`: finished successfully. - `cargo +stable-x86_64-pc-windows-gnu test --workspace -- --test-threads=4 --skip pe::tests::parses_own_test_binary_tls --skip test_title_runs_and_game_folder_is_untouched`: 701 passed, 0 failed, 41 ignored, 2 filtered out. - The two skipped tests also fail on unmodified `upstream/main` with the GNU fallback toolchain: `pe::tests::parses_own_test_binary_tls` (no TLS directory in GNU-linked binaries) and `e2e::test_title_runs_and_game_folder_is_untouched` (TLS-based stub report is empty). No test printed `SKIPPED <test>`. **Regression run** - Not run: no game title is available in this environment, so `scripts/smoke.ps1` could not produce the required `main` and head-commit `xcl-smoke` blocks. **Not tested** - MSVC toolchain: not built or tested; this machine has no Visual Studio `link.exe`, so verification used the GNU fallback toolchain. - `scripts/smoke.ps1` with a real title; a real UNC data folder; AMD or NVIDIA GPUs. **AI use** - OpenCode with Big Pickle: selected the issue, wrote the fix and tests, and ran the verification above.
MoveFileExW rejects paths longer than MAX_PATH unless they use the extended-length form. std::fs writes the temporary file through its own verbatim prefix, so writes succeeded and only the final atomic replace failed with ERROR_PATH_NOT_FOUND, returning E_FAIL to the title.

Encode both paths with \\?\ (or \\?\UNC\ for shares) before the replace. Fixes #722.

The regression test fails with E_FAIL before the fix and passes after it. cargo test -p xcl --lib hle::xgameruntime::gamesave::tests: 12 passed, 0 failed. Workspace run with the GNU fallback toolchain: 701 passed, 0 failed, 41 ignored, 2 filtered out; the two filtered tests also fail on unmodified main with that toolchain. MSVC linker is unavailable here.

Assisted-by: OpenCode (Big Pickle)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:32:18 +00:00
github-bot closed this pull request 2026-11-26 04:32:18 +00:00
Author
Owner

@⁠milas6669 on GitHub · 2026-11-24 05:14 UTC · original

Test report on f57deac (PR head, base main f4ce27c; main is now d208e14, and the change is in gamesave.rs only).

Tested

  • Intel i9-10900KF, Windows 11 Pro 10.0.26200, rustc 1.100.0 x86_64-pc-windows-msvc, debug, NTFS
  • cargo test -p xcl --lib gamesave -- --test-threads=2: 12 passed, 0 failed on this head, against 10 passed on main d208e14. The new tests include a_blob_past_max_path_is_saved, which passes.

Not tested

  • the whole suite, the GPU tests and the e2e tests (GPU busy)
  • a UNC data folder (the \?\UNC\ branch)
  • scripts/smoke.ps1 (this is a runtime change)
  • that the new test fails on main: I did not run it there

AI use

  • Claude Code, Claude Sonnet 5.5, ran the commands and wrote this report.
**@⁠milas6669** on GitHub · 2026-11-24 05:14 UTC · [original](https://github.com/xcl-dev/xcl/pull/777#issuecomment-7122754709) Test report on `f57deac` (PR head, base `main` f4ce27c; main is now d208e14, and the change is in `gamesave.rs` only). **Tested** - Intel i9-10900KF, Windows 11 Pro 10.0.26200, rustc 1.100.0 `x86_64-pc-windows-msvc`, debug, NTFS - `cargo test -p xcl --lib gamesave -- --test-threads=2`: **12 passed, 0 failed** on this head, against 10 passed on `main` d208e14. The new tests include `a_blob_past_max_path_is_saved`, which passes. **Not tested** - the whole suite, the GPU tests and the e2e tests (GPU busy) - a UNC data folder (the `\?\UNC\` branch) - `scripts/smoke.ps1` (this is a runtime change) - that the new test fails on `main`: I did not run it there **AI use** - Claude Code, Claude Sonnet 5.5, ran the commands and wrote this report.
Author
Owner

@⁠mastrr9 on GitHub · 2026-11-24 05:20 UTC · original

Independent native Windows MSVC + NVIDIA RTX 5080 build/test run and code review at head f57deac289da77e9e00213acfae969530c0092d1 (covering the MSVC toolchain gap noted in the PR description).

Code Review

  • Clean fix for #722: verbatim_wide_path resolves via std::path::absolute(p) and prepends \\?\ (or \\?\UNC\ for UNC paths) while preserving already-verbatim paths before calling MoveFileExW. Both unit and >260-char regression tests are solid. No issues found.

Tested

  • Environment: NVIDIA GeForce RTX 5080 (16 GB, wave32, driver 617.42 / 32.0.16.1742), Windows 11 Pro 25H2 (26200.9974), rustc 1.100.0 (0ef1bc386 2026-11-09) x86_64-pc-windows-msvc, DXC from Windows SDK 10.0.26100.0, debug build.
  • Command: cargo build --workspace && cargo test --workspace -- --test-threads=4
  • Result: 703 passed, 0 failed, 41 ignored (0 new warnings; both pe::tests::parses_own_test_binary_tls and e2e::test_title_runs_and_game_folder_is_untouched pass under MSVC).
  • PR-specific tests (2/2 ok):
    • hle::xgameruntime::gamesave::tests::a_blob_past_max_path_is_saved
    • hle::xgameruntime::gamesave::tests::move_file_paths_are_extended_length
  • SKIPPED (2):
    • gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask (no wave64)
    • gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware (no wave64)

Not tested

  • Real UNC share path, D3D12 debug layer, AMD/wave64 hardware, release build, and retail titles.

AI use: Antigravity (Gemini 4 Neon) performed the code review, ran the MSVC + RTX 5080 workspace tests, and drafted this comment.

**@⁠mastrr9** on GitHub · 2026-11-24 05:20 UTC · [original](https://github.com/xcl-dev/xcl/pull/777#issuecomment-7122850357) Independent native Windows MSVC + NVIDIA RTX 5080 build/test run and code review at head `f57deac289da77e9e00213acfae969530c0092d1` (covering the MSVC toolchain gap noted in the PR description). ### Code Review - Clean fix for `#722`: `verbatim_wide_path` resolves via `std::path::absolute(p)` and prepends `\\?\` (or `\\?\UNC\` for UNC paths) while preserving already-verbatim paths before calling `MoveFileExW`. Both unit and >260-char regression tests are solid. No issues found. ### Tested - **Environment:** NVIDIA GeForce RTX 5080 (16 GB, wave32, driver `617.42` / `32.0.16.1742`), Windows 11 Pro 25H2 (`26200.9974`), `rustc 1.100.0 (0ef1bc386 2026-11-09)` `x86_64-pc-windows-msvc`, DXC from Windows SDK `10.0.26100.0`, debug build. - **Command:** `cargo build --workspace && cargo test --workspace -- --test-threads=4` - **Result:** **703 passed, 0 failed, 41 ignored** (0 new warnings; both `pe::tests::parses_own_test_binary_tls` and `e2e::test_title_runs_and_game_folder_is_untouched` pass under MSVC). - **PR-specific tests (2/2 `ok`):** - `hle::xgameruntime::gamesave::tests::a_blob_past_max_path_is_saved` - `hle::xgameruntime::gamesave::tests::move_file_paths_are_extended_length` - **SKIPPED (2):** - `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask` (`no wave64`) - `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware` (`no wave64`) ### Not tested - Real UNC share path, D3D12 debug layer, AMD/wave64 hardware, release build, and retail titles. **AI use:** Antigravity (Gemini 4 Neon) performed the code review, ran the MSVC + RTX 5080 workspace tests, and drafted this comment.
Author
Owner

@⁠MesshM on GitHub · 2026-11-24 05:24 UTC · original

Test run of f57deac289da77e9e00213acfae969530c0092d1 on AMD RDNA4. I merged it onto current main d208e14 locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 706 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 665 passed, 0 failed, 21 ignored
  • 0 SKIPPED; a_blob_past_max_path_is_saved passes.

Review: Giving MoveFileExW the extended-length form for the final replace matches what std::fs already does for the temporary write, so blobs past MAX_PATH no longer fail only at the last step. I found nothing to change.

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

**@⁠MesshM** on GitHub · 2026-11-24 05:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/777#issuecomment-7122910980) Test run of `f57deac289da77e9e00213acfae969530c0092d1` on AMD RDNA4. I merged it onto current `main` `d208e14` locally (clean merge) and tested that tree. **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug - `cargo build --workspace` + `cargo test --workspace -- --test-threads=4` on the merge: **706 passed, 0 failed, 41 ignored**, exit code 0; `xcl` lib tests 665 passed, 0 failed, 21 ignored - **0 `SKIPPED`**; `a_blob_past_max_path_is_saved` passes. **Review:** Giving `MoveFileExW` the extended-length form for the final replace matches what `std::fs` already does for the temporary write, so blobs past `MAX_PATH` no longer fail only at the last step. I found nothing to change. **Not tested:** no retail title or regression run (I have no unpacked game), no `XCL_SAMPLE_*` tests, release build; the PR's head on its old base was not run, only its merge onto `main`. Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
Author
Owner

@⁠ldeep98154deep-jpg on GitHub · 2026-11-24 05:30 UTC · original

Closing because runtime changes require a local title for scripts/smoke.ps1; switching to a standalone recompiler/test task.

**@⁠ldeep98154deep-jpg** on GitHub · 2026-11-24 05:30 UTC · [original](https://github.com/xcl-dev/xcl/pull/777#issuecomment-7123018485) Closing because runtime changes require a local title for scripts/smoke.ps1; switching to a standalone recompiler/test task.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.