Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No support for controllers that use two bytes for DPAD #23

Open
MrMcGoats opened this issue Jul 17, 2018 · 3 comments
Open

No support for controllers that use two bytes for DPAD #23

MrMcGoats opened this issue Jul 17, 2018 · 3 comments

Comments

@MrMcGoats
Copy link

The MAYFLASH Genesis USB adapter uses two bytes for each DPAD direction

@Maschell
Copy link
Owner

Do you have example values?

@patters-match
Copy link

patters-match commented Feb 3, 2024

I have been trying to make a controller INI for the Adaptoid N64 to HID device adapter. It uses 12bit signed values for each axis and joins them into 3 bytes. This works perfectly without drivers on Windows and macOS, but sadly controller_patcher does not appear to handle this.

I bought this Adaptoid device when UltraHLE emulator first came out in 1999, so it would be cool to be able to carry on using it on a modern console 25 years later, especially to play N64 Virtual Console titles.

Here is the HID descriptor for this device:

06F7 0001: Wish Technologies - Adaptoid
DESCRIPTOR:
  05  01  09  04  a1  01  09  01  a1  00  05  01  09  30  09  31 
  16  50  fb  26  b0  04  36  00  00  46  60  09  75  0c  95  02 
  81  02  c0  05  09  19  01  29  0e  15  00  25  01  35  00  45 
  01  75  01  95  0e  81  02  95  02  75  01  81  01  c0  
  (62 bytes)

Which according to https://eleccelerator.com/usbdescreqparser/ parses as:

0x01, 0x05,        // Unknown (bTag: 0x00, bType: 0x00)
0x01, 0x09,        // Unknown (bTag: 0x00, bType: 0x00)
0x04,              // Usage Page
0xA1, 0x01,        // Collection (Application)
0x09, 0x01,        //   Usage (0x01)
0xA1, 0x00,        //   Collection (Physical)
0x05, 0x01,        //     Usage Page (Generic Desktop Ctrls)
0x09, 0x30,        //     Usage (X)
0x09, 0x31,        //     Usage (Y)
0x16, 0x50, 0xFB,  //     Logical Minimum (-1200)
0x26, 0xB0, 0x04,  //     Logical Maximum (1200)
0x36, 0x00, 0x00,  //     Physical Minimum (0)
0x46, 0x60, 0x09,  //     Physical Maximum (2400)
0x75, 0x0C,        //     Report Size (12)
0x95, 0x02,        //     Report Count (2)
0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0,              //   End Collection
0x05, 0x09,        //   Usage Page (Button)
0x19, 0x01,        //   Usage Minimum (0x01)
0x29, 0x0E,        //   Usage Maximum (0x0E)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x01,        //   Logical Maximum (1)
0x35, 0x00,        //   Physical Minimum (0)
0x45, 0x01,        //   Physical Maximum (1)
0x75, 0x01,        //   Report Size (1)
0x95, 0x0E,        //   Report Count (14)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x95, 0x02,        //   Report Count (2)
0x75, 0x01,        //   Report Size (1)
0x81, 0x01,        //   Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0,              // End Collection

// 63 bytes

X and Y axis values are signed 12bit little endian values. I measured the following results during joystick movements in HIDtest, which are consistent with the HID descriptor:

Direction Reported X bin X dec Y bin Y dec
No input 00 00 00 0000 0000 0000 0 0000 0000 0000 0
Fully up 4C 00 B5 0000 0100 1100 76 1011 0101 0000 -1200
Fully down 39 00 4B 0000 0011 1001 57 0100 1011 0000 1200
Fully left 50 0B 00 1011 0101 0000 -1200 0000 0000 0000 0
Fully right B0 04 00 0100 1011 0000 1200 0000 0000 0000 0

@patters-match
Copy link

patters-match commented Feb 22, 2024

I raised a PR to add support for axis inputs up to 16bit, signed values, and non-byte-aligned values:
#42

I now realise that OP was asking about DPAD though, not axis values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants