Dosbox mouse emulation
-
So looking around on a few threads on here and other places online, I can't seem to find anywhere people have managed to map an analog stick to Dosbox? The mapper built into Dosbox works great for keystrokes, but the mapper (as far as I can see) doesn't have any commands for emulating the mouse?
I had a go at installing the most recent Linux Joystick Mapper (gives me version 0.4.2) but that seems to cause my cursor to fly across the screen and not behave.
Before I go the xboxdrv route, is there anything obvious in Dosbox or loadmap that I'm missing?
Also I'm using the standalone Dosbox rather than the lr core as I think I saw the retroarch core isn't as good? Or has the lr core been updated and works better?
-
@retropieuser555 No xboxdrv is the only way that we have to works well. It does seem overwhelming. But it's not that bad. There are a few people here that are good with it. Just ask for help
-
@ExarKunIv That's a bummer. Looking at the documentation, my concern is the xboxdrv will have a knock on effect and reset my controls for a bunch of the LR cores and kodi so I'll have to redo all those settings? I might try and see if the one game I want to do this with (fallout) works good enough of the lr-dosbox core, if it does I'll just use that for that one game and the keyboard mapper for the rest of the dosbox games I have that don't need mouse input.
-
@retropieuser555 It is possible to configure xboxdrv to be used with DOSBox on a game-by-game basis. Rather than use the
runcommand-onstart.sh
approach outlined in documentation, I used bash shell scripts to launch xboxdrv with DOSBox, and then to kill the xboxdrv process after exiting DOSBox.You can find he shell script and xboxdrv config file I am using for Abuse at: https://gist.github.com/dudleydes/4bdfa051492b99b5106845b3ee016171
-
@dudleydes Ah nice!! That's kind of what I was attempting with the Linux Joystick Mapper, so it's good to know xboxdrv can behave the same way. I'll look into that option then, thanks!!
-
@dudleydes thanks for the file. i knew there was a way to get xboxdrv to work this way. i have it working for a few others.
i did not know if is was going to be different. this gave me a good head start on finishing my mapping :) -
@dudleydes So Afraid I couldn't get this working the last couple of evenings. I followed the instructions here https://github.com/RetroPie/RetroPie-Setup/wiki/Universal-Controller-Calibration-&-Mapping-Using-xboxdrv but used your files as a basis. I also found my controller is relatively similar to yours as I use an 8bitdo playstation classic adapter (it recognises on linux as a PS4 controller I think), so my controller name, axis etc are roughly named to your abuse.xboxdrv file.
Under Configuration/Tools in RetroPie Setup, does xboxdrv need to be enabled or disabled? As I wasn't sure if that's something that was messing up my file. Aside from that I've tried to keep things as uniform as your file and only changing the path/filenames but Dosbox isn't seemingly recognising the config file.
Oh I also tried using the event number rather than the by-id/name of the controller, still no dice.
Any ideas?
-
@retropieuser555 said in Dosbox mouse emulation:
Under Configuration/Tools in RetroPie Setup, does xboxdrv need to be enabled or disabled?
I believe I have left it disabled as I intend to call xboxdrv at the same time as launching DOSBox.
From memory, this is how I went about creating a config file:
[xboxdrv]
The entry for this line was determined by running the command
ls -l /dev/input/by-id/
and selecting the entry mapped to../event0
. In my case, the output ispi@retropie:~ $ ls -l /dev/input/by-id/ total 0 lrwxrwxrwx 1 root root 9 Aug 25 18:23 usb-Sony_PLAYSTATION_R_3_Controller-event-joystick -> ../event0 lrwxrwxrwx 1 root root 6 Aug 25 18:23 usb-Sony_PLAYSTATION_R_3_Controller-joystick -> ../js0
EDIT
I can test whether xboxdrv picks up controller by running the command below with xboxdrv reporting that Xbox controller is available asjs1
.pi@retropie:~ $ sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv --silent --evdev /dev/input/by-id/usb-Sony_PLAYSTATION_R_3_Controller-event-joystick xboxdrv 0.8.8 - http://pingus.seul.org/~grumbel/xboxdrv/ Copyright © 2008-2011 Ingo Ruhnke <grumbel@gmail.com> Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions; see the file COPYING for details. Your Xbox/Xbox360 controller should now be available as: /dev/input/js1 /dev/input/event1 Press Ctrl-C to quit
If I were to try, for example,
--evdev /dev/input/by-id/usb-Sony_PLAYSTATION_R_3_Controller-joystick
, then I get an error message so it's worth testing commands for your controller in a terminal before proceeding with the below.btw
--evdev /dev/input/event0
also works for my controller.[evdev-absmap]
&[evdev-keymap]
The guide advises to use the command
evtest /dev/input/event0
but when I tried this, I got scrolling text and little info. Instead I used the jstest-gtk application on my Linux PC which gave me the mapping required.I then mapped the buttons and axes on my PS3 controller to those on the virtual XBox 360 controller in this image.
Note the button numbers are the old ones used in Jessie which differ to the ones used in Stretch.
[axismap]
I believe I added this to reverse the Y-axes of the two analog sticks so that up would be up rather than the default flight controls where up is dive (i.e. down). You may need to check if you need this for your controller.
[calibration]
These are the maximum and minimum positions of the analog sticks which can be obtained by running
jstest /dev/input/js0
and moving the analog sticks in any direction.[ui-axismap]
These map the arrow keys to the left analog stick (lines 53-54) and the mouse to the right analog stick (lines 57-58). To map the mouse to the left stick, you can use:
x1 = REL_X:10 y1 = REL_Y:10
[ui-buttonmap]
This section maps key presses to the buttons. The key codes,
KEY_ENTER
etc, were obtained from this page. The buttons are those on the virtual XBox 360 controller as in section[evdev-keymap]
.For testing, I created a test config,
test.xboxdrv
, with the above configuration and in the[ui-buttonmap]
section, the d-pad was mapped to the numbers 1 to 4 and the face buttons to the lettersa
tod
as below:[ui-buttonmap] a = KEY_A x = KEY_B y = KEY_C b = KEY_D du= KEY_1 dr= KEY_2 dd= KEY_3 dl= KEY_4
In the terminal, I ran the command
sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv --config /path/to/test.xboxdrv
I then pressed a button or a direction on the d-pad and if configured correctly, the corresponding key would be written to the terminal. Once I was happy, I used CTRL+C to kill xboxdrv and set about creating the configs for individual games.
-
Hi
When I was messing round with lr-dosbox about a year ago you could control the mouse using the gamepad analog stick. I think this is exactly what you are looking for.
Hope this helps, good luck.
Andy
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.