Homepage Forums RetroPie Project Everything else related to the RetroPie Project XBox's 360 wireless dpad not working in snes9x

Tagged: , , ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #84527
    sandking
    Participant

    I got no problem with dpad working in NES (RetroArch) and Mame but I can’t make it work in snes9x. I used jtest to check out keys of dpad and this way I set up NES but it doesn’t work in snes9x setup. I tried to use h0up/down/left/right but with no effect. Has anyone made it work?

    #89174
    wikked
    Participant

    I was struggling with this as well until yesterday.

    My problems were:
    * dpad not working
    * left stick not calibrated correctly so it automatically moved left and right even when I didn’t touch it. Menus were a pain as well.
    * buttons not mapped correctly

    I tried figuring out how to remap the buttons properly, but ended up with a working but not so neat solution.

    With snes9x-rpi you need to edit the source files to change the config and then compile it. Luckily it isn’t that hard.

    First, get the source files via git
    git clone https://github.com/chep/snes9x-rpi.git
    This downloads everything into a folder called snes9x-rpi, open it
    cd snes9x-rpi

    open joystick.hpp in the input folder
    nano unix/input/joystick.hpp

    Add the following lines after #define DOWN, the numbers are button IDs for the dpad directions.

    #define JB_UP    13
    #define JB_DOWN    14
    #define JB_LEFT    11
    #define JB_RIGHT    12

    Ctrl+X and save

    open player.cpp in the same folder
    nano unix/input/player.cpp

    Edit the section with all JB stuff to your liking. This works for me (the A, B and X ,Y buttons were flipped as well as Start and Select):

    		if (j[JB_L]) state |= SNES_TL_MASK;
    		if (j[JB_R]) state |= SNES_TR_MASK;
    
    		if (j[JB_Y]) state |= SNES_X_MASK;
    		if (j[JB_X]) state |= SNES_Y_MASK;
    		if (j[JB_A]) state |= SNES_B_MASK;
    		if (j[JB_B]) state |= SNES_A_MASK;
    
    		if (j[JB_SELECT]) state |= SNES_START_MASK;
    		if (j[JB_START]) state |= SNES_SELECT_MASK;
    
    		if (j[JB_LEFT])  state |= SNES_LEFT_MASK;
    		if (j[JB_RIGHT]) state |= SNES_RIGHT_MASK;
    		if (j[JB_UP])    state |= SNES_UP_MASK;
    		if (j[JB_DOWN])  state |= SNES_DOWN_MASK;

    Since I replaced the stuff in the last four if statements, the analog stick doesn’t work anymore, only the dpad.

    Ctrl+X and save the file.

    Compile it
    make
    I got a few warnings during the compilation, but as long as the last lines finish without errors, it seems ok.

    I renamed the old snes9x and kept it just in case
    sudo mv /opt/retropie/emulators/snes9x/snes9x /opt/retropie/emulators/snes9x/snes9x_orig

    Copy the new snes9x to the emulator folder:
    sudo cp snes9x /opt/retropie/emulators/snes9x

    That’s it. I don’t even think it needs to reboot before you try it, but it doesn’t hurt.

    It would be nice to just edit the button ID for each JB label instead of this hack, but I couldn’t figure out how to do that correctly. Perhaps you just have to add more #define lines in joystick.hpp?

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Everything else related to the RetroPie Project’ is closed to new topics and replies.