Repository navigation
iOS front end: DM_PAD_MAP moves the buttons of physical controllers (on #386) - #955
Open
Haseenesss wants to merge 2 commits into
Open
Haseenesss wants to merge 2 commits into
Haseenesss wants to merge 2 commits into
Conversation
…d controller buttons, and a Mac app keeps them as saved choices The keyboard's keys and the controllers' buttons were fixed in front_mac.m (key_bit and pad_read), so a player who wanted A on another key, the camera on the keyboard, or A and B swapped on a controller had no way to get it. Both maps now come from input_map.h, a pure header the front end reads at start: - DM_KEYMAP=<name>=<key code>,... puts a function on another key. The names are those of DM_KEYS (A ... Down, LUp ... RRight, Shake); the key code is the macOS virtual key code, or "none". One key holds one function: a key's earlier function is left on no key, so A=40,B=38 swaps A and B. The defaults are the keys as before; the right stick, which had no keys, can now have some. - DM_PAD_MAP=<name>=<name>,... makes the button that sends the first name by default send the second, after the default mapping by position, so it composes with however that mapping is made. Unset, both maps are the previous assignments, and the keyboard's held keys still release on focus loss and for the text box. A malformed entry is left out with a [RED] line; the rest still applies. A Mac app's launcher also reads launcher.DM_KEYMAP and launcher.DM_PAD_MAP from the app's preferences domain, in the same pass and order as the other saved choices (launch environment, env.txt files, saved choices) and with DM_SAVED_CHOICES=0. They are no launcher.json rows, so DMSettings cannot check them: the launcher includes input_map.h and asks input_map_valid(), the host's own parser without its log lines or a map. A value the host would not take whole (an unknown name, a key code past 127, a button where a key code belongs, empty, not a string) is ignored and logged. The controls are read whether or not the settings window ran, as the window does not offer them. pack_app.py lists input_map.h and dm_input.h among the launcher's inputs, so a change to them repacks. t_input_map (30 checks) covers the defaults, moves, swaps, none, case-insensitive names, the malformed entries and input_map_valid. test_nsp_mac_app.test_saved_controls starts a packed app with saved values: applied, environment and env.txt winning, DM_SAVED_CHOICES=0, invalid values ignored. The Mac host builds (make -C dm/host GAME=010015100B514000). The switches are in docs/env_switches.tsv (env_switches.py --check), the development guide's input row and docs/frontends.md (Saved choices); impact_map.tsv gets a rule for input_map.h.
The Mac front end applies DM_PAD_MAP to controller buttons (seedds#386), the iOS one ignored it, so a front end that offers a button mapping, such as Swap A and B, had no effect on an iPhone or iPad. DmGamepad.m now parses DM_PAD_MAP with input_map.h when the pads start, logs it, and passes each physical controller's buttons through pad_map_apply before dm_pad_set_player. The touch gamepad is unchanged, as on the Mac only physical controllers are mapped. docs/env_switches.tsv and docs/development.md say so. Checked: built into an iOS app (Release, Xcode 27.2) on an iPad mini (A17 Pro), iPadOS 27.2, with a controller: DM_PAD_MAP=A=B,B=A swaps A and B in game, no DM_PAD_MAP leaves the buttons as they were.
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 <noreply@anthropic.com>
2 tasks done
eyasbzour
added a commit
to eyasbzour/nxnative-online
that referenced
this pull request
Nov 13, 2026
…s#955) DmGamepad.m parses DM_PAD_MAP with input_map.h when the pads start and maps each controller's buttons before dm_pad_set_player; the touch gamepad is not mapped. Applied after press-to-join and the controller prompt.
lucaszhongsj
pushed a commit
to lucaszhongsj/nxnative
that referenced
this pull request
Nov 19, 2026
Upstream-Status: forwarded seedds#955 (on seedds#386, patch 0009) Reason: the iOS host ignores DM_PAD_MAP, so the shell's button mapping (global and per game) never reaches physical controllers. The Mac host applies it already Issue: LNPANDY/NX2Apple#494
sofianbll
pushed a commit
to sofianbll/nxnative
that referenced
this pull request
Nov 28, 2026
Upstream-Status: forwarded seedds#955 (on seedds#386, patch 0009) Reason: the iOS host ignores DM_PAD_MAP, so the shell's button mapping (global and per game) never reaches physical controllers. The Mac host applies it already Issue: LNPANDY/NX2Apple#494 Taken from LNPANDY/NX2Apple a79d397 (MIT), patches/0011-ios-apply-controller-button-mappings-to-physical.patch
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.
What and why
Depends on #386. This branch is #386's commit plus one new commit, the last one (
iOS front end: DM_PAD_MAP moves the buttons of physical controllers). Review only that one. I will rebase ontomainonce #386 lands.The Mac front end applies
DM_PAD_MAPto controller buttons (#386). The iOS front end ignored it, so a front end that offers a button mapping, for example Swap A and B, had no effect on an iPhone or iPad.dm/ios/Sources/DmGamepad.mnow:DM_PAD_MAPwithinput_map.hwhen the pads start, and logs it (malformed entries are left out and named in the log, as on the Mac)pad_map_applybeforedm_pad_set_playerThe touch gamepad is not mapped. As on the Mac, only physical controllers are.
docs/env_switches.tsvanddocs/development.mdnow say the switch works on iOS too.The need comes from NX2Apple's iOS shell, which now offers a global and a per-game button mapping and passes it as
DM_PAD_MAP(LNPANDY/NX2Apple#494, LNPANDY/NX2Apple#495). There it is carried as a patch until this lands.Checked
dm/tools/teststest_docs,test_env_switchesandtest_player_envpass. The change adds no parser code:t_input_map.cfrom Mac front end: DM_KEYMAP and DM_PAD_MAP move buttons to other keys and controller buttons #386 coverspad_map_parseandpad_map_apply.DM_PAD_MAP=A=B,B=Aswaps A and B in game. WithoutDM_PAD_MAPthe buttons are as before. The touch gamepad is unchanged.regress.py: none. The change is indm/iosonly, which no Mac build compiles, and it does nothing unlessDM_PAD_MAPis set.Docs
docs/reference/<subsystem>.mdentry, andpython3 dm/tools/docs_symptoms.pywas run (the symptom index): no finding, the switch's entries indocs/env_switches.tsvanddocs/development.mdare updateddmsh_chain.py --headerwas run anddm/gfx/nvn/dmsh_chain.his part of the change (no chain change)🤖 Generated with Claude Code