NicoHood / Nintendo

Use Nintendo Controllers with Arduino
http://www.nicohood.de
MIT License
278 stars 55 forks source link

Added support for mode 4 reads (dance game). #25

Closed DinsFire64 closed 3 years ago

DinsFire64 commented 3 years ago

Hi there.

I was in the middle of making a new JAMMA adapter that can connect to a variety of consoles for playing different DDR games using a DDR arcade cabinet.

So I got a user request to support Gamecube/Wii games, so here I am.

I was in the middle of incorporating your library when I noticed the controller worked everywhere...except the DDR games I needed them to work in.

So I did some digging into Dolphin's source code and began to see where the differences lied.

I began to flesh out some of the commands being sent by the console (in case that was the problem), but no dice. I referenced this block of code for the additional commands. https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/Core/HW/SI/SI_DeviceGCController.cpp#L56

But then I noticed that the library only responds to polling mode 3, so I took a stab and turns out the games were asking for mode 4.

The mode itself seems to only move around the analog values, which in the case of this dance game...is none.

https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/Core/HW/SI/SI_DeviceGCController.cpp#L167

Now I don't know how precisely you want to handle the different analog orientations, since they only affect the CStick/L&R/development Analog A/B buttons, but for my case I just respond to mode 4 like I would mode 3.

Just thought I'd share my findings because in all I'm ecstatic it was a "simple" fix given the intricacy of this one wire protocol.

NicoHood commented 3 years ago

Hey there! Sorry or my late answer, I totally missed this post from you.

I looked at your diff and my code, but I am a bit lost now. Its been a long time, that ive written it, so you need to help me one more.

That is what I understand:

Now I am really happy to implement this, but if you can please arrange the format 4 data in a way, that is compatible with what the console requested, that'd be great. And the code must still be fast enough, in order to work properly of course. I would really go this way, because next time someone else has a dolphin game that uses analog stick and is wasting so many time to find out why we are sending incorrect values, you see?

Could you please correct this?

NicoHood commented 3 years ago

Ping

NicoHood commented 3 years ago

Closing in favor of: https://github.com/NicoHood/Nintendo/pull/42