RetroUSB joystick behaviour different in Windows and OSX/Lin

Stephen Anthony wrote:

I originally reported this issue in 2007 (!) and then eventually forgot about it. Now it’s popped up again, both in SDL1.2 and still present in SDL2.0.

The adaptor I’m using is RetroUSB SNES controller, but others have reported similar issues with the Genesis controller. The following output from Stella (multi-platform Atari 2600 emulator) is as follows:

For Windows: Joystick name: SNES
Attributes: 2 axes, 4 buttons, 0 hats

For OSX/Linux:
Joystick name: RetroUSB.com SNES RetroPort
Attributes: 2 axes, 8 buttons, 0 hats

My first thought here is that the Windows driver is broken. :wink:

I’m curious which buttons are reported to Windows. I’m kind of betting it’s reporting B, Y, Select, and Start. If that’s the case, it’s only reporting the first 8 shifts off the shift register as if it were reading a NES controller. Here’s the difference:

SNES: 1 1 1 1 RT LT X A Ri Le Dn Up St Se Y B
NES : - - - - - - - - Ri Le Dn Up St Se B A

Buttons are active low, and the high order nybble is always 1111 for a SNES controller. (I assume you don’t care about the SNES mouse and probably, sadly, your USB adapter probably tries to at least mimic a HID device in some way, meaning that it’s probably not smart enough
)

If you’re not using any special driver for Windows, it might be that the SNES was made to read both NES and SNES controllers?just read 8 more bits of serial data into the microcontroller. It may simply be that it’s operating in NES mode. This much is probably significantly beyond the SDL list to fix, if it is in fact a Windows driver bug. If the driver has source code somewhere, it’s probably not hard to fix. Obviously it’s supported in Linux, so any necessary initialization is already done somewhere you can find source and read it.

I personally cannot help with Windows driver code much?beyond my expertise, but I just had a quick look at some modern Linux HID driver code, and I think I remember enough to at least read it. :slight_smile:

Can you look up the USB vendor/device IDs? I can at least check the kernel source to see if Linux has a specific driver for it, or if it just uses a generic HID joystick driver.

Stephen Anthony wrote:

Note that this is also confirmed in testjoystick in SDL1.2 and SDL2.0, so it isn’t an app-specific problem. And I’ve seen similar reports through Googling, but no solution.

Any advice on how to proceed? I’m willing to attempt to debug this, but would like some idea on where to start. I have fairly extensive experience with debugging SDL in Linux, but not in Windows at all. I have access to all compilers and WIndows versions from XP onward (MSDNAA).

If Linux uses a generic HID driver, you may have the option of a vendor-supplied or Windows generic driver. If it’s not a HID device, or if it’s doing something custom, you might be able to find an open source Windows driver that either supports it or can be tweaked to support it.

Personally I like the notion of assigning the DPad to a hat, as modern controllers do, because I’ve never been a fan of the whole analog/digital thing. But I see why they did it the way they did since older games tended to assume all you had was a PC game port. :wink:

Mental note, see if I can convince SDL forum to give me a fixed width
editor font in future?

Since bytes are actually 8 bits, not 7, that should obviously be:

SNES: 1 1 1 1 RT LT X A Ri Le Dn Up St Se Y B
NES : - - - - - - - - - Ri Le Dn Up St Se B A

JosephOn Wed, Sep 25, 2013 at 02:20:38AM +0000, Joseph Carter wrote:

SNES: 1 1 1 1 RT LT X A Ri Le Dn Up St Se Y B
NES : - - - - - - - - Ri Le Dn Up St Se B A

2013/9/24, Joseph Carter :

I’m curious which buttons are reported to Windows. I’m kind of betting it’s
reporting B, Y, Select, and Start. If that’s the case, it’s only reporting
the first 8 shifts off the shift register as if it were reading a NES
controller. Here’s the difference:

SNES: 1 1 1 1 RT LT X A Ri Le Dn Up St Se Y B
NES : - - - - - - - - Ri Le Dn Up St Se B A

I was under the impression the D-pad, B, A, Start and Select were in
the same place, and it was the new buttons that were placed afterwards
(X, Y, L, R).

If you’re not using any special driver for Windows, it might be that the
SNES was made to read both NES and SNES controllers?just read 8 more bits of
serial data into the microcontroller. It may simply be that it’s operating
in NES mode.

The SNES was indeed made to read both controllers, in fact the port is
at exactly the same address (0x4016 for 1P port, 0x4017 for 2P port).
The SNES controller just has four more bits for the extra buttons (X,
Y, L, R). All this makes sense if you consider supposedly they tried
to make it backwards compatible with the NES at some point.

In any case I don’t see how any of this will help with SDL :stuck_out_tongue: