Skip to content

Console mode: a full-screen, controller-first view of the library (view layer, previewable with NSPB_CONSOLE_DEMO), and the player-mode setting - #169

Merged
LNPANDY merged 16 commits into
mainfrom
v0lumehi/console-mode
Oct 29, 2026
Merged

LNPANDY merged 16 commits into
mainfrom
v0lumehi/console-mode

Conversation

@v0lumehi

@v0lumehi v0lumehi commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

What players see now

Console mode works. With a controller connected, press its Select-type button (DualShock Share, DualSense Create, Xbox View, Nintendo Minus) on the desktop: the bottom hint row shows that controller's own glyph with "Console mode". You can also answer the connect prompt (once per launch, switch it off in Settings) or use View, Console Mode (Option-Command-K, since Control-Command-F is the system's full screen). The window goes full screen for the mode and goes back when you leave. The Home button is not touched, and in console mode Select does nothing special (B goes back). The desktop shows no controller status. Settings, Controls has the Controllers list (identify, assign players) and All controllers are player 1 (makes Play pass DM_PAD_MERGE=1).

desktop bottom bar
connect prompt

What is added

A full-screen, controller-first view of the library (notes in frontend/Console.md):

  • Real driver (LiveConsoleDriver): games and status from GameLibrary, covers through GameLibrary.artwork, launch options through SavedChoices (the store LaunchOptionsView uses), controllers from GameController (kind, player, battery, connect and disconnect toasts, Identify as a short rumble when the controller has haptics). Play goes through GameStart.environment, the function the desktop Play button now uses too, so saved choices and DM_PAD_MERGE match. Starting ends when the game window takes the front, and when the game quits the console comes back to the front. PR The launcher comes back to the front when a game it started quits #110 (the launcher returns to the front when a game quits) only observes the same termination and does not conflict. A Bluetooth controller cannot be dropped by an app, so Disconnect says where to do it.
  • Input: the view uses the launcher's LauncherGamepad. D-pad and left stick move, A activates, B backs out, + and X open game options, Y opens Controllers, and the keyboard works as well. Face buttons are read by label in one place (LauncherGamepad.face): A is the bottom button on Xbox and PlayStation (the cross) and the one printed A on a Nintendo-layout controller, as GameController reports them. This also changes the desktop launcher's pad navigation from the old by-position reading. The in-game mapping setting (By label / By position, Controls: one-click layouts (Nintendo, Xbox, by label) #70) is unchanged.
  • Glyphs follow the last input (ConsoleGlyphs), in console mode and in the desktop pad hints: the controller's own symbols (sfSymbolsName, with a per-family table as fallback), key caps after the keyboard, a neutral letter if nothing is known. The glyph is the element the same mapping reads.
  • Battery is our own proportional icon (red at 20 percent or less, a bolt while charging), in the chips and the Controllers list.
  • Covers: nothing is bundled and there are no SwiftPM resources. The demo loads covers from the repository's docs/images through GameLibrary.artwork(for:repo:) and draws a generated placeholder when an image is missing. The first commit still carries Codex's 12 JPGs in history, so squash on merge.
  • The desktop's top tabs no longer change width when the selection moves. That came from upstream/main (the selected tab is bold), not from this PR.

Demo scenarios (still available)

cd frontend
NSPB_CONSOLE_DEMO=full swift run          # 12 games, ready, needs-build, missing-data and broken
NSPB_CONSOLE_DEMO=few swift run
NSPB_CONSOLE_DEMO=empty swift run
NSPB_CONSOLE_DEMO=controllers swift run
NSPB_CONSOLE_DEMO=controllersMixed swift run
NSPB_CONSOLE_DEMO=starting swift run      # simulated shader progress, never a real launch

Identity rules

The console view is our own design, not a copy of a console home menu. No round system-button row under the tiles, no console fonts, icons, sounds or wording, no brand logos. It uses the launcher palette, Manrope and generic SF Symbols. Changed in review: the fixed A/B/Y/+ circle icons in the hint bar became glyphs that follow the controller in use, the controller kinds are named fullSize and paired ("Full-size pad", "Paired controllers"), and the mock "Pro controller" became "Full-size controller". There is no semicolon in any user-facing string (en or zh), and a test checks it.

Screenshots (offscreen capture, 1920x1080 and compact 390 wide)

1920x1080 compact
Home (Xbox glyphs)
Home (DualSense glyphs)
Home (keyboard caps)
Controllers (mixed)
Options
Starting
Empty

Checks

swift build -c release and swift test in frontend/ pass (300 tests, 11 opt-in captures skipped), python3 scripts/patches.py check is ok, and each demo scenario starts from the release binary.

Manual checks I still do

  • A real controller: D-pad, A, B, +, Y, Select opening console mode (buttonOptions), glyphs for your controller family. Identify, battery, Home-free launch and the DualShock 4 were checked by the author on hardware in earlier rounds, the rest of this list has not been.
  • Several controllers: every controller GameController lists drives the launcher and is published on its connect notification (debug log under subsystem NX2Apple, category console.controllers, showing what macOS reports). Picking a player turns player-1 merge off, the next press from any controller takes that player, B cancels, 8 seconds time out. Tested with fakes only.
  • Every connected controller is sent its player once per assignment (player lights, and a calm light bar colour per player), because a DualShock 4 over Bluetooth only reports its battery after an output report. GameController's repeated connect and disconnect notifications are handled once per instance.
  • Entering and leaving console mode is a short calm transition (0.4 s, no bounce, plain fade with Reduce Motion), sequenced with the macOS full screen animation. It could not be screen-recorded from this session, so it needs a look.
  • Controllers come from GameController only (GCController.controllers() and the connect and disconnect notifications), keyed by instance, published at once, torn down on disconnect and rebuilt on connect, with the old player back for a returning controller. An earlier IOKit watcher was removed because it produced a phantom "GamePad-1" entry, and a test keeps IOKit out of the controller code. Debug logs: subsystem NX2Apple, category console.controllers.
  • Battery: shown only when known (a level with its percentage, a bolt while charging). Nothing is drawn for no battery object or 0 with an unknown state. It is observed with KVO and read at launch, 2 s and 5 s after a connect, then every 20 s, with a debug log per read.
  • Full screen on entering and the earlier window state after leaving.
  • Starting a real game, then quitting it: the console should come back.
  • Shader progress while Starting is only the preparing and opening stages, since the launcher has no live shader count.

Type: feature, 48h.

… input, player-mode setting

- Remove the 12 bundled cover JPGs and the SwiftPM resources change. The demo loads covers
  from the repository's docs/images through GameLibrary.artwork (the launcher's own lookup),
  with a generated placeholder (palette gradient and title) as the fallback.
- Identity: hint glyphs follow the input used last (ConsoleGlyphs: the controller's own
  symbols, key caps for the keyboard, a neutral letter otherwise) instead of fixed A/B/Y/+
  circles. Controller kinds are named fullSize and paired, not after a console's products.
- The controller works in console mode through the launcher's LauncherGamepad (D-pad and
  stick move, A activates, B backs out, + and X open options, Y opens Controllers).
- Home is one status row (controller chips and the clock), the focused game's title appears
  once, and the NX2Apple wordmark is gone.
- The "Console mode" entry button, the connection prompt and the controller strip stay
  hidden until the console is wired, so the launcher looks as before.
- New launcher setting "All controllers are player 1" (off by default, UserDefaults): Play
  passes DM_PAD_MERGE=1. In Settings and in the Controllers sheet.
- Tests for the environment plumbing, the glyph resolution and the pad path into the view.
…ins, Starting backdrop

- Focus changes cross-fade in place: the title slot has a fixed height and fades in 0.15 s, the
  background art fades in 0.38 s, the tile scale stays at 1.025 and the row scroll eases
  without overshoot. A new focus replaces the running animation.
- Face buttons are read by label in one place (LauncherGamepad.face): A confirms, B backs out,
  Y opens Controllers. On Xbox and PlayStation that is the bottom button, on a Nintendo-layout
  controller the one printed A, as GameController reports them. The glyphs take the element
  from the same mapping. The Controls page layout for games (#70) is unchanged.
- The lone glyph beside the clock is gone.
- The focus ring hugs its control in console mode (PadRingStyle.hug), in the control's own
  shape. The desktop launcher keeps its outset ring.
- Identify, Assign player and Disconnect are three equal tiles with the icon above the label.
- The tile row is clipped to the page margins, and the version label has a fixed width so the
  platform badges do not move.
- Starting shows the cover aspect-filled, blurred and darkened behind the unchanged text.
…ttery icon, layout fixes

- LiveConsoleDriver runs the console over the real library, saved choices, GameStart.environment (shared with the
  desktop Play button), controllers from GameController and the player-mode setting. Starting ends when the game
  window takes the front, and the console comes back when the game quits.
- Entry: a Console mode button in the top bar, the controller prompt (once per launch, setting to turn it off) and
  View, Console Mode (Option-Command-K). The window goes full screen for the mode and back.
- The desktop pad hints use the same ConsoleGlyphs as the console.
- Battery drawn as a proportional icon (red at 20 percent or less, bolt while charging).
- Equal-width hint slots, tile focus ring and image as one unit, edge captions hidden when clipped, Starting shows
  only the blurred cover with the text centered.
- Top nav tabs no longer change width when the selection moves (the selected tab is bold).
…r row

- The connect prompt has one button row, macOS order, both buttons the launcher's standard size, glyphs of the
  controller in use, and a Don't ask again checkbox tied to the Settings switch.
- The desktop controller chips sit in the top bar row itself, before the Console mode button, and never clip: a
  short bar drops the battery and folds the rest into a +N chip.
- A controller with no player shows a dash in its chip, the full word stays in the Controllers list.
…versions, calmer scrolling, wide hint bar

- A controller that connects without a player takes the next free one (P1, P2, ...) with a toast, so players never see
  Unassigned. With all four taken the toast says to open Controllers, with the button glyph.
- Statuses say what this Mac can do: built for Mac is ready, built for iPhone only says iPhone only and explains how to
  build for Mac, then Not built yet and Needs game data.
- The version comes from the Mac app, the iPhone app or the IPA, and the label is hidden only when none states one.
- The row scrolls only when the focused tile would leave the visible area, by the least needed, in 0.2 s without
  overshoot. The title cross-fade is 0.12 s, opacity only.
- Wide layout: inline hints centered as a group with the active one a cream pill. Compact keeps equal pills.
…ngs row

- The controller's Home button opens console mode while the launcher is in front (GameController's
  preferredSystemGestureState on buttonHome, restored when the launcher is not active so a game keeps its own).
  Settings, Controls has a switch for it. The connect prompt and the desktop hints show the Home glyph.
- The desktop shows no controller status. The Console mode button and the Home hint are at the bottom right while a
  controller is connected, and Settings, Controls has a Controllers row next to the player-mode switch.
- Identify uses what the controller has: player lights, light bar, a rumble that keeps its haptics engine alive, and
  is hidden when it has none.
- A battery that reports 0 with an unknown state (a DualShock 4 over Bluetooth) is shown as unknown, not as a red 0%.
  The levels are read again every 20 seconds.
…ment by press, battery rules

- Select (buttonOptions, the system does not claim it) opens console mode from the desktop, and the desktop hint shows
  the controller's own glyph with Console mode. Home is not touched. The connect prompt mentions Select. Select does
  nothing in console mode.
- Every controller GameController lists drives the launcher (per controller press edges, a handler on each physical
  input profile) and is published the moment its connect notification arrives, with a debug log of what macOS reports.
- Picking a player turns All controllers are player 1 off. The next press from any controller takes that player, is not
  used to navigate, swaps the former holder to the freed number and sets the controller's player lights. B cancels, 8
  seconds time out. The merge row is a switch with its state spelled out.
- The battery icon is built from one geometry (outline stroked inside its frame, fill inside the inner rect, snapped to
  pixels) with a test. Charging and full show the bolt, an unknown or unreported battery is an outline only.
- Controller chips take their own width, an overflowing row fades. The wide hint bar is spaced like the original and
  centered. Controllers settings row in Settings, Controls.
- A controller with no battery object is shown as wired (a plug symbol, no number). A battery object with an unknown
  state stays an outline. The fill grows smoothly between reads.
- IOKit registry matching (no device is opened) reports game pads the moment they are plugged in. They show as
  Connecting until GameController reports them, or for ten seconds, and disappear on the hardware detach even before
  GameController lets go. GameController's connect and disconnect notifications still publish at once.
- A disconnect tears down the old instance (input handler, haptics engine, Identify). A controller coming back takes its
  old player when that is free, and its battery is read again 2 and 5 seconds after a connect.
- Debug logs with timestamps under subsystem NX2Apple, category console.controllers.
…ery logged per read

- A controller without a battery object is called wired only after the object has been missing for six seconds, so a
  battery GameController hands over a moment after the connect shows its level (and is never labelled wired).
- Battery reads happen at launch and at 2, 5 and 8 seconds after a connect, then every 20 seconds, from the current
  instance, and each read is logged (identity, object present, level, state) under category console.controllers.
- The IOKit watcher, the Connecting placeholders and the safety-net polling are removed. Controllers come from
  GCController.controllers() and the GameController connect and disconnect notifications, published at once, keyed by
  the instance, torn down on disconnect and rebuilt on connect. A returning controller gets its old player back.
- Battery is read from the current instance on every refresh (at launch, 2 s and 5 s after a connect, then every 20 s),
  and a controller counts as wired only when it still has no battery object at the 5 s read.
- The connect prompt's scrim ignores the safe area, so it covers the strip behind the hidden title bar as well.
…ith KVO

- A controller without a usable battery reading (no battery object, or 0 with an unknown state) shows nothing: no outline,
  no plug, no Battery not reported. A known level shows the icon and the percentage, charging and full show the bolt.
- GCDeviceBattery's batteryLevel and batteryState are key-value observed, so a change refreshes the list at once. The
  reads at launch, 2 s and 5 s after a connect and every 20 s stay, and each read is still logged.
…m enter and leave

- Every connected controller is sent its player (player lights and light bar in a calm colour per player) once per
  assignment right after it connects. A DualShock 4 over Bluetooth only reports its battery after an output report, so
  the battery now appears without pressing Identify. No rumble on connect.
- GameController posts the connect notification two or three times per connect and the disconnect twice. The handling is
  idempotent per instance: one entry, one toast, one set of writes, one assignment.
- Entering and leaving console mode is a short calm transition (0.4 s, no bounce): the desktop settles back from 0.97 and
  the console arrives from a soft blur. It is sequenced with the macOS full screen animation (the content follows when the
  window has entered full screen, and the window leaves after the console faded out). Reduce Motion gets a plain fade.
@LNPANDY
LNPANDY merged commit d5b7823 into main Oct 29, 2026
9 checks passed
subyoung added a commit to subyoung/NX2Apple that referenced this pull request Oct 29, 2026
Play opens the game's app and the launcher stayed where it was: after a session there was nothing in front to pick the next game with. Console mode (LNPANDY#169) already came back on its own, with its own watcher; the desktop Play did not.

One watcher now serves both (GameReturnWatcher, ReturnAfterPlay.swift). The desktop Play and console mode register the process they opened, by its process ID, as LNPANDY#169 matched it; a game opened from Finder is left alone. When one quits, the caller's own bookkeeping runs (console mode ends its Starting state and keeps the selected game), and the launcher comes forward (unhidden, activated, its window in front) when Settings > App leaves "Come back when a game quits" on, the default. Console mode's own terminate observer and activation are gone, so the two ways of starting a game behave the same and the one switch covers both. The setting has its Swedish entry.

Checked: swift build; swift test, 364 tests, 0 failures (ReturnAfterPlayTests: a started game comes back once, another process changes nothing, switched off the bookkeeping still runs; ConsoleLiveTests unchanged, including testStartingEndsWhenTheGameQuits).
@v0lumehi
v0lumehi deleted the v0lumehi/console-mode branch October 29, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants