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

    [Solved] DragonRise Controller axis and buttons inverted when in-game

    Scheduled Pinned Locked Moved Help and Support
    dragonrise usbswap controllerconfiguration
    19 Posts 2 Posters 7.3k 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.
    • DjGenEsIsD
      DjGenEsIs
      last edited by DjGenEsIs

      Hey Guys,

      I have a weird one which I think may be a configuration issue.
      I am running RetroPie on Pi 3B with a pair of DragonRise USB controllers.

      I've read a lot in the forum before I even started the project so I connected all buttons e.t.c. EXACTLY the same.
      During testing, my rig was running ok, and the controllers ran wonderfully in and out of MAME.

      However, I must have changed something (maybe changed the emulator from Mame4All to fba, or because I re-ran the initial setup, or changed any settings, hard to know for sure) and now, while the DragonRise controls are working correctly on the EmulationStation menus, settings, e.t.c. when I launch any game this happens:

      -The X and Y axis get inverted.(up/down on the joystick moves the character left/right and vice versa)
      -Start and Select buttons are swapped
      -A and B buttons are swapped.

      This happens only during in-game. Things I've tried:

      • I've configured the controllers a million times,
      • checked the config scripts to see if my controls are registered and they look OK,
      • checked the emulators configs and there's nothing there so they're pointing to the global config which itself looks OK to me too
        -swapped USBs making J1 be J2 and vice versa...

      Does anyone know why the axis and buttons get swapped? is this an emulator issue since it happens only in-game? Could it be the controller boards? The connections?

      tags:

      1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator
        last edited by mitu

        If the controller(s) work fine in Emulationstation (i.e. no inverted axis and no switched buttons) , then check if you didn't remap your controller buttons in the emulator used - RetroArch remaps are in /home/pi/.config/retroarch/config/remaps.
        Start RetroArch with verbose logging enabled from the Runcommand launch menu and get the log file (/dev/shm/runcommand.log) and post it on pastebin.com.

        Did you use the stock RetroPie image when installing the system ?

        DjGenEsIsD 1 Reply Last reply Reply Quote 1
        • DjGenEsIsD
          DjGenEsIs @mitu
          last edited by

          hi mitu! Thanks for the reply :)

          @mitu said in DragonRise Controller axis and buttons inverted when in-game:

          Did you use the stock RetroPie image when installing the system ?

          Yes, I used the RetroPie image.

          check if you didn't remap your controller buttons in the emulator used

          I'll do that straight when I go home.

          Start RetroArch with verbose logging enabled from the Runcommand launch menu and get the log file (/dev/shm/runcommand.log) and post it on pastebin.com.

          Thanks for the info. Looks like I've got a lot to go on with now! I'll post back with my findings

          1 Reply Last reply Reply Quote 0
          • DjGenEsIsD
            DjGenEsIs
            last edited by DjGenEsIs

            Right, I've connected remotely to the RetroPie so:

            1. No re-maps in retroarch/config/remaps (directory is empty)
            2. retroarch.log pastebin (retroarch was ran through remote SSH keep that in mind) https://pastebin.com/86AvixEX
            3. retroarch.cfg on pastebin https://pastebin.com/8AzVSUDB
            4. DragonRise Inc. Generic USB Joystick .cfg configuration from ~/.config/retroarch/autoconfig https://pastebin.com/TyfhBvDm
            1 Reply Last reply Reply Quote 0
            • mituM
              mitu Global Moderator
              last edited by mitu

              This is not the log from a standard RetroPie image

              sudo: ./opt/retropie/supplementary/emulationstation/scripts/configscripts/retroarch.sh: command not found
              ...
              [INFO] [Autoconf]: 0 profiles found..
              ...
              [INFO] [Config]: Saved new config to "/root/.config/retroarch/retroarch.cfg".
              

              You're running RA as root and you've enabled Save on Exit. Also, since the joypad configuration is saved under the pi's user, RetroArch cannot find it, since it looks under the root's settings (which are obviously empty).

              Please start with the image from retropie.org.uk/download, we don't support 3rd party images. Follow the docs to configure your joystick/gamepad.

              DjGenEsIsD 1 Reply Last reply Reply Quote 0
              • DjGenEsIsD
                DjGenEsIs @mitu
                last edited by

                Thanks for helping me out @mitu.

                This is not the log from a standard RetroPie image

                I don't understand wha you mean.. Maybe I understood something wrong. This is the official RetroPIe image retropie-4.4-rpi2_rpi3.img.gz downloaded from https://retropie.org.uk/download/. I still have the image file laying on my desktop....
                I guess I made the mistake of running Retroarch with sudo which produced the wrong output and threw you off.

                Nevertheless I've run it again and here are the logs

                I ran :

                /opt/retropie/emulators/retroarch/bin/retroarch  --menu --verbose >> /home/pi/retroarch.log 2>&1
                

                Which produced:

                retroarch.log--> https://pastebin.com/478eHiQG
                retroarch.cfg from /home/pi/.config/retroarch/retroarch.cfg --> https://pastebin.com/wDbbXBnB
                DragonRise Inc. Generic USB Joystick .cfg configuration from ~/.config/retroarch/autoconfig --> https://pastebin.com/TyfhBvDm

                mituM 1 Reply Last reply Reply Quote 0
                • mituM
                  mitu Global Moderator @DjGenEsIs
                  last edited by

                  @DjGenEsIs said in DragonRise Controller axis and buttons inverted when in-game:

                  I don't understand wha you mean.. Maybe I understood something wrong. This is the official RetroPIe image retropie-4.4-rpi2_rpi3.img.gz downloaded from https://retropie.org.uk/download/. I still have the image file laying on my desktop....

                  Then please run RetroArch from Emulationstation, as it's run in a standard image, not from the commandline. RetroArch is set-up to run through Runcommand, and it doesn't use the normal config file as if would be run standalone. Here is how RetroArch configurations work in RetroPie.
                  If you wish to use RetroArch standalone, then I recommend using Lakka - it's just the barebones Linux starting RetroArch.

                  DjGenEsIsD 1 Reply Last reply Reply Quote 0
                  • DjGenEsIsD
                    DjGenEsIs @mitu
                    last edited by

                    please run RetroArch from Emulationstation, as it's run in a standard image, not from the commandline

                    @mitu OK now I see where did the confusion stem from.

                    Can you please direct me to the documentation that explains how to do that? On this thread the user @dudleydes states:
                    << Verbose logging is only available as an option in the runcommand menu for RetroArch emulators.>>
                    The runcommand wiki does not mention anything.

                    I'll read the retroarch config guide you gave me but is this to validate my configuration or to manipulate the config options to change the key sequence in-game?

                    mituM 1 Reply Last reply Reply Quote 0
                    • mituM
                      mitu Global Moderator @DjGenEsIs
                      last edited by

                      @DjGenEsIs said in DragonRise Controller axis and buttons inverted when in-game:

                      The runcommand wiki does not mention anything.

                      It's literally the 2nd picture from the page - where the Runcommand launch options are shown.

                      I'll read the retroarch config guide you gave me but is this to validate my configuration or to manipulate the config options to change the key sequence in-game?

                      No, it's to understand how the RA configuration files are processed by Runcommand in RetroPie - where the main configuration file is located (i.e. not in ~/.config/retroarch), where you can set per-system RA options or even per-game configuration options. So you'd know in which configuration file to look and modify if you need to change the defaults.
                      Also, the page explains that the way to change the input configuration mappings is through Core input remapping and not by using 'Save Configuration' or 'Save Configuration on Exit'.

                      DjGenEsIsD 1 Reply Last reply Reply Quote 0
                      • DjGenEsIsD
                        DjGenEsIs @mitu
                        last edited by

                        @mitu thanks for the help. I'll do the work, post back and clean the thread if I solve the problem myself.

                        mituM 1 Reply Last reply Reply Quote 0
                        • mituM
                          mitu Global Moderator @DjGenEsIs
                          last edited by

                          @DjGenEsIs There's no need to clean-up anything. Try working with the RetroPie's configuration conventions and see if you can find a solution.

                          1 Reply Last reply Reply Quote 0
                          • DjGenEsIsD
                            DjGenEsIs
                            last edited by DjGenEsIs

                            OK I solved the issue! For future reference and to maybe help someone else, I'll share troubleshooting info:

                            Intro

                            Note that This page explains how the configuration works for RetroArch. I'll sum the parts that interest you in a TL;DR version

                            RetroArch

                            RetroArch is the system that sits between the emulator and your pi and facilitates audio video an gaming inputs.

                            RetroArch and controlls

                            When RetroArch loads, it builds a "virtual controller" which maps your actual controller's buttons to the virtual ones. The virtual controller then passes the inputs on the emulator.
                            There are 3 main ways to configure the virtual controller buttons.
                            1) Automatic configuration from EmulatioStation. This is the first menu you see when you load RetroPie for the first time. So this is saved here:
                            /opt/retropie/configs/all/retroarch/autoconfig
                            The contents of my autoconfig were:

                            
                                  pi@retropie:~ $ ls -al /opt/retropie/configs/all/retroarch/autoconfig
                                  total 16
                                 drwxr-xr-x  2 pi pi 4096 Jan 23 01:42 .
                                 drwxr-xr-x 16 pi pi 4096 Jan 23 14:33 ..
                                 -rw-r--r--  1 pi pi  477 Jan 23 01:42 DragonRise Inc.   Generic   USB  Joystick  .cfg
                                -rw-r--r--  1 pi pi  551 Jan 23 00:50 DragonRise Inc.   Generic   USB  Joystick  .cfg.bak 
                            

                            And the contents of my configuration in DragonRise Inc. Generic USB Joystick .cfg:

                               input_device = "DragonRise Inc.   Generic   USB  Joystick  "
                               input_driver = "udev"
                               input_start_btn = "6"
                               input_exit_emulator_btn = "6"
                               input_down_axis = "-0"
                               input_right_axis = "+1"
                               input_state_slot_increase_axis = "+1"
                                input_select_btn = "7"
                               input_left_axis = "-1"
                               input_state_slot_decrease_axis = "-1"
                               input_up_axis = "+0"
                               input_a_btn = "0"
                               input_b_btn = "1"
                               input_reset_btn = "1"
                               input_enable_hotkey_btn = "5"
                               input_x_btn = "2"
                               input_menu_toggle_btn = "2"
                               input_y_btn = "3"  
                            

                            Notice, the values below:

                            input_up_axis = "+0"
                            input_down_axis = "-0"
                            input_right_axis = "+1"
                            input_left_axis = "-1"

                            When I configured my controller through the GUI and press up/down on my joystick, the values I see on the screen correspond to the "+0" "+1" e.t.c. So the problem was not there.

                            2) Hardcoded Configurations With RetroArch you can configure the mapping of Physical Controller <==> Virtual Controller buttons &joystick axis per emulator.
                            This type further includes to options. Either to change the mappings for a) all emulators, or change the mappings b) per emulator.
                            To achieve a) a global configuration file needs to be edited. This sits in: /opt/retropie/configs/all/retroarch.cfg
                            My retroarch.cfg file is too big so there's no point in attaching it here. However, the specific section which references the controllers is this:

                            # Input device buttons.
                            # Figure these out by using RetroArch-Phoenix or retroarch-joyconfig.
                            # You can use joypad hats with hnxx, where n is the hat, and xx is a string representing direction.
                            # E.g. "h0up"
                            # input_player1_a_btn =
                            # input_player1_b_btn =
                            # input_player1_y_btn =
                            # input_player1_x_btn =
                            # input_player1_start_btn =
                            # input_player1_select_btn =
                            # input_player1_l_btn =
                            # input_player1_r_btn =
                            # input_player1_left_btn =
                            # input_player1_right_btn =
                            # input_player1_up_btn =
                            # input_player1_down_btn =
                            # input_player1_l2_btn =
                            # input_player1_r2_btn =
                            # input_player1_l3_btn =
                            # input_player1_r3_btn =
                            
                            

                            Notice that all the lines have a # in the front, which means they are commented out. This also means that this configuration file does not contain any controller info that would cause the buttons switching during game play.

                            To achieve b) a configuration file for each emulator needs to be edited, and it should reside in its respective folder in the retropie emulator system folder: /opt/retropie/configs/XXXXXXX/retroarch.cfg where XXXXXX is the name of the emulator.
                            In my system these are the contents of /configs folder:

                            pi@retropie:~ $ ls -al /opt/retropie/configs/
                            total 140
                            drwxr-xr-x 35 pi   pi   4096 Jan 20 18:43 .
                            drwxr-xr-x  7 root root 4096 Mar 13  2018 ..
                            drwxr-xr-x  4 pi   pi   4096 Jan 24 09:48 all
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:03 amstradcpc
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:29 arcade
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:08 atari2600
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:02 atari5200
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:07 atari7800
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:02 atari800
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:04 atarilynx
                            drwxr-xr-x  3 pi   pi   4096 Jan 20 18:43 dreamcast
                            drwxr-xr-x  2 pi   pi   4096 Jan 24 08:12 fba
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:06 fds
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:04 gamegear
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:05 gb
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:08 gba
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:05 gbc
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:05 mame-libretro
                            drwxr-xr-x  9 pi   pi   4096 Jan 23 01:32 mame-mame4all
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:06 mastersystem
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:06 megadrive
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:42 n64
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:03 neogeo
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:07 nes
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:02 ngp
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:02 ngpc
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:03 pcengine
                            drwxr-xr-x  2 pi   pi   4096 Mar 13  2018 ports
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:06 psx
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:06 sega32x
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:06 segacd
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:04 sg-1000
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:07 snes
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:08 vectrex
                            drwxr-xr-x  2 pi   pi   4096 Jan 23 01:04 zxspectrum
                            

                            Since I've been playing MAME games and using an fba emulator I checked the contents of the /fba folder:

                             pi@retropie:~ $ ls -al /opt/retropie/configs/fba
                            total 32
                            drwxr-xr-x  2 pi pi 4096 Jan 24 08:12 .
                            drwxr-xr-x 35 pi pi 4096 Jan 20 18:43 ..
                            -rw-r--r--  1 pi pi  195 Apr 14  2018 capex.cfg
                            -rw-r--r--  1 pi pi  441 Jan 23 19:50 content_history.lpl
                            -rw-r--r--  1 pi pi  454 Jan 24 08:06 emulators.cfg
                            -rw-r--r--  1 pi pi  918 Jan 24 08:12 fba2x.cfg
                            -rw-------  1 pi pi  221 Apr 14  2018 retroarch.cfg
                            

                            Sure enough there is something in the /fba2x.cfg file

                            [Keyboard]
                            # Get codes from /usr/include/SDL/SDL_keysym.h
                            A_1=306
                            B_1=32
                            X_1=308
                            Y_1=304
                            L_1=122
                            R_1=120
                            START_1=13
                            SELECT_1=9
                            LEFT_1=276
                            RIGHT_1=275
                            UP_1=273
                            DOWN_1=274
                            QUIT=27
                            #player 2 keyboard controls, disabled by default
                            A_2=999
                            B_2=999
                            X_2=999
                            Y_2=999
                            L_2=999
                            R_2=999
                            START_2=999
                            SELECT_2=999
                            LEFT_2=999
                            RIGHT_2=999
                            UP_2=999
                            DOWN_2=999
                            
                            [Joystick]
                            # Get codes from "jstest /dev/input/js0"
                            # from package "joystick"
                            # Defaults to XBOX 360 Controller
                            A_1=1
                            B_1=0
                            X_1=2
                            Y_1=3
                            L_1=4
                            R_1=5
                            START_1=7
                            SELECT_1=6
                            #Joystick axis
                            JA_LR_1=0
                            JA_UD_1=1
                            #player 2 button configuration
                            A_2=1
                            B_2=0
                            X_2=2
                            Y_2=3
                            L_2=4
                            R_2=5
                            START_2=7
                            SELECT_2=6
                            #Joystick axis
                            JA_LR_2=0
                            JA_UD_2=1
                            #player 3 button configuration
                            A_3=1
                            B_3=0
                            X_3=2
                            Y_3=3
                            L_3=4
                            R_3=5
                            START_3=7
                            SELECT_3=6
                            #Joystick axis
                            JA_LR_3=0
                            JA_UD_3=1
                            #player 4 button configuration
                            A_4=1
                            B_4=0
                            X_4=2
                            Y_4=3
                            L_4=4
                            R_4=5
                            START_4=7
                            SELECT_4=6
                            #Joystick axis
                            JA_LR_4=0
                            JA_UD_4=1
                            
                            [Graphics]
                            DisplaySmoothStretch=1
                            # Display Effect: 0 none, 1 scanlines
                            DisplayEffect=0
                            DisplayBorder=0
                            MaintainAspectRatio=1
                            DisplayAutoRotate=0
                            
                            [Sound]
                            

                            Notice the section below:

                            [Joystick]
                            # Get codes from "jstest /dev/input/js0"
                            # from package "joystick"
                            # Defaults to XBOX 360 Controller
                            A_1=1
                            B_1=0
                            X_1=2
                            Y_1=3
                            L_1=4
                            R_1=5
                            START_1=7
                            SELECT_1=6
                            #Joystick axis
                            JA_LR=0
                            JA_UD=1
                            

                            The #Joystick axis section contains JA_LR_1=0 and JA_UD_1=1 where left and right, according to my the contents of my configuration in DragonRise Inc. Generic USB Joystick .cfg (see above) UP/DOWN should have been '0' and LEFT/RIGHT should have been '1'.

                            Changing these values and correcting the appropriate button maps, solved my problem :)

                            3) The third retroarch controller configuration method is to change the emulator's input mapping itself instead of changing the mapping on RetroPie or RetroArch configuration. For this to work, the emulator itself needs to support this method and it can be applied on the Emulation Station GUI.
                            The example below is a page extract from the RetroArch config page

                            • Start a game of the system you want to remap the buttons
                            • list itemInvoke RGUI (Select+X with player 1)
                            • Go to Quick Menu and then Controls
                            • Configure the buttons the way you want
                            • Select Save Core Remap File
                              OR, if you want to save this remapping for the current game only, select Save Game Remap File

                            Thanks @mitu for pointing me in the right direction !

                            mituM 1 Reply Last reply Reply Quote 0
                            • mituM
                              mitu Global Moderator @DjGenEsIs
                              last edited by

                              @DjGenEsIs Well, glad you got it sorted out. I bet it was easier than modifying any config files.
                              Btw, regarding your post about the fba emulator - the fba2x.cfg I think it's only used for pifba, which is not a RetroArch emulator and only recommended for low perf systems (Pi Zero/1).

                              DjGenEsIsD 1 Reply Last reply Reply Quote 0
                              • DjGenEsIsD
                                DjGenEsIs @mitu
                                last edited by DjGenEsIs

                                @mitu I actually ended up modifying the fba2x.cfg config in /opt/retropie/configs/fba

                                • With regards to pifba I don't know if it came with the image, or it was automatically installed when I updated the RPI with sudo apt-get upgrade or by updating the retropie-setup script and then reinstalling it. Apart from pifba I also have lr-fbalpha and another whose name I can't remember, but my ROM only loads with pifba.

                                Which core in your experience works best ?

                                mituM 1 Reply Last reply Reply Quote 0
                                • mituM
                                  mitu Global Moderator @DjGenEsIs
                                  last edited by

                                  @DjGenEsIs said in DragonRise Controller axis and buttons inverted when in-game:

                                  Which core in your experience works best ?

                                  Undoubtedly, lr-fbalpha. As mentioned in the arcade quick start docs, get the proper ROM set for your emulator, not the other way around.

                                  DjGenEsIsD 1 Reply Last reply Reply Quote 0
                                  • DjGenEsIsD
                                    DjGenEsIs @mitu
                                    last edited by DjGenEsIs

                                    [REPLY MOVED AS A NEW TOPIC]
                                    https://retropie.org.uk/forum/topic/20984/on-mame-emulator-popularity

                                    1 Reply Last reply Reply Quote 0
                                    • DjGenEsIsD
                                      DjGenEsIs
                                      last edited by

                                      @DjGenEsIs said in DragonRise Controller axis and buttons inverted when in-game:

                                      Somehow I feel this needs to be a separate post :S

                                      1 Reply Last reply Reply Quote 0
                                      • DjGenEsIsD
                                        DjGenEsIs
                                        last edited by

                                        @mitu can you please mark this post as [Solved] ?

                                        1 Reply Last reply Reply Quote 0
                                        • mituM
                                          mitu Global Moderator
                                          last edited by

                                          I think you can do it yourself - just edit your initial post.

                                          1 Reply Last reply Reply Quote 1
                                          • 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.