Skip to content

Mac front end: DM_KEYMAP and DM_PAD_MAP move buttons to other keys and controller buttons - #386

Open
v0lumehi wants to merge 1 commit into
seedds:mainfrom
v0lumehi:input-remap
Open

v0lumehi wants to merge 1 commit into
seedds:mainfrom
v0lumehi:input-remap

Conversation

@v0lumehi

@v0lumehi v0lumehi commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

What it does

The Mac front end's keys and controller buttons were fixed in front_mac.m. Both assignments now come from dm/host/input_map.h, a pure header with tests:

  • DM_KEYMAP=<name>=<key code>,… puts a button, a stick direction (the right stick too, on no key by default) or Shake on another key (macOS virtual key code, or none). One key holds one function: A=40,B=38 swaps A and B.
  • DM_PAD_MAP=<name>=<name>,… changes what a controller's buttons send, after the default mapping by position: A=B,B=A swaps them, none sends nothing.

Unset, both are the previous assignments. In the host, a malformed entry is left out with a [RED] line and the rest still applies.

Saved choices (the part added for #388)

launcher.DM_KEYMAP and launcher.DM_PAD_MAP are now saved choices in the app's preferences domain, read by dm/mac/launcher.c in the same pass and order as the others (launch environment, player's env.txt, bundle env.txt, saved choices, tested defaults), with the same DM_SAVED_CHOICES=0 and the same log lines (launcher: env … (saved choice), … not used: … is set, … ignored: …).

They are not launcher.json rows, so DMSettings cannot check them. The launcher checks them with the host's own parser instead: input_map_valid(spec, pad) in input_map.h runs the same parser as the host, without a map and without log lines, and the launcher includes the header (-I dm/host was already on pack_app.py's launcher compile line; input_map.h and dm_input.h are now among the packer's reuse inputs). So the host and the launcher cannot disagree about what a valid value is.

One difference from the host: the launcher takes a value whole or not at all. The host alone applies the good entries of a list and names the bad ones; for a saved value written by a front end, a value with any bad entry, an empty one, or one that is not a string is ignored and logged, so a saved choice is either what the player wrote or nothing.

The controls are read whether or not the settings window ran: the window does not offer them, so saved_choices() now also runs after the window's Play (it skips the DMSettings rows then, as the window applied those). docs/frontends.md ("Saved choices"), docs/env_switches.tsv and docs/development.md name the two keys and the different check.

Tests

  • make -C dm/host/tests GAME=010015100B514000: all pass; t_input_map 30 checks, 0 failed (22 before, plus input_map_valid: valid lists, unknown name, key code past 127, text, a sign, empty and NULL, the two maps not interchangeable).
  • dm/tools/tests/test_nsp_mac_app.py: 43 tests OK, including the new test_saved_controls, which packs a real Mac app with its own bundle ID and starts it with a stand-in host: a valid saved keymap and pad map are applied, a launch override and the player's env.txt win, DM_SAVED_CHOICES=0 ignores them (and leaves them saved), and invalid values (unknown name, A=128, text, a stick on a button, a key code in a pad map, empty, a non-string) are ignored and logged.
  • test_docs.py and test_env_switches.py: 11 tests OK.
  • make -C dm/host GAME=010015100B514000 builds the Mac host; launcher.c compiles with -Wall without warnings and links in the packed app.
  • The rest of dm/tools/tests (360 tests): 34 do not run on the machine used, for want of the optional Python modules capstone and lz4 (ModuleNotFoundError); the others pass. Not related to this change.

Not verified

  • scripts/regress.py check was not run: it starts games, and the Mac was in use by other runs. The report will follow from a run by the author. regress.py impact was run: the change reaches every Mac game through launcher.c and front_mac.m (it does not touch the host's graphics, services or tables).
  • A real start from Finder with a saved keymap, and the window path with a saved keymap (the tests have a launcher.json without settings, so the window does not show), have not been tried by hand.
  • Per-controller choices stay in the host, as one map applies to every controller.

v0lumehi added a commit to v0lumehi/NX2Apple that referenced this pull request Oct 27, 2026
…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.
LNPANDY added a commit to LNPANDY/NX2Apple 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 added a commit to LNPANDY/NX2Apple 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 force-pushed the input-remap branch 3 times, most recently from ce6fc7a to 48a08d9 Compare October 27, 2026 17:11
@v0lumehi

Copy link
Copy Markdown
Contributor Author

Updated along the lines in #388 ("Controls on the same store") and rebased on current main. A Mac app now also keeps launcher.DM_KEYMAP and launcher.DM_PAD_MAP as saved choices, in the same order as the others and with DM_SAVED_CHOICES=0. They have no launcher.json rows, so the launcher checks them with the host's own parser (input_map_valid in input_map.h) and uses a value only when the host takes all of it. They are read whether or not the settings window ran, because the window doesn't offer them.

The tests and the open points are in the description. The regress.py check report will follow from a run on my Mac.

@v0lumehi

Copy link
Copy Markdown
Contributor Author

I checked the saved controls with a real start. I packed Hades as a Mac app with this branch, started it with open (as a Finder double-click would), and wrote the keys with defaults write org.nxnative.0100535012974000 …:

  • A valid keymap and pad map:
    launcher: env DM_KEYMAP=A=40 (saved choice)
    launcher: env DM_PAD_MAP=A=B,B=A (saved choice)
    [dm] front end: keyboard map from DM_KEYMAP (A=40)
    [dm] front end: controller buttons from DM_PAD_MAP (A=B,B=A)
    
  • An invalid keymap (A=128): it is ignored, and the valid pad map still applies.
    launcher: saved choice DM_KEYMAP=A=128 ignored: the host does not take it
    launcher: env DM_PAD_MAP=A=B,B=A (saved choice)
    
  • DM_SAVED_CHOICES=0 in the player's env.txt:
    launcher: saved choices ignored (DM_SAVED_CHOICES=0)
    

Not checked: a start through the settings window. The window waits for a click, which an unattended run can't give.

No regress.py check report. regress.py impact says the change reaches every Mac game, through launcher.c and front_mac.m. But it only changes which key or button a function sits on, and nothing a regress run measures: shaders, frames or memory. The unit tests (t_input_map, 30 checks) and the Mac app tests (test_nsp_mac_app.py, 43, including the saved controls against a stand-in host) pass. If you want the report anyway, tell me which games and I'll run it.

@djdev0010

Copy link
Copy Markdown
Contributor

Question: would you take an in-game controls window as a follow-up to this PR?

What it is: Settings → Controllers… (⌘,) inside the running game.

What it adds on top of this PR:

  • Remap keys and buttons while playing, with no restart (Save to keep).
  • A separate map per controller type (Pro Controller, Xbox, …), so each follows its printed letters.
  • Pick which controller is which player by pressing a button on it.
  • Stick swap and a deadzone slider.

How it fits: it uses this PR's input_map.h parser and saved choices, so there's still only one remapping system.

Two things to decide:

  1. Should per-controller maps extend DM_PAD_MAP's format, or be a separate saved choice?
  2. Maps are per controller type right now, so two players on the same kind of controller share one. Would you prefer per-player maps?

Happy to wait until this PR merges.

image

@v0lumehi

Copy link
Copy Markdown
Contributor Author

Yes, please, that's a good follow-up, and building on input_map.h and the saved choices keeps it one system. On your two questions:

  1. I'd extend DM_PAD_MAP rather than add a second variable, e.g. DM_PAD_MAP=A=B;xbox:A=B,X=Y: an unprefixed part is the default for every controller, and a type: part overrides it for that controller type. Then the launcher, env.txt and saved choices stay one entry, and input_map.h parses it in one place.
  2. Per controller type is the right default, since it follows the printed letters. Per player could come later as the same syntax with a player prefix (p2:…) if someone needs it.

seedds has the final say on the format, of course. I'd wait for his review of this PR before you build on it.

@v0lumehi
v0lumehi force-pushed the input-remap branch 2 times, most recently from f21be82 to 97eaa98 Compare October 29, 2026 18:47
Haseenesss added a commit to Haseenesss/NX2Apple that referenced this pull request Nov 2, 2026
The upstream pull request builds on seedds/nxnative#386, which is patch
0009 here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added host The Horizon host: SVCs, services, threads, memory (dm/host) packing Building an IPA or a Mac app: the NSP script, extraction, the shader split, the packers mac The Mac front end and app (dm/mac, front_mac.m) tools Tools and scripts (dm/tools, scripts) docs Documentation labels Nov 3, 2026
@jonpage0

jonpage0 commented Nov 6, 2026

Copy link
Copy Markdown

Found while running this on two Macs with NX2Apple's launcher (which ships this patch as its 0009-mac-keymap.patch): g_held_fn keeps one bit per function, so two physical keys holding the same function interfere, and the function is recomputed on every key-down event, including repeats:

  • Shift+Up holds the right stick up; with an explicit RUp=<key> binding also held, releasing either key cleared the shared bit and dropped the direction the other key was still holding.
  • Holding Up and pressing or releasing Shift during the key's repeats rebinds the repeat's function (D-pad ↔ right stick), so the first function stays set with nothing to release it: a stuck D-pad or stick until the key is pressed again.

The fix that worked for me: track physical keys, then combine. key_state holds each pressed key code's function (plus one; zero = released); a key-down that is already down keeps the function it took at its first press (so repeats and Shift changes do not rebind it); a key-up clears only that key; the held functions are the OR over the keys:

typedef struct { uint8_t fn[IM_KEYS]; } key_state;   // each pressed key's function plus one; zero is released
static uint32_t key_state_event(key_state *s, const key_map *m, unsigned code, int down, int shift) {
    if (code < IM_KEYS) {
        if (!down) s->fn[code] = 0;
        else if (!s->fn[code]) {
            int f = key_map_fn(m, code);
            if (shift && f >= 12 && f <= 15) f = f == 12 ? IM_RLEFT : f == 13 ? IM_RUP : f == 14 ? IM_RRIGHT : IM_RDOWN;
            if (f >= 0) s->fn[code] = (uint8_t)(f + 1);
        }
    }
    uint32_t held = 0;
    for (int c = 0; c < IM_KEYS; c++) if (s->fn[c]) held |= 1u << (s->fn[c] - 1);
    return held;
}

front_mac.m then does g_held_fn = key_state_event(&g_key_state, &g_keys, c, down, shift) in the key handler and memset(&g_key_state, 0, sizeof g_key_state) where it already resets g_held_fn (focus loss, the software keyboard). t_input_map.c gets seven checks for it (Shift+Up holds the right stick; a repeat after releasing Shift keeps the original direction; an explicit binding can hold the same direction; releasing the shifted key keeps the explicit key held; releasing the last key clears it despite changed modifiers; plain Up holds the D-pad; pressing Shift during a repeat adds no stuck second function). Diff available if you want it as a commit on this branch.

@akratch

akratch commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Reviewed head e144537. I integrated your mapping parser and saved-choice support into a local Mac build, with adaptations for the newer input paths.

One parser edge worth addressing: keycodes 54–63 are modifier-only keys. AppKit reports them through flagsChanged, so accepting them while listening only for keyDown/keyUp produces assignments that never fire. The local parser rejects those codes, and the launcher and companion use the same restriction.

The newer host also has Shift+arrow camera controls. I preserved that shortcut when an arrow retains its default D-pad assignment; explicit remaps take precedence. Each physical key remembers the function selected on key-down until release, regardless of later Shift changes. Held functions are recomputed from physical keys, so releasing one of two keys driving the same function does not release the other. Focus loss and input prompts clear this state.

Applying the controller map once in the shared pad_set path covers GameController and raw HID, including the full-controller Switch 2 path. Separate Joy-Con device states remain unchanged; Home and controller-setup prompts retain their normal controls.

Validation: 38 parser/event checks passed, including ASan/UBSan, plus 5,828 C/Python parser-parity cases and launcher saved-choice precedence tests. A packaged OOT build also loads the latest copied save, detects the connected DualSense, and reports the test A/B and right-stick mappings correctly in its native diagnostics. Physical button presses on the remapped controller have not been exercised. These integration notes build on your patch.

eyasbzour added a commit to eyasbzour/nxnative that referenced this pull request Nov 13, 2026
… end

The keyboard goes through the key map (input_map.h), with main's Shift + arrow
right stick, pointer hiding and controller prompt keys kept. DM_PAD_MAP is
applied in pad_set, so GameController, raw HID and Switch 2 pads all take it;
main's press-to-join and pad release stay.
Ayymeric pushed a commit to Ayymeric/nxnative that referenced this pull request Nov 17, 2026
An Xbox or PlayStation pad maps by position by default, as Switch emulators do: the right button is A. DM_PAD_MAP=label (launcher: Face buttons, By label) maps GameController's buttonA, the bottom button an Xbox pad marks A, to the Switch's A, buttonB to B, X to X and Y to Y, as PC games read an Xbox pad, so the letters the game asks for are the pad's. Nintendo pads map name for name either way; raw HID pads keep DM_HID_MAP. On the Mac and iOS (pad_apple.h). The host also tells a build's stubs (frame step state +0xb0), for prompts that follow the layout.

Other pull requests propose the same mapping under other names (seedds#1481 DM_PAD_LABELS, seedds#2196 DM_PAD_LAYOUT); seedds#386 uses the name DM_PAD_MAP for a remap. The name here can follow whichever is taken.

Front-ends: new: DM_PAD_MAP (Face buttons: position, label), in launcher.json for every game

Co-Authored-By: Claude Opus 5.5 <[email protected]>
chgpalmer added a commit to chgpalmer/nxnative that referenced this pull request Nov 17, 2026
The Mac keyboard's keys were fixed in front_mac.m (key_bit, on_key), and
issues seedds#1216, seedds#2572 and seedds#2346 ask to change them. They now come from a map,
dm/host/keymap.h, a pure header with tests (t_keymap), as pad_hid.h and
ctrl_prompt.h are: each key presses a button, a stick direction or the shake,
a target may have several keys, and the default map is the previous layout,
Shift + arrows as the right stick included.

How it is built, and where each choice comes from:

- Keys are macOS virtual key codes (Carbon's kVK_*), as front_mac.m read them
  before: a binding is a key's place, so AZERTY's ZQSD works as WASD. They are
  named by the US layout (DM_KEYMAP=A=space RUP=up DUP=1), or #<code>.
- Shift, Control and Option are keys too. macOS reports them as flagsChanged,
  not key downs, so a modifier event is read with the device-dependent
  NX_DEVICE*KEYMASK bits (the trap seedds#1216's reporter names); Command (the
  menus'), Caps Lock and fn are never bound.
- A binding can be a chord, as in a game's own keybinding screen: hold
  Shift, Control or Option and press a key (shift+up; shown as the menus'
  symbols). A key pressed with a modifier held is the chord's target when
  the chord is bound, else the key's own, so ZL on Shift with the D-pad on 1
  is still ZL + D-pad up. Shift + arrows as the right stick (4de40e6, for
  Donkey Kong Bananza's camera) was a fixed branch of on_key; it is now the
  default map's RLEFT=shift+left ... RDOWN=shift+down, shown and editable
  like any other binding. Either side's modifier makes the chord.
- A key goes back up as it went down, and each target counts the keys that
  hold it: two keys on one target, or Shift let go before an arrow, release
  correctly. These are the two faults reviewers found in PR seedds#386's per-function
  bits (jonpage0, akratch on seedds#386).
- Stored as the saved choice launcher.DM_KEYMAP, the store and precedence
  decided on seedds#388 and landed with seedds#431 (launch environment, env.txt, saved
  choices, defaults; DM_SAVED_CHOICES=0). As seedds#386 proposed, the launcher checks
  it with the host's own parser and ignores a value the host would not take
  whole. PR seedds#386's form, <name>=<key code>,... with its names, reads too, so a
  value NX2Apple's patch of seedds#386 saved still applies.
- Remapping happens where it can be tested: Window > Keyboard Map... (Cmd-Shift-K)
  shows the map beside the running game, a click then a key press binds it
  (Esc stops; right-click: No Key, or Add Key... for another key as well),
  and the change applies at once and is saved. The panel never
  takes the key window, as the Cheats panel. The settings window's Keyboard
  section, right below Controls, opens the same map before the game.
- Presets are INI files, as controller profiles are in other emulators (one
  file per profile): the original layout, then
  ~/Library/Application Support/nxnative/keymaps/*.ini by their Name line.
  Save as Preset... writes one; they can be written by hand. The Preset
  pop-up at the top of the map names the preset the map is (Custom once
  changed), as emulators show the active profile.

keyboard_mac.h holds the keyboard part of the front end, as home_quit_mac.h
and pad_hid_mac.h hold theirs: front_mac.m's key monitor hands it each key of
the game window that is no menu shortcut, and input_release, the controller
applet's prompt and the text box let go of what it holds. The prompt takes
the map's keys of A and B as well as Return and Escape. pack_app.py rebuilds
the launcher when keymap.h changes.

Tests: t_keymap (71 checks, ASan and UBSan: the default map, chords (either
side, Control and Option, a key with no chord its own, a bound Shift both a
button and a chord's modifier, Shift let go first), repeats, two keys on one
target, errors, the full form and keymap files read back, the presets
folder, seedds#386's form); test_nsp_mac_app with a new test_saved_keymap (a real
launcher: the saved choice, a launch override, DM_SAVED_CHOICES=0, a value
the host rejects, seedds#386's form); test_docs, test_env_switches, test_usage,
test_launcher_settings; lint_c.py tidy with LLVM 23: no findings.
scripts/regress.py was not run: nothing below the Mac front end changes, and
its scripted input (DM_KEYS, DM_CTL) takes another path.

Played on a MacBook Pro (M3 Pro, 18 GB, macOS 27.2.1) with Ocarina of Time
(0400486024DEC000, v131072), handheld and docked: the map, the panel, presets
and the saved choice across starts; no added input lag noticed. The host was
built from this branch's front-end files on the commit the app's shader
library was packed with, since main's shader chain has moved on;
front_mac.m's keyboard code is the same on both.

Covers the keyboard part of PR seedds#386; DM_PAD_MAP (controller buttons) is not
touched.

Front-ends: new: launcher.DM_KEYMAP is a saved choice, checked by the host's parser (docs/frontends.md, Saved choices)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
chgpalmer added a commit to chgpalmer/nxnative that referenced this pull request Nov 18, 2026
The Mac keyboard's keys were fixed in front_mac.m (key_bit, on_key), and
issues seedds#1216, seedds#2572 and seedds#2346 ask to change them. They now come from a map,
dm/host/keymap.h, a pure header with tests (t_keymap), as pad_hid.h and
ctrl_prompt.h are: each key presses a button, a stick direction or the shake,
a target may have several keys, and the default map is the previous layout,
Shift + arrows as the right stick included.

How it is built, and where each choice comes from:

- Keys are macOS virtual key codes (Carbon's kVK_*), as front_mac.m read them
  before: a binding is a key's place, so AZERTY's ZQSD works as WASD. They are
  named by the US layout (DM_KEYMAP=A=space RUP=up DUP=1), or #<code>.
- Shift, Control and Option are keys too. macOS reports them as flagsChanged,
  not key downs, so a modifier event is read with the device-dependent
  NX_DEVICE*KEYMASK bits (the trap seedds#1216's reporter names); Command (the
  menus'), Caps Lock and fn are never bound.
- A binding can be a chord, as in a game's own keybinding screen: hold
  Shift, Control or Option and press a key (shift+up; shown as the menus'
  symbols). A key pressed with a modifier held is the chord's target when
  the chord is bound, else the key's own, so ZL on Shift with the D-pad on 1
  is still ZL + D-pad up. Shift + arrows as the right stick (4de40e6, for
  Donkey Kong Bananza's camera) was a fixed branch of on_key; it is now the
  default map's RLEFT=shift+left ... RDOWN=shift+down, shown and editable
  like any other binding. Either side's modifier makes the chord.
- A key goes back up as it went down, and each target counts the keys that
  hold it: two keys on one target, or Shift let go before an arrow, release
  correctly. These are the two faults reviewers found in PR seedds#386's per-function
  bits (jonpage0, akratch on seedds#386).
- Stored as the saved choice launcher.DM_KEYMAP, the store and precedence
  decided on seedds#388 and landed with seedds#431 (launch environment, env.txt, saved
  choices, defaults; DM_SAVED_CHOICES=0). As seedds#386 proposed, the launcher checks
  it with the host's own parser and ignores a value the host would not take
  whole. PR seedds#386's form, <name>=<key code>,... with its names, reads too, so a
  value NX2Apple's patch of seedds#386 saved still applies.
- Remapping happens where it can be tested: Window > Keyboard Map... (Cmd-Shift-K)
  shows the map beside the running game, a click then a key press binds it
  (Esc stops; right-click: No Key, or Add Key... for another key as well),
  and the change applies at once and is saved. The panel never
  takes the key window, as the Cheats panel. The settings window's Keyboard
  section, right below Controls, opens the same map before the game.
- Presets are INI files, as controller profiles are in other emulators (one
  file per profile): the original layout, then
  ~/Library/Application Support/nxnative/keymaps/*.ini by their Name line.
  Save as Preset... writes one; they can be written by hand. The Preset
  pop-up at the top of the map names the preset the map is (Custom once
  changed), as emulators show the active profile.

keyboard_mac.h holds the keyboard part of the front end, as home_quit_mac.h
and pad_hid_mac.h hold theirs: front_mac.m's key monitor hands it each key of
the game window that is no menu shortcut, and input_release, the controller
applet's prompt and the text box let go of what it holds. The prompt takes
the map's keys of A and B as well as Return and Escape. pack_app.py rebuilds
the launcher when keymap.h changes.

Tests: t_keymap (71 checks, ASan and UBSan: the default map, chords (either
side, Control and Option, a key with no chord its own, a bound Shift both a
button and a chord's modifier, Shift let go first), repeats, two keys on one
target, errors, the full form and keymap files read back, the presets
folder, seedds#386's form); test_nsp_mac_app with a new test_saved_keymap (a real
launcher: the saved choice, a launch override, DM_SAVED_CHOICES=0, a value
the host rejects, seedds#386's form); test_docs, test_env_switches, test_usage,
test_launcher_settings; lint_c.py tidy with LLVM 23: no findings.
scripts/regress.py was not run: nothing below the Mac front end changes, and
its scripted input (DM_KEYS, DM_CTL) takes another path.

Played on a MacBook Pro (M3 Pro, 18 GB, macOS 27.2.1) with Ocarina of Time
(0400486024DEC000, v131072), handheld and docked: the map, the panel, presets
and the saved choice across starts; no added input lag noticed. The host was
built from this branch's front-end files on the commit the app's shader
library was packed with, since main's shader chain has moved on;
front_mac.m's keyboard code is the same on both.

Covers the keyboard part of PR seedds#386; DM_PAD_MAP (controller buttons) is not
touched.

Front-ends: new: launcher.DM_KEYMAP is a saved choice, checked by the host's parser (docs/frontends.md, Saved choices)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation host The Horizon host: SVCs, services, threads, memory (dm/host) mac The Mac front end and app (dm/mac, front_mac.m) packing Building an IPA or a Mac app: the NSP script, extraction, the shader split, the packers tools Tools and scripts (dm/tools, scripts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants