Skip to content

iOS: quit a game from the in-game menu or by holding Home - #601

Merged
v0lumehi merged 2 commits into
v0lumehi/engine-bump-1.1.0from
v0lumehi/ios-quit-menu
Nov 3, 2026
Merged

v0lumehi merged 2 commits into
v0lumehi/engine-bump-1.1.0from
v0lumehi/ios-quit-menu

Conversation

@v0lumehi

@v0lumehi v0lumehi commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Fix or feature

  • Fix
  • Feature

A maintainer's feature (#421, milestone v1.1.0). It stacks on #598, the engine bump to 641d148, because it extends that pin's in-game menu. It is reviewed against #598 and merges after it.

What and why

Fixes #421

On the iPhone a running game had no way back to the launcher. The player had to close the app in the app switcher. A player asked for an "exit game" button.

The design

There is one way back for touch, plus the Home button for controllers. I did not add a second on-screen control.

  • Quit in the in-game menu. At the new pin the 2D/3D button is a gear that opens the in-game menu (upstream's GameMenu.swift). The menu now ends with "Quit ", red and on its own. The gear stays while a controller hides the other touch controls, so touch players and controller players reach it the same way. A stray tap on the gear only opens the menu.
  • Holding Home for 2 seconds, as on the Mac (Console mode: always start in console mode, and quit a game from the controller #336, Console mode: quit a game by holding the Home button (macOS 27) #579). The engine already claims Home. iOS 27 respects that when the Home button setting for apps lets the app decide (GCControllerHomeButtonSettingsManager, in the iOS 27.2 SDK). The game's log names the setting once. On iOS 26, or with the setting left to the system, Quit in the menu still works.
  • Both open the same prompt over the game, the Mac's in look: "Quit ?", a note, and Quit and Cancel. Each pill has one fixed width in every language, and every label fits at full size, checked in six languages. A tap on Quit or A quits. A tap on Cancel or outside the card, B or a new Home press closes it. While the prompt is open the game is told it lost the focus and gets no input.

What quitting does

The engine runs one game per process. The game profile and the early loading run once, and a second Play in the same session is refused (ShellMain.m). So the engine cannot hand the window back to the library. iOS also has no way for an app to start itself again.

So Quit does the same steps as the app going to the background and then a SIGTERM:

  1. The cloud saves go out (save_sync_flush, as when the app goes to the background).
  2. The host stops audio and graphics and drains GPU work (dm_host_shutdown).
  3. The app ends.

What the game saved is on disk already. The note says it plainly: unsaved progress is lost, the app closes and opens on your games next time. When the player opens it again, the shell shows the library with that game first.

The patches

  • 0068-ios-quit-a-game-from-the-in-game-menu-or-by-hold.patch: the menu item, the prompt (quit_prompt.h, Core Animation and Core Text only), the iOS Home hold on upstream's home_quit.h, and the quit steps. Upstream-Status: forwarded seedds/nxnative#1115. It differs from upstream in one line: the fork reads the game's name from dm_profile()->name (0001), upstream from DM_GAME_NAME.
  • 0069-ios-shell-compile-the-in-game-menu-so-the-gear-o.patch: the shell compiles GameMenu.swift and LauncherSettings.swift, as the Duo harness does. fork-only, because the shell is the fork's (0050). At the 641d148 pin the shell does not link without it. DmGamepad.m's gear calls dm_game_menu, which only GameMenu.swift defines. test_shell_build.py on Engine pin: seedds/nxnative 641d1480021a (52 commits ahead) #598 alone fails with Undefined symbols: _dm_game_menu. With 0069 it passes.
  • The shell passes DM_HOME_QUIT_TEXT in the player's language (ios.host.quit*), as the Mac launcher does for its prompt. The hold, title, Quit and Cancel texts reuse the Mac's homeQuit.* translations. The new note in it, sv, de and fr is machine-translated and needs a native look. zh is mine.

Whoever merges renumbers 0068 and 0069 if main has taken those numbers.

Checked

  • Tests:
    • python3 -m unittest dm/ios/tests/test_quit_prompt.py: the touch steps of the state machine, and the layout on iPhone, iPad and Duo screens in six languages.
    • test_shell_build.py with DM_SHELL_PACKAGE=frontend-ios: the shell is generated and built unsigned.
    • test_pad_geometry.py.
    • GAME=010015100B514000 python3 dm/ios/tools/compile_check.py: 262 files, 0 failed, both passes.
    • t_home_quit: 40 checks.
    • python3 tools/engine.py check.
    • swift test --package-path frontend-ios: 136 tests. Two of them are new: the prompt's texts reach every game with its name, and the texts follow the rules in every language.
    • tools/l10n_shell_catalogs.py --check, the l10n tool tests and the Qt l10n tests.
  • Test for a fix: not a fix.
  • Visual QA: QP_CAPTURE_DIR=<dir> python3 -m unittest dm/ios/tests/test_quit_prompt.py draws the prompt with the same layers the game uses, on the Mac.
  • Not run:
    • The Duo harness (needs the Simulator).
    • The real teardown on a device.
    • The Home hold with a real controller on iOS 27, and what the Home setting for apps is by default on a new iPhone.
    • How the app closing looks to the player.
    • VoiceOver on the prompt.
    • The menu item itself. A UIMenu cannot be drawn without the Simulator, so there is no picture of it.

Screenshots

There was no prompt before, so there is no before picture. The gear menu with Quit could not be captured (see above).

After, iPhone 15 size, English, German and Chinese. Both pills have the same width in every language:

prompt en
prompt de
prompt zh

iPhone SE size:

prompt SE

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#..., or pending until that PR is open
  • 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

…g Home (#421)

0068 ends the gear's in-game menu with Quit <game> and opens a quit
prompt over the game, the Mac's in look, from it or from a 2 s Home
hold. Quitting flushes the cloud saves and ends the app as on SIGTERM.
One game runs per process, so the player opens the app again.
Forwarded as seedds/nxnative#1115.

0069 makes the shell compile GameMenu.swift, which the gear needs. At
the 641d148 pin the shell does not link without it.
Every game gets DM_HOME_QUIT_TEXT in the player's language, as the Mac
launcher passes it for its Home button prompt. The engine shows the
prompt for Quit in the in-game menu and for a held Home button. Texts
in all six languages, the note in it, sv, de and fr machine-translated.
@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 ios iPhone or iPad labels Nov 3, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation windows Windows (the Qt front end) patch-queue Changes the patch queue or the upstream pin labels Nov 3, 2026
@v0lumehi
v0lumehi merged commit a5b51f0 into v0lumehi/engine-bump-1.1.0 Nov 3, 2026
18 checks passed
@v0lumehi
v0lumehi deleted the v0lumehi/ios-quit-menu branch November 20, 2026 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request ios iPhone or iPad launcher The NX2Apple launcher app 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