Adding 8BitDo M30 Support (and more!)

95 views
Skip to first unread message

Chris Platts

unread,
Mar 12, 2020, 6:17:03 PM3/12/20
to Unijoysticle
Hi Ricardo!

Firstly, thank you so much for your work on Unijoysticle!  I've got to the prototyping stage for something like this often, but never quite to a finished product.  In particular, this project has pretty much the only complete implementation of an ESP32 Bluetooth HID Host for gamepads out there.  Great work!!

I'm currently designing my own board to run Unijoysticle on.  I've only ever built a bunch of stripboard circuits before, but I'll soon be ordering my PCB for my Unijoysticle clone.  It's essentially a 'mini' version, using an ESP32 PICO board.  I'm dropping the LEDs and the barrel jack, instead relying on the PICO's USB port for external power.  I don't intend to do anything commercial -- just a fun project to keep me out of trouble :)

Anyway, I'm currently looking at adding support for the 8BitDo M30 Bluetooth gamepad.  This works well enough in Switch/X-Input mode, but I'd like to move the buttons around a bit to more closely match the proper UJ positions.

These gamepads are very similar to the old Genesis/Megadrive pads, with a single D-Pad, 6 face buttons and a START button.  It also adds two shoulder buttons and three option buttons.

They're mapped quite differently to the existing two supported 8BitDo pads.  Before I start monkeying about with the code, would a new parser, e.g. uni_hi_parser_8bitdo_m30 be acceptable?  I'll get myself set up on Gitlab and raise a PR when it's ready!

I'll eventually be using the Unijoysticle code with a bunch of different systems (Atari XEGS, ST, Falcon030, Commodore CDTV, VIC-20).  Also, I plan on reusing UJ's bluetooth code for a couple of machine-specific boards.  Foremost, I want to free my Atari Jaguar from the tyranny of its dreadful controller.  Once I've got the multiplexing sorted, I'm going to use unused gamepad buttons as 'shift' buttons so that the full 12-key 'telephone-style' buttons can be supported.  

Lastly, I want to eventually build a board for my Acorn Archimedes.  Sadly those machines never standardised on a particular joystick interface, but some sort of connection via the parallel port seems to be most common.

Thanks again for your work - really great stuff!!

Cheers,
Chris

Ricardo Quesada

unread,
Mar 12, 2020, 6:54:25 PM3/12/20
to Chris Platts, Unijoysticle
Hi Chris,

Perhaps I need to create an easier to way to generic "HID" driver to
be used for "generic" devices like 8bitdo, Android etc... and then
have specific ones the ones that are not pure HID (Xbox, Wii,
Dualshock, etc...).
And for the generic ones I can reuse the Android mappings, or perhaps
the libsdl2 ones.
So, in order to add support for 8bitdo m30 (assuming it has its own
product and vendor id), then adding a new entry in the DB will be
enough (like libSDL).

In any case, please send me the HID Report + product ID + Vendor ID of
the 8bitdo M30 to see how different it is from the other 8bitod
devices.

Please, send photos once your device once you you have it running. I'd
love to see it in an Archimedes!


BTW, feel free to sell your own unijoysticles if you want. I don't
mind at all. Although you might need to pay to BTStack (it is a
commercial product). Ping me via private for details.
> --
> You received this message because you are subscribed to the Google Groups "Unijoysticle" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to unijoysticle...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/unijoysticle/fc8d24f3-292b-4263-aef3-8e8dd874b7e3%40googlegroups.com.

Chris Platts

unread,
Mar 12, 2020, 7:31:22 PM3/12/20
to Unijoysticle
Hi Ricardo - thanks for the reply!

Here's the descriptor with the pad in Android mode:

05 01 09 05 A1 01 85 03 05 01 15 00 25 07 46 3B 01 95 01 75 04 65 14 09 39 81 42 75 01 95 04 81 01 15 00 26 FF 00 09 30 09 31 09 32 09 35 95 04 75 08 81 02 05 02 15 00 26 FF 00 09 C4 09 C5 95 02 75 08 81 02 05 09 19 01 29 10 15 00 25 01 75 01 95 10 81 02 C0 

Vendor ID: 0x2dc8 - Product ID: 0x0651

I've not yet tried the pad with my breadboard prototype in Android mode.  But from the debug logs I can see that the shoulder buttons are interpreted as the brake/accel axes.  

I did have a go earlier with the pad in XInput mode.  That worked quite well (dpad was fine, A and B were Fire and Jump) - although C was autofire instead of the right shoulder button.

I'll be sure to take some photos and document the Archimedes and Jaguar versions.  The Archie has a small game library, but amongst them are some classics (Elite, Zarch).  Going to have to find out what joystick interface methods each game supports so I can pick a design that'll be compatible with the most games.  The Atari Jaguar's the one I'm really keen on implementing.  I'd play it much more often if it weren't for that dreadful controller!

Thanks for the tip regarding BTstack's license (and indeed for being willing to share your own work).  If I'm fortunate enough to end up with something that people are willing to pay for, I'll be sure to get in touch with you!

Cheers,
Chris


On Thursday, 12 March 2020 22:54:25 UTC, Ricardo Quesada wrote:
Hi Chris,

Perhaps I need to create an easier to way to generic "HID" driver to
be used for "generic" devices like 8bitdo, Android etc... and then
have specific ones the ones that are not pure HID (Xbox, Wii,
Dualshock, etc...).
And for the generic ones I can reuse the Android mappings, or perhaps
the libsdl2 ones.
So, in order to add support for 8bitdo m30 (assuming it has its own
product and vendor id), then adding a new entry in the DB will be
enough (like libSDL).

In any case, please send me the HID Report + product ID + Vendor ID of
the 8bitdo M30 to see how different it is from the other 8bitod
devices.

Please, send photos once your device once you you have it running. I'd
love to see it in an Archimedes!


BTW, feel free to sell your own unijoysticles if you want. I don't
mind at all.  Although you might need to pay to BTStack (it is a
commercial product). Ping me via private for details.


On Thu, Mar 12, 2020 at 3:17 PM Chris Platts <chris...@gmail.com> wrote:
>
> Hi Ricardo!
>
> Firstly, thank you so much for your work on Unijoysticle!  I've got to the prototyping stage for something like this often, but never quite to a finished product.  In particular, this project has pretty much the only complete implementation of an ESP32 Bluetooth HID Host for gamepads out there.  Great work!!
>
> I'm currently designing my own board to run Unijoysticle on.  I've only ever built a bunch of stripboard circuits before, but I'll soon be ordering my PCB for my Unijoysticle clone.  It's essentially a 'mini' version, using an ESP32 PICO board.  I'm dropping the LEDs and the barrel jack, instead relying on the PICO's USB port for external power.  I don't intend to do anything commercial -- just a fun project to keep me out of trouble :)
>
> Anyway, I'm currently looking at adding support for the 8BitDo M30 Bluetooth gamepad.  This works well enough in Switch/X-Input mode, but I'd like to move the buttons around a bit to more closely match the proper UJ positions.
>
> These gamepads are very similar to the old Genesis/Megadrive pads, with a single D-Pad, 6 face buttons and a START button.  It also adds two shoulder buttons and three option buttons.
>
> They're mapped quite differently to the existing two supported 8BitDo pads.  Before I start monkeying about with the code, would a new parser, e.g. uni_hi_parser_8bitdo_m30 be acceptable?  I'll get myself set up on Gitlab and raise a PR when it's ready!
>
> I'll eventually be using the Unijoysticle code with a bunch of different systems (Atari XEGS, ST, Falcon030, Commodore CDTV, VIC-20).  Also, I plan on reusing UJ's bluetooth code for a couple of machine-specific boards.  Foremost, I want to free my Atari Jaguar from the tyranny of its dreadful controller.  Once I've got the multiplexing sorted, I'm going to use unused gamepad buttons as 'shift' buttons so that the full 12-key 'telephone-style' buttons can be supported.
>
> Lastly, I want to eventually build a board for my Acorn Archimedes.  Sadly those machines never standardised on a particular joystick interface, but some sort of connection via the parallel port seems to be most common.
>
> Thanks again for your work - really great stuff!!
>
> Cheers,
> Chris
>
> --
> You received this message because you are subscribed to the Google Groups "Unijoysticle" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to unijoy...@googlegroups.com.

Ricardo Quesada

unread,
Mar 12, 2020, 10:05:16 PM3/12/20
to Chris Platts, Unijoysticle
Thanks for the info.
I've just uploaded it to my "descriptor DB":
https://gitlab.com/ricardoquesada/unijoysticle2/-/commit/4b692c71e9be3577226af2152c0e0aa30fac4fe8

The 8bitdo M30 has the same HID descriptor as the 8bitod NES30.
I have to confirm that they have different product ids... most
probably they have. IIRC 8bitdo has its own vendor id.

It will take me a few weeks to implement the hid-generic driver, but
once it is done, it should be trivial to add new mappings.
> To unsubscribe from this group and stop receiving emails from it, send an email to unijoysticle...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/unijoysticle/41848777-b711-4418-bc8d-75019ff0d726%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages