jackun / USBqemu-wheel

PCSX2 usb plugin for wheels and increasingly more stuff
The Unlicense
118 stars 21 forks source link

Keyboardmania support #60

Closed aleksre closed 3 years ago

aleksre commented 3 years ago

This PR adds support for the Keyboardmania controller to USBqemu. Supported games are Keyboardmania 1 and Keyboardmania 2+3, both of which are now playable for the first time.

Tested and fully working:

jackun commented 3 years ago

@aleksre can you check that this actually works still :D https://github.com/PCSX2/pcsx2/tree/usb-keyboardmania

aleksre commented 3 years ago

Hmm. I can't seem to build PCSX2 locally without errors. I'll verify once it's merged to master at least :)

aleksre commented 3 years ago

@jackun Was able to build it now. Works great! 👍

987123879113 commented 3 years ago

Nice work! Happy to see this supported. The only other way to play Keyboardmania in PCSX2 up until now was a plugin that someone is selling for ~$50 (seriously).

I previously made a branch to make Keyboardmania playable but I took an entirely different approach and it turned out really messy so I never tried upstreaming it. Keyboardmania supports multiple USB devices as input controllers besides the official controller, so I ended up implementing a full on MIDI keyboard that was supported between both of the Keyboardmania releases.

If it's any interest or help at all, here's my old branch: https://github.com/987123879113/USBqemu-wheel/tree/keyboardmania This is also Windows-only as it relies on WinAPI for MIDI inputs. It emulates the Roland PC-300 MIDI keyboard.

For reference, here's the full list of supported devices pulled from the game's code:

Keyboardmania 1st:
"FastLane" device name? (Mark of the Unicorn MOTU FastLane MIDI Interface??)

Unknown I-O Data device
VID 0x04bb, PID 0x0a06

I-O Data Serial USB-RSAQ1
VID 0x04bb, PID 0x0a03

Roland SC-8850 
VID 0x0582, PID 0x0003

Roland PC-300
VID 0x0582, PID 0x0008

Keyboardmania 2nd & 3rd:
"FastLane" device name? (Mark of the Unicorn MOTU FastLane MIDI Interface??)

Yamaha UX256 MIDI I/F
VID 0x0499, PID 0x1000

Yamaha UX96 MIDI I/F
VID 0x0499, PID 0x1008

Yamaha UX16 MIDI I/F
VID 0x0499, PID 0x1009

Roland SC-8850 
VID 0x0582, PID 0x0003

Roland PC-300
VID 0x0582, PID 0x0008

Roland UM-1(E/S/X)
VID 0x0582, PID 0x0009
aleksre commented 3 years ago

Nice. MIDI emulation would actually be a really nice addition IMO, and probably quite a bit easier for people who want to play using a MIDI keyboard.

There are also other PS2 titles that allow MIDI hardware to be connected over USB so I guess support could be expanded over time to support more games. Guitar Freaks & DrumMania comes to mind, maybe others as well?

987123879113 commented 3 years ago

Guitar Freaks & DrumMania comes to mind, maybe others as well?

I'm not sure what other games use MIDI besides GFDM, but I did have some WIP code that worked with GF4DM3. I stopped short of debugging why later GFDM games didn't accept the emulated UX-16 MIDI adapter. Most likely the faked USB descriptor is my guess. I'll see about cleaning up and fixing the code and maybe sending off a PR after working out some kinks.

jackun commented 3 years ago

Started to add Linux support and noticed buttons 7,15,23 are unused?

aleksre commented 3 years ago

Yes, they don't map to anything in-game.

Looks like those buttons would map to hex 80, which in unused.

Florin9doi commented 3 years ago

80 80 80 80 bits are used for padding, they aren't buttons: https://github.com/aleksre/USBqemu-wheel/blob/203df0b523e8fb2411e1807a72df8d27d68768bb/src/usb-pad/usb-pad.h#L1329

aleksre commented 3 years ago

Yeah that's true. In that case I'm not sure, although it's peculiar that the skips are at these exact positions. I only skipped these buttons because I noticed they didn't work and the next index mapped to the expected button.