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

    DOSBOX exit key mapping on gamepad issue

    Scheduled Pinned Locked Moved Help and Support
    dosboxgamepad config
    18 Posts 3 Posters 2.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.
    • jamrom2J
      jamrom2 @mbernier
      last edited by jamrom2

      @mbernier have you tried mapping in the game as well.

      Some games you have to trick to map correctly as they won't see the inputs from a dual stick controller.

      What I mean is this...
      You can make your own mapping file for each game.

      Create the config file for the game and in the [sdl] section add "mapperfile = mapper-sdl2-0.77.1.map" but change the name to whatever you want it to be. Hold that file on the side.

      Now go into the game and config your controls to map to whatever key you want. Let's say "strafe" you set to "s" and "jump" you set to "j". So the game will see those inputs as keyboard inputs... and should work.

      Now go to the mapper file and find the "s" key and "j" key and map those to your controller input whatever you want them to be. Do that for whatever inputs you need for the game and you should have them working in the game now.

      Place that new mapper file in /opt/retropie/configs/pc and again, name goes in the [sdl] section as mentioned above.

      Restart the game and you should have it working.

      These games you have to finagle with because remember... back then, we only had Gravis pads and Joysticks. Wasn't until the Xbox and PS1 came out that we got Multi-button controllers on PC as well. So the games are geared up for keyboard/mouse input as well

      ** you can do what mitsu said above as well. I prefer to keep my mapping files all in the same place this was they are separate from the roms.

      but for staging... create a folder called "dos" in the /home/pi/RetroPie/roms folder. I store all of my DOS games there for Staging so all I have in the /home/pi/RetroPie/roms/pc folder are the configs and the .dosz files for lr-dosbox-pure. It keeps everything clean and separate. So in each of my config files to run my Staging games... I simply have this... plus any other sections I added for performance, mapping... etc.

      for Dynamix A-10 Tank Killer :

      [autoexec]
      mount c /home/pi/RetroPie/roms/dos
      C:
      CD a10
      a10.com
      EXIT

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

        @mbernier said in DOSBOX exit key mapping on gamepad issue:

        my complete map file is here: [https://pastebin.com/921LG5dn](link url)

        The only issue with the map you posted is a blank line at the end, which causes the message from the log:

        ...
        Can't find matching event for
        ...
        

        Otherwise, replacing btn9/10 with btn6/7 (to match my joystick) works for exiting Dosbox by pressing both buttons. So there's nothing wrong with the configuration file.

        Can you try running the game with the .conf file I posted in my first reply ? Just create it in the pc roms folder, replacing the .sh file you have, and run the game.

        EDIT: one more thing - can you check that you're using the RetroPie patched libsdl1.2 package ? Run

        dpkg -l | grep libsdl1.2
        

        and post the output.

        M 1 Reply Last reply Reply Quote 0
        • M
          mbernier @mitu
          last edited by

          @mitu

          Hello !

          Here the command output:

          pi@retropie:~ $ dpkg -l | grep libsdl1.2
          hi  libsdl1.2-dev                     1.2.15+dfsg2-7rpi                   armhf                                     Simple DirectMedia Layer development files
          ii  libsdl1.2debian:armhf             1.2.15+dfsg2-7rpi                   armhf                                     Simple DirectMedia Layer
          

          I removed the blank line in .map file

          And also i tried the "clean" by .sh by moving my multiple -c arguments in the .sh into the [autoexec] tag in the .conf. It works, but it does not solve the original mapping problem. BTW thank you for this trick, it is a lot more clearer now and intuitive !

          I think i will now migrate to staging-dosbox or wait for a new major release of RetroPie (4.8 ?) and re-install everything...

          Best regards,

          Martin

          M 1 Reply Last reply Reply Quote 0
          • M
            mbernier @mbernier
            last edited by mbernier

            Re-Hello,

            i finally understand what happened. It seems that after a kernel/firmware update, gamepad configuration was changed. In fact only a couple of button (select, start, triggers) changed and i was able to remap most of them, but one thing remains: The triggers are now seen as axis instead of button. And this is for all non-libretro core (ex: dosbox).

            i can confirm this by using "jstest /dev/input/js0" that are recognizing my left/right triggers in the axis 2/5 instead of the button 6/7 .

            In the case of dosbox, i changed my left trigger from "stick_0 button 6" to "stick_0 axis 2 0": This works but as soon as i press the trigger in a game, dosbox sees it as always pressed. So i would like to revert my configuration from axis to button based triggers.

            I saw numerous posts on this subject before writing this post and tried the following without success:

            • unsintalled/installed xpad driver
            • edited "options xpad triggers_to_buttons=1" from 1 to 0 in xpad.conf file
            • re-started the emulationstation gamepad configuration GUI

            Nothing works...

            any ideas ?

            regards

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

              @mbernier said in DOSBOX exit key mapping on gamepad issue:

              So i would like to revert my configuration from axis to button based triggers.
              ...
              edited "options xpad triggers_to_buttons=1" from 1 to 0 in xpad.conf file

              If you like the shoulder trigger to behave like buttons, then you need the triggers_to_buttons parameter to be set to 1. Did you try to see if jstest behaves differently with the different options set (0 / 1) ? Note that you need to restart after changing the parameter in order for this to work.

              M 1 Reply Last reply Reply Quote 0
              • M
                mbernier @mitu
                last edited by mbernier

                @mitu

                Hello !

                Thanks for your answer.

                The parameter "options xpad triggers_to_buttons" has the same output in jstest if it configured to 1 or 0. Just to be sure the subdirectory is /etc/modprobe.d/xpad.conf.

                I am 100% confident that the changes are done since i verified the change using "more xpad.conf" after each modification.

                Normal value is -32767 and pressed value is +32767 for both axes 2 and 5. Previously (before kernel or firmware update weeks ago) it was button 6 and 7.

                I also rebooted the RPi 400 after each change.

                Weird isn't ? Also even if i stay on this axis configuration, that is strange that the trigger seems to stay glued after using it. This happens only in games, not in jstest.

                p.s. i have two different logitech f710 gamepad and both of them have the same result.

                UPDATE: I want to add that my F710 controler is configured in Xinput (X) mode,
                meaning that it is in 'analog trigger' mode. But is there a way to keep in X mode and use in button mode in retropie ? The reason for this is that the logitech button is not working in DirectInput (D) mode...

                To recap: why the "options xpad triggers_to_buttons=1" is no longer working for me ?

                Ciao !

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

                  @mbernier said in DOSBOX exit key mapping on gamepad issue:

                  To recap: why the "options xpad triggers_to_buttons=1" is no longer working for me ?

                  Let's check whether the xpad driver is correctly installed. Run the following commands and post the output:

                  cat /sys/module/xpad/parameters/triggers_to_buttons
                  modinfo xpad | head -n 5
                  
                  M 1 Reply Last reply Reply Quote 0
                  • M
                    mbernier @mitu
                    last edited by

                    @mitu

                    Hello !

                    Here is the requested output:

                    pi@retropie:~ $ cat /sys/module/xpad/parameters/triggers_to_buttons
                    Y
                    pi@retropie:~ $ modinfo xpad | head -n 5
                    filename:       /lib/modules/5.10.63-v7l+/kernel/drivers/input/joystick/xpad.ko
                    license:        GPL
                    description:    X-Box pad driver
                    author:         Marko Friedemann <mfr@bmx-chemnitz.de>
                    srcversion:     E1B709DF2EBAA331E53C6D6
                    

                    Thanks a lot !

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

                      @mbernier Can you run the following commands:

                      sudo rmmod xpad
                      sudo rm "/lib/modules/5.10.63-v7l+/kernel/drivers/input/joystick/xpad.ko"
                      sudo depmod -a
                      

                      then reboot and try again after the reboot to see if the triggers map to buttons.

                      M 1 Reply Last reply Reply Quote 0
                      • M
                        mbernier @mitu
                        last edited by

                        @mitu

                        OK i executed the commands. It works ! Will try a couple of things to confirm later but can you tell me what happened ? I am not sure of what i have removed :-)

                        You are a magician !

                        Will do some testing and get back to you !

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

                          @mbernier said in DOSBOX exit key mapping on gamepad issue:

                          I am not sure of what i have removed :-)

                          You removed the Linux kernel's built-in xpad module (driver), so the one installed by RetroPie-Setup took over.

                          The reason the parameter triggers_to_buttons didn't work is because the built-in kernel driver applies it only for certain gamepads, whereas the xpad driver installed from RetroPie-Setup applies it to all gamepads. The system loaded the built-in driver instead of the one installed by RetroPie, so the parameter didn't work for your gamepad(s).

                          Now the question remains why the override doesn't happen by default, this may be something that's changed with an update (for dkms maybe ?).
                          Note that upgrading the kernel would still make the built-in driver the default, reverting to the behavior you noticed, so we should find a solution that would work without the steps I posted earlier.

                          M 1 Reply Last reply Reply Quote 0
                          • M
                            mbernier @mitu
                            last edited by

                            @mitu

                            Thanks for this. That was not an easy one (for me). The support is fantastic, you really are a very knowledgeable team! I would never have found it on my own.

                            I can confirm now that everything seems to be back to normal now.

                            In my case i did not notice immediatly because it only affected non libretro package like redream, dosbox, vice and jzintv. All the others was working properly so it's something that can easily go unnoticed.

                            Best regards,

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

                              @mbernier said in DOSBOX exit key mapping on gamepad issue:

                              In my case i did not notice immediatly because it only affected non libretro package like redream, dosbox, vice and jzintv. All the others was working properly so it's something that can easily go unnoticed.

                              My guess is only SDL1 apps would not be able to work reliably without the trigger_to_buttons param, all other SDL2 applications, should have better support for this configuration.

                              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.