mist-devel / mist-binaries

Firmware and core binaries for the MIST board
202 stars 48 forks source link

Retroflag SNES USB gamepad support #109

Closed z00m128 closed 2 years ago

z00m128 commented 3 years ago

Hello, I recently bought cheap "Retroflag SNES classic USB gamepad" which sadly does not work at all with MiST. With the MiST core and USB debug setting I got this output: Retroflag-gamepad-MiST-log.txt

Then I connected it into my laptop and found out that the gamepad is detected as Microsoft Xbox360 Controller: Retroflag-gamepad-dmesg-log.txt

Is there any chance to get this thing working with MiST? Thank you.

gyurco commented 3 years ago

These connected-disconnected events happens rapidly? Then probably a powering issue.

z00m128 commented 3 years ago

No, only when it is plugged in. Then it looks like it is stabilized. Now I realized, that the gamepad can be set to HID mode (press and hold Y and plug in). In the F12/Input devices/USB status menu of minimig core I can see that it is somehow mapped, because the DB9 Joys are remapped to Joy2&Joy3, but the Joy1 test is not working.

Also the mapper.exe can see it afterwards and produces _joystickremap=0583,2060,1,2,4,8,10,20,100,200,400,800,40,80, which i added to mist.ini, but still no luck and gamepad is still not working.

The debug output of MiST core looks like this now: Retroflag-gamepad-HID-log.txt

gyurco commented 3 years ago

Then something must be seen on the Joystick 1 Test screen (in any generic core, like C64, fpgagen, etc...)

z00m128 commented 3 years ago

I don't know what I'm doing wrong but nothing is there. See the attached images. IMG_0667 IMG_0668

gazsp commented 2 years ago

Just to keep this alive - I have the same issue here.

gyurco commented 2 years ago

Definitely an USB problem, just don't know where. It's hard to debug without an actual hardware.

Julitium commented 2 years ago

Hi. Perhaps it should be tried with the "Joystick Mapper" utility for PC. It's in main Git. Maybe giving it the ID names, etc in Mist.ini Produces some improvement.

All the Best.

z00m128 commented 2 years ago

Definitely an USB problem, just don't know where. It's hard to debug without an actual hardware.

If you want to investigate this, I can send the gamepad to you for free.

gazsp commented 2 years ago

Perhaps it should be tried with the "Joystick Mapper" utility for PC. It's in main Git.

Have done (as @z00m128 did). I see the same thing - Joy 1 with an empty name, and the tester shows nothing. I've attached my config file.

I've got a spare Retroflag Classic controller here - happy to post it to you for testing if you want to drop me an email (gary dot renes at gmail dot com).

mist.ini.txt

gazsp commented 2 years ago

@gyurco Gamepad will be posted tomorrow. Good luck!

gyurco commented 2 years ago

@gazsp Great, but if you need it back, then please don't send it.

gazsp commented 2 years ago

No worries - it'll be in the post tomorrow.

gyurco commented 2 years ago

Ok, the problem seems to be this: ~HID: HID protocol is NONE There's a hack for devices which identifies themselves as "NONE" to be handled as Arduino-based keyboards, however seems it's not enough, as this gamepad also behaves similarly. Now the question is how to fix it without breaking those keyboards.~ The above thing is wrong. The problem is that the joypad returns NAK for all IN transfer requests, instead of sending its data. Need to find out what should be done to force it to not keep its secrets.

gyurco commented 2 years ago

Looks like I have a success. This gamepad is very strange, it has 3 personalities:

The Nintendo one usually just initializes, then reset itself to the 3rd one, and that one works now. But only if it is the one which is booted. If it boots into the Nintendo one, then switches into Retroflag, it won't work. So it might need to press reset after turning on the MiST. Weird controller.

gazsp commented 2 years ago

Nice work.

It is possible to make it switch modes by holding down a different button on the pad when powering up (think the info is on the box - I can't remember which buttons at the moment - X and Y maybe?). No idea if that helps or not...

gyurco commented 2 years ago

Seems even you switch roles, the first powerup happens in Nintendo mode, then the gamepad resets itself, and goes into the Retroflag mode. In this case, it won't send the movement packets. However if you reset MiST, then the gamepad will start directly in Retroflag mode, and works. That's the best I could do so far, you have to reset MiST once after you turn it on.

gazsp commented 2 years ago

Cool, I'll give it a shot :-)

gyurco commented 2 years ago

You can try the attached firmware. Just press reset (left button) after the first power-up or gamepad connection (and switch to HID mode before - that's remembered by the controller, it has to be done once). firmware-usb-hat-joy-test.zip

mapfde commented 2 years ago

Hi, I own a "Retroflag Classic USB Gamepad" with a Genesis layout (6 buttons and 2 shoulder buttons) and found this issue. It shows exactly the same behaviour as the SNES variant. With the attached firmware, it is recognised by MiST after a reset. It then works fine.

Thank you for solving this problem and I hope the change enters the official firmware soon.

gazsp commented 2 years ago

@gyurco The pad now works fine with the latest firmware. Thank you!

gyurco commented 2 years ago

I'm closing this as it works - with the small inconvenience with the extra reset required.

gyurco commented 2 years ago

The new firmware supports this gamepad in XBOX mode (called Direct Input in some manuals). It works without an initial reset for me.