Skip to content

Console mode: quit a game by holding the Home button (macOS 27) - #579

Merged
v0lumehi merged 4 commits into
mainfrom
v0lumehi/quit-with-home
Nov 3, 2026
Merged

v0lumehi merged 4 commits into
mainfrom
v0lumehi/quit-with-home

Conversation

@v0lumehi

@v0lumehi v0lumehi commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Fix or feature

  • Fix
  • Feature

Part of #336. This is part 2, "Quit the game from the controller", for macOS 27. macOS 26 keeps Cmd+Q, as agreed in the issue.

What and why

Quitting a game needed Cmd+Q, so a keyboard had to be close. Now a player holds the Home button (the logo button on Xbox and PlayStation controllers) for 2 seconds, and the game shows a "Quit?" prompt. A quits, B or another press of Home closes it. Letting go before 2 seconds does nothing. After the game quits, the launcher comes back in the mode it started the game from. GameReturnWatcher and LiveConsoleDriver.gameDidTerminate already do that, so nothing changed there.

Engine, patch 0064 (forwarded seedds/nxnative#1084). The game process reads the controller, so the engine detects the hold and draws the prompt in the game's own view.

  • dm/host/home_quit.h: the hold timer and the states (idle, holding, prompt, settle, quit), pure C. The settle state keeps the B that closed the prompt away from the game.
  • dm/host/home_quit_mac.h: the prompt and the hold indicator as AppKit views, in the console mode's look (dark card, cream pill for the main action, the controller's own A and B glyphs). Sizes follow the view height, so it reads from a couch.
  • front_mac.m: A quits through NSApp terminate, the same path as Cmd+Q. While the prompt is open the game gets no controller input and is told it lost the focus, as the Switch's HOME menu does. Losing the window focus closes the prompt.
  • macOS 27 only (@available). The host already set preferredSystemGestureState = .disabled on Home for every pad. DM_HOME_QUIT=0 turns it off.
  • Once a controller is there, the log names the system's Home button setting for apps: front end: Home button in apps: system|app|off|unavailable.

Launcher

  • The game gets the prompt's texts in the launcher's language (DM_HOME_QUIT_TEXT, one line per text).
  • After a game quits in console mode, the launcher reads that game's log. If the game found that the system keeps Home for itself (system), the console shows a hint once, with Open Settings. The button calls openControllerHomeButtonSettings(for: .customizeInAppAction). If that throws (no controller connected), System Settings opens instead. I read the setting from the game's log and not from the launcher, because GCControllerHomeButtonSettingsManager reads it "for the current application" and it may differ per app.
  • Settings > Controls has a row "Quit with the Home button". On macOS 27 it says how it works and has Open Settings. Before macOS 27 it says Cmd+Q is the way.
  • Texts in zh, en, sv, de, fr and it. The Italian texts are machine-translated. Please check them, a native speaker should look.

APIs checked against the macOS 27.2 SDK (Xcode 27.2)

  • GCControllerElement.preferredSystemGestureState and GCSystemGestureStateDisabled: exist, available since macOS 11, not 27. The header says the system does not have to respect it.
  • GCControllerHomeButtonSettingsManager: exists, macOS 27. Swift: controllerHomeButtonInAppAction (throws, returns (action, customized)), openControllerHomeButtonSettings(for:) (throws). ObjC: readControllerHomeButtonInAppAction:withError:, openControllerHomeButtonSettingsForActivity:error:.
  • .customizeInAppAction: exists (GCControllerHomeButtonSettingsCustomizeInAppActionActivity).
  • In-app action values: systemDefault (the system keeps Home), defer (the app decides, after it sets preferredSystemGestureState), disabled, unavailable. The header says the manager works only while a controller is connected.

Checked

  • Tests: cd frontend && swift test. New: HomeButtonHintTests (log parsing, when the hint shows, prompt texts in every language), ConsoleLiveTests (the hint shows once after a game quits, only for system and only on macOS 27, the button opens the setting and closes the hint, Play passes the texts). Failing here and not touched by this PR: 2 tests in ShellInstallTests (testBuildWithTheShellTargetInstallsAndResignsTheSharedApp, testUnknownDeviceStopsTheBuildBeforeTheScriptRuns), which also show German text from the machine.
  • Engine: make -C dm/host/tests for t_home_quit (41 checks: hold time, early release, A and B, a button already held when the prompt opens, Home closing it, settle, focus loss, the macOS 27 gate, the texts) and t_home_quit_mac (11 checks: the views at 720p and 1080p, a long title, a missing glyph). front_mac.m compiles with the host's flags. python3 tools/engine.py check passes. python3 dm/tools/env_switches.py --check fails only on DM_FONT_CACHE and DM_SHARED_FONT_SMALL, which were missing rows before this change.
  • Test for a fix: not a fix.
  • Visual QA: the Controls card and the hint with NX_LAUNCHER_CAPTURE_DIR (HomeButtonCaptureTests, in English, German, Chinese and the language with the longest label, which is German), the engine prompt with DM_HOME_QUIT_CAPTURE (t_home_quit_mac, drawn over a stand-in picture).
  • Button widths: HomeButtonCaptureTests renders Settings > Controls and the hint in all six languages at the default and a larger text size and checks that each button keeps its width. t_home_quit_mac checks the Quit and Cancel pills for all six languages and a far longer label.
  • Run on a device or Mac: not run. No real controller and no game on this Mac, macOS 27.2, Apple silicon. I did not build the full host or play a game. Not verified: the hold with a real pad, whether buttonHome reaches the app's handlers, the exit path in a running game, what the Home button setting is on a fresh Mac with macOS 27 (open question in the issue), and whether the app still sees the press when the system keeps Home. A small probe on this Mac without a controller could not read the in-app setting ("Unable to retrieve settings for the current application"), so that needs a test with a pad.

Screenshots

Every button this PR adds keeps one width per role in every language. German has the longest "Open Settings" of the six languages. HomeButtonCaptureTests checks the widths in all six languages at the default and a larger text size, and t_home_quit_mac does the same for the engine prompt.

Settings > Controls, before and after (macOS 27). "Open Settings" has the same width as Customize and Open, in every language:

controls before en
controls after en
controls after de
controls after zh

The row before macOS 27, with no button:

controls macOS 26 en

Console mode, before (no hint) and after (the hint once, after a game quit, when the system keeps Home). Both buttons take the sheet's width:

console before
console hint en
console hint de
console hint zh

The engine's prompt and hold indicator over a game (new, no before). Quit and Cancel are one fixed width in every language:

prompt en
prompt de
prompt zh
hold

Scope

  • No engine file (dm/, scripts/, docs/, ref/) is added to the repository: a change there is a patch in patches/ (a commit in engine/, then tools/engine.py export, and tools/engine.py check passes), with its Upstream-Status
  • A fix to the engine or a game profile also goes to seedds/nxnative as a PR in parallel: this PR's patch says forwarded seedds/nxnative#1084
  • A change to a launcher view has before and after screenshots above
  • No keys, game files or data extracted from a game in the change or the attachments

Patch 0064: #575 took 0063, so I merged main and moved this patch to 0064. It is the next free number on main now. The touch controls stack follows with 0065 to 0067.

On macOS 27 holding Home for 2 seconds opens a quit prompt over the game. A quits as Cmd+Q does, B or Home closes it. The log names the system's Home button setting for apps, which the launcher reads. Forwarded as seedds/nxnative#1084.
A game started from the launcher gets its quit prompt texts in the launcher's language (DM_HOME_QUIT_TEXT). When a game quit and its log says the system keeps the Home button for itself, console mode shows a hint once with a button that opens the Home button settings. Settings > Controls says how quitting with Home works, or that it needs macOS 27. Texts in zh, en, sv, de, fr and it.
@v0lumehi v0lumehi added this to the v1.1.0 milestone Nov 3, 2026
@v0lumehi v0lumehi added enhancement New feature or request launcher The NX2Apple launcher app mac Mac labels Nov 3, 2026
@github-actions github-actions Bot added windows Windows (the Qt front end) patch-queue Changes the patch queue or the upstream pin labels Nov 3, 2026
The engine prompt's Quit and Cancel pills sized to their labels. They are now one fixed width, and a longer label gets a smaller font or is cut (patch 0063, t_home_quit_mac checks all six languages). The hint's two buttons take the sheet's width and wrap or shrink a long label. HomeButtonCaptureTests checks in every language, at the default and a larger text size, that Open Settings in Settings > Controls has the width of its neighbours and that the hint's buttons keep one width.
@v0lumehi
v0lumehi merged commit 1a43125 into main Nov 3, 2026
18 checks passed
victorwads pushed a commit to victorwads/NX2Apple that referenced this pull request Nov 3, 2026
LNPANDY#575 took 0063 and LNPANDY#579 reserves 0064. The geometry test also checks that
the picture Fill (0063) leaves the controls where they are.
victorwads pushed a commit to victorwads/NX2Apple that referenced this pull request Nov 3, 2026
@v0lumehi
v0lumehi deleted the v0lumehi/quit-with-home branch November 20, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request launcher The NX2Apple launcher app mac Mac patch-queue Changes the patch queue or the upstream pin windows Windows (the Qt front end)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant