Repository navigation
Console mode: quit a game by holding the Home button (macOS 27) - #579
Merged
Merged
Conversation
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.
Closed
1 task done
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.
4 of 6 tasks
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
5 of 6 tasks
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix or 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.
GameReturnWatcherandLiveConsoleDriver.gameDidTerminatealready 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 throughNSApp 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.@available). The host already setpreferredSystemGestureState = .disabledon Home for every pad.DM_HOME_QUIT=0turns it off.front end: Home button in apps: system|app|off|unavailable.Launcher
DM_HOME_QUIT_TEXT, one line per text).system), the console shows a hint once, with Open Settings. The button callsopenControllerHomeButtonSettings(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, becauseGCControllerHomeButtonSettingsManagerreads it "for the current application" and it may differ per app.APIs checked against the macOS 27.2 SDK (Xcode 27.2)
GCControllerElement.preferredSystemGestureStateandGCSystemGestureStateDisabled: 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).systemDefault(the system keeps Home),defer(the app decides, after it setspreferredSystemGestureState),disabled,unavailable. The header says the manager works only while a controller is connected.Checked
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 forsystemand 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 inShellInstallTests(testBuildWithTheShellTargetInstallsAndResignsTheSharedApp,testUnknownDeviceStopsTheBuildBeforeTheScriptRuns), which also show German text from the machine.make -C dm/host/testsfort_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) andt_home_quit_mac(11 checks: the views at 720p and 1080p, a long title, a missing glyph).front_mac.mcompiles with the host's flags.python3 tools/engine.py checkpasses.python3 dm/tools/env_switches.py --checkfails only onDM_FONT_CACHEandDM_SHARED_FONT_SMALL, which were missing rows before this change.NX_LAUNCHER_CAPTURE_DIR(HomeButtonCaptureTests, in English, German, Chinese and the language with the longest label, which is German), the engine prompt withDM_HOME_QUIT_CAPTURE(t_home_quit_mac, drawn over a stand-in picture).HomeButtonCaptureTestsrenders 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_macchecks the Quit and Cancel pills for all six languages and a far longer label.buttonHomereaches 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.
HomeButtonCaptureTestschecks the widths in all six languages at the default and a larger text size, andt_home_quit_macdoes 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:
The row before macOS 27, with no button:
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:
The engine's prompt and hold indicator over a game (new, no before). Quit and Cancel are one fixed width in every language:
Scope
dm/,scripts/,docs/,ref/) is added to the repository: a change there is a patch inpatches/(a commit inengine/, thentools/engine.py export, andtools/engine.py checkpasses), with itsUpstream-Statusforwarded seedds/nxnative#1084Patch 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.