-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
VMUs and Rumble Packs with Original Dreamcast Controllers #1810
base: dev
Are you sure you want to change the base?
Conversation
I can try it with the DreamConn S for possible issues. Can you please provide a Windows build? |
you can grab it here: https://github.com/flyinghead/flycast/actions/runs/12806671980/artifacts/2440333360 |
Thanks for your work on this to get this integrated with DreamcastControllerUsbPico! Using the CDC interface is certainly the easiest way to go about it 🤣 It was originally only meant to be a debug tool, but I don't see any harm in using it this way! Keep it simple, right? I did get the PID/VID assigned through pidcodes.github.com, so no one else should be using that address. FYI The storage device implementation is very basic, essentially a proof-of-concept, and I never hardened it to allow for random access of data (only copy or paste of an entire vmu). It would be interesting to see an emulator working directly off of the data somehow though. I'd be interested in helping with that if it seems like a useful feature. |
Awesome work! This is really cool! |
Just tested with DreamConn S, and everything seems to be working fine. |
@chrisvcpp Thanks for checking!
@Tails86 This was the low hanging fruit :D My initial idea was to use a Pi Pico with WIFI and extend DreamcastControllerUsbPico with a TCP Server to piggyback on the existing TCP-to-localhost stuff from DreamConn - but the CDC makes it way easier.
@Tails86 Maybe this can also be addressed by DreamcastControllerUsbPico. Unfortunately I don't have a Debug Kit available so I couldn't figure out why the USB HID seems to be exposed differently on MacOS/Windows vs Linux (Linux has the "correct" mapping). But I guess this is related to how the OSes interpret the HID - any thoughts on this? |
I'm using a descriptor that is very similar descriptor to what TinyUSB recommends. The only tweak I made is the minimum is -128 instead of -127 to better match up with the Dreamcast controller. It seemed like TinyUSB followed a standard recommended by the Linux community, so that tracks. Conversion from Dreamcast controller input happens here: Button indices are defined here: I can of course tweak the descriptor and/or conversions to be whatever is most compatible. Do you have any idea what layout this needs to be? I'm sort of wondering if the analog trigger range [-128,127] is a problem. |
@Tails86 thanks for the pointers!
For future reference, its stated here https://github.com/hathach/tinyusb/blob/880aae4be2556704abd4dae9c707c9fa87603cf1/src/class/hid/hid.h
By default on Linux, or when manually configuring the Controller on MacOS/Windows, the triggers work fine. Sega Rally 2 has a nice test for this - there is an option menu for configuring the deadzone. To my feeling, the triggers need to be pressed quite a bit before they are recognized. I am not sure if this is the default behaviour of the controller on the original DC, or something which is due to DreamcastControllerUsbPico. I briefly tested a trigger range of [-127, 127] which did not change my perception of this. I currently cannot test this with a real DC - maybe you have something available to compare this with?
The problem seems to be that MacOS and Windows use different input event codes, hence those OS by default do not or do only falsely recognize the buttons/axis. So it seems that there is no one-fits-all solution from what I could find. To my mind, the button mapping issue can be worked around by either
From what I can tell, for 1. we need to figure out the correct input event codes and probably do some heavy lifting in DreamcastControllerUsbPico - what is your take on this @Tails86? |
I second that! |
This PR enables the usage of VMUs and Rumble Packs with original Dreamcast Controllers connected to MacOS/Linux/Windows using the DreamcastControllerUsbPico Raspberry Pi Pico-based USB-Adapter.
By default, the USB-Adapter provides the following devices:
Using the USB CDC serial device, this PR piggybacks on the handler for DreamConn+ Controllers as discussed here. It currently provides a working implementation of VMUs and Rumble Packs using MapleIO with support for MacOS/Linux/Windows.
Demo: https://youtu.be/Nj4dRMZ_jB0
Usage:
/dev/ttyACM*
) is owned by root. Change permission of the device to your user, or startup Flycast with superuser permissionsNotes:
Todos:
async_write()
finishes. As such, the disconnection of a serial device can currently not be detected reliably since the device will report being open despite being disconnected. As a consequence, theDreamConn
instance is not deconstructed correctly until a new game is started/dev/ttyACM0
,COM1
) changes. Currently, the first serial device found is used. This should probably be exposed to a config file or the UI for proper handlingcheckKeyCombo()
is not working since leftTrigger and rightTrigger seem to be not correctly wired within theSDLGamepad
handler - I couldn't figure out why. This can probably be hardcoded? The mapping is:Credits go to @Tails86 for DreamcastControllerUsbPico, @flyinghead for Flycast, and @chrisvcpp for DreamConn+. Thanks to @Marcel43367 for helping on serial device debugging!