CLI: check for AVX2 before running a title (VICTORY_SKIP_CPU_CHECK=1 to bypass) #238

Manually merged
github merged 1 commit from gh-pr/238/head into gh-pr/238/base 2026-11-26 03:56:00 +00:00
Owner

@⁠dpalacios69 on GitHub · 2026-11-24 01:42 UTC · original
dpalacios69:feat/cpu-avx2-check → main · +73 −0 · 1 files · 1 commits · merged 2026-11-25 00:08 UTC

victory run --execute on a CPU without AVX2 currently starts the title and dies with 0xc000001d (illegal instruction) at the title's first VEX instruction (seen here on a Xeon X5675, which has no AVX). The crash report does not say why. This adds a pre-flight check so the user gets a clear message before any title code runs. It does not touch the AMD-only instruction emulation (clzero, clwb, ...) in the loader.

Change

apps/victory/src/run.rs (+73 lines, one file):

  • When --execute is passed (a plain run without it is unaffected), run() checks is_x86_feature_detected!("avx2") and fails with: this CPU does not support AVX2, which Xbox Series titles require.
  • VICTORY_SKIP_CPU_CHECK=1 bypasses it, for people running under CPU emulation (e.g. Intel SDE). Only the exact value 1 bypasses.
  • The decision is a pure function (check_cpu_features_with) so it is tested without depending on the host CPU.

Tests

4 new unit tests: AVX2 present passes; missing AVX2 fails with an error naming AVX2, Xbox Series and the env var (for unset, "", 0, true); =1 bypasses; the real host check agrees with the detected feature.

  • rustfmt --edition 2024 --check: clean. cargo clippy -p victory --tests (windows-msvc): 0 warnings.
  • cargo xtask policy: ok.
  • cargo test -p victory, cross-built for x86_64-pc-windows-msvc on Linux and run under Wine 11.21: 5 passed, 0 failed.

Not tested

  • A title run with the check enabled: the bypass is covered by unit tests only. The development machine has no AVX2 (Xeon X5675), so the "has AVX2" path was exercised through the host-detection test and the pure function, not on an AVX2 CPU.
  • Non-Windows hosts: the check lives under cfg(windows), like the rest of run.

No game data used. AI-assisted (Claude Code).

**@⁠dpalacios69** on GitHub · 2026-11-24 01:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/238) `dpalacios69:feat/cpu-avx2-check` → `main` · +73 −0 · 1 files · 1 commits · merged 2026-11-25 00:08 UTC `victory run --execute` on a CPU without AVX2 currently starts the title and dies with `0xc000001d` (illegal instruction) at the title's first VEX instruction (seen here on a Xeon X5675, which has no AVX). The crash report does not say why. This adds a pre-flight check so the user gets a clear message before any title code runs. It does not touch the AMD-only instruction emulation (clzero, clwb, ...) in the loader. ## Change `apps/victory/src/run.rs` (+73 lines, one file): - When `--execute` is passed (a plain `run` without it is unaffected), `run()` checks `is_x86_feature_detected!("avx2")` and fails with: this CPU does not support AVX2, which Xbox Series titles require. - `VICTORY_SKIP_CPU_CHECK=1` bypasses it, for people running under CPU emulation (e.g. Intel SDE). Only the exact value `1` bypasses. - The decision is a pure function (`check_cpu_features_with`) so it is tested without depending on the host CPU. ## Tests 4 new unit tests: AVX2 present passes; missing AVX2 fails with an error naming AVX2, Xbox Series and the env var (for unset, `""`, `0`, `true`); `=1` bypasses; the real host check agrees with the detected feature. - `rustfmt --edition 2024 --check`: clean. `cargo clippy -p victory --tests` (windows-msvc): 0 warnings. - `cargo xtask policy`: ok. - `cargo test -p victory`, cross-built for `x86_64-pc-windows-msvc` on Linux and run under Wine 11.21: 5 passed, 0 failed. ## Not tested - A title run with the check enabled: the bypass is covered by unit tests only. The development machine has no AVX2 (Xeon X5675), so the "has AVX2" path was exercised through the host-detection test and the pure function, not on an AVX2 CPU. - Non-Windows hosts: the check lives under `cfg(windows)`, like the rest of `run`. No game data used. AI-assisted (Claude Code).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:55:58 +00:00
github manually merged commit 534e1dd74c into gh-pr/238/base 2026-11-26 03:56:00 +00:00
Author
Owner

@⁠MisaXz on GitHub · 2026-11-24 02:27 UTC · original

Test report on real Windows with an AVX2 CPU (the description's runs were under Wine on a CPU without AVX2).

Tested

  • Ryzen 7 9800X3D (has AVX2); Windows 11 Pro 26300 (native); Rust 1.98.1; debug
  • This PR at 397005f (base d2a4bae): cargo test --workspace --no-fail-fast: 268 passed, 0 failed, 4 ignored.
  • cargo test -p victory: 5 passed, 0 failed, including run::tests::cpu_feature_check_matches_host, which here takes the "has AVX2" side on real hardware.

Not tested

  • victory run --execute itself: no title was run (no game files used), so the check's place in run() is covered by the unit tests only.
  • A CPU without AVX2, a release build.

AI use

  • Claude Code (Claude Fable 5.2) ran the tests and wrote this report from their output.
**@⁠MisaXz** on GitHub · 2026-11-24 02:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/238#issuecomment-7120156434) Test report on real Windows with an AVX2 CPU (the description's runs were under Wine on a CPU without AVX2). **Tested** - Ryzen 7 9800X3D (has AVX2); Windows 11 Pro 26300 (native); Rust 1.98.1; debug - This PR at `397005f` (base `d2a4bae`): `cargo test --workspace --no-fail-fast`: 268 passed, 0 failed, 4 ignored. - `cargo test -p victory`: 5 passed, 0 failed, including `run::tests::cpu_feature_check_matches_host`, which here takes the "has AVX2" side on real hardware. **Not tested** - `victory run --execute` itself: no title was run (no game files used), so the check's place in `run()` is covered by the unit tests only. - A CPU without AVX2, a release build. **AI use** - Claude Code (Claude Fable 5.2) ran the tests and wrote this report from their output.
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!238
No description provided.