How to use Joystick as a mouse? Ports Edition.
-
@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 \ &
-
-
@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/
-
@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
-
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.
-
-
@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
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.