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

    PS4 Analog Stick as Mouse for DosBox - Need Help

    Scheduled Pinned Locked Moved Help and Support
    ps4 wirelessmousedosbox
    15 Posts 5 Posters 4.4k 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.
    • D
      dunnieboy
      last edited by dunnieboy

      Can someone point me to recent instructions on how to do this ... there seems to be a glut of WIP threads but I can find anything final.

      Again - I'd like to use my wireless PS4 controller to use the left stick for moving the mouse cursor and the X button to left click and the circle button as right click. The arrows keys i'd like to map to the D-pad. Escape is mapped to share, Enter to options and space could be the big rectangular button or triangle.

      Thanks for any help. - I'd pay for a video tutorial ! =)

      herb_fargusH mediamogulM 2 Replies Last reply Reply Quote 0
      • herb_fargusH
        herb_fargus administrators @dunnieboy
        last edited by

        @dunnieboy http://dosonthepi.blogspot.com/2015/01/configure-game-controllers-in-dosbox_29.html?m=1

        If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

        Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

        1 Reply Last reply Reply Quote 3
        • mediamogulM
          mediamogul Global Moderator @dunnieboy
          last edited by

          @dunnieboy

          The built-in DOSBox mapper is the easiest, most effective way to key-map like you're wanting. However, I don't think it will handle the mouse mapping. For that you'll need an external mapping solution. There's a guide here detailing how to accomplish this in xboxdrv, but it's a couple of streets over from being a video tutorial. If it's something you end up exploring and have questions, I'll be happy to help.

          RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

          D 1 Reply Last reply Reply Quote 0
          • D
            dunnieboy
            last edited by dunnieboy

            this tutorial does not work.

            cd retropie/emulators/dosbox/bin/ does bring me into the bin directory, but when I enter the next command dosbox -startmapper I get -bash: dosbox: command not found.

            1 Reply Last reply Reply Quote 0
            • D
              dunnieboy @mediamogul
              last edited by

              @mediamogul This tutorial is awesome .. however i am running into one problem ... my ps4 wireless controller is giving off signal constantly due to the tilt sensitivity. Do you know a way to kill that ?

              mediamogulM D 2 Replies Last reply Reply Quote 0
              • mediamogulM
                mediamogul Global Moderator @dunnieboy
                last edited by mediamogul

                @dunnieboy

                Not off hand, but you may be able to push a button on your controller, kill evtest immediately and then scroll up to see what the input was. You'd have to do that for each button, but I don't really know of another way.

                RetroPie v4.5 • RPi3 Model B • 5.1V 2.5A PSU • 16GB SanDisk microSD • 512GB External Drive

                1 Reply Last reply Reply Quote 0
                • D
                  dudleydes @dunnieboy
                  last edited by

                  @dunnieboy It's not possible to map the mouse to an analog stick using the DOSBox mapper. I use the Linux Joystick Mapper to map the mouse to the left analog stick of PS3 controller.

                  Here are some threads that describe how to set this up:

                  https://retropie.org.uk/forum/topic/2032/dosbox-mapping-mouse-to-ps3-analog-stick
                  http://blog.petrockblock.com/forums/topic/mapping-a-game-controller-in-kodi/#post-106586

                  D 1 Reply Last reply Reply Quote 1
                  • D
                    dunnieboy
                    last edited by

                    Thanks guys ... Amazing community here.

                    1 Reply Last reply Reply Quote 0
                    • D
                      dunnieboy @dudleydes
                      last edited by dunnieboy

                      @dudleydes ok ... so I think I have everything setup correctly .. but when I enter command and conquer my keyboard is the only device being accessed (and its touchpad is being picked up as mouse)

                      I did the whole joymap thing and got it configured correctly I think.

                      I use .sh files to call .conf files to launch my DOS titles. Here is the code for both.

                      cc.sh
                      sudo /home/pi/joymap-0.4.2/loadmap /home/pi/RetroPie/roms/pc/dosbox-map/mouse.map &
                      /opt/retropie/emulators/dosbox/bin/dosbox -conf "/home/pi/RetroPie/roms/pc/CC.conf"

                      then in the [autoexec] portion of my cc.conf file I have this ...

                      [autoexec]
                      mount c /home/pi/RetroPie/roms/pc
                      c:
                      mount d /home/pi/RetroPie/roms/pc/CC_INSTALL/CDROM -t cdrom -usecd 0 -label GDI
                      cd c&c
                      c&C
                      exit

                      Here is my ps4 mouse.map

                      #General Mouse Mapping for DOSBox

                      #Map Mouse
                      axis vendor=0x054c product=0x05c4 src=0 target=mouse axis=0
                      axis vendor=0x054c product=0x05c4 src=1 target=mouse axis=1
                      button vendor=0x054c product=0x05c4 src=1 target=mouse button=0
                      button vendor=0x054c product=0x05c4 src=2 target=mouse button=1

                      #Navigation
                      button vendor=0x054c product=0x05c4 src=8 target=kbd button="esc"
                      button vendor=0x054c product=0x05c4 src=9 target=kbd button="enter"
                      button vendor=0x054c product=0x05c4 src=13 target=kbd button="space"

                      button vendor=0x054c product=0x05c4 src=4 target=kbd button="up"
                      button vendor=0x054c product=0x05c4 src=7 target=kbd button="right"
                      button vendor=0x054c product=0x05c4 src=5 target=kbd button="down"
                      button vendor=0x054c product=0x05c4 src=6 target=kbd button="left"

                      Thoughts ?

                      D 1 Reply Last reply Reply Quote 0
                      • D
                        dudleydes @dunnieboy
                        last edited by

                        @dunnieboy Your configs look fine.

                        It may be worth testing whether the loadmap binary is working. To do this, I created a file test.map with the following contents for a PS3 controller:

                        # Test Mapping
                        
                        # D-Pad to letters
                        button vendor=0x054c product=0x0268 src=4 target=kbd button="a"
                        button vendor=0x054c product=0x0268 src=5 target=kbd button="b"
                        button vendor=0x054c product=0x0268 src=6 target=kbd button="c"
                        button vendor=0x054c product=0x0268 src=7 target=kbd button="d"
                        
                        # Buttons to numbers
                        button vendor=0x054c product=0x0268 src=12 target=kbd button="num1"
                        button vendor=0x054c product=0x0268 src=13 target=kbd button="num2"
                        button vendor=0x054c product=0x0268 src=14 target=kbd button="num3"
                        button vendor=0x054c product=0x0268 src=15 target=kbd button="num4"
                        

                        From the terminal on the Pi itself - this will not work if you run a terminal session via SSH, run the following command:

                        sudo /home/pi/joymap-0.4.2/loadmap /path/to/test.map
                        

                        When I run this, I see the following messages confirming that loadmap has successfully mapped my PS3 controller:

                        0 joysticks.
                        Found device Sony PLAYSTATION(R)3 Controller (vendor=0x054c, product=0x0268)
                        Found device JOYMAP Code Device (vendor=0x00ff, product=0x0000)
                        16 button assignments.
                        0 axes assignments.
                        

                        When I press a direction on the D-pad, I see one of the letters a to d printed to the console and when I press a face button, I see a number between 1 and 4. Press CTRL+C to exit the program.

                        If your loadmap program isn't working, then try a different version. I found version 0.3.1 worked best for my controller.

                        1 Reply Last reply Reply Quote 0
                        • D
                          dunnieboy
                          last edited by dunnieboy

                          i get the following

                          0 joysticks.
                          Found device Logitech K400 Plus(vendor=0x046d, product=0x404d)
                          Found device Wireless Controller Plus(vendor=0x054c, product=0x05c4)
                          Found device JOYMAP code Device (vendor-0x00ff, product=0x0000)
                          18 button assignments
                          2 axes assignments
                          

                          here is my map file

                           #Test Mapping
                          
                          # D-Pad to letters
                          button vendor=0x054c product=0x05c4  src=4 target=kbd button="a"
                          button vendor=0x054c product=0x05c4  src=7 target=kbd button="b"
                          button vendor=0x054c product=0x05c4  src=5 target=kbd button="c"
                          button vendor=0x054c product=0x05c4  src=6 target=kbd button="d"
                          
                          # Buttons to numbers
                          button vendor=0x054c product=0x05c4  src=1 target=kbd button="num1"
                          button vendor=0x054c product=0x05c4  src=2 target=kbd button="num2"
                          button vendor=0x054c product=0x05c4  src=8 target=kbd button="num3"
                          button vendor=0x054c product=0x05c4  src=9 target=kbd button="num4"
                          button vendor=0x054c product=0x05c4  src=13 target=kbd button="num5"
                          
                          axis vendor=0x054c product=0x05c4 src=0 target=mouse axis=0
                          axis vendor=0x054c product=0x05c4 src=1 target=mouse axis=1
                          

                          When I try to use the controller i get no response.

                          I am using some driver for xbox360 controller installed from the retropie drivers configuration. Is is possible that is interfering ? ( I am using that for Mame etc)

                          ps : i just tried 0.3.1 - same result ...

                          I am wondering if i should try https://github.com/chrippa/ds4drv

                          i saw this post there
                          https://github.com/chrippa/ds4drv/issues/121

                          D 1 Reply Last reply Reply Quote 0
                          • D
                            dudleydes @dunnieboy
                            last edited by

                            @dunnieboy I am using my PS3 controller wired so it may be worthwhile testing your controller via a USB cable.

                            D 1 Reply Last reply Reply Quote 0
                            • D
                              dunnieboy @dudleydes
                              last edited by dunnieboy

                              @dudleydes So ... this is almost working ... I got the mouse motion somewhat under control using the following ...

                              # General Mouse Mapping for DOSBox
                              
                               Map Mouse
                              axis vendor=0x054c product=0x09cc src=0 target=mouse axis=0 min=0 max=255 speed=100 deadzone=20
                              axis vendor=0x054c product=0x09cc src=1 target=mouse axis=1 min=0 max=255 speed=100 deadzone=20
                              
                              #Mouse Buttons
                              button vendor=0x054c product=0x09cc src=1 target=mouse button=0
                              button vendor=0x054c product=0x09cc src=2 target=mouse button=1
                              

                              The buttons don't work at all.

                              The mouse still drifts a bit to the right ... but its way better ... is the only mapper out there for Linux command line?

                              Check this out ... https://github.com/libretro/Lakka/wiki/DOSBox

                              Thanks

                              D 1 Reply Last reply Reply Quote 0
                              • D
                                dudleydes @dunnieboy
                                last edited by

                                @dunnieboy The only other command line mapper program I am aware of is Joy2Key. I couldn't get this to work which is why I ended up using the Linux Joystick Mapper. This tool was created by the developer for his own use and made available to others to use as they wished. The fact that it works on the Pi with any success is due to good fortune rather than design.

                                I would suggest xboxdrv. You can find an example configuration for a PS4 controller connected via USB here.

                                The link you provide is for the libretro version of DOSBox which isn't available in RetroPie because of this issue.

                                1 Reply Last reply Reply Quote 0
                                • N
                                  ningenisu
                                  last edited by

                                  i know is a older post, but here is my map for Worms Reinforcements (1996) for "Dragonrise inc, generic usb joystick", similar PS2 gamepad, using joymap-0.4.2 the dpad controls aim and movement, leftstick analog controls the mouse, L1 & Start buttons for Left - right mouse buttons, square is "enter", cross is "spacebar" and R2 for" control "& right trigger for "f9" ( a combination that quits emulator)

                                  **# Mapping for worms for dragonrise

                                  # Map mouse
                                  axis vendor=0x0079 product=0x0006 src=0 target=mouse axis=0 min="0" max="255" speed="16" deadzone="127"
                                  axis vendor=0x0079 product=0x0006 src=1 target=mouse axis=1 min="0" max="255" speed="16" deadzone="127"

                                  button vendor=0x0079 product=0x0006 src=4 target=mouse button=0
                                  button vendor=0x0079 product=0x0006 src=9 target=mouse button=1

                                  # Actions
                                  axis vendor=0x0079 product=0x0006 src=17 target=kbd plus="down" minus="up" flags="trinary"
                                  axis vendor=0x0079 product=0x0006 src=16 target=kbd plus="right" minus="left" flags="trinary"

                                  button vendor=0x0079 product=0x0006 src=2 target=kbd button="space"
                                  button vendor=0x0079 product=0x0006 src=8 target=kbd button="esc"
                                  button vendor=0x0079 product=0x0006 src=3 target=kbd button="enter"
                                  button vendor=0x0079 product=0x0006 src=7 target=kbd button="leftctrl"
                                  button vendor=0x0079 product=0x0006 src=11 target=kbd button="f9"**

                                  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.