Skip to content

Launcher: a Controls page for keys and controller buttons, and one width for the settings' buttons and controls - #39

Merged
LNPANDY merged 3 commits into
LNPANDY:mainfrom
v0lumehi:launcher-controls
Oct 27, 2026
Merged

LNPANDY merged 3 commits into
LNPANDY:mainfrom
v0lumehi:launcher-controls

Conversation

@v0lumehi

@v0lumehi v0lumehi commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Two launcher changes: the controls remapping KohlerVG asked for in #27, and one width for the buttons and controls on the Settings and Launch options screens.

Controls

Settings → Controls → Customize… opens a sheet that lists every keyboard function and every controller button. The keyboard functions come first: the sticks and D-pad, then the buttons and Shake.

  • Keys: click a field and press the new key. Esc keeps the old key; × leaves the function on no key. One key holds one function, so the function that had the key before is left on None. The host does the same.
  • Controller: each button picks the button it sends, e.g. A and B swapped.
  • The right stick has no keys by default and can get some here, for camera control on the keyboard.
  • The layout is kept in the user defaults and applies to every game. Play passes only the changes, as DM_KEYMAP / DM_PAD_MAP. The game's own launch options win if both ever set one variable.

Engine side: the host reads these from seedds/nxnative#386 on (dm/host/input_map.h), so the sync brings it and this fork carries no engine change. A build without it ignores both variables and plays with the default keys, which the sheet's footer says.

One width

  • Settings: every button in the cards has the same minimum width (150 pt), so Refresh, Change folder…, Customize…, Check for updates and Check again stand in one column. The interface language choice (e82f60b) uses the launcher's own list instead of the system pop-up menu, drawn like those buttons and the same width.
  • Launch options: every control sits in one column of one width (220 pt). The 30/60 fps, Docked/Handheld and Standard/MetalFX choices share it equally, the language list fills it, and the slider with its percentage fits it. Before, each control was as wide as its labels.

Checked

  • swift build -c release is clean. swift test gives 23 tests, 0 failures. The new ControlsTests covers:
    • defaults pass nothing
    • a move onto another function's key leaves that function on none
    • a swap, and a move back to the default that drops the entry
    • the controller map
    • persistence across a reload
    • every function has a label
  • The visual QA capture (NX_LAUNCHER_CAPTURE_DIR) renders the Controls sheet as well now. I checked the Settings, Launch options (with Breath of the Wild's launcher.json) and Controls captures by eye.
  • Only frontend/ changes, so pr-scope has nothing to say.

Screenshots

These are rendered by the visual QA test (NX_LAUNCHER_CAPTURE_DIR). Launch options use Breath of the Wild's launcher.json. The Controls sheet has right stick up moved to I, so Y is on none, and A/B swapped on the controller.

Settings Launch options
Controls: keyboard Controls: controller

The controller lists now take the keyboard rows' width (ec36d40): at 140 pt the screenshot showed "Left stick press" cut short.

…dth for the settings' buttons and controls

Controls (asked for in LNPANDY#27): Settings has a Controls card whose
Customize... opens a sheet with every keyboard function (sticks and
D-pad, then buttons and Shake) and every controller button. A key is set
by clicking its field and pressing the key (Esc keeps the old one, x
leaves the function on no key); one key holds one function, so the
function that had it is left on none, as the host does. A controller
button picks the button it sends. The layout is kept in the user
defaults, and Play passes only its changes as DM_KEYMAP / DM_PAD_MAP,
which the host reads from seedds/nxnative#386 on (input_map.h); a build
without it ignores them. The game's own launch options win over the
layout if both ever set one variable.

Widths: the Settings cards' buttons all have one minimum width, so they
stand in one column (Refresh, Change folder..., Check for updates, Check
again). In Launch options every control has one column of one width:
the two- and three-way choices share it equally, the language list
fills it, and the slider with its value fits it, so the controls of a
card line up whatever their labels.

ControlsTests checks the defaults (nothing passed), a move onto another
function's key, a swap, a move back to the default, the controller map,
persistence and the labels; the visual QA capture renders the sheet.
…ke the buttons beside it

The language choice (e82f60b) was the system's pop-up menu, the one
control on the Settings page in the system's look. It is the launcher's
list now (LauncherMenuPicker, as in Launch options), drawn as the
secondary buttons are (buttonLike) and as wide, and the App card has its
divider between the two rows like the other cards.
…bel is cut

At 140 pt, Left stick press and Right stick press were cut short. The
lists take the keyboard rows' width (168 pt: the clear button and the key
field), which fits every label and lines both columns up.
LNPANDY added a commit that referenced this pull request Oct 27, 2026
…rts are repaired

The launcher's Controls page (PR #39) writes DM_KEYMAP / DM_PAD_MAP at Play, but nothing on
this side read them: the page moved the fields and every game kept its default keys. This
brings seedds/nxnative#386's engine side here — dm/host/input_map.h (the key and button maps,
pure so a test runs without a keyboard) and front_mac.m using it in place of the fixed
key_bit() switch — so the page does what it says. #386 is still open upstream, so
front_mac.m and input_map.h are carriers here (OURS for the two new files, patch_front_mac()
for the changed one), and the day #386 merges, a sync finds every anchor applied already.

Two more things surfaced while checking the suites:

* patch_nso.py had lost the NRO header skip (issue #14). It was fixed in 4b86323 and then
  silently reverted by a sync, because the file was not a carrier: an NRO's text starts at
  0x80, and scanning from 0 read the header's build ID as instructions and skipped the last
  128 bytes of text. Restored, and patch_nso.py is a carrier now (patch_patch_nso).
* patch_tests_makefile() opened with `if 'romfs_arc.c' in t: return skip(...)`, which made the
  touch-pad test block that follows dead code ever after. Its first addition skips on its own
  now, so the new t_input_map rule is not skipped as well.

docs/env_switches.tsv gains the rows the tool asks for (DM_KEYMAP, DM_PAD_MAP), the two it
listed with no meaning (DM_FULL_ROMFS, DM_PROFILE), and the mode change PR #41 needed.

Checked: t_input_map 22/22; the full host suite (make -C dm/host/tests run) exits 0; dmhost
builds; the Python suite is 350 passed, 17 skipped, 0 failed (test_env_switches and
test_nro_header were both failing before this); the sync reports every patcher agreeing with
the tree.
@LNPANDY
LNPANDY merged commit 816684f into LNPANDY:main Oct 27, 2026
@LNPANDY

LNPANDY commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Merged as 816684f6 — thank you, this is a good PR. The Controls sheet, the tests and the one-width pass all hold up: swift build -c release is clean and swift test gives 23 tests, 0 failures against today's main, with no conflicts after the rebase.

One thing you could not have known, and it was worth the wait: the engine side of your PR did not exist in this fork. Your PR description says the host reads DM_KEYMAP / DM_PAD_MAP from seedds/nxnative#386, which is true — but #386 is still open upstream, so none of that code is here. dm/host/front_mac.m was byte-identical to upstream: no input_map.h, no getenv("DM_KEYMAP"). The sheet would have saved the layout, passed it at Play, and every game would have kept its default keys without a word in the log.

So I brought #386's engine side over in 9f7d4216, before merging this:

I also verified the chain end to end: NSWorkspace.OpenConfiguration.environment → dm/mac/launcher.c's env_file(), which only fills variables that are not set yet (setenv(..., 0)), so the launcher's values win over env.txt.

Two smaller notes on the diff, neither blocking:

  • ControlLayout.assign walks Self.functions twice per call and rebuilds the dictionary each time. It is a 25-entry list on a click, so it does not matter; mentioning it only so you know I looked at it and decided not to ask for a change.
  • The 148/168 widths in keyRow/padRow are hand-tuned to each other. If a longer label ever lands, they will drift apart; LaunchControl.width is the pattern the other screens use.

frontend/README.md's Controls section says a build without the engine change ignores the variables and plays with the default keys. That was true when you wrote it and is no longer: a build from now on reads them. Want to adjust that sentence, or shall I?

LNPANDY added a commit that referenced this pull request Oct 27, 2026
…who carries them

The section said a build without the engine change ignores DM_KEYMAP / DM_PAD_MAP and plays
with the default keys. That was true when PR #39 was written — seedds/nxnative#386 was open
and nothing here read them — but 9f7d421 carried #386's engine side into this fork, so it
reads them now. It also points at docs/env_switches.tsv, where both names are listed.
@v0lumehi
v0lumehi deleted the launcher-controls branch November 1, 2026 05:10
Wilderness01 added a commit to Wilderness01/NX2Apple that referenced this pull request Nov 12, 2026
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