HLE: match Windows executable paths case- and separator-insensitively on relaunch #3464

Open
github-bot wants to merge 1 commit from github-bot/gh-3464 into main AGit
Owner

@⁠alexandruiulian201-bot on GitHub · 2026-11-27 03:49 UTC · original
alexandruiulian201-bot:fix/relaunch-args-windows-case → main · +39 −2 · 1 files · 1 commits · open

Problem

In crates/victory-hle/src/modules/xgame.rs, relaunch_args matches the startup executable argument against current (runtime::image_path) using exact OsStr equality. On Windows, if the user launched victory run with different ASCII casing or forward slashes (for example, g:/game/gta6.exe vs G:\Game\GTA6.exe), the executable slot is not matched and XLaunchNewGame relaunches the original executable instead of exe.

Fix

  • Add a same_path helper that compares paths case-insensitively (ASCII) and treats / and \ equivalently on Windows, while keeping exact comparison on non-Windows targets.
  • Use same_path in relaunch_args for both direct and std::path::absolute-normalized comparisons.
  • Add Windows unit test a_relaunch_matches_windows_executable_paths_case_and_separator_insensitively.

Verification

  • cargo test -p victory-hle --lib --locked modules::xgame::tests::: all passed.
  • cargo clippy -p victory-hle --all-targets --locked -- -D warnings: clean.
  • cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings: clean.
  • cargo run -p xtask --locked -- policy: 191 files ok.

AI-assisted. Synthetic unit test only (no game files used).

**@⁠alexandruiulian201-bot** on GitHub · 2026-11-27 03:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/3464) `alexandruiulian201-bot:fix/relaunch-args-windows-case` → `main` · +39 −2 · 1 files · 1 commits · open ### Problem In `crates/victory-hle/src/modules/xgame.rs`, `relaunch_args` matches the startup executable argument against `current` (`runtime::image_path`) using exact `OsStr` equality. On Windows, if the user launched `victory run` with different ASCII casing or forward slashes (for example, `g:/game/gta6.exe` vs `G:\Game\GTA6.exe`), the executable slot is not matched and `XLaunchNewGame` relaunches the original executable instead of `exe`. ### Fix - Add a `same_path` helper that compares paths case-insensitively (ASCII) and treats `/` and `\` equivalently on Windows, while keeping exact comparison on non-Windows targets. - Use `same_path` in `relaunch_args` for both direct and `std::path::absolute`-normalized comparisons. - Add Windows unit test `a_relaunch_matches_windows_executable_paths_case_and_separator_insensitively`. ### Verification - `cargo test -p victory-hle --lib --locked modules::xgame::tests::`: all passed. - `cargo clippy -p victory-hle --all-targets --locked -- -D warnings`: clean. - `cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings`: clean. - `cargo run -p xtask --locked -- policy`: `191 files ok`. AI-assisted. Synthetic unit test only (no game files used).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 03:53:18 +00:00
Author
Owner

@⁠cloph-dsp on GitHub · 2026-11-27 04:17 UTC · original

Independent CPU-only verification on Windows (Rust 1.100.0/MSVC, per-worktree CARGO_TARGET_DIR, CARGO_BUILD_JOBS=2, no game data).

  • PR head 1322d45f, base 63bcca4.
  • cargo test --locked -p victory-hle --lib -- modules::xgame::tests::a_relaunch_matches_windows_executable_paths_case_and_separator_insensitively --exact --test-threads=1 --quiet -> test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 152 filtered out.
  • git diff --check 63bcca4 HEAD -> exit 0.
  • Negative control: new test name absent from 63bcca4 via git grep on the file (no output, exit 1).

Note: only the named synthetic path test was replayed; a full crate suite was not run. The bare test name matches 0 tests; the module-qualified name is required. GPU/driver: N/A. AI-assisted (Hy4 flash). No game data, assets, extracted shaders or DRM.

**@⁠cloph-dsp** on GitHub · 2026-11-27 04:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/3464#issuecomment-7209676805) Independent CPU-only verification on Windows (Rust 1.100.0/MSVC, per-worktree CARGO_TARGET_DIR, CARGO_BUILD_JOBS=2, no game data). - PR head `1322d45f`, base `63bcca4`. - `cargo test --locked -p victory-hle --lib -- modules::xgame::tests::a_relaunch_matches_windows_executable_paths_case_and_separator_insensitively --exact --test-threads=1 --quiet` -> `test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 152 filtered out`. - `git diff --check 63bcca4 HEAD` -> exit 0. - Negative control: new test name absent from `63bcca4` via `git grep` on the file (no output, exit 1). Note: only the named synthetic path test was replayed; a full crate suite was not run. The bare test name matches 0 tests; the module-qualified name is required. GPU/driver: N/A. AI-assisted (Hy4 flash). No game data, assets, extracted shaders or DRM.
Author
Owner

@⁠AurumCarlos on GitHub · 2026-11-27 10:24 UTC · original · reviewed

I don't think the mismatch this fixes can happen at runtime. current is std::path::absolute of the very argument relaunch_args searches for:

  • run.rs:85 records the victory run argument with set_image_path(image.base(), exe), and runtime.rs:29 stores std::path::absolute(path). launch_new_game then compares it with args_os(), which holds that same argument.
  • So on main, the second check (xgame.rs:113, std::path::absolute(a) == current) already matches g:/game/gta6.exe: both sides are the same GetFullPathNameW result, with the same case and \ separators. The new test builds a current (G:\Game\GTA6.exe) that the runtime never produces from that argument.

Unless there's a path where the image path is recorded differently from the launch argument, this is a guard for a case that doesn't occur. If there is one, a test that goes through set_image_path would show it.

**@⁠AurumCarlos** on GitHub · 2026-11-27 10:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/3464#pullrequestreview-6086700293) · **reviewed** I don't think the mismatch this fixes can happen at runtime. `current` is `std::path::absolute` of the very argument `relaunch_args` searches for: - `run.rs:85` records the `victory run` argument with `set_image_path(image.base(), exe)`, and `runtime.rs:29` stores `std::path::absolute(path)`. `launch_new_game` then compares it with `args_os()`, which holds that same argument. - So on `main`, the second check (`xgame.rs:113`, `std::path::absolute(a) == current`) already matches `g:/game/gta6.exe`: both sides are the same `GetFullPathNameW` result, with the same case and `\` separators. The new test builds a `current` (`G:\Game\GTA6.exe`) that the runtime never produces from that argument. Unless there's a path where the image path is recorded differently from the launch argument, this is a guard for a case that doesn't occur. If there is one, a test that goes through `set_image_path` would show it.
Author
Owner

@⁠passerbyyhx on GitHub · 2026-11-27 18:53 UTC · original

I ran the Windows CLI on 1322d45f5a9e220ae7a1b1759f38242e87ae6d3c and parent 63bcca43c6a00a758510398fa43096ce7e4f7df0. A synthetic guest A asks XLaunchNewGame to start guest B. B returns 73 only if its new argument arrived and the original one was removed. Direct controls distinguish an accidentally restarted A (41) and B with stale arguments (74).

Both builds launched B with marker 73 in all four cases: absolute, mixed-case relative with mixed separators, mixed-case absolute with forward slashes, and verbatim absolute paths. All three marker controls also passed. The ordinary startup path derives the saved image path from the CLI input. This verifies the relaunch end to end but did not produce a parent failure; a real producer of differing spellings would still help establish when this patch changes behavior.

Synthetic fixture. GTA-VI-3/EIGHT-20261127. AI-assisted with Codex.

**@⁠passerbyyhx** on GitHub · 2026-11-27 18:53 UTC · [original](https://github.com/Marvisak/VIctory/pull/3464#issuecomment-7225977643) I ran the Windows CLI on `1322d45f5a9e220ae7a1b1759f38242e87ae6d3c` and parent `63bcca43c6a00a758510398fa43096ce7e4f7df0`. A synthetic guest A asks XLaunchNewGame to start guest B. B returns 73 only if its new argument arrived and the original one was removed. Direct controls distinguish an accidentally restarted A (41) and B with stale arguments (74). Both builds launched B with marker 73 in all four cases: absolute, mixed-case relative with mixed separators, mixed-case absolute with forward slashes, and verbatim absolute paths. All three marker controls also passed. The ordinary startup path derives the saved image path from the CLI input. This verifies the relaunch end to end but did not produce a parent failure; a real producer of differing spellings would still help establish when this patch changes behavior. [Synthetic fixture](https://github.com/passerbyyhx/VIctory/commit/a89768c4d67c0ea552440a625e2534cc9abdd13c). GTA-VI-3/EIGHT-20261127. AI-assisted with Codex.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3464/head:github-bot/gh-3464'
git switch 'github-bot/gh-3464'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3464'
git switch 'github-bot/gh-3464'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3464'
git switch 'github-bot/gh-3464'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3464'
git switch 'main'
git merge --squash 'github-bot/gh-3464'
git switch 'main'
git merge --ff-only 'github-bot/gh-3464'
git switch 'main'
git merge 'github-bot/gh-3464'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!3464
No description provided.