Skip to content

iOS: Joy-Con pairs held sideways, and a Players section in the launcher - #585

Closed
subyoung wants to merge 1 commit into
seedds:mainfrom
subyoung:ios-joycon-sideways
Closed

subyoung wants to merge 1 commit into
seedds:mainfrom
subyoung:ios-joycon-sideways

Conversation

@subyoung

@subyoung subyoung commented Oct 28, 2026 •

Copy link
Copy Markdown

What and why

Builds on fdea829 (each controller a player of its own on iOS, #504). That commit still leaves two gaps.

A pair of Joy-Con cannot be held sideways as two players, as on a Switch. iPadOS hands the pair over as one combined controller ("Joy-Con (L/R)") and does not offer the halves separately: Settings shows them, but GameController exposes only the combined one. There is also no way to see or change which controller is which player before the game starts.

  • Joy-Con pairs held sideways (DmGamepad.m):
    • The pair becomes two players: the left half on the controller's own player, the right half on the next free one (a second slot in pad_slots.h, freed with the controller).
    • Each half's stick is turned a quarter, and its four buttons are read by their new positions.
    • GameController names a Joy-Con's face buttons by their printed labels, not by position (pad_apple.h, Map Nintendo controller buttons by label on Mac and iOS #650), and does not turn them with the pair. So the right half's X, A, Y and B are its right, bottom, top and left buttons.
    • A button log on the iPad confirmed this: top, right, bottom, left gave buttonY, buttonX, buttonA, buttonB.
    • SL / SR are not in the combined profile (its button list has no such elements). So each half's own shoulder buttons stand in: L or R is L, ZL or ZR is R.
    • The pair's gyro goes to the left half's player.
  • Players section in the launcher (LauncherControllers.swift, below Reset to tested defaults):
    • It lists the players as the game will get them: P1, P2, …, with a sideways pair as two rows.
    • Upright / Sideways per pair (players.joyconSideways.<pair>).
    • ↑ ↓ to change the order (players.order); DmGamepad.m takes the controllers in that order.
    • After a run, it shows how many players the game takes and greys out the controllers past that. dm_pad_players_accepted in hle_hid.c counts that from SetSupportedNpadIdType, and the app keeps it as players.max.
  • Override: DM_JOYCON_SIDEWAYS=0|1 in the environment overrides the hold.

A pair held upright, and every other controller, maps its face buttons through dm_pad_face (pad_apple.h, #650); this change does not touch it.

This also answers part of the open question in pad_apple.h ("if GameController keeps its labels there instead of turning them with the controller"): for a pair held sideways it keeps them. The button log on the iPad gave buttonY, buttonX, buttonA, buttonB for the right half's top, right, bottom and left. A single Joy-Con (iPadOS offers the pair only) is still untried.

Checked

  • Tests:
    • make -C dm/host/tests GAME=010015100B514000 run: all pass. t_hid gains t_accepted, 147 checks; t_pad_apple passes.
    • dm/tools/tests/test_docs.py and test_env_switches.py: pass.
    • DmGamepad.m built with -Wall -Wextra -Werror for iOS, and the launcher's Swift files type-checked for iOS.
  • Games run: Super Mario Bros. Wonder (010015100B514000, v1.2.1), local play, from an IPA built from this branch.
    • One Joy-Con pair held sideways as players 1 and 2: both played without problems, with the right button mapping.
    • Several controllers at once played without problems. The setups were two Joy-Con pairs and an Xbox Wireless Controller: both pairs sideways (P1–P5), both pairs sideways alone (P1–P4), and mixes of upright and sideways.
    • Reordering with ↑ ↓ also worked: the Xbox controller first, then a pair as P2. The screenshots below show the Players section for these.
    • The log keeps only the last runs, so it has no lines for the multi-controller sessions; those rest on play and the screenshots.
    • The log of that run:
      controller 'Joy-Con (L/R)' connected, held sideways: left half player 1, right half player 2
      front end: the game takes 8 players
      hid supported controller ids 0x1ff (bit n: No n+1, bit 8 Handheld, bit 9 Other)
      
    • Wonder supports No1–No8, so the Players section says "takes up to 8".
  • Devices and OS: iPad Air 13-inch (M3), iPadOS 27.2.
  • Not checked:
    • Controller gyro on a second player.
    • Disconnecting and reconnecting a pair mid-game.
    • An iPhone.

Docs

  • docs/playing.md: a Players paragraph.
  • docs/development.md: the Input row.
  • docs/env_switches.tsv: DM_JOYCON_SIDEWAYS.
  • No game files, keys or data extracted from a game in the change or the attachments

Screenshots

players-two-pairs-sideways-xbox players-reordered-xbox-first players-sideways players-upright

With each controller a player of its own on iOS (fdea829), a pair of Joy-Con still could not be held sideways as two players, as on a Switch: iPadOS hands the pair over as one combined controller ("Joy-Con (L/R)") and does not offer the halves separately. There was also no way to see or change which controller is which player before the game starts.

Held sideways, the pair now becomes two players: the left half on the controller's own player, the right half on the next free one (a second slot in pad_slots.h, freed with the controller). Each half's stick is turned a quarter and its four buttons are read by their new positions. GameController names a Joy-Con's face buttons by their printed labels (pad_apple.h, PR seedds#650) and does not turn them with the pair: a button log on the iPad gave buttonY, buttonX, buttonA and buttonB for the right half's top, right, bottom and left. So its X, A, Y and B are its right, bottom, top and left buttons. SL and SR are not in the combined profile, so each half's own shoulder buttons stand in: L or R is L, ZL or ZR is R. The pair's gyro goes to the left half's player.

The launcher's new Players section (LauncherControllers.swift) lists the players as the game will get them. It lets the player hold each pair upright or sideways (players.joyconSideways.<pair>) and change the order (players.order); DmGamepad.m takes the controllers in that order. After a run it greys out the controllers past what the game takes: hle_hid.c's new dm_pad_players_accepted counts that from SetSupportedNpadIdType, and the app keeps it as players.max. DM_JOYCON_SIDEWAYS=0|1 in the environment overrides the hold.

A pair held upright maps its face buttons through dm_pad_face (pad_apple.h), as any other Nintendo pad.

Checked: make -C dm/host/tests run (t_hid gains t_accepted, 123 checks), dm/tools/tests test_docs and test_env_switches, DmGamepad.m with -Wall -Wextra -Werror and the launcher's Swift files for iOS. On an iPad Air 13-inch (M3), iPadOS 27.2, with Super Mario Bros. Wonder 1.2.1: one Joy-Con pair held sideways as players 1 and 2.
@subyoung
subyoung force-pushed the ios-joycon-sideways branch from 574950f to 20747de Compare October 30, 2026 02:13
@github-actions github-actions Bot added host The Horizon host: SVCs, services, threads, memory (dm/host) ios The iPhone and iPad app (dm/ios) docs Documentation labels Nov 3, 2026
seedds added a commit that referenced this pull request Nov 9, 2026
…sor per Joy-Con, splits when the game asks, and the Switch 2 Joy-Cons choose by a three-second hold (3 of 3, issue #1267)

A front end that reads Joy-Cons one by one reports them to the npad layer (dm_input.h: dm_joy_attach, dm_joy_set, dm_motion_set_joy, dm_motion_clear_joy; no controller-specific names, so Switch 1 Joy-Cons and #585 / #878 can feed it later). Nothing changes until one does. hle_hid.c then shows the game what it asks for, from the styles it supports (SetSupportedNpadStyleSet, recorded before and never consulted): docked, a pad holding both Joy-Cons is one JoyDual npad (both Joy-Cons' buttons, rail buttons included, which fill no longer masks away for these styles; each stick on its side; a six-axis handle per Joy-Con); on single assignment (SetNpadJoyAssignmentModeSingle and its forms, SetNpadJoyAssignmentModeDual, GetNpadJoyAssignment) the left Joy-Con stays on the npad, or the one the game named, and the other takes the lowest free supported npad; one Joy-Con alone is JoyLeft or JoyRight. The controller applet splits a pair when the game wants more players than there are controllers. A game that supports no Joy-Con style reads the pad as a full-key controller, as before. Vibration handles exist for the Joy-Con styles (types 5, 6 and 7) and reach the motor of their Joy-Con on whichever npad it is; a full-key handle the game got before the Joy-Cons connected still reaches them (Super Mario Odyssey keeps sending to its full-key handles after asking for the JoyDual ones). Handheld mode: player 1's Joy-Cons count as attached to the console (the Handheld npad) and are never split.

The Switch 2 transport (pad_switch2_apple.m) reports each Joy-Con's own buttons, stick and sensor (not while the game has no input: the front end's new blocked callback), keeps a left and a right one that connect together as a pair, and lets the player choose on the controllers, as a Switch's Change Grip/Order screen does, without its screen: SL + SR held three seconds on a Joy-Con of a pair gives it a player of its own; L on a left one alone and R on a right one alone, held together three seconds, pairs them (switch2_proto.h s2_gesture, s2_hold_update). The player lights show the result. DM_PAD_MERGE keeps every pad full-key.

Checked on an M1 Pro, macOS 27.2, with a left and a right Joy-Con 2: Super Mario Odyssey 1.3.0 (a JoyDual npad: the two-handed up and spin throws; two-player mode splits the pair through the applet; rumble on both; the split and join holds), Super Mario Bros. Wonder 1.2.1 (choosing two players splits the pair), Super Smash Bros. Ultimate 13.0.5 (the SL + SR hold makes two sideways players; a 1v1 with a Joy-Con each, rail buttons as shoulders, rumble on each). t_hid: 175 checks (t_joycons: inert until a Joy-Con is reported, JoyDual with rail buttons, the unsupported-style fallback, single assignment and the other half's npad, the applet split, vibration handles per style, handheld); t_switch2: 80 checks (the Joy-Con buttons, the gestures and their timing). Not checked: more than two Joy-Cons, the Pro Controller 2.

Front-ends: new: dm_joy_attach / dm_joy_set / dm_motion_set_joy / dm_motion_clear_joy (dm_input.h) let a front end report Joy-Cons one by one; until it does, nothing changes
Front-ends: interface: dm_switch2_front has a blocked callback (NULL: never blocked)

PR #1363

Co-authored-by: JakePre <[email protected]>
Know-It-All-Brother pushed a commit to Know-It-All-Brother/nxnative that referenced this pull request Nov 9, 2026
…sor per Joy-Con, splits when the game asks, and the Switch 2 Joy-Cons choose by a three-second hold (3 of 3, issue seedds#1267)

A front end that reads Joy-Cons one by one reports them to the npad layer (dm_input.h: dm_joy_attach, dm_joy_set, dm_motion_set_joy, dm_motion_clear_joy; no controller-specific names, so Switch 1 Joy-Cons and seedds#585 / seedds#878 can feed it later). Nothing changes until one does. hle_hid.c then shows the game what it asks for, from the styles it supports (SetSupportedNpadStyleSet, recorded before and never consulted): docked, a pad holding both Joy-Cons is one JoyDual npad (both Joy-Cons' buttons, rail buttons included, which fill no longer masks away for these styles; each stick on its side; a six-axis handle per Joy-Con); on single assignment (SetNpadJoyAssignmentModeSingle and its forms, SetNpadJoyAssignmentModeDual, GetNpadJoyAssignment) the left Joy-Con stays on the npad, or the one the game named, and the other takes the lowest free supported npad; one Joy-Con alone is JoyLeft or JoyRight. The controller applet splits a pair when the game wants more players than there are controllers. A game that supports no Joy-Con style reads the pad as a full-key controller, as before. Vibration handles exist for the Joy-Con styles (types 5, 6 and 7) and reach the motor of their Joy-Con on whichever npad it is; a full-key handle the game got before the Joy-Cons connected still reaches them (Super Mario Odyssey keeps sending to its full-key handles after asking for the JoyDual ones). Handheld mode: player 1's Joy-Cons count as attached to the console (the Handheld npad) and are never split.

The Switch 2 transport (pad_switch2_apple.m) reports each Joy-Con's own buttons, stick and sensor (not while the game has no input: the front end's new blocked callback), keeps a left and a right one that connect together as a pair, and lets the player choose on the controllers, as a Switch's Change Grip/Order screen does, without its screen: SL + SR held three seconds on a Joy-Con of a pair gives it a player of its own; L on a left one alone and R on a right one alone, held together three seconds, pairs them (switch2_proto.h s2_gesture, s2_hold_update). The player lights show the result. DM_PAD_MERGE keeps every pad full-key.

Checked on an M1 Pro, macOS 27.2, with a left and a right Joy-Con 2: Super Mario Odyssey 1.3.0 (a JoyDual npad: the two-handed up and spin throws; two-player mode splits the pair through the applet; rumble on both; the split and join holds), Super Mario Bros. Wonder 1.2.1 (choosing two players splits the pair), Super Smash Bros. Ultimate 13.0.5 (the SL + SR hold makes two sideways players; a 1v1 with a Joy-Con each, rail buttons as shoulders, rumble on each). t_hid: 175 checks (t_joycons: inert until a Joy-Con is reported, JoyDual with rail buttons, the unsupported-style fallback, single assignment and the other half's npad, the applet split, vibration handles per style, handheld); t_switch2: 80 checks (the Joy-Con buttons, the gestures and their timing). Not checked: more than two Joy-Cons, the Pro Controller 2.

Front-ends: new: dm_joy_attach / dm_joy_set / dm_motion_set_joy / dm_motion_clear_joy (dm_input.h) let a front end report Joy-Cons one by one; until it does, nothing changes
Front-ends: interface: dm_switch2_front has a blocked callback (NULL: never blocked)

PR seedds#1363

Co-authored-by: JakePre <[email protected]>
@seedds

seedds commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Closing as superseded: 36e6e4a on main makes Joy-Cons dual or single npads as the game asks (a pair is a JoyDual npad with a sensor per Joy-Con, and it splits when the game requests it), instead of manual splitting. The button-map observations here remain useful; please open an issue if any button is still wrong on main. Thanks!

@seedds seedds closed this Nov 14, 2026
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) ios The iPhone and iPad app (dm/ios)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants