HLE: honor the requested executable on relaunch #455

Merged
Quat3rnion merged 2 commits from upstream-pr/455 into main 2026-11-25 00:10:56 +00:00
Quat3rnion commented 2026-11-24 03:37:26 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Quat3rnion on 2026-11-24T03:37:26Z.


What

runtime::set_image_path makes the title image path absolute, but
relaunch_args searched the raw command line for that exact string. After
victory run game.exe --execute, an XLaunchNewGame request for a different
executable found no match and silently reran game.exe. This normalises the
launch argument the same way runtime does before replacing it, so relative
startup paths work and the requested executable is used.

The same helper split the title's arguments with split_whitespace, which
broke quoted paths from the title's configuration. A small splitter keeps
quoted strings together, including empty arguments. The child process gets
those as separate argv entries; lifecycle::relaunch already passes them
through with Command::args and does not re-split.

An AI tool wrote part of this change.

Tested

  • Linux: cargo test --workspace: 165 passed, 0 failed, 3 ignored. The existing argv test still passes; a new regression uses a relative startup path, a different target, and a quoted path plus an empty argument.
  • Windows cross-build: cargo check --target x86_64-pc-windows-gnu --workspace --tests passes. No Windows host here, so the spawned child was not run.
  • cargo xtask policy passes (150 files ok). No game files or data from them were added.
  • Not tested: a real title's XLaunchNewGame call; the regression is at the argument-building layer.

Checklist

  • Workspace tests and Windows cross-check pass.
  • cargo xtask policy passes. No game files or data from them were added.
  • AI authorship is disclosed above.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6574048699 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/455). Originally posted by [Quat3rnion](https://github.com/Quat3rnion) on 2026-11-24T03:37:26Z. --- ## What `runtime::set_image_path` makes the title image path absolute, but `relaunch_args` searched the raw command line for that exact string. After `victory run game.exe --execute`, an `XLaunchNewGame` request for a different executable found no match and silently reran `game.exe`. This normalises the launch argument the same way `runtime` does before replacing it, so relative startup paths work and the requested executable is used. The same helper split the title's arguments with `split_whitespace`, which broke quoted paths from the title's configuration. A small splitter keeps quoted strings together, including empty arguments. The child process gets those as separate argv entries; `lifecycle::relaunch` already passes them through with `Command::args` and does not re-split. An AI tool wrote part of this change. ## Tested - Linux: `cargo test --workspace`: 165 passed, 0 failed, 3 ignored. The existing argv test still passes; a new regression uses a relative startup path, a different target, and a quoted path plus an empty argument. - Windows cross-build: `cargo check --target x86_64-pc-windows-gnu --workspace --tests` passes. No Windows host here, so the spawned child was not run. - `cargo xtask policy` passes (150 files ok). No game files or data from them were added. - Not tested: a real title's `XLaunchNewGame` call; the regression is at the argument-building layer. ## Checklist - [x] Workspace tests and Windows cross-check pass. - [x] `cargo xtask policy` passes. No game files or data from them were added. - [x] AI authorship is disclosed above.
mercuryVM commented 2026-11-24 06:53:09 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T05:47:23Z.

Review: CHANGES_REQUESTED


Tested 1c129da on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (248 passed, 0 failed; this branch is based on an older main, hence the lower count).

The absolute-path match in relaunch_args is a good fix. One bug in split_args, though:

crates/victory-hle/src/modules/xgame.rs, split_args: ' is treated as a quote character. Windows command lines (CommandLineToArgvW, MSVCRT) quote only with ". An apostrophe inside an argument now starts a quoted run that swallows the following whitespace:

  • -name=O'Brien -y gives one argument -name=OBrien -y.
  • With split_whitespace before, it gave -name=O'Brien and -y, so this is a regression for any title argument containing an apostrophe.

Suggested fix: drop '\'' from both quote arms and only toggle on ", and add O'Brien to the test. Following the CommandLineToArgvW backslash rules (\" is a literal quote, 2n backslashes before " become n) would also keep paths like "C:\dir\\" intact.

Smaller points:

  • The #[cfg(windows)] / #[cfg(not(windows))] split in launch_new_game is not mentioned in the description. On non-Windows the function now returns instead of parking, which changes its contract. It would be clearer as its own commit with a reason.
  • The branch is behind main. Rebasing would let the full current test suite run against it.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6034305988 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/455#pullrequestreview-6034305988). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T05:47:23Z. **Review:** CHANGES_REQUESTED --- Tested 1c129da on Windows 11, RTX 5070, MSVC: `cargo test --workspace --no-fail-fast` passes (248 passed, 0 failed; this branch is based on an older main, hence the lower count). The absolute-path match in `relaunch_args` is a good fix. One bug in `split_args`, though: **`crates/victory-hle/src/modules/xgame.rs`, `split_args`: `'` is treated as a quote character.** Windows command lines (`CommandLineToArgvW`, MSVCRT) quote only with `"`. An apostrophe inside an argument now starts a quoted run that swallows the following whitespace: - `-name=O'Brien -y` gives one argument `-name=OBrien -y`. - With `split_whitespace` before, it gave `-name=O'Brien` and `-y`, so this is a regression for any title argument containing an apostrophe. Suggested fix: drop `'\''` from both quote arms and only toggle on `"`, and add `O'Brien` to the test. Following the `CommandLineToArgvW` backslash rules (`\"` is a literal quote, `2n` backslashes before `"` become `n`) would also keep paths like `"C:\dir\\"` intact. Smaller points: - The `#[cfg(windows)]` / `#[cfg(not(windows))]` split in `launch_new_game` is not mentioned in the description. On non-Windows the function now returns instead of parking, which changes its contract. It would be clearer as its own commit with a reason. - The branch is behind main. Rebasing would let the full current test suite run against it. AI-assisted (Claude Code).
Quat3rnion commented 2026-11-24 08:02:49 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Quat3rnion on 2026-11-24T07:30:04Z.


Rebased on current main. Fixed split_args to quote only on double quotes; apostrophes are ordinary text. Added -name=O'Brien to the regression. New head a9bc94e.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7125059426 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/455#issuecomment-7125059426). Originally posted by [Quat3rnion](https://github.com/Quat3rnion) on 2026-11-24T07:30:04Z. --- Rebased on current main. Fixed split_args to quote only on double quotes; apostrophes are ordinary text. Added -name=O'Brien to the regression. New head a9bc94e.
mercuryVM commented 2026-11-24 10:03:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T09:20:06Z.

Review: APPROVED


Re-tested a9bc94e on Windows 11, RTX 5070, MSVC: cargo test --workspace --exclude victory-shader passes (196 passed, 0 failed), including the extended relaunch test. I ran victory-shader separately single-threaded, since its parallel GPU tests hang, which is unrelated to this change.

Thanks, this fixes what I raised. split_args now quotes only with ", and the test covers -name=O'Brien. The branch is rebased onto current main, so the full suite runs.

Not blocking, from my first review: there are still no CommandLineToArgvW backslash rules (\"), and the #[cfg(windows)] split in launch_new_game is still undescribed. Neither affects Windows behaviour. Approving.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6036576485 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/455#pullrequestreview-6036576485). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T09:20:06Z. **Review:** APPROVED --- Re-tested a9bc94e on Windows 11, RTX 5070, MSVC: `cargo test --workspace --exclude victory-shader` passes (196 passed, 0 failed), including the extended relaunch test. I ran `victory-shader` separately single-threaded, since its parallel GPU tests hang, which is unrelated to this change. Thanks, this fixes what I raised. `split_args` now quotes only with `"`, and the test covers `-name=O'Brien`. The branch is rebased onto current main, so the full suite runs. Not blocking, from my first review: there are still no `CommandLineToArgvW` backslash rules (`\"`), and the `#[cfg(windows)]` split in `launch_new_game` is still undescribed. Neither affects Windows behaviour. Approving. AI-assisted (Claude Code).
upstream-sync closed this pull request 2026-11-25 01:03:49 +00:00
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
Marvisak/VIctory!455
No description provided.