feat(versions): on a processor without AVX2, offer only builds from source and say why once #375

Merged
HumanBean merged 1 commit from HumanBean/LongshotLauncher:feat/old-cpu-source-builds into main 2026-11-29 23:32:52 +00:00
Owner

Longshot's prebuilt versions now need an x86-64-v3 processor (AVX2), and the builder refuses a release build on an older one (Longshot #2833, the builder side). Players with an older processor can still build from source, so the launcher should lead them there instead of to a build that fails.

Summary

  • Detection (src/cpu.rs, new): cpuid reads AVX2, FMA, BMI1, BMI2, MOVBE, LZCNT and F16C, and OSXSAVE plus XGETBV for the OS's AVX state. The launcher is still built for plain x86-64 (no target-cpu anywhere), so the check runs at run time on any PC. Features is a plain struct, so the tests check it with fake feature sets. LONGSHOT_LAUNCHER_FAKE_OLD_CPU=1 makes the launcher act as if the processor had no AVX2, FMA or BMI2.
  • Add version: on an older processor, Stable, Nightly and Earlier release are disabled with "Needs AVX2; your processor has none." (short, so it fits the menu without being cut off) Main and Pull request stay enabled. The build page's channel dropdown offers only those two, the default track is Main, and the wizard refuses a release channel with a message naming what is missing.
  • One-time notice (ui/old-cpu-dialog.slint): on the first start on such a processor it says what is missing, that main or a pull request still works, that the first build takes longer and that these are not tested releases. "Got it" (or a click outside) sets oldCpuNoticeSeen in the launcher's settings, so it shows once.
  • The 7 new strings are translated into every catalog.
  • Docs: an "Older processors" section in docs/pull-requests.md, and a pointer to it in the README.

How main and pull request builds work: the launcher downloads the newest signed nightly builder and runs from-source with it (releases.rs install_builder). Per #2833, that builder is plain x86-64, from-source never refuses, and the builder it compiles builds everything at -march=native on an older processor. The source tags the launcher passes as --name are main-<8 hex> and pr-<N>-<8 hex>, never release-shaped (vX.Y.Z, nightly-N-…), so the builder never takes them for a release.

Screenshots

With LONGSHOT_LAUNCHER_FAKE_OLD_CPU=1:

The notice on the first start:

The first-start notice

Add version: the three release rows are greyed out with the hint:

Add version on an older processor

The build page's channel list, with Main and Pull request only:

The channel list on an older processor

Testing

Tested:

  • scripts/ci-test.sh: fmt and clippy (-D warnings) clean, translations validated, LAUNCHER=… test_release.py passes (46 tests).
  • cargo test: 277 passed, including the new cpu::tests. 2 failed only because another session had a longshot/longshot-builder process running on this PC: "Close longshot (PID …) before continuing". Neither test touches this change.
  • Not run in the game. The UI was opened only for the screenshots below, with LONGSHOT_LAUNCHER_FAKE_OLD_CPU=1 and throwaway folders. The PR was opened with --force for the game-run requirement only, which the person I work for approved for this CPU work.

Still to test: on a processor without AVX2 (or with LONGSHOT_LAUNCHER_FAKE_OLD_CPU=1): the notice shows once, Add version greys out the three release rows with the hint, and a main build completes.

Risks

A processor with AVX2 whose OS has AVX turned off now counts as old, as intended: the prebuilt game could not run there either. Builds already installed from a release on such a PC are not changed. Rebuilding them stops with the builder's own cpu_too_old message, which points to building from source.

🤖 Generated with Claude Code

Longshot's prebuilt versions now need an x86-64-v3 processor (AVX2), and the builder refuses a release build on an older one (Longshot [#2833](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2833), the builder side). Players with an older processor can still build from source, so the launcher should lead them there instead of to a build that fails. ## Summary - **Detection** (`src/cpu.rs`, new): `cpuid` reads AVX2, FMA, BMI1, BMI2, MOVBE, LZCNT and F16C, and OSXSAVE plus XGETBV for the OS's AVX state. The launcher is still built for plain x86-64 (no `target-cpu` anywhere), so the check runs at run time on any PC. `Features` is a plain struct, so the tests check it with fake feature sets. `LONGSHOT_LAUNCHER_FAKE_OLD_CPU=1` makes the launcher act as if the processor had no AVX2, FMA or BMI2. - **Add version**: on an older processor, Stable, Nightly and Earlier release are disabled with "Needs AVX2; your processor has none." (short, so it fits the menu without being cut off) Main and Pull request stay enabled. The build page's channel dropdown offers only those two, the default track is Main, and the wizard refuses a release channel with a message naming what is missing. - **One-time notice** (`ui/old-cpu-dialog.slint`): on the first start on such a processor it says what is missing, that main or a pull request still works, that the first build takes longer and that these are not tested releases. "Got it" (or a click outside) sets `oldCpuNoticeSeen` in the launcher's settings, so it shows once. - The 7 new strings are translated into every catalog. - **Docs**: an "Older processors" section in `docs/pull-requests.md`, and a pointer to it in the README. **How main and pull request builds work:** the launcher downloads the newest signed nightly builder and runs `from-source` with it (`releases.rs` `install_builder`). Per [#2833](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2833), that builder is plain x86-64, `from-source` never refuses, and the builder it compiles builds everything at `-march=native` on an older processor. The source tags the launcher passes as `--name` are `main-<8 hex>` and `pr-<N>-<8 hex>`, never release-shaped (`vX.Y.Z`, `nightly-N-…`), so the builder never takes them for a release. ## Screenshots With `LONGSHOT_LAUNCHER_FAKE_OLD_CPU=1`: The notice on the first start: ![The first-start notice](https://git.magicbean.dev/attachments/db3cd4f9-d38b-4d36-a444-c5884dc71787) Add version: the three release rows are greyed out with the hint: ![Add version on an older processor](https://git.magicbean.dev/attachments/01143e7a-7c5e-4c27-99e3-2e7d752bb9bb) The build page's channel list, with Main and Pull request only: ![The channel list on an older processor](https://git.magicbean.dev/attachments/3583fb38-fe6b-42c8-9642-c466ed3435b5) ## Testing **Tested:** - `scripts/ci-test.sh`: fmt and clippy (`-D warnings`) clean, translations validated, `LAUNCHER=… test_release.py` passes (46 tests). - `cargo test`: 277 passed, including the new `cpu::tests`. 2 failed only because another session had a `longshot`/`longshot-builder` process running on this PC: "Close longshot (PID …) before continuing". Neither test touches this change. - Not run in the game. The UI was opened only for the screenshots below, with `LONGSHOT_LAUNCHER_FAKE_OLD_CPU=1` and throwaway folders. The PR was opened with `--force` for the game-run requirement only, which the person I work for approved for this CPU work. **Still to test:** on a processor without AVX2 (or with `LONGSHOT_LAUNCHER_FAKE_OLD_CPU=1`): the notice shows once, Add version greys out the three release rows with the hint, and a main build completes. ## Risks A processor with AVX2 whose OS has AVX turned off now counts as old, as intended: the prebuilt game could not run there either. Builds already installed from a release on such a PC are not changed. Rebuilding them stops with the builder's own `cpu_too_old` message, which points to building from source. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(versions): on a processor without AVX2, offer only builds from source and say why once
Some checks failed
CI / What the change needs (pull_request) Successful in 9s
CI / Lint (actionlint, ShellCheck, gitleaks) (pull_request) Successful in 15s
PR title / Conventional Commit title (pull_request) Successful in 6s
CI / Rust formatting, lint and tests (pull_request) Has been cancelled
CI / Release packages and stable upgrades (pull_request) Has been cancelled
32911b7c42
Longshot's prebuilt versions need x86-64-v3 (AVX2, FMA, BMI1/2, MOVBE, LZCNT, F16C).
The launcher reads cpuid at start-up (src/cpu.rs, the launcher stays plain x86-64),
disables Stable, Nightly and Earlier release with a plain hint on an older processor,
defaults to Main, and shows a one-time notice (oldCpuNoticeSeen).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean changed title from WIP: feat(versions): on a processor without AVX2, offer only builds from source and say why once to feat(versions): on a processor without AVX2, offer only builds from source and say why once 2026-11-29 23:19:48 +00:00
HumanBean force-pushed feat/old-cpu-source-builds from 32911b7c42
Some checks failed
CI / What the change needs (pull_request) Successful in 9s
CI / Lint (actionlint, ShellCheck, gitleaks) (pull_request) Successful in 15s
PR title / Conventional Commit title (pull_request) Successful in 6s
CI / Rust formatting, lint and tests (pull_request) Has been cancelled
CI / Release packages and stable upgrades (pull_request) Has been cancelled
to c23db86a8f
Some checks failed
CI / What the change needs (pull_request) Successful in 9s
CI / Lint (actionlint, ShellCheck, gitleaks) (pull_request) Successful in 17s
PR title / Conventional Commit title (pull_request) Successful in 8s
CI / Rust formatting, lint and tests (pull_request) Successful in 12m48s
CI / Release packages and stable upgrades (pull_request) Failing after 29m50s
2026-11-29 23:29:11 +00:00
Compare
HumanBean deleted branch feat/old-cpu-source-builds 2026-11-29 23:32:53 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
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
MagicBeanDev/LongshotLauncher!375
No description provided.