Repository navigation
Conversation
…r 2 that connects waits for its first button press instead of being let go as if every player were taken (issue seedds#1267) With DM_PAD_PRESS_TO_JOIN=1 the front end gives a new pad no player until its first button (front_mac.m s2pad_attach, then s2pad_read through pad_join), but the transport took a pad with no player after attach as "no free player" and dropped the connection: a controller held in Sync paired, connected and disconnected at once, and a button press only woke it to be dropped again. Found on an iPhone with the iOS wiring (seedds#1900), which offers the setting; the Mac has the same path, unseen because every run had the setting off. The front end's attach now says whether it keeps the pad (pad_switch2_apple.h: 1 with a player or waiting for its first press, 0 with no free player), and only 0 lets the controller go. A pad that gets its player later, at that press, gets its Joy-Con styles (dm_joy_attach through s2_sync_sides) and its player lights at the next report, which before came only at connection. A Joy-Con split off a pair (SL + SR held) waits for a press the same way when the setting is on; with no free player it goes back into the pair as before. The log says "a player once a button is pressed" for a pad that waits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…onnects waits for its first button press instead of being let go: with DM_PAD_PRESS_TO_JOIN=1 the front end gives a new pad no player until its first button (s2pad_attach, then s2pad_read through pad_join), and the transport took no player after attach for no free player and dropped the controller (attachPad, pad_switch2_apple.m), so no Joy-Con 2 or Pro Controller 2 could be used with the setting on; a press only woke it to be dropped again. The front end's attach now returns whether it keeps the pad (pad_switch2_apple.h): 1 with a player or waiting for its first press, 0 with no free player, and only 0 lets the controller go; a Joy-Con split off a pair (SL + SR held) is kept the same way, and goes back into the pair only with no free player. A pad that gets its player later gets its Joy-Con styles (dm_joy_attach through s2_sync_sides) and its player lights then: playerSync, after each read() of the front end, in report: and in leavePair, where the held SL + SR are that press and read() makes the Joy-Con a player at once. PR #1907 made that check in report: only, after leavePair had already noted the new player, so a split-off Joy-Con never got its single Joy-Con style with the setting on. The log says a player once a button is pressed for a pad that waits. Checked here: the Mac host builds and the host tests pass (t_switch2 among them; none covers the Objective-C transport). The author's runs, with the PR's form: on the Mac (M1 Pro) Nintendo Switch 2 Welcome Tour with a left and a right Joy-Con 2, both stayed connected and joined as player 1 at the first press, with rumble and the mouse; on an iPhone 17 with PR #1900's wiring, Super Mario Galaxy, the same, and a split made player 2 at once. Not run: any Switch 2 controller with this form, so the split-off Joy-Con's style is unchecked; the Pro Controller 2; more than two controllers waiting; lint_c.py; regress.py (the reach is the Switch 2 transport, off by default). Open: a waiting pad's lights show player 1's pattern (PR #1907) Co-authored-by: JakePre <130175182+JakePre@users.noreply.github.com>
|
Landed on main as 7ef8339, with you as co-author. Thanks for the diagnosis and the fix. Your three files are in as written, with one change in I have no Joy-Con 2 here, so this is checked by the host build and the host tests only. Could you retest on main with press to join on: Sync, first press, then a split, and whether the game sees the split-off one as a single Joy-Con? #1900 needs a rebase onto main now; its host part is this commit. |
|
Retested on main as asked (7ef8339, built at dfc5a15), on the Mac (M1 Pro) with a left and a right Joy-Con 2, DM_SW2=1 and DM_PAD_PRESS_TO_JOIN=1. I added two log lines locally, not in any PR: one in Super Smash Bros. Ultimate (supported styles 0x3f):
Nintendo Switch 2 Welcome Tour (supported styles 0x7, no single Joy-Con styles): the same joins and split, with the same Not run: the Pro Controller 2, and more than two controllers waiting. |
What and why
With Press a button to join on (
DM_PAD_PRESS_TO_JOIN=1), a Switch 2 controller couldn't be used. Holding Sync paired it and it connected, then it was dropped at once. A button press only woke it to be dropped again. On an iPhone, the log showed:The front end deliberately gives a new pad no player until its first button (
s2pad_attach, thens2pad_readthroughpad_join). But the transport took "no player after attach" to mean "no free player" and let the controller go. The Mac has the same path. It wasn't seen because every run I made had the setting off. That's on me: it came in with #1346.The change:
attachnow returns whether it keeps the pad (pad_switch2_apple.h): 1 with a player or waiting for its first press, 0 with no free player. Only 0 lets the controller go.dm_joy_attachthroughs2_sync_sides) and its player lights at the next report. Before, both came only at connection.a player once a button is pressedfor a pad that waits.front_mac.mreturns the new value. #1900's iOS wiring does the same.Checked
make -C dm/host/tests GAME=0100000000010000 runpasses.lint_c.py tidy: 0 findings above the baseline.DM_PAD_PRESS_TO_JOIN=1.a player once a button is pressed, the right one joining the left as a pair).a button pressed: player 1 (npad 0).Docs
🤖 Generated with Claude Code