RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    snes9x-rpi controls broken? Retroflag Gpi

    Scheduled Pinned Locked Moved Help and Support
    snes9x-rpisnes9xcontrollerkeyboardsource code
    48 Posts 4 Posters 4.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      spud11 @SinisterSpatula
      last edited by spud11

      @SinisterSpatula The other thing I should add. Like you, I started using xboxdrv to ensure consistency in exiting all emulators. However, I also found that it was useful for old Arcade games which had 4-way (rather than 8-way) joysticks by using the --four-way-restrictor argument.

      So for individual games such as Pacman that have 4 way restriction, you could set up an individual xboxdrv configuration with --four-way-restrictor which would resolve any diagonal issues. It is a very effective software solution.

      I haven't played too many of the 4-way restricted games as yet on the GPi, so I'm not sure whether this is a problem with the GPi's dpad because it seems to default to the hat mode rather than axis/joystick mode, but I flag it in case people have had trouble with some of the controls for older Arcade games that require a 4 way restricted gate.

      RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

      1 Reply Last reply Reply Quote 0
      • S
        SinisterSpatula
        last edited by

        Yep the $3 I had future plans to do. I think I'm going to move to the fancy way of doing the maps (where it's building the script on the fly so to speak, by just calling blocks of code, so you only write it once and then use the same code block for different mappings), but I thought that might over complicate things for me, early on. But eventually I want to do that. For right now, I just started a new repo where I plan to start basing the mappings off using the alternate D-pad mode, and moving my mappings out of onstart.sh and using a source command inside it instead, to call my mappings that way. My new repo is at: https://github.com/SinisterSpatula/Gpi2/ everything is updated except for the mappings themselves. (working on that next)

        S 1 Reply Last reply Reply Quote 0
        • S
          spud11 @SinisterSpatula
          last edited by

          @SinisterSpatula I think this is a very good idea. Whatever is ultimately easiest for you in designing the code and updating it is definitely the way to go. You've really helped (and are continuing to help) the GPi community which is great.

          The only thing I'm wondering about is whether using the alternate D-pad method permanently will require people to press the SELECT+DPAD LEFT before they start any game and then switch back to the "normal" method after exiting the game. I stress I didn't need to do that with the vice code I've used so hopefully it won't be the case. It'd be really great if the whole thing winds up completely seamless.

          RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

          S 1 Reply Last reply Reply Quote 0
          • S
            SinisterSpatula @spud11
            last edited by

            @spud11 Yes it should be seamless, basically, you set the dpad mode once and leave it. Emulationstation will have it's inputs using that mode and so will all the Lr-cores (because they use what emulationstation uses). One thing that is doing my head in, and maybe you can help with, is.. I saw your --ui-axismap X1=KEY_A:KEY_D,Y1=KEY_S:KEY_W \ and that's exactly what I needed to start using the new d-pad mode. It works wonderfully! But now I'm wondering how do this for my more complex uses of the D-pad, like Duke Nukem 3D for example, where before I was able to do a modifier button + dpad to give it an alternate mapping. My old way using the other d-pad mode was to do this (looking at Duke mapping):

            #Duke Nukem
            if [ "$2" = "eduke32" ]
            then
                sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                --evdev /dev/input/by-id/usb-RetroFlag_GPi_Case_RetroFlag_01-event-joystick \
                --detach-kernel-driver \
                --silent \
                --force-feedback \
                --deadzone-trigger 15% \
                --deadzone 4000 \
                --mimic-xpad \
                --dpad-as-button \
                --no-extra-events \
                --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2,ABS_Z=lt,ABS_RZ=rt \
                --evdev-keymap BTN_SOUTH=a,BTN_EAST=b,BTN_NORTH=x,BTN_WEST=y,BTN_TL=lb,BTN_TR=rb,BTN_THUMBL=tl,BTN_THUMBR=tr,BTN_MODE=guide,BTN_SELECT=back,BTN_START=start,BTN_TRIGGER_HAPPY3=du,BTN_TRIGGER_HAPPY4=dd,BTN_TRIGGER_HAPPY1=dl,BTN_TRIGGER_HAPPY2=dr \
                --evdev-absmap ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
                --ui-buttonmap x=KEY_RIGHTCTRL,a=KEY_E,b=KEY_SPACE,y=KEY_LEFTSHIFT,lb=KEY_A,rb=KEY_D,a+lb=KEY_SEMICOLON,a+rb=KEY_APOSTROPHE,lb+rb=KEY_LEFTCTRL,rb+lb=KEY_LEFTCTRL \
                --ui-buttonmap start=KEY_ENTER+KEY_M,back=KEY_ESC,back+start=KEY_F10 \
                --ui-buttonmap du=KEY_UP+KEY_W,du+a=rel:REL_Y:-5:5,a+du=rel:REL_Y:-5:5,dd=KEY_DOWN+KEY_S,dd+a=rel:REL_Y:5:5,a+dd=rel:REL_Y:5:5,dl=KEY_LEFT,dr=KEY_RIGHT \
                --ui-buttonmap start+y=KEY_J,start+b=KEY_N,start+x=KEY_H,start+a=KEY_TAB \
            &
            fi
            

            Any idea what that might look like with the new d-pad mode?

            1 Reply Last reply Reply Quote 0
            • S
              SinisterSpatula
              last edited by SinisterSpatula

              By the way, du+a and a+du looks repetitive, but I actually found it works better, because this way it does not matter if the player pushed A first, or direction up first. Both ways get the "shifted output".

              1 Reply Last reply Reply Quote 0
              • S
                SinisterSpatula
                last edited by

                Oh, I probably should mention also, regarding your "will it be seamless question", I don't leave xboxdrv running all the time. It's disabled in retropie setup, so it does not start on boot. I start it up during the runcommand-onstart, and I kill it during runcommand-onend. This way it does not conflict with emulation station, or lr-cores. You might have already guessed this, but just in case, I thought I should explain that.

                S 1 Reply Last reply Reply Quote 0
                • S
                  spud11 @SinisterSpatula
                  last edited by

                  @SinisterSpatula said in snes9x-rpi controls broken? Retroflag Gpi:

                  Oh, I probably should mention also, regarding your "will it be seamless question", I don't leave xboxdrv running all the time. It's disabled in retropie setup, so it does not start on boot. I start it up during the runcommand-onstart, and I kill it during runcommand-onend. This way it does not conflict with emulation station, or lr-cores. You might have already guessed this, but just in case, I thought I should explain that.

                  Yes, that is how I do things too. Thanks for confirming.

                  In relation to the modifier+dpad scenario and whether something similar can be done with axis mode, I'll think about that, but I'll need to do that after work, so it might be 6 or 7 hours before I get to it.

                  RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                  1 Reply Last reply Reply Quote 0
                  • S
                    SinisterSpatula
                    last edited by

                    No worries! :) I'm reading the holy bible of xboxdrv (https://xboxdrv.gitlab.io/xboxdrv.html) and it does look like axismap supports combo keys, so I think I'm in luck. I'll update here once I figure this out. :D

                    S 1 Reply Last reply Reply Quote 0
                    • S
                      spud11 @SinisterSpatula
                      last edited by

                      @SinisterSpatula That is very good. That's where I was going to head to as well this evening and also to this thread for ideas:
                      https://retropie.org.uk/forum/topic/2861/guide-advanced-controller-mappings

                      RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                      S 1 Reply Last reply Reply Quote 0
                      • S
                        SinisterSpatula @spud11
                        last edited by

                        @spud11 I got it!!! Yay! :D This works perfectly:

                        #Duke Nukem
                        if [ "$2" = "eduke32" ]
                        then
                            sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
                            --evdev /dev/input/by-id/usb-RetroFlag_GPi_Case_RetroFlag_01-event-joystick \
                            --detach-kernel-driver \
                            --silent \
                            --force-feedback \
                            --deadzone-trigger 15% \
                            --deadzone 4000 \
                            --mimic-xpad \
                            --dpad-as-button \
                            --no-extra-events \
                            --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2,ABS_Z=lt,ABS_RZ=rt \
                            --evdev-keymap BTN_SOUTH=a,BTN_EAST=b,BTN_NORTH=x,BTN_WEST=y,BTN_TL=lb,BTN_TR=rb,BTN_THUMBL=tl,BTN_THUMBR=tr,BTN_MODE=guide,BTN_SELECT=back,BTN_START=start,BTN_TRIGGER_HAPPY3=du,BTN_TRIGGER_HAPPY4=dd,BTN_TRIGGER_HAPPY1=dl,BTN_TRIGGER_HAPPY2=dr \
                            --evdev-absmap ABS_X=dpad_x,ABS_Y=dpad_y \
                            --ui-buttonmap x=KEY_RIGHTCTRL,a=KEY_E,b=KEY_SPACE,y=KEY_LEFTSHIFT,lb=KEY_A,rb=KEY_D,a+lb=KEY_SEMICOLON,a+rb=KEY_APOSTROPHE,lb+rb=KEY_LEFTCTRL,rb+lb=KEY_LEFTCTRL \
                            --ui-buttonmap start=KEY_ENTER+KEY_M,back=KEY_ESC,back+start=KEY_F10 \
                            --ui-buttonmap start+y=KEY_J,start+b=KEY_N,start+x=KEY_H,start+a=KEY_TAB \
                            --ui-buttonmap du=KEY_UP+KEY_W,du+a=rel:REL_Y:-5:5,a+du=rel:REL_Y:-5:5,dd=KEY_DOWN+KEY_S,dd+a=rel:REL_Y:5:5,a+dd=rel:REL_Y:5:5,dl=KEY_LEFT,dr=KEY_RIGHT \
                        &
                        fi
                        
                        S 1 Reply Last reply Reply Quote 0
                        • S
                          SinisterSpatula @SinisterSpatula
                          last edited by

                          Now I'm wondering if it's better to do an axismap or if I should stick with this method (no axismap). I'm leaning toward no axismap because buttonmap seems to be more flexible, or allows more complexity. (or so it seems, I could be wrong)

                          S 1 Reply Last reply Reply Quote 0
                          • S
                            SinisterSpatula
                            last edited by

                            It turns out all I had to change was just one line. All of my mappings just needed this:

                            --evdev-absmap ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
                            

                            Changed to

                            --evdev-absmap ABS_X=dpad_x,ABS_Y=dpad_y \
                            

                            Literally the only change needed.

                            S 1 Reply Last reply Reply Quote 0
                            • S
                              spud11 @SinisterSpatula
                              last edited by

                              @SinisterSpatula Very well done.

                              Is it possible to combine the two? eg --dpad-as-button \ and --trigger-as-button \ plus, for example, --ui-axismap X1=KEY_A:KEY_D,Y1=KEY_S:KEY_W \ and --evdev-absmap ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \ etc?

                              If not, my recollection is that mediamogul had figured out a way of having 2 separate configurations which can be switched via button press.

                              RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                              1 Reply Last reply Reply Quote 0
                              • S
                                spud11 @SinisterSpatula
                                last edited by

                                @SinisterSpatula Excellent. My last message crossed with your's.

                                RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                                1 Reply Last reply Reply Quote 0
                                • S
                                  SinisterSpatula
                                  last edited by

                                  Hmmm, yes that is something to experiment with for sure. Like, if we wanted to try and support whatever mode the dpad button happened to be? I'm not too sure about that. I'm thinking while that would be cool, how much use would it really be. We don't want people constantly switching their d-pad mode. They really should "set it and forget it". So all my maps are going to be consistent and based on a certain mode. I guess, if it's just that one line that changes, it could be stored as a variable at the top of the file, and used in place of the line, depending on which mode they want it to be.

                                  S 1 Reply Last reply Reply Quote 0
                                  • S
                                    spud11 @SinisterSpatula
                                    last edited by

                                    @SinisterSpatula You've probably tried this already, but could you have both --evdev-absmap ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \ and --evdev-absmap ABS_X=dpad_x,ABS_Y=dpad_y \ in the one configuration? Does it conflict?

                                    RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                                    1 Reply Last reply Reply Quote 0
                                    • S
                                      SinisterSpatula
                                      last edited by

                                      @spud11 said in snes9x-rpi controls broken? Retroflag Gpi:

                                      --evdev-absmap ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \

                                      OMG! THAT WORKS. I did not try that, I didn't think that would work but it TOTALLY DOES! I can be in game, and switch my D-pad mode and it does not miss a beat. Holy cow. That's lifechanging lol

                                      S 1 Reply Last reply Reply Quote 0
                                      • S
                                        spud11 @SinisterSpatula
                                        last edited by

                                        @SinisterSpatula Terrific! Your work here is done!!! xboxdrv really is an amazing piece of software.

                                        RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                                        1 Reply Last reply Reply Quote 0
                                        • S
                                          SinisterSpatula
                                          last edited by

                                          Hey @spud11 I got my mappings converted into that advanced fancy style (the one from the advanced xboxdrv controls author). It makes me dizzy to look at it, but it works! :) Thank you so much for your ideas, and input, truly epic advancements today :D I will see about including your vice config and seeing if I can (maybe) improve upon it. I also have openbor on my todo list (there's just a basic mapping to work with the menu's right now for that one).

                                          S 1 Reply Last reply Reply Quote 0
                                          • S
                                            spud11 @SinisterSpatula
                                            last edited by

                                            @SinisterSpatula That's great indeed and I'm glad I could help. I can't wait to see the next iteration you produce.

                                            The advanced mapping method with case statement really works well if you have a lot of code. My arcade machine's runcommand-onstart.sh has about 4,300 lines of code for 4 arcade joysticks, a PS4 wireless controller and an 8BitDo Zero covering about 60 systems. I also use it for all of the libretro cores too now. It doesn't miss a beat, so I reckon you're going down the right path.

                                            Going back to my GPi vice code, with a bit more testing I'm finding that it's definitely not working for every game, so I reckon your newly produced code will be more successful than mine in "universalising" the controls for the c64. Please feel free to experiment with my code of course and make any changes you think are best.

                                            RetroPie v4.4.1 • RPi3 Model B • 5.1V 2.5A PSU • 32GB SanDisk Extreme microSD • 2TB Toshiba Canvio Basics Portable USB 3.0 hard drive • 4 x DragonRise USB Arcade joysticks • 2 x TurboTwist spinners • 1 x USB trackball • 1 x PS4 wireless • 1 x 8BitDo Zero

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                            Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.