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
Add support for more controllers: maracas (Samba de Amigo), Pop'n Music, ... #681
Comments
If possible, I would like to get some guidance about how I could implement maracas support in Flycast. I read the Samba de Amigo US Dreamcast US manual and the maracas US Patent US 7331856 B1. Each maraca has (patent pg 31, pg. 60 col 18 line 37, pg 62 col 22 line 16):
This DC Emulation post gives more details:
I'm new to Libretro, so I read all the Libretro Docs for Developers. From that, I think maracas can be implemented as an Analog RetroPad (RETRO_DEVICE_ANALOG). Now I'm reading the files in https://github.com/flyinghead/flycast/tree/master/core/hw/maple , and I'm wondering how much low level information I need to know / get from the maple bus about the maracas - and how to get it. Could / should I write a program using DreamSDK / KallistiOS to get that info? What exactly would I need to get? (maple function ID, device name, capabilities, ...) In which branch should I work / make a PR? Any comments or suggestions are welcome. Thanks! |
And I think I've found another GPL project that might have most (or all) the information needed to support maracas and fishing rod: 240p Test Suite - e.g., see https://github.com/ArtemioUrbina/240pTestSuite/blob/master/240psuite/Dreamcast/PVR/controller.c |
This is the document you need for this task: Some suggestions:
At this point maracas should work in standalone. Then for libretro you need to add maracas to the list of controller available (shell/libretro.cpp) probably as a subtype of retropad (like twin stick and ascii stick), and do the button and axes mapping (RETRO_DEVICE_ANALOG and RETRO_DEVICE_JOYPAD) |
I got the Pop'n Music functioning properly (I guess), and I'm trying to implement other controllers as well. I just could not understand one part so far. In struct maple_sega_controller: maple_base
{
virtual u32 transform_kcode(u32 kcode)
{
mutualExclusion(kcode, DC_DPAD_UP | DC_DPAD_DOWN);
mutualExclusion(kcode, DC_DPAD_LEFT | DC_DPAD_RIGHT);
return kcode | 0xF901; // mask off DPad2, C, D and Z;
} |
The Maracas have four analog axes (two for each maraca)... I can map two axes (Thumbstick U/D & &L/R) to a controller, and they seem to be working. Is there any way to map the other two axes? |
The F901 value is used to force some buttons in the released state. The standard dreamcast controller doesn't have a second DPad or C, D and Z buttons. Reporting these buttons as pressed could confuse some games. There are 6 analog axes slots in the maple standard. The dreamcast controller puts the analog stick values in the first 2 slots and the trigger values in the following. The last 2 aren't used. The Atomiswave controller has 4 analog axes and puts them in slots 3 to 6 (the first 2 aren't used). |
Thanks! I already knew the function of the mask, but I was making confusion with the buttons and could not get the correct values. Doh! But I should have been clearer about the analog mapping: I want to know how can I use the Flycast GUI to map a PC controller axes to virtual Dreamcast axes. I can map the Left or Right stick of the PC controller to the Dreamcast "Thumbstick". By changing "Dreamcast Controls" to "Arcade Controls" I can also map to the "R.Thumbstick". Using the 240p Test Suite, I can see the two analog axes, but only the left one is working. BTW, I just tested the original Pop'n Music controller with two different PC adapters and the Flycast on Windows 11:
Despite the issues, it was pretty cool! Thanks for all the help! :) |
You need to make changes to the UI in order for the Right Thumbstick to appear in console mode and be able to bind it. Right now it doesn't appear because none of the supported Dreamcast controllers has a right joystick, until now. |
Maracas are working! I haven't tested them extensively (yet!), but the only "issue" I've seem so far is that they are only detected / recognized in Samba de Amigo and Samba de Amigo Ver. 2000 when connected to ports A or B (even though they work in the 240p Test Suite on ports C & D). Now I'm trying to implement support for the fishing controller, but it has built-in vibration. Do you have any tips on how I can do it? |
This is the spec document for the fishing controller: https://github.com/Kochise/dreamcast-docs/blob/master/CONTROLR/DOCS/10_tsurih080e.doc |
I've seen the document and the So one way to solve it (I guess) would be creating a purupuru in case MDT_FishingController:
mcfg_Create(MDT_FishingController, bus, 5);
mcfg_Create(MDT_PurupuruPack, bus, 0);
break; ... but I'm not sure if that is the correct way. Another issue is that it has 6 analog axes:
I can map A1 (reel) to the left or right trigger, since it outputs 0 at rest, but the remaining 5 axes range from 0 to 0xFF with 0x80 at rest. I could hack one axis (e.g., Z) to the right trigger, but it would eliminate motion detection in one direction in that axis. u32 z;
if (index == 1) {
// hack: this eliminates motion in the Z axis in the backward direction!
z = 0x80 + pjs.trigger[PJTI_L];
return z > 0xFF ? 0xFF : z; // A2: acceleration sensor Z
} A "cleaner" solution could be adding a 3 axes acceleration sensor to the What would you suggest? |
None of the maple devices currently uses it but the function type is sent with the GetCondition command. Call Regarding the missing full axis in |
I added support for vibration to the fishing controller. Contrary to what I wrote above, the vibration device is distinct from the input controller and has its own maple bus address. So it was just a matter of adding a vibration pack at this address along with the fishing controller. See 231a1b6 |
Awesome! Thank you! :D Now I'll soon take a look at the libretro interface. |
Thank you SO MUCH for your help and patience! Thanks to you, today I played Samba de Amigo in VR (my first VR project as well) and it felt just like old days (really old, almost 20 years ago)! 😄 I'll give it some polish and publish it later for anyone who wants to give it a try. And with #1123 , I think we can close this! |
Thanks a million for your help! |
Hi there!
On a quick glance at the source of flycast, it seems to support several Dreamcast peripherals (even lightguns!), but it doesn't seem to support maracas for Samba de Amigo and Samba de Amigo: Ver. 2000 or the Pop'n Music controller.
(Images from https://bordersdown.net/content/400-Dreamcast-Peripherals-and-Hardware-List-with-photos&new_comment)
Would it be possible to add support for at least the maracas controllers in flycast?
Of course, there is also the issue of connecting those peripherals to the computer running flycast, but they can also be emulated with other devices (e.g., VR controllers).
The text was updated successfully, but these errors were encountered: