charcole / Dreamcast-PopnMusic

A laser cut Dreamcast Pop'n Music controller and integrated memory card using the Raspberry Pi Pico's Programmable IO
Other
52 stars 4 forks source link

Compatibility with regular DC controller emulation #3

Open daslord opened 3 years ago

daslord commented 3 years ago

Hi, this is a great project, thank you for making it happen, would it work for emulating a regular DC controller instead of a Pop'n'Music one? I see you put some parts like:

#if POPNMUSIC
            "pop'n music controller        ",
#else
            "Dreamcast Controller          ",
#endif

But I don't believe just setting the flag #define POPNMUSIC 1 to 0 would make it work since there are other parts of the code that do not seem to have the regular controller counterpart, like this part:

static ButtonInfo ButtonInfos[NUM_BUTTONS]=
{
    { 16, 13, 0x0040, 0 },  // White left
    { 17, 12, 0x0010, 0 },  // Yellow left
    { 18, 11, 0x0020, 0 },  // Green left
    { 19, 10, 0x0080, 0 },  // Blue left
    { 20, 9, 0x0004, 0 },   // Red centre
    { 21, 8, 0x0400, 0 },   // Blue right
    { 22, 7, 0x0002, 0 },   // Green right
    { 26, 6, 0x0200, 0 },   // Yellow right
    { 27, 5, 0x0001, 0 }    // White right
};

Can you bring some guidance about what stuff would have to be modified in the code of this project in order to make the raspberry pico work as a generic DC pad? I would love to use it as a JAMMA to DC adapter, that's why I'm asking. Thanks a lot!!

charcole commented 3 years ago

Hey,

Yeah, you should definitely be able to make that modification fairly easily. Sounds a cool project.

#if POPNMUSIC
    InfoPacket.Info.FuncData[0] = __builtin_bswap32(0x000006ff); // What buttons it supports
#else
    InfoPacket.Info.FuncData[0] = __builtin_bswap32(0x000f06fe); // What buttons it supports
#endif

The Pop'n'Music controller says it has a C button (bit 0 is set) as well as the normal buttons while the Dreamcast controller line says it has an analogue stick and analogue triggers (bits 16,17,18,19 are set) and no C button (bit 0 is clear). http://mc.pp.se/dc/controller.html has some tables that show what bits mean what.

By setting the POPNMUSIC define to 0 everything should just work as long as you leave pin 27 floating (as it's the C button and a regular controller would never send that).

Only problem you might have is you'd have no sticks or triggers but that might be OK depending on the game. You could always add some code to set them in SendControllerStatus as long as you change the CRC also.

Hope that helps, Charlie

misteraddons commented 3 years ago

I'm actually curious about this as well and have done a bit of research to understand the function_data. Would you mind verifying if I have this correct?

image

Also, you mention modifying the CRC to add analog sticks and triggers. I don't currently need this function but, if I did, what needs to be done?

Thanks for taking time to answer these rudimentary questions. I've made my own fork and pushed my initial commits if you wouldn't mind taking a look :)

mackieks commented 3 years ago

@misteraddons Feel free to check out my fork. I've set up the Pico's ADC and gotten the joystick working. I'll add the analog triggers soon as well as implement block writes to the VMU's LCD with a SPI OLED display.

Many thanks to @charcole for writing such great code! This is super useful for portablizers who need a compact DC controller replacement for Dreamcast handheld builds.

misteraddons commented 3 years ago

Oh, rad, awesome! I’ll check out what you did. I was thinking of linking C to RT and Z to LT with RT/LT being set to digital by sending a 255 value when pressed for games that don’t support joystick.

Cheers!

On Thu, Aug 19, 2021 at 8:07 PM mackieks @.***> wrote:

@misteraddons https://github.com/misteraddons Feel free to check out my fork. I've set up the Pico's ADC and gotten the joystick working. I'll add the analog triggers soon as well as implement block writes to the VMU's LCD with a SPI OLED display.

Many thanks to @charcole https://github.com/charcole for writing such great code! This is super useful for portablizers who need a compact DC controller replacement for Dreamcast handheld builds.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/charcole/Dreamcast-PopnMusic/issues/3#issuecomment-902374983, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMFWWHUQIKPC2XT6B77ZTB3T5W2E3ANCNFSM5A26TMAA .