Repository navigation
Conversation
502c302 to
f010229
Compare
An 8BitDo in its own mode pairs as a Bluetooth HID gamepad that GameController never lists, so it got no input (seedds#637). pad_hid_mac.h reads such pads with IOHIDManager (skipping GameController's synthetic devices and the Microsoft, Sony and Nintendo pads it drives itself) and gives each a player slot like a GameController controller. pad_hid.h maps buttons, hat, sticks and analog triggers; DM_HID_MAP overrides the button map, DM_HID_LOG=1 logs usages, DM_HID_PADS=0 turns it off.
The tool tests failed because DM_HID_LOG, DM_HID_MAP and DM_HID_PADS, which the previous commit reads, had no row. dm/tools/env_switches.py added them; this writes their meanings. test_env_switches passes.
f010229 to
917bee7
Compare
…#669, #637) An 8BitDo in its own mode pairs as a Bluetooth HID gamepad that GameController never lists, so it got no input. pad_hid_mac.h reads such pads with IOHIDManager and gives each a player slot like a GameController controller; pad_hid.h maps buttons, hat, sticks and analog triggers (tests/t_pad_hid.c). DM_HID_MAP moves the buttons, DM_HID_LOG=1 logs each button's number, DM_HID_PADS=0 turns it off. A device is skipped when +[GCController supportsHIDDevice:] says GameController lists it itself, so no pad of any vendor is read twice (the PR skipped Microsoft, Sony and Nintendo by vendor ID). Each stick has one round dead zone with the deflection scaled back to start at 0, in place of a fixed cut per axis. HID has no standard button numbering: the default is 8BitDo's, and a pad of another vendor gets a log line saying so and how to map it. With DM_PAD_MERGE=1 player 1 is released only when the last controller of either kind goes away, and HID pads leave the player mask alone, as GameController ones do. Fixes #637. Co-authored-by: Lars van der Niet <[email protected]>
|
Thanks, Lars! This landed on main as a5281d0 with you as co-author. I made three changes:
With I don't have an 8BitDo here: could you check that your Ultimate 2C still connects as |
|
Tested main (a5281d0) with my Ultimate 2C Wireless over Bluetooth, and it's skipped now. Looks like supportsHIDDevice means "I know this kind of device" rather than "I'll give you a controller for it". Opened #859, which keeps your check but only for the Microsoft/Sony/Nintendo vendors. Haven't been able to try the new dead zone yet, my test build had no picture (main's host in an older app build). Will do once I have a full build. |
…seedds#669, seedds#637) An 8BitDo in its own mode pairs as a Bluetooth HID gamepad that GameController never lists, so it got no input. pad_hid_mac.h reads such pads with IOHIDManager and gives each a player slot like a GameController controller; pad_hid.h maps buttons, hat, sticks and analog triggers (tests/t_pad_hid.c). DM_HID_MAP moves the buttons, DM_HID_LOG=1 logs each button's number, DM_HID_PADS=0 turns it off. A device is skipped when +[GCController supportsHIDDevice:] says GameController lists it itself, so no pad of any vendor is read twice (the PR skipped Microsoft, Sony and Nintendo by vendor ID). Each stick has one round dead zone with the deflection scaled back to start at 0, in place of a fixed cut per axis. HID has no standard button numbering: the default is 8BitDo's, and a pad of another vendor gets a log line saying so and how to map it. With DM_PAD_MERGE=1 player 1 is released only when the last controller of either kind goes away, and HID pads leave the player mask alone, as GameController ones do. Fixes seedds#637. Co-authored-by: Lars van der Niet <[email protected]>
What and why
Fixes #637.
On the Mac, a controller that macOS pairs but GameController does not list is ignored. An 8BitDo Ultimate 2C Wireless in its own mode (VID 0x2DC8, PID 0x301B, Bluetooth HID) shows up in System Settings with a battery level, but no game sees it. GameController only takes Xbox, PlayStation, Switch Pro and MFi controllers.
This reads such controllers with IOHIDManager and gives each one a player slot, the same way front_mac.m does for GameController pads, so they mix freely (2 Xbox + 2 8BitDo = players 1 to 4).
dm/host/pad_hid.h: pure mapping from HID buttons, hat and axes to Switch buttons and sticks (analog triggers press ZL / ZR past half, a small dead zone per axis). Default buttons follow 8BitDo's D-input numbering.dm/host/pad_hid_mac.h: the IOHIDManager side. It skips GameController's synthetic devices and the vendors GameController drives itself (Microsoft, Sony, Nintendo), so no controller is read twice.front_mac.m: attach / detach / read for HID pads on the existing slots.DM_HID_MAP=A=1,B=2,...remaps buttons,DM_HID_LOG=1logs each button's usage number,DM_HID_PADS=0turns it off.Known limit: the skip list is by vendor. An MFi pad from another vendor would be read twice; the comment in pad_hid_mac.h says where to add it.
Checked
make -C dm/host/tests GAME=0100152000022000 runpasses, including the newt_pad_hid(16 checks).[hid]log lines.Docs
docs/playing.md, "On the Mac": what is read and the three settings.