Repository navigation
Mac front end: a Joy-Con pair is one player - #799
Closed
stephenschloesser wants to merge 3 commits into
Closed
stephenschloesser wants to merge 3 commits into
stephenschloesser wants to merge 3 commits into
Conversation
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.
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
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_facemaps 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 likepad_apple.h, so the iPhone could use it the day iPadOS exposes halves):productCategoryandvendorName— macOS names themJoy-Con (L)/Joy-Con (R), GameController's category isNintendo 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).dm_pad_face(their printed labels), right stick, R / ZR and + — the pad a Pro Controller reports. Sticks go topad_axisas any controller's do, so travel and feel are unchanged.GCMotionfeeds 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.pad_slot_ownerinpad_slots.h), not to either controller.DM_JOYCON_PAIR=0keeps each half a controller of its own. This is general, not game-specific: front-end input routing only, no Horizon service changed.hle_hid.cneeds no change — a pair arrives as one player'sdm_pad_set_playerstate and onedm_motion_setsource, 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 1line, 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
make -C dm/host/tests GAME=010099C022B96000 run— every suite passes (17/17), including the newt_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, andt_hid(147 checks).python3 -m unittest dm.tools.tests.test_docs,test_env_switches,test_regress,test_usage: pass.python3 dm/tools/env_switches.pywrote theDM_JOYCON_PAIRrow.010099C022B96000v1.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.handpad_slots.hare added todm/tools/impact_map.tsv(hle:*hid*) so later changes to them are scored.regress.py check --gameswas 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).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) anddocs/env_switches.tsv(DM_JOYCON_PAIR); no game note ordocs/referenceentry — no guest-visible service changed, a pair is still one npad's pad statedmsh_chain.py --headerrun anddmsh_chain.hincluded — not touched