Skip to content

Mac front end: a Joy-Con pair is one player - #799

Closed
stephenschloesser wants to merge 3 commits into
seedds:mainfrom
stephenschloesser:joycon-pair
Closed

stephenschloesser wants to merge 3 commits into
seedds:mainfrom
stephenschloesser:joycon-pair

Conversation

@stephenschloesser

@stephenschloesser stephenschloesser commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

What and why

What macOS 26 actually reports. With both halves connected, GameController presents a Joy-Con pair as one controller, Joy-Con (L/R), with an extended gamepad profile (probed on this Mac; iPadOS does the same, #585). That case is already whole and plays: it takes a player like any pad, dm_pad_face maps its buttons by their printed labels (#650), and this change leaves it alone (dm_joycon_side → DM_JOY_WHOLE, no pair formed). A lone Joy-Con has no extended profile at all and the front end still ignores it, as before.

This change is for the other shape: the OS handing over two controllers, Nintendo Switch Joy-Con (L) and (R), which is what the request describes. Today each half would take a player of its own — the left one with the d-pad, left stick, L / ZL and − but no A / B / X / Y, the right one with the buttons and stick but no d-pad — and neither could play. Both halves now hold one player slot and one standard state is read from them (dm/host/pad_joycon.h, new and shared like pad_apple.h, so the iPhone could use it the day iPadOS exposes halves):

  • Which half a controller is: from productCategory and vendorName — macOS names them Joy-Con (L) / Joy-Con (R), GameController's category is Nintendo Switch Joy-Con (L). A side is looked for before the combined (L/R), so two names that disagree still give one half; a Joy-Con named without a side, a Pro Controller, and anything else are used as they are (DM_JOY_NONE).
  • The merged state: the left half's d-pad, left stick, L / ZL and −, the right half's X / A / B / Y through dm_pad_face (their printed labels), right stick, R / ZR and + — the pad a Pro Controller reports. Sticks go to pad_axis as any controller's do, so travel and feel are unchanged.
  • Motion: the right half's GCMotion feeds the player's six-axis sensor (dm_motion_set), the left half's while the right one has none or is gone, as on a Switch where a pair's motion comes from the right Joy-Con. Swapping sources detaches the old one first, so the first sample of the new source is not read as a jump.
  • A half that goes away leaves the player to the other one instead of freeing it: the game keeps its npad and the remaining half plays with what it has. The player is freed, with nothing left pressed, when both halves are gone — no stall, no stuck button.
  • A half that comes back joins its partner's player rather than taking a second one: the slot belongs to the pair (pad_slot_owner in pad_slots.h), not to either controller.

DM_JOYCON_PAIR=0 keeps each half a controller of its own. This is general, not game-specific: front-end input routing only, no Horizon service changed. hle_hid.c needs no change — a pair arrives as one player's dm_pad_set_player state and one dm_motion_set source, which is what a Pro Controller already does.

A log says which shape a machine is in: one controller 'Joy-Con (L/R)' connected: player 1 line, or two half lines (this change: the Joy-Con pair is player 1).

Not this PR: iPadOS hands a pair over as one controller, so nothing pairs there; a pair held sideways as two players is #585's; a lone Joy-Con's profile (microGamepad, no extended gamepad) is a separate gap.

Checked

  • Tests: make -C dm/host/tests GAME=010099C022B96000 run — every suite passes (17/17), including the new t_pad_joycon (halves' names, the merged state with fake halves, a lone half, the one-stick tolerance, (L/R) read as whole), t_pad_apple, and t_hid (147 checks). python3 -m unittest dm.tools.tests.test_docs, test_env_switches, test_regress, test_usage: pass. python3 dm/tools/env_switches.py wrote the DM_JOYCON_PAIR row.
  • Games run, with title ID and version: Super Mario Galaxy 010099C022B96000 v1.3.1, Mac app built from this branch (--platform mac-app), booted and ran past frame 1200 with an Xbox pad on USB: controller 'Controller' connected: player 1 (npad 0); the same three [RED] shader lines the build before the change had, no new ones.
  • regress.py impact origin/main..HEAD: names Breath of the Wild, Tears of the Kingdom and Scarlet (hid: GetNpadState, GetNpadStates, GetSixAxisSensorStates, SendVibrationValue*, BindNpadStyleSetUpdateEvent) and Hades. dm/host/pad_joycon.h and pad_slots.h are added to dm/tools/impact_map.tsv (hle:*hid*) so later changes to them are scored. regress.py check --games was not run: the only local game, Super Mario Galaxy, has no smoke route and this machine has no baseline (regress.py list: route: no, baselines: none).
  • Devices and OS: M1 Pro, macOS 26.6.
  • Measurements before and after: not a speed change.
  • Not checked: this branch has not seen two Joy-Con halves, because macOS 26 does not present them separately here (see above); the halves case rests on t_pad_joycon's fake pads and Apple's documented Joy-Con profile. Also not checked: a pair on an iPhone, a third controller while a pair plays, and clang-tidy locally (no LLVM here; CI's ratchet covers it). Whether upstream wants code for a shape no Apple platform currently produces is the maintainer's call — it is a safety net, not a fix for a symptom visible today.

Docs

  • docs/playing.md (a Joy-Con pairs paragraph), docs/development.md (the Input row) and docs/env_switches.tsv (DM_JOYCON_PAIR); no game note or docs/reference entry — no guest-visible service changed, a pair is still one npad's pad state
  • Chain tool changed → dmsh_chain.py --header run and dmsh_chain.h included — not touched
  • No game files, keys or data extracted from a game

A Mac has each Joy-Con as a controller of its own, and neither half plays
alone: the left one has the d-pad, the left stick, L / ZL and − but no
A / B / X / Y, the right one the face buttons and stick but no d-pad. Both
halves of a pair now hold one player's slot, and one state is read from
them (pad_joycon.h): the left half's d-pad, left stick, L / ZL and −, the
right half's X / A / B / Y by their labels, right stick, R / ZR and +, as a
Pro Controller reports them. The right half's gyro feeds the player's
six-axis sensor, the left one's while the right has none or is gone. A half
that disconnects leaves the player to the other one instead of freeing it,
so the game keeps its npad; the player is freed when both are gone.

The slot a pair holds belongs to the pair (pad_slot_owner, pad_slots.h), so
a half that comes back joins its partner rather than taking a second player.
DM_JOYCON_PAIR=0 keeps each half a controller of its own. iPadOS hands a
pair over as one controller already, so nothing changes there.

t_pad_joycon covers the halves' names and the merged state with fake pads.
pad_joycon.h (a pair's state and six-axis source) and pad_slots.h (each
controller's player slot) decide what GetNpadState, GetSixAxisSensorStates
and the vibration calls see, so regress.py impact names the games that read
them.
macOS 26 presents a pair as one Joy-Con (L/R) with an extended gamepad
profile (probed on the Mac, as iPadOS does), so the pairing only binds for
the two-halves shape; say so where players and maintainers read it rather
than describing the binding as what a pair always needs.
@stephenschloesser
stephenschloesser deleted the joycon-pair branch October 31, 2026 17:37
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