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

    How to use Joystick as a mouse? Ports Edition.

    Scheduled Pinned Locked Moved Help and Support
    portsfallout 2gamepadmousejoystick
    25 Posts 6 Posters 1.8k 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
      sleve_mcdichael @Fenderus
      last edited by sleve_mcdichael

      @Fenderus said in How to use Joystick as a mouse? Ports Edition.:

      @sleve_mcdichael Is there like a way to run it on a specific Port,

      Yeah so here is my runcommand_onstart.sh (excerpt):

      # $1 = system, $2 = emulator, $3 = rompath, $4 = command
      [[ -f "/opt/retropie/configs/all/xboxdrv/$1.xbd" ]] && bash "/opt/retropie/configs/all/xboxdrv/$1.xbd" #xbd
      

      ...so then, the mapping I posted earlier goes into a file called for example jedioutcast.xbd and so whenever the system (port) jedioutcast is ran (you would call yours fallout2.xbd with this scheme), the mapping is loaded at start.

      runcommand-onend.sh then kills the process and restores the default gamepad mapping with:

      pgrep xboxdrv >/dev/null && sudo killall xboxdrv >> /dev/shm/runcommand.log 2>&1 #xbd
      

      (In the guide, they kill the custom xboxdrv mapping and then restart a "default" one -- I don't use a default one, it's just for the special cases, so I just kill any that are found at end and don't start any new one.)

      ExarKunIvE F 2 Replies Last reply Reply Quote 0
      • ExarKunIvE
        ExarKunIv @sleve_mcdichael
        last edited by

        @sleve_mcdichael said in How to use Joystick as a mouse? Ports Edition.:

        [[ -f "/opt/retropie/configs/all/xboxdrv/$1.xbd" ]] && bash "/opt/retropie/configs/all/xboxdrv/$1.xbd" #xbd

        how does that work?

        i use a more direct way, but as i have comes to expect from you, your way it way cleaner

        RPi3B+ / 200GB/ RetroPie v4.5.14, RPi4 Model B 4gb / 256gb / RetroPie 4.8.2
        RPi5 4gb / 512gb / RetroPie 4.8.9 -Basic
        Maintainer of RetroPie-Extra .

        S 1 Reply Last reply Reply Quote 0
        • S
          sleve_mcdichael @ExarKunIv
          last edited by

          @ExarKunIv said in How to use Joystick as a mouse? Ports Edition.:

          how does that work?

          [[ -f "/opt/retropie/configs/all/xboxdrv/$1.xbd" ]] && bash "/opt/retropie/configs/all/xboxdrv/$1.xbd" #xbd

          "[[ If there's a file in the specified location called '[system].xbd` (where `[system]` matches the system being launched) ]], && then execute the contents of that file using bash interpreter. #identifying mark indicates the purpose of this line."

          ExarKunIvE 1 Reply Last reply Reply Quote 0
          • ExarKunIvE
            ExarKunIv @sleve_mcdichael
            last edited by

            @sleve_mcdichael i thought that's now it might work, thanks for verifying that

            RPi3B+ / 200GB/ RetroPie v4.5.14, RPi4 Model B 4gb / 256gb / RetroPie 4.8.2
            RPi5 4gb / 512gb / RetroPie 4.8.9 -Basic
            Maintainer of RetroPie-Extra .

            1 Reply Last reply Reply Quote 0
            • F
              Fenderus @sleve_mcdichael
              last edited by Fenderus

              @sleve_mcdichael Should I replace $1

              # $1 = system, $2 = emulator, $3 = rompath, $4 = command
              [[ -f "/opt/retropie/configs/all/xboxdrv/$1.xbd" ]] && bash "/opt/retropie/configs/all/xboxdrv/$1.xbd" #xbd
              
              

              with fallout2?

              And write this:

              pgrep xboxdrv >/dev/null && sudo killall xboxdrv >> /dev/shm/runcommand.log 2>&1 #xbd
              

              onto the runcommand-onend.sh file?

              S 1 Reply Last reply Reply Quote 0
              • S
                sleve_mcdichael @Fenderus
                last edited by

                @Fenderus said in How to use Joystick as a mouse? Ports Edition.:

                Should I replace $1
                with fallout2?

                No, keep it as the variable $1; then, the fallout mapping file will be loaded when you play fallout, the (for example) doom file will be loaded when you play doom, and etc.

                F 2 Replies Last reply Reply Quote 0
                • F
                  Fenderus @sleve_mcdichael
                  last edited by Fenderus

                  @sleve_mcdichael problem is, does the lxde desktop get involved, since it is a port? And how about the void things like:

                  --ui-buttonmap guide=void,x=void,y=void,lb=void,rb=void,tl=void,tr=void,lt=void,rt=void,back=void \
                  --ui-axismap x2=void \
                  

                  Is it important?

                  S 1 Reply Last reply Reply Quote 0
                  • F
                    Fenderus @sleve_mcdichael
                    last edited by

                    @sleve_mcdichael Also, the game isn't launching, maybe because there is no fi on the runcommad files

                    1 Reply Last reply Reply Quote 0
                    • S
                      sleve_mcdichael @Fenderus
                      last edited by

                      @Fenderus said in How to use Joystick as a mouse? Ports Edition.:

                      @sleve_mcdichael problem is, does the lxde desktop get involved, since it is a port?

                      No.

                      And how about the void things like:

                      --ui-buttonmap guide=void,x=void,y=void,lb=void,rb=void,tl=void,tr=void,lt=void,rt=void,back=void \
                      --ui-axismap x2=void \
                      

                      Is it important?

                      You can "void" an input if you don't want it to do anything not even its original function.

                      Also, the game isn't launching, maybe because there is no fi on the runcommad files

                      Maybe cause what? I don't understand what you mean but you can check for any errors reported in the runcommand.log file.

                      If you're talking about the runcommand onstsrt/onend scripts, please post the entire contents in a

                      ```
                      code block
                      with three back-ticks
                      before and after
                      ```
                      

                      (Or upload to pastebin.com if it is very large and share the link here.)

                      F 1 Reply Last reply Reply Quote 0
                      • F
                        Fenderus @sleve_mcdichael
                        last edited by

                        @sleve_mcdichael Yeah, I meant the run command on-start and on-end files, also the #!/bin/sh in the two files came from the official guide (https://retropie.org.uk/docs/Universal-Controller-Calibration-%26-Mapping-Using-xboxdrv/)

                        My run command on start (Copied from your Suggestions):

                        #!/bin/sh
                        [[ -f "/opt/retropie/configs/all/xboxdrv/$1.xbd" ]] && bash "/opt/retropie/configs/all/xboxdrv/$1.xbd" #xbd
                        

                        My run command on end (Copied from your Suggestions):

                        #!/bin/sh
                        pgrep xboxdrv >/dev/null && sudo killall xboxdrv >> /dev/shm/runcommand.log 2>&1 #xbd
                        

                        Anf my Fallout 2 xbd file:

                        sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv >> /dev/shm/runcommand.log 2>&1 \
                            --evdev /dev/input/event0
                            --silent \
                            --detach-kernel-driver \
                            --force-feedback \
                            --deadzone-trigger 15% \
                            --deadzone 1000 \
                            --evdev-absmap ABS_X=x1,ABS_Y=y1,ABS_RX=x2,ABS_RY=y2,ABS_Z=lt,ABS_RZ=rt,ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y \
                            --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 \
                            --axismap -Y1=Y1,-Y2=Y2 \
                            --ui-axismap x1=REL_X:16,y1=REL_Y:16 \
                            --ui-buttonmap a=BTN_LEFT,b=BTN_RIGHT,x=KEY_RETURN,y=KEY_ESC,tl=BTN_RIGHT,tr=BTN_LEFT,start=KEY_ESC \
                            &
                        
                        S 1 Reply Last reply Reply Quote 0
                        • S
                          sleve_mcdichael @Fenderus
                          last edited by sleve_mcdichael

                          @Fenderus

                          --evdev /dev/input/event0
                          

                          Missing a \ backslash here, could that sort you out?

                          F 2 Replies Last reply Reply Quote 0
                          • F
                            Fenderus @sleve_mcdichael
                            last edited by Fenderus

                            @sleve_mcdichael It launched normally, but the controls did not work.

                            Also, does /dev/input/by-id/ exist when there are multiple controllers? Because the directory didn't exist when I typed:

                            ls /dev/input/by-id/
                            
                            1 Reply Last reply Reply Quote 0
                            • F
                              Fenderus @sleve_mcdichael
                              last edited by

                              @sleve_mcdichael Found the Problem, apparently, I don't know what the ENTER key is, found the problem on the /dev/shm/runcommand.log file:

                              fallout2
                              fallout2
                              
                              /opt/retropie/ports/fallout2/fallout2.sh
                              xboxdrv: no process found
                              
                              -- [ ERROR ] ------------------------------------------------------
                              error: invalid argument '--ui-buttonmap a=BTN_LEFT,b=BTN_RIGHT,x=KEY_RETURN,y=K$couldn't convert 'KEY_RETURN' to enum, not a member of EV_KEY
                              
                              Parameters:
                              Executing: /opt/retropie/ports/fallout2/fallout2.sh
                              
                              N 1 Reply Last reply Reply Quote 1
                              • N
                                Nash @Fenderus
                                last edited by Nash

                                @Fenderus

                                Try KEY_ENTER

                                You can see all KEY_ accepted by xboxdrv with the command xboxdrv --help-key

                                If you have 2 joysticks on your gamepad you can map the mouse too on x2 and y2 with smaller REL values. In game you can be more precise with this second joystick if needed.

                                F 1 Reply Last reply Reply Quote 0
                                • F Fenderus referenced this topic on
                                • F
                                  Fenderus @Nash
                                  last edited by

                                  @Nash does xboxdrv have hotkeys, turbo, and toggle settings like antimicrox?

                                  Made a post here: https://retropie.org.uk/forum/topic/35784/does-xboxdrv-have-hotkeys-turbo-and-toggle-settings-like-antimicrox

                                  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.