Skip to content

Controls: one-click controller layouts, and Auto picks one for the controller - #84

Merged
LNPANDY merged 1 commit into
LNPANDY:mainfrom
v0lumehi:feat-70-control-presets
Oct 27, 2026
Merged

LNPANDY merged 1 commit into
LNPANDY:mainfrom
v0lumehi:feat-70-control-presets

Conversation

@v0lumehi

Copy link
Copy Markdown
Collaborator

Closes #70.

Settings → Controls has a Button layout picker with the modes from the discussion in #70. Each mode is only a value of DM_PAD_MAP, so there is no engine change.

Mode DM_PAD_MAP For
Standard layout empty, as today: by position, right A, bottom B, top X, left Y PlayStation and other controllers
By label A=B,B=A,X=Y,Y=X Nintendo and Xbox controllers: A/B/X/Y as printed
Custom the per-button map changing any button switches to Custom, starting from what the current mode sent
Auto Standard or By label, from GCController.productCategory matches "Xbox", "Switch Pro", "Joy-Con" / "JoyCon"

The page shows which controller is connected and what Auto would pick, and updates when controllers come and go. Saved settings from before load as Custom if they had buttons changed, otherwise as Standard.

Why one swap fits both families:

Limit, said in the UI: the launcher passes one map for every controller. Auto picks from the controller connected when you press Play, and two different kinds at once can't both be right. A per-controller choice belongs in the host (seedds/nxnative#382).

The layout is stored with the rest of the controls, which apply to every game.

Checked:

  • swift build -c release clean, swift test: 55 pass (3 skipped). The 5 new tests cover each mode's value, Auto per product category (stand-in strings), switching to Custom, and older saved settings.
  • Not checked: a real controller.
Auto, Xbox controller connected By label

Ideas from seedds/nxnative#102, #180, #295 and #382, and @Nishikori-Yui's structure in #70.

…ntroller (LNPANDY#70)

The Controls page had only the per-button choice, so playing with an Xbox or a
Nintendo controller by its printed letters took four changes by hand. It now has
a layout, each one only a DM_PAD_MAP value (the host is unchanged):

- Standard layout, the default: nothing passed. The host reads the face buttons
  by position in the Nintendo layout (front_mac.m pad_read); for PlayStation and
  other controllers.
- By label: A=B,B=A,X=Y,Y=X. GameController reports both families by their
  letters: an Xbox controller's are Apple's diamond, and a real Pro Controller's
  A, on the right, arrives as buttonA (seedds/nxnative#382). The host's
  positional reading turns each into the other letter, so one swap serves both,
  and for a Nintendo controller it is also its position.
- Custom: the buttons chosen by hand. Changing a button switches to it, starting
  from what the buttons sent in the layout before.
- Auto: By label or Standard from GCController.productCategory of the controller
  connected at Play (Nintendo, Switch Pro, Joy-Con/JoyCon or Xbox in the name).
  The note says the limit: one map for every controller, so two kinds at once
  cannot both be right; a per-controller choice belongs in the host (LNPANDY#382).

The page shows the connected controller and what Auto picks for it, following
connects and disconnects. The layout is stored with the rest of the controls;
settings saved before it load as Custom when they had buttons set, else Standard.
A preset counts as one change in Settings.

The tests check each layout's DM_PAD_MAP, Auto's choice for stand-in categories,
an edit switching to Custom, old saved settings, and the swap played through the
host's reading for both families; a mutation of the swap fails them. swift build
-c release is clean, swift test passes (55, 3 skipped), and the visual QA renders
the page scrolled to the layout by the controller's focus, Auto with a stand-in
Xbox controller and By label with none. Not checked with a real controller.
@v0lumehi
v0lumehi force-pushed the feat-70-control-presets branch from 8253794 to 9b814c4 Compare October 27, 2026 16:46
@LNPANDY
LNPANDY merged commit 0313148 into LNPANDY:main Oct 27, 2026
6 checks passed
LNPANDY added a commit that referenced this pull request Oct 27, 2026
…nostics and Saves captures

The three visual-QA blocks share one test method; the splice dropped the controller block's
do-close, which the compiler placed at end of file (969:1 expected '}' in class).
@v0lumehi
v0lumehi deleted the feat-70-control-presets branch November 1, 2026 05:10
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.

Controls: one-click layouts (Nintendo, Xbox, by label)

2 participants