xerpi / fakemote

A Wii cIOS module that fakes Wiimotes from the input of USB game controllers
GNU General Public License v2.0
174 stars 16 forks source link

Support PS3 Guitar Hero instruments (Guitar, Drums, Turntable) #28

Open sanjay900 opened 1 year ago

sanjay900 commented 1 year ago

I maintain a project for letting people build their own guitar hero and rock band instruments from arduinos, and I have had a few people request that i support using them to play guitar hero on wii.

Currently I have tested guitar hero, and i will test drums and turntable later. I need to grab an actual ps3 guitar and test with that as well, to see if the tilt logic works there.

sanjay900 commented 1 year ago

I also noted a couple of bugs and fixed them up here too, namely, vid and pid were swapped and there was an extra s.

xerpi commented 1 year ago

The code looks incredibly nice, thank you very much! The MR is still a Draft, right?

By the way, do you mind creating a separate MR for the bug fixes so that we can land them immediately?

sanjay900 commented 1 year ago

Sure thing, ill get on that now. https://github.com/xerpi/fakemote/pull/29

Out of curiousity, do you know why a game needs to be restarted to pick the controller up? It seems like theres some sort code in here to detect new controllers being plugged into the wii, but that doesn't seem to be working?

Main reason this is in draft is i have not yet tested the turntable or drums, and i need to do some testing with an actual PS3 controller to work out if the tilt stuff works correctly or not, ill have to go find my old PS3 guitar pcbs, as i've put arduinos in most of my guitars.

I did also have some issues with my guitars just disconnecting in the middle of playing songs, and i'm not really sure what was causing that either

xerpi commented 1 year ago

Sure thing, ill get on that now. #29

Out of curiousity, do you know why a game needs to be restarted to pick the controller up? It seems like theres some sort code in here to detect new controllers being plugged into the wii, but that doesn't seem to be working?

Main reason this is in draft is i have not yet tested the turntable or drums, and i need to do some testing with an actual PS3 controller to work out if the tilt stuff works correctly or not, ill have to go find my old PS3 guitar pcbs, as i've put arduinos in most of my guitars.

I did also have some issues with my guitars just disconnecting in the middle of playing songs, and i'm not really sure what was causing that either

Are you trying with a PS3 controller? I think they have problems with reconnects. IIRC it should work with PS4 controllers.

sanjay900 commented 1 year ago

Its my own controller, but it does emulate a PS3 controller. Any ideas why? I can implement things differently on my end if needed? I unfortunately don't own any PS4 controllers to test.

Also, have you got instructions for IOS58? I could only ever get IOS57 working myself.

sanjay900 commented 1 year ago

@xerpi Is there an easy way to get the debug output from a wii, or do i need a gecko for that or something? Never written any wii code before this lol

Ive also now grabbed myself a copy of DJ hero so ill test drums and dj soon hopefully and get things rolling

xerpi commented 1 year ago

A Gecko is by far the best way, especially when debugging from the ARM cores (like Fakemote).

sanjay900 commented 1 year ago

Interesting Hotplug works with beta53 + IOS58, but then my games don't seem to start with IOS58

Ah now beta53 + IOS57 seems to be working, and has working hotplug!

sanjay900 commented 1 year ago

@xerpi can you think of anything that the Wii would be doing differently between the standard Wii menu and a Wii menu using ios57+fakemote? For some odd reason, my Arduino guitars work wonderfully but with fakemote loaded, an official guitar adapter seems to lock up and it's LEDs stop blinking, while without fakemote loaded it doesn't do this. can you think of any requests that might be being sent differently when fakemote is loaded (I even tried commenting out all the PS3 specific controll requests to no avail)

The only real difference i can think of is internally the real adapters use a usb hub while my stuff is direct but i then tried using my stuff through a hub and that still seemed to work.

EddietheTroopers commented 1 year ago

I have a PS3 guitar, but i not have the dongle, how can i makes that?

sanjay900 commented 1 year ago

I have a PS3 guitar, but i not have the dongle, how can i makes that?

@EddietheTroopers https://sanjay900.github.io/guitar-configurator/guides/direct.html if you follow this, you can convert your PS3 guitar into a wired one. You can pick modes to have it emulate PS3 or wii RB guitars, and if you put it in PS3 mode then you can use it with this. You can also use it on PS2 as well, using OPL

xerpi commented 11 months ago

Do you mind doing a rebase over main?

sanjay900 commented 11 months ago

Yeah, i can do in a moment, i was just playing around with some ideas on how to potentially get actual instruments working, so ill rebase after i finish that

sanjay900 commented 11 months ago

Would it be difficult to support hid4? It seems that the guitar hero and rock band instruments actually initialize with IOS56, and the rock band games did use IOS56.

xerpi commented 11 months ago

Yeah, i can do in a moment, i was just playing around with some ideas on how to potentially get actual instruments working, so ill rebase after i finish that

Ok, perfect!

I was also thinking about splitting the ds3, drum, guitar, etc drivers into different files, and maybe put all the USB drivers into a separate directory, something like:

sanjay900 commented 11 months ago

That seems like a good idea, i can do that after rebasing.

xerpi commented 11 months ago

Would it be difficult to support hid4? It seems that the guitar hero and rock band instruments actually initialize with IOS56, and the rock band games did use IOS56.

I think it should be possible. Then at runtime we can detect the IOS and use hid v4 or hid v5 accordingly.

sanjay900 commented 11 months ago

Would it be difficult to support hid4? It seems that the guitar hero and rock band instruments actually initialize with IOS56, and the rock band games did use IOS56.

I think it should be possible. Then at runtime we can detect the IOS and use hid v4 or hid v5 accordingly.

I don't even think you have to do that, i think you can just rely on the GETVERSION IOCTL

sanjay900 commented 11 months ago

Yeah, i can do in a moment, i was just playing around with some ideas on how to potentially get actual instruments working, so ill rebase after i finish that

Ok, perfect!

I was also thinking about splitting the ds3, drum, guitar, etc drivers into different files, and maybe put all the USB drivers into a separate directory, something like:

* `usb_drivers/`

  * `sony_ds3.c`
  * `sony_ds4.c`
  * `sony_gh_guitar.c`

Alright, i've rebased, and split the drivers into separate files.

I've also implemented HIDv4 as well, though i suspect there might be better ways to implement some bits of it, I just was struggling to wrap my head around the way HIDv4 uses virtual pointers, and without a USB gecko I couldn't really easily debug it. I can confirm however that with HIDv4 (and IOS56), the official guitar hero controller does actually work now.

xerpi commented 11 months ago

Yeah, i can do in a moment, i was just playing around with some ideas on how to potentially get actual instruments working, so ill rebase after i finish that

Ok, perfect! I was also thinking about splitting the ds3, drum, guitar, etc drivers into different files, and maybe put all the USB drivers into a separate directory, something like:

* `usb_drivers/`

  * `sony_ds3.c`
  * `sony_ds4.c`
  * `sony_gh_guitar.c`

Alright, i've rebased, and split the drivers into separate files.

I've also implemented HIDv4 as well, though i suspect there might be better ways to implement some bits of it, I just was struggling to wrap my head around the way HIDv4 uses virtual pointers, and without a USB gecko I couldn't really easily debug it. I can confirm however that with HIDv4 (and IOS56), the official guitar hero controller does actually work now.

Looks pretty good overall! What's the problem with virtual pointers? I see that you had to use a global buffer v4_data instead of passing device->usb_async_resp directly.

sanjay900 commented 11 months ago

Yeah, i can do in a moment, i was just playing around with some ideas on how to potentially get actual instruments working, so ill rebase after i finish that

Ok, perfect! I was also thinking about splitting the ds3, drum, guitar, etc drivers into different files, and maybe put all the USB drivers into a separate directory, something like:

* `usb_drivers/`

  * `sony_ds3.c`
  * `sony_ds4.c`
  * `sony_gh_guitar.c`

Alright, i've rebased, and split the drivers into separate files. I've also implemented HIDv4 as well, though i suspect there might be better ways to implement some bits of it, I just was struggling to wrap my head around the way HIDv4 uses virtual pointers, and without a USB gecko I couldn't really easily debug it. I can confirm however that with HIDv4 (and IOS56), the official guitar hero controller does actually work now.

Looks pretty good overall! What's the problem with virtual pointers? I see that you had to use a global buffer v4_data instead of passing device->usb_async_resp directly.

Yeah it just wasn't working until I made that change, Ive got not idea why. Would you have any ideas as to why that was necessary?

xerpi commented 11 months ago

Yeah, i can do in a moment, i was just playing around with some ideas on how to potentially get actual instruments working, so ill rebase after i finish that

Ok, perfect! I was also thinking about splitting the ds3, drum, guitar, etc drivers into different files, and maybe put all the USB drivers into a separate directory, something like:

* `usb_drivers/`

  * `sony_ds3.c`
  * `sony_ds4.c`
  * `sony_gh_guitar.c`

Alright, i've rebased, and split the drivers into separate files. I've also implemented HIDv4 as well, though i suspect there might be better ways to implement some bits of it, I just was struggling to wrap my head around the way HIDv4 uses virtual pointers, and without a USB gecko I couldn't really easily debug it. I can confirm however that with HIDv4 (and IOS56), the official guitar hero controller does actually work now.

Looks pretty good overall! What's the problem with virtual pointers? I see that you had to use a global buffer v4_data instead of passing device->usb_async_resp directly.

Yeah it just wasn't working until I made that change, Ive got not idea why. Would you have any ideas as to why that was necessary?

I thought it might be the alignment, but usb_async_resp is properly aligned to 32 bytes: https://github.com/xerpi/fakemote/blob/main/include/usb_hid.h#L30 Btw I have added you on Discord.