Memory: detect a macOS host under Wine (mac_host) #2351

Open
vakaobr wants to merge 1 commit from upstream-pr/2361 into main
vakaobr commented 2026-11-25 16:40:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by vakaobr on 2026-11-25T16:40:37Z.


Adds util::mac_host(): the process runs under Wine on a Mac (CrossOver or the Game Porting Toolkit), where D3D12 is Apple's D3DMetal and the title's code runs through Rosetta 2. ntdll's wine_get_host_version names the host's system, and "Darwin" is a Mac; XCL_MAC_HOST=1 / 0 overrides it. Nothing calls it yet: two Mac changes that need to know they run there build on it (the s_barrier default and title textures on shared pages, both stacked on this). Until now only the mac7 branch from #258 had it. Part of #258.

What is in it

  • crates/xcl/src/util.rs: mac_host() (next to under_wine()), its decision in mac_host_from(forced, sysname), and the test a_mac_host_is_darwin_under_wine_unless_forced.

Tested

  • MacBook Pro M5 Pro, macOS 27.2.1, CrossOver 26.3.0, D3DMetal 3.0, Rust 1.100.0 x86_64-pc-windows-gnu, debug, at 6d6a3e3 (on main 65fc114).
  • util::tests::a_mac_host_is_darwin_under_wine_unless_forced and util::tests::dll_keys, each in its own process in the CrossOver bottle: 2 passed.
  • The detection is the same as mac7's, which has been running on this Mac.

Regression run

  • None: nothing calls the new function, so a run is the same as main's. I have no title of my own to run scripts/smoke.ps1 on.

Not tested

  • Windows (where wine_get_host_version does not exist, so it answers false), Wine on Linux, the whole suite.

AI use

  • Claude Code with Claude Opus 5.5 wrote the change and the test, ran the tests and wrote this description.
<!-- greyfinch-sync:ivall/xcl:issue:5495304424 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2361). Originally posted by [vakaobr](https://github.com/vakaobr) on 2026-11-25T16:40:37Z. --- Adds `util::mac_host()`: the process runs under Wine on a Mac (CrossOver or the Game Porting Toolkit), where D3D12 is Apple's D3DMetal and the title's code runs through Rosetta 2. ntdll's `wine_get_host_version` names the host's system, and "Darwin" is a Mac; `XCL_MAC_HOST=1` / `0` overrides it. Nothing calls it yet: two Mac changes that need to know they run there build on it (the `s_barrier` default and title textures on shared pages, both stacked on this). Until now only the `mac7` branch from #258 had it. Part of #258. **What is in it** - `crates/xcl/src/util.rs`: `mac_host()` (next to `under_wine()`), its decision in `mac_host_from(forced, sysname)`, and the test `a_mac_host_is_darwin_under_wine_unless_forced`. **Tested** - MacBook Pro M5 Pro, macOS 27.2.1, CrossOver 26.3.0, D3DMetal 3.0, Rust 1.100.0 `x86_64-pc-windows-gnu`, debug, at `6d6a3e3` (on `main` `65fc114`). - `util::tests::a_mac_host_is_darwin_under_wine_unless_forced` and `util::tests::dll_keys`, each in its own process in the CrossOver bottle: 2 passed. - The detection is the same as `mac7`'s, which has been running on this Mac. **Regression run** - None: nothing calls the new function, so a run is the same as `main`'s. I have no title of my own to run `scripts/smoke.ps1` on. **Not tested** - Windows (where `wine_get_host_version` does not exist, so it answers false), Wine on Linux, the whole suite. **AI use** - Claude Code with Claude Opus 5.5 wrote the change and the test, ran the tests and wrote this description.
DavidM1911 commented 2026-11-25 19:09:14 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T18:50:14Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7171468272 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2361#issuecomment-7171468272). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T18:50:14Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
bmjask commented 2026-11-25 20:55:15 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-11-25T20:55:15Z.

Review: COMMENTED


No concrete source defect found; optional Wine host-version detection and OnceLock use are sound, and this preparatory PR is behavior-neutral today. It is draft/stacked with failing description checks and lacks Windows/Wine whole-suite evidence. Also, XCL_MAC_HOST treats every value except literal "0"—including empty and "false"—as true. Document that conspicuously or accept only 0/1 to avoid accidental activation of future Mac-specific paths.

<!-- greyfinch-sync:ivall/xcl:review:6064858747 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2361#pullrequestreview-6064858747). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-25T20:55:15Z. **Review:** COMMENTED --- No concrete source defect found; optional Wine host-version detection and OnceLock use are sound, and this preparatory PR is behavior-neutral today. It is draft/stacked with failing description checks and lacks Windows/Wine whole-suite evidence. Also, XCL_MAC_HOST treats every value except literal "0"—including empty and "false"—as true. Document that conspicuously or accept only 0/1 to avoid accidental activation of future Mac-specific paths.
github-actions[bot] commented 2026-11-30 08:40:03 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-30T08:40:03Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7273192165 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2361#issuecomment-7273192165). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-30T08:40:03Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 07:55:32 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:55:32Z.


Triage (#1607) – head 69c0b04

No open or merged PR adds mac_host on its own, and main has no mac_host or wine_get_host_version. #2363 and #3525 are stacked on this commit (69c0b04). #2402 and #2492 carry an identical copy of it (6d6a3e3, same patch), so they should be rebased onto this one. Those are stacks, not duplicates.
No problems found in the diff: nothing calls mac_host() yet, and the decision logic is tested in mac_host_from.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7304653620 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2361#issuecomment-7304653620). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T07:55:32Z. --- **Triage (#1607)** – head 69c0b04 No open or merged PR adds `mac_host` on its own, and main has no `mac_host` or `wine_get_host_version`. #2363 and #3525 are stacked on this commit (69c0b04). #2402 and #2492 carry an identical copy of it (6d6a3e3, same patch), so they should be rebased onto this one. Those are stacks, not duplicates. No problems found in the diff: nothing calls `mac_host()` yet, and the decision logic is tested in `mac_host_from`. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2361:upstream-pr/2361'
git switch 'upstream-pr/2361'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2361'
git switch 'upstream-pr/2361'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2361'
git switch 'upstream-pr/2361'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2361'
git switch 'main'
git merge --squash 'upstream-pr/2361'
git switch 'main'
git merge --ff-only 'upstream-pr/2361'
git switch 'main'
git merge 'upstream-pr/2361'
git push origin 'main'
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!2351
No description provided.