How to use Joystick as a mouse? Ports Edition.
-
I am currently playing Fallout 2 as of this thread:
https://retropie.org.uk/forum/topic/35480/tried-running-win-95-on-dosbox-pure-on-retropie-just-for-fallout-2-failed-need-help/16And I am trying to use my Joystick, or generally Gamepad, as a mouse.
Since Fallout 2 is launched within the ports as of the Retropie-Extras Package, I really need to find out how. I tried to use QJoyPad and using theqjoypad
command, but it always spouts the error:
cannot connect to x server
-
Echoing my comment from Reddit, you'll want to use xboxdrv. You can map any combination of mouse and/or keyboard onto your gamepad; I've not tried it for Fallout but it works well on other ports I have tried like Jedi Outcast which typically uses WASD/mouse controls.
https://retropie.org.uk/docs/Universal-Controller-Calibration-%26-Mapping-Using-xboxdrv/
-
@sleve_mcdichael Quick question, does
xboxdrv
work on newer Xbox gamepads and non-360 (eg 8bitdo) gamepads? Not everybody, including me (I use my Pro Controller, which works just fine), has a 360, let alone a 360 gamepad. -
@PiBoyyy it works on everything, as far as I know. I'm using it with a Logitech.
-
@sleve_mcdichael So from a generic controller, to a Virtual XBox 360 controller, to a mouse? Is that possible? And also, can you give an example of the runcommand-onstart.sh for mouse mapping?
-
@Fenderus Ok, it is late & maybe I should have avoided to post right now...
Edit: And I should have... ok, 3 minutes past & I cannot delete it... so please ignore this post!
-
@Fenderus yes if it puts out a key press. It should be able to be mapped.
I'm 99% sure it will work. But I'm not going to say 100% since all the controllers I have used xboxdrv with have been a 8bitdo.
But but when I was first learning how to use Xbox drv there were people asking questions about using dragon controls for arcade style sticks and they were able to get it to work so I would think your controller also will work
-
@Fenderus said in How to use Joystick as a mouse? Ports Edition.:
also, can you give an example of the runcommand-onstart.sh for mouse mapping?
For example, here is the mapping I use for Jedi Outcast:
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv >> /dev/shm/runcommand.log 2>&1 \ --evdev /dev/input/by-id/usb-Logitech_Wireless_Gamepad_F710_C1A591C5-event-joystick \ --silent \ --detach-kernel-driver \ --force-feedback \ --deadzone-trigger 15% \ --deadzone 1000 \ --device-name "OpenJK-JO Virtual Mouseboard" \ --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=KEY_A:KEY_D,y1=KEY_W:KEY_S,x2=REL_X:16,y2=REL_Y:16 \ --ui-buttonmap a=KEY_SPACE,b=KEY_C,x=KEY_E,y=KEY_F,lt=BTN_RIGHT,rt=BTN_LEFT,lb=REL_WHEEL:1:150,rb=REL_WHEEL:-1:150,tl=KEY_ENTER,tr=KEY_L,dl=KEY_Z,dr=KEY_X,du=KEY_LEFTBRACE,dd=KEY_RIGHTBRACE,guide=KEY_M,back=KEY_TAB,start=KEY_ESC \ &
-
@Fenderus the mouse-to-gamepad mappings are here at:
--ui-axismap (...),x2=REL_X:16,y2=REL_Y:16 \ --ui-buttonmap (...),lt=BTN_RIGHT,rt=BTN_LEFT,lb=REL_WHEEL:1:150,rb=REL_WHEEL:-1:150,(...) \
(This puts the mouse movement, buttons, and wheel onto gamepad right stick, triggers, and bumpers.)
-
@sleve_mcdichael Is there like a way to run it on a specific Port, like when I run Fallout 2, it says on the Booting screen that:
Launching fallout2
Which maybe I can use for this maybe in the file?:
if [ "$1" = "scummvm" ] then sudo killall >> /dev/shm/runcommand.log 2>&1 xboxdrv
I found this on the Official Retropie Guide.
-
@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 yoursfallout2.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.)
-
@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
-
@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."
-
@sleve_mcdichael i thought that's now it might work, thanks for verifying that
-
@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?
-
@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, thefallout
mapping file will be loaded when you play fallout, the (for example)doom
file will be loaded when you play doom, and etc. -
@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?
-
@sleve_mcdichael Also, the game isn't launching, maybe because there is no fi on the runcommad files
-
@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.)
-
@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 \ &
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.