Skip to content

Mac app: a Game Mode setting, through a nested copy of the host with its own bundle ID - #2283

Open
dontpokethebear3893 wants to merge 3 commits into
seedds:mainfrom
dontpokethebear3893:upstream/mac-game-mode
Open

dontpokethebear3893 wants to merge 3 commits into
seedds:mainfrom
dontpokethebear3893:upstream/mac-game-mode

Conversation

@dontpokethebear3893

Copy link
Copy Markdown

What and why

Mac apps are packed with LSSupportsGameMode false, because on an M4 Pro macOS's Game Mode held the GPU at its lowest clock while the game was busy (issue #349; docs/reference/frame-rate.md, "macOS Game Mode holds the GPU at its lowest clock"). That takes Game Mode's benefits away from every Mac, though: less CPU for background tasks, and Bluetooth controllers and AirPods read twice as often.

This adds a Game Mode setting to the Mac launcher (Performance, off by default):

  • pack_app.py game_mode_helper: every Mac app also carries Contents/Helpers/Game Mode.app. It is a copy of the host with a bundle ID of its own (<app>.gamemode) and LSSupportsGameMode true. It is signed before the bundle that holds it.
  • launcher.c: with DM_GAME_MODE=1 the launcher registers that copy with LaunchServices and runs its host instead of Contents/MacOS/dmhost. If the copy is missing, it logs a [RED] line and runs the game without Game Mode.
  • Why a second bundle ID: macOS remembers an app it has run in Game Mode and keeps it on after a re-pack with the key false. The app's own ID never runs in Game Mode, so turning the setting off always works.
  • Settings and docs: a settings.tsv row (Mac only), docs/settings.md (Game Mode), the DM_GAME_MODE switch in docs/env_switches.tsv, and two bullets in the frame-rate entry.

Checked

  • Tests: dm/tools/tests test_launcher_settings and test_nsp_mac_app pass (80 tests). test_nsp_mac_app packs an app and checks the nested copy's bundle ID, executable, name and key.

  • Games run: Breath of the Wild 1.9.0 (01007EF00011E000), full screen at 120 fps, standing still in the open world, 5 min 50 s with the setting on.

    • gamepolicyd logged Game mode enabled and Set DPS to 2.
    • The GPU clock (IOReport GPU Performance States, sampled each second) stayed at 960–1,530 MHz, about 1,100 on average, and never fell to its lowest, 338 MHz.
    • Frames held 119.8 fps, with GPU time a flat 5.3 ms.
  • Devices and OS: Apple M5 Max, macOS 27.2.1.

  • Not checked: the same run without Game Mode; the M4 Pro, where the clock fell; other games.

  • After the rebase on main (6a6a018):

    • make -C dm/host/tests GAME=01007EF00011E000 run, check_t_feedback and check_t_reorder_chain (dm/gfx/tests) pass.
    • dm/tools/tests passes: test_docs, test_patches, test_game_profile, test_env_switches, test_launcher_settings, test_settings, test_nsp_mac_app, test_fps_target, test_player_env, test_lint_c and test_gfx_tests_makefile. dm/ios/tests test_launcher_storage passes.
    • lint_python.py --against origin/main reports one new finding, dm/gfx/tools/dmsh_entry.py:7 (F401, an unused import). main itself reports the same one, and this change does not touch that file.
    • The measurements and game runs above were made before the rebase and were not repeated on it.

Docs

  • The finding is in docs/reference/frame-rate.md (macOS Game Mode holds the GPU at its lowest clock) and docs/settings.md (Game Mode), and python3 dm/tools/docs_symptoms.py was run
  • A chain tool changed: n/a
  • No game files, keys or data extracted from a game in the change or the attachments

🤖 Generated with Claude Code

…its own bundle ID

The launcher runs Contents/Helpers/Game Mode.app/Contents/MacOS/dmhost (bundle ID
<app>.gamemode, LSSupportsGameMode true) when DM_GAME_MODE=1, after registering it
with LaunchServices. The app's own ID keeps the key false, so it is never labelled
a game, which macOS would remember. Settings row (Performance, Mac only), docs,
env switch and test. On an M5 Max, 5 min 50 s in Game Mode at 120 fps (5K output):
the GPU clock held about 1,100 MHz and never fell to 338 MHz; 119.8 fps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tedkoniszewski and others added 2 commits November 12, 2026 15:30
Brings the branch up to date with main (fixes for the t_save_sync cloud
device check and the clang-tidy fixture findings, among others) and
resolves the conflicts with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation mac The Mac front end and app (dm/mac, front_mac.m) packing Building an IPA or a Mac app: the NSP script, extraction, the shader split, the packers tools Tools and scripts (dm/tools, scripts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant