XGameRuntime: accept XGameSave blob paths past MAX_PATH #772

Closed
ldeep98154deep-jpg wants to merge 1 commit from upstream-pr/777 into main
ldeep98154deep-jpg commented 2026-11-24 05:09:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ldeep98154deep-jpg on 2026-11-24T05:09:07Z.


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.
<!-- greyfinch-sync:ivall/xcl:issue:6575096479 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/777). Originally posted by [ldeep98154deep-jpg](https://github.com/ldeep98154deep-jpg) on 2026-11-24T05:09:07Z. --- 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.
upstream-sync closed this pull request 2026-11-24 06:59:54 +00:00
milas6669 commented 2026-11-24 07:06:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by milas6669 on 2026-11-24T05:14:10Z.


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.
<!-- greyfinch-sync:ivall/xcl:comment:7122754709 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/777#issuecomment-7122754709). Originally posted by [milas6669](https://github.com/milas6669) on 2026-11-24T05:14:10Z. --- 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.
ethandepstein-del commented 2026-11-24 07:06:32 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ethandepstein-del on 2026-11-24T05:20:08Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7122850357 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/777#issuecomment-7122850357). Originally posted by [ethandepstein-del](https://github.com/ethandepstein-del) on 2026-11-24T05:20:08Z. --- 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.
MesshM commented 2026-11-24 07:06:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by MesshM on 2026-11-24T05:24:01Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7122910980 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/777#issuecomment-7122910980). Originally posted by [MesshM](https://github.com/MesshM) on 2026-11-24T05:24:01Z. --- 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.
ldeep98154deep-jpg commented 2026-11-24 07:06:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ldeep98154deep-jpg on 2026-11-24T05:30:52Z.


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

<!-- greyfinch-sync:ivall/xcl:comment:7123018485 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/777#issuecomment-7123018485). Originally posted by [ldeep98154deep-jpg](https://github.com/ldeep98154deep-jpg) on 2026-11-24T05:30:52Z. --- Closing because runtime changes require a local title for scripts/smoke.ps1; switching to a standalone recompiler/test task.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!772
No description provided.