macos: run from a Game Mode app bundle, set interactive QoS, and track git refs #548

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

@⁠Sheffy007 on GitHub · 2026-11-28 02:44 UTC · original
Sheffy007:feat/macos-game-bundle-qos-commit → main · +460 −8 · 13 files · 1 commits · open

Summary

  • Game Mode bundle (tools/macos/native-binary.sh, run-native.sh, native-setup.sh, apps/victory/src/window.rs): Stage the built victory host executable inside Victory.app beside the release binary with LSApplicationCategoryType = public.app-category.games, LSSupportsGameMode = true, and NSHighResolutionCapable = true (removing any previous binary copy before refreshing to preserve Apple Silicon's vnode code-signing cache and ad-hoc signing the bundle), and mark the NSWindow with NSWindowCollectionBehaviorFullScreenPrimary (1 << 7) so macOS Game Mode engages in full screen.
  • User-interactive title threads (crates/victory-platform, crates/victory-loader/src/native/run.rs): Promote both "title-main" (run_entry_with) and CreateThread threads (spawn_title_thread_with) to QOS_CLASS_USER_INTERACTIVE (pthread_set_qos_class_self_np) on startup.
  • Current HUD commit (apps/victory/build.rs, apps/victory/build_git.rs, apps/victory/src/window.rs): Watch both the worktree HEAD and shared commondir branch ref (or nearest existing ref directory + packed-refs when packed) so Cargo reruns build.rs whenever a commit moves the branch ref, keeping VICTORY_GIT_COMMIT current in the ScarlettMac Native | <Series S|Series X> (<commit>) window title.

Verification

  • cargo xtask policy
  • /bin/bash tools/macos/tests/target-directory.sh (including new game_mode_bundle regression) and all macos-scripts CI tests
  • cargo test --locked -p victory-platform
  • cargo test --locked --target x86_64-apple-darwin -p victory --bin victory
  • cargo test --locked --target x86_64-apple-darwin -p victory-loader --lib
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings
  • cargo clippy --workspace --all-targets --all-features --locked --target x86_64-pc-windows-gnullvm -- -D warnings

Closes #537
cc @⁠Olima34

**@⁠Sheffy007** on GitHub · 2026-11-28 02:44 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/544) `Sheffy007:feat/macos-game-bundle-qos-commit` → `main` · +460 −8 · 13 files · 1 commits · open ## Summary - **Game Mode bundle (`tools/macos/native-binary.sh`, `run-native.sh`, `native-setup.sh`, `apps/victory/src/window.rs`):** Stage the built `victory` host executable inside `Victory.app` beside the release binary with `LSApplicationCategoryType = public.app-category.games`, `LSSupportsGameMode = true`, and `NSHighResolutionCapable = true` (removing any previous binary copy before refreshing to preserve Apple Silicon's vnode code-signing cache and ad-hoc signing the bundle), and mark the `NSWindow` with `NSWindowCollectionBehaviorFullScreenPrimary` (`1 << 7`) so macOS Game Mode engages in full screen. - **User-interactive title threads (`crates/victory-platform`, `crates/victory-loader/src/native/run.rs`):** Promote both `"title-main"` (`run_entry_with`) and `CreateThread` threads (`spawn_title_thread_with`) to `QOS_CLASS_USER_INTERACTIVE` (`pthread_set_qos_class_self_np`) on startup. - **Current HUD commit (`apps/victory/build.rs`, `apps/victory/build_git.rs`, `apps/victory/src/window.rs`):** Watch both the worktree `HEAD` and shared `commondir` branch ref (or nearest existing ref directory + `packed-refs` when packed) so Cargo reruns `build.rs` whenever a commit moves the branch ref, keeping `VICTORY_GIT_COMMIT` current in the `ScarlettMac Native | <Series S|Series X> (<commit>)` window title. ## Verification - `cargo xtask policy` - `/bin/bash tools/macos/tests/target-directory.sh` (including new `game_mode_bundle` regression) and all `macos-scripts` CI tests - `cargo test --locked -p victory-platform` - `cargo test --locked --target x86_64-apple-darwin -p victory --bin victory` - `cargo test --locked --target x86_64-apple-darwin -p victory-loader --lib` - `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` - `cargo clippy --workspace --all-targets --all-features --locked --target x86_64-pc-windows-gnullvm -- -D warnings` Closes #537 cc @⁠Olima34
Stage the built native host executable inside Victory.app beside the Cargo
release output with LSApplicationCategoryType=public.app-category.games and
LSSupportsGameMode=true so macOS Game Mode engages in full screen when launched
via run-native.sh, and mark the NSWindow as fullScreenPrimary.

Promote the title's main thread and CreateThread worker threads to
QOS_CLASS_USER_INTERACTIVE on startup so macOS schedules frame-driving title
threads as interactive work.

Resolve both worktree gitdir and shared commondir refs (loose branch refs and
packed-refs) in apps/victory/build.rs so VICTORY_GIT_COMMIT in the
ScarlettMac Native | <console> (<commit>) window title updates whenever a
commit advances the branch ref.

Closes #533
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 02:49:18 +00:00
Author
Owner

@⁠Olima34 on GitHub · 2026-11-28 03:54 UTC · original · requested changes

Thanks @⁠Sheffy007. Running from an app bundle so Game Mode can engage, and keeping the build commit current in the window title, are both useful. We read the whole diff of 733e350c while helping the maintainer clear the queue. Three things before it can merge:

  1. The rename. The window title becomes "ScarlettMac Native | ()" and the menu item "Quit ScarlettMac Native" (the module doc too). That changes the product's name, which isn't part of #537 and is the maintainer's call. Please keep "VIctory" and add the console and commit to it, e.g. "VIctory | Series S (41d6563)", or ask the maintainer first if the new name is intended.
  2. QOS_CLASS_USER_INTERACTIVE for every title thread. spawn_title_thread_with promotes every CreateThread thread, not just the main and render threads: dozens of them, with the streaming, audio and job workers among them. At the top QoS class they compete with the AppKit main thread, the pipeline-compile threads and Metal's own threads, which stay at default. It may help, or it may make frame pacing worse; the PR has no run either way. Please post a before/after world run (tools/macos/run-summary.sh --compare of two headless runs of the same length, fps per 64 frames). If it's mixed, limit the promotion to title-main and the thread that presents. A VICTORY_* switch to turn it off would also help testers compare.
  3. Game Mode itself. Please say in the description, or in docs/native-host.md, how you checked that it engages: the Game Mode indicator in the menu bar, or log stream --predicate 'subsystem == "com.apple.gamepolicy"' while the bundled host is full screen. Then the next tester knows what to look for.

The build-script part (build_git.rs, watching the common dir's branch ref and packed-refs) and its tests look right, as does the script test for the bundle. CI is green on this head. No game run on our side.

**@⁠Olima34** on GitHub · 2026-11-28 03:54 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/544#pullrequestreview-6095595394) · **requested changes** Thanks @⁠Sheffy007. Running from an app bundle so Game Mode can engage, and keeping the build commit current in the window title, are both useful. We read the whole diff of 733e350c while helping the maintainer clear the queue. Three things before it can merge: 1. **The rename.** The window title becomes "ScarlettMac Native | <console> (<commit>)" and the menu item "Quit ScarlettMac Native" (the module doc too). That changes the product's name, which isn't part of #537 and is the maintainer's call. Please keep "VIctory" and add the console and commit to it, e.g. "VIctory | Series S (41d6563)", or ask the maintainer first if the new name is intended. 2. **`QOS_CLASS_USER_INTERACTIVE` for every title thread.** `spawn_title_thread_with` promotes every `CreateThread` thread, not just the main and render threads: dozens of them, with the streaming, audio and job workers among them. At the top QoS class they compete with the AppKit main thread, the pipeline-compile threads and Metal's own threads, which stay at default. It may help, or it may make frame pacing worse; the PR has no run either way. Please post a before/after world run (`tools/macos/run-summary.sh --compare` of two headless runs of the same length, fps per 64 frames). If it's mixed, limit the promotion to `title-main` and the thread that presents. A `VICTORY_*` switch to turn it off would also help testers compare. 3. **Game Mode itself.** Please say in the description, or in docs/native-host.md, how you checked that it engages: the Game Mode indicator in the menu bar, or `log stream --predicate 'subsystem == "com.apple.gamepolicy"'` while the bundled host is full screen. Then the next tester knows what to look for. The build-script part (`build_git.rs`, watching the common dir's branch ref and `packed-refs`) and its tests look right, as does the script test for the bundle. CI is green on this head. No game run on our side.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/548/head:github-bot/gh-544'
git switch 'github-bot/gh-544'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-544'
git switch 'github-bot/gh-544'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-544'
git switch 'github-bot/gh-544'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-544'
git switch 'main'
git merge --squash 'github-bot/gh-544'
git switch 'main'
git merge --ff-only 'github-bot/gh-544'
git switch 'main'
git merge 'github-bot/gh-544'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.