With DM_WINDOW=1 every connected pad with an extended gamepad profile goes to dm_pad_set, the path the iPhone's controllers take, ORed with the keyboard (a non-zero stick wins). The buttons are mapped by position as DmGamepad.m read_pad does: the right face button is A, the bottom B, the top X, the left Y; shoulders L R, triggers ZL ZR, Menu + and Options -, both sticks and their presses. Connecting and disconnecting are logged and rescan the pads; when the last one goes away its buttons and sticks are released.
Changed from the PR: the PR ORed the pad into the keyboard's dm_input_set in push() and mapped the labels straight across (an Xbox pad's bottom A was the Switch's A), so one pad pressed different buttons on the Mac and the iPhone. No wireless discovery: pads paired in the system's Bluetooth settings connect on their own.
Built for Super Mario Odyssey; not yet run with a controller here (the PR played Odyssey with an XInput pad on an M1 Pro).
Co-authored-by: JY626 <151988630+JY626@users.noreply.github.com>