Snes9x GX forked: Added Retrode 2 SNES gamepad adapter

Discussion in 'Wii - Emulation and Homebrew' started by revvv, Jul 29, 2019.

  1. revvv
    OP

    revvv Member

    Newcomer
    2
    May 11, 2019
    Germany
    Hi folks, I'm proud to present a patched version of Snes9x GX which supports the Retrode 2: An USB adapter for the original SNES controllers:

    https://github.com/revvv/snes9xgx-retrode

    I published also a small test app for the SNES gamepads. (It also supports my Speedlink Hornet gamepad, which is very unlikely that you have one :lol:, so it's an undocumented feature)

    As I don't have a SNES mouse I didn't add support for it. However my test app shows its output. (Contact me, tell me what you see and I'll add it to Snes9x.)
    In theory it supports 4 players (2 SNES controllers and 2 Genesis controllers), but I also did not test that. I never had 4 player games back in the days...
     
    ChaosEternal, RunningSnakes and niuus like this.
  2. niuus

    niuus GBAtemp Advanced Fan

    Member
    6
    Mar 4, 2016
    Venezuela
    This looks very nice for Retrode users, reminds me of how useful HID support would be. Why not make a pull request to integrate it in GX and RX?
     
    Last edited by niuus, Jul 30, 2019
  3. revvv
    OP

    revvv Member

    Newcomer
    2
    May 11, 2019
    Germany
    Thanks :)

    I already asked before I finished my project, but he refused. That's was a pity, because I had do it all by myself. :rofl2:
    On the other hand, I understand their decision: Starting support for USB gamepads is like a can of worms.
    I'm surprised that Nintendont and RetroArch did it.

    In RetroArch the USB support got broken for the Wii after 1.7.0 and nobody seems willing to fix it. I guess, the market is very small now :cry:
     
    Humanity likes this.
  4. niuus

    niuus GBAtemp Advanced Fan

    Member
    6
    Mar 4, 2016
    Venezuela
    The controllers weren't detected because the PID/VID were wrong. It was fixed 18 days ago: https://github.com/libretro/RetroArch/pull/9099

    It is normal because of the Wii's age, though the console has proven very reliable and incredibly good for homebrew and emulation, which is why the scene is not dead, far from it.

    If you want to submit a pull request to Snes9x RX, to add the Retrode support , you're more than welcome, i'll check it, compile, and approve it. I don't have the means to test it because i don't have the Retrode, but someone could check it out.
     
    revvv likes this.
  5. Bladeoner

    Bladeoner GBAtemp Regular

    Member
    4
    Oct 15, 2018
    Netherlands
    I will try to add it to Snes9x GX, if its added could you test it?
    I don't own a Retrode 2: An USB adapter.
     
    MaeseJesus and revvv like this.
  6. revvv
    OP

    revvv Member

    Newcomer
    2
    May 11, 2019
    Germany
    That's great news. Thanks a lot. Of course I'll test it.
     
    Bladeoner likes this.
  7. Bladeoner

    Bladeoner GBAtemp Regular

    Member
    4
    Oct 15, 2018
    Netherlands
    @revvv just compiled the emulator (see attachment), could you test it?

    Left out the part where you can check if its connected or not.

    Thanks in advance.
     

    Attached Files:

    Last edited by Bladeoner, Aug 1, 2019
    MaeseJesus and rogerioronin like this.
  8. revvv
    OP

    revvv Member

    Newcomer
    2
    May 11, 2019
    Germany
    Works like a charm! Thank you!

    Tested with Super Mario World, Street Fighter 2, Doom and Super Bomberman.
    (For 4 players you have to enable 4 controllers)

    Some notes:
    • If the Retrode does not react, you just have to restart Snes9x GX. I never had to restart HBC or the Wii. This happens with my fork, too. But not very often.
    • Doom is a good testcase: My first build had a huge lag, but only with this game. After polling the Retrode only for player 1, the lag disappeared. (Doom is a single player game, so it's strange that they poll player 2.)
     
    MaeseJesus and Bladeoner like this.
  9. Bladeoner

    Bladeoner GBAtemp Regular

    Member
    4
    Oct 15, 2018
    Netherlands
    Thank you for testing and the quick response. I will send the change in so it can be merged.

    I had to adjust the code a little bit, it was not compiling Snes9x GX for the Gamecube.
     
    MaeseJesus likes this.
  10. revvv
    OP

    revvv Member

    Newcomer
    2
    May 11, 2019
    Germany
    I was aware of that, now I really have a bad conscience :ph34r:
    But as the GC has no USB ports my fork will never release GC builds...
     
  11. Bladeoner

    Bladeoner GBAtemp Regular

    Member
    4
    Oct 15, 2018
    Netherlands
    Don't worry, the change I implement only adds the code to support Retrode in the Wii build not to the GC build, actually the GC build skips all of that. :)

    You can see the changes and compare over here, I only used the code needed, left out the check:
    https://github.com/dborth/snes9xgx/pull/870/commits/349b1d044050bba7cc4259ea5493bc2613491c0c
     
    Last edited by Bladeoner, Aug 2, 2019
    revvv likes this.
  12. revvv
    OP

    revvv Member

    Newcomer
    2
    May 11, 2019
    Germany
    Fine. Merged your ifdefs.

    I just realized that I always do the USB call even if there is no Retrode present. :cry:
    https://github.com/revvv/snes9xgx-retrode/commit/fe22adc7b9f8d47cdef3071c76b45995c1478880

    @niuus and I invested a lot of time getting an elder devkitpro version to run with his fork on my PC. Unfortunately the USB device gets closed somewhere. So reading the Retrode right after opening works, but not in the next decodepad() call. If you have any idea where this happens...?
    The Retrode is also an USB mass storage device which contains 1-3 files (Retrode config, ROM, savegame) if this information helps...
     
    Bladeoner likes this.
  13. Bladeoner

    Bladeoner GBAtemp Regular

    Member
    4
    Oct 15, 2018
    Netherlands
    Thanks for pointing to the change, I added it in my Pull Request.
     
    revvv likes this.
  14. Bladeoner

    Bladeoner GBAtemp Regular

    Member
    4
    Oct 15, 2018
    Netherlands
    niuus, revvv and the_randomizer like this.
  15. revvv
    OP

    revvv Member

    Newcomer
    2
    May 11, 2019
    Germany
    Perfect header file! Thank you. I intended to do it later, but [...whatever excuse you like..] :rofl2:
    @niuus fork turns off all USB interrupts during emulation. I could not indentify what line of code is the root of all evil. This really drives me nuts.
     
    niuus likes this.
  16. Ch3ma1980

    Ch3ma1980 Newbie

    Newcomer
    1
    Aug 6, 2019
    Spain
    Nice job ,
    it would be incredible to be able to use hid gamepads in emulators...
     
    revvv likes this.
  17. niuus

    niuus GBAtemp Advanced Fan

    Member
    6
    Mar 4, 2016
    Venezuela
  18. Bladeoner

    Bladeoner GBAtemp Regular

    Member
    4
    Oct 15, 2018
    Netherlands
    Could you please try the file below and see if it works with Retrode, it is compiled with the latest libogc and devkitppc:
    https://gbatemp.net/attachments/snes9xrx-4-1-0_test-zip.175628/
     
  19. revvv
    OP

    revvv Member

    Newcomer
    2
    May 11, 2019
    Germany
    Bladeoner likes this.
  20. revvv
    OP

    revvv Member

    Newcomer
    2
    May 11, 2019
    Germany
    Added XBOX360 controller support! :toot::yayone:

    For the moment I only checked in the sources. Binary will follow later.

    Rumble is also possible, but I'm not sure if Snes9x GX uses this feature in games :unsure:
    And by default this is for player 1 only. Maybe XBOX button could iterate through players. (LED control works, too.)

    Ah yeah, I tested with the wired controller, wireless has the same VID/PID, so it should work, too.
     
    Bladeoner and Ch3ma1980 like this.
Quick Reply
Draft saved Draft deleted
Loading...