DOSBox does not detect axis 4 or 5 on PS4 and XBox 360 controller
-
@BobHarris said in DOSBox does not detect axis 4 (right stick y+/y- up/down) on PS4 controller:
That's odd indeed. I used the Dosmapper for 1 layout for 5 DOS games. I had no issues assigning keys to any of the directions on the right thumbstick (Dual shock 4 v2). But I couldn't assign any key to the left thumbstick.
Edit: I'm not at home now so I can't verify it...could be that it was just the horizontal axis on the left stick that didn't respond.
I only experience this issue with y on the right stick, and only on a playstation 4 controller, which Retropie reads as "axis 4". You can see what axis is assigned to this by looking under\RETROPIE\configs\all\retroarch-joypads and checking the value after "input_r_y_plus_axis" and "input_r_y_minus_axis".
My playstation 2 controller do not have this problem. The same input is detected as axis 2.
The right stick is essential for our project since we use it for prelaunch commands (such as "f3 for vga, f5 for soundblaster") and for looking around or turning in 3d games.
@BobHarris said in DOSBox does not detect axis 4 (right stick y+/y- up/down) on PS4 controller:
Dual shock 4 v2
I do not know if it matters, but both my controllers are v2 and I tested both. Both are detected as "axis 4" in Retropie.
-
@JemyM IT's been a while since I worked on that and apparently I remembered it wrong. :) I have the same problem as you with the right stick.
-
@JemyM The issue seems to be that in Stretch, the triggers on Playstation controllers are recognised as buttons and axes.
Running
jstest
on my PS3 controller provides the following info:- Axis 0 (X) is Left stick left/right
- Axis 1 (Y) is Left stick up/down
- Axis 2 (Z) is Left trigger
- Axis 3 (Rx) is Right stick left/right
- Axis 4 (Ry) is Right stick up/down
- Axis 5 (Rz) is Right trigger
The standard joystick port in DOS supports a maximum of 4 axes (source). As DOSBox recognises the right stick up/down as the 5th axis, it is not recognised.
My RetroPie build containing DOSBox is still running Jessie, primarily because it would have involved renumbering my DOSbox mapper files. Consequently I haven't looked into this issue (which validates my decision to stick with Jessie).
One solution may be remap the axes with a tool such as xboxdrv which can be installed from the setup script.
Alternatively, you could post at the DOSBox forums, VOGONS.
-
@dudleydes said in DOSBox does not detect axis 4 or 5 on PS4 and XBox 360 controller:
@JemyM The issue seems to be that in Stretch, the triggers on Playstation controllers are recognised as buttons and axes.
Running
jstest
on my PS3 controller provides the following info:- Axis 0 (X) is Left stick left/right
- Axis 1 (Y) is Left stick up/down
- Axis 2 (Z) is Left trigger
- Axis 3 (Rx) is Right stick left/right
- Axis 4 (Ry) is Right stick up/down
- Axis 5 (Rz) is Right trigger
The standard joystick port in DOS supports a maximum of 4 axes (source). As DOSBox recognises the right stick up/down as the 5th axis, it is not recognised.
My RetroPie build containing DOSBox is still running Jessie, primarily because it would have involved renumbering my DOSbox mapper files. Consequently I haven't looked into this issue (which validates my decision to stick with Jessie).
One solution may be remap the axes with a tool such as xboxdrv which can be installed from the setup script.
Alternatively, you could post at the DOSBox forums, VOGONS.
This answers the question indeed. It seems Retropie relies on a dosbox that lacks the joystick patch which is used by both ECE and Daum and other more popular editions.
https://www.vogons.org/viewtopic.php?f=32&t=27452&p=314840&hilit=joystick#p314840
-
@JemyM It is possible to apply the patch in the first post in that thread to RetroPie's version of DOSBox to enable the two remaining axes 4 and 5. I have successfully tested it with a fresh 4.4 image and using Blood where the right stick up/down axis is mapped to look/aim up and down.
Below are the commands I used. It's a good idea to back up your image first or start with a fresh image.
Get Sources
cd cd RetroPie-Setup sudo ./retropie_packages.sh dosbox depends sudo ./retropie_packages.sh dosbox sources
Apply Patch
pushd tmp/build/dosbox/ sudo wget -O dosbox-joystick-patch.diff https://www.vogons.org/download/file.php?id=8645 sudo patch -f -p1 < dosbox-joystick-patch.diff
When applying the patch, you will get a message
Hunk #2 FAILED at 523
. I checked the relevant section of the code and it appears that that section of patch has already been applied.Build and Install
popd sudo ./retropie_packages.sh dosbox build sudo ./retropie_packages.sh dosbox install sudo ./retropie_packages.sh dosbox configure
Now you can test your right stick up/down axis. If all is well, you can remove the source code with the command:
sudo ./retropie_packages.sh dosbox clean
It is possible to raise an issue to ask the devs to include the patch so that DOSBox with the joystick patch can be installed using the setup script rather than the command line.
-
@dudleydes said
It is possible to raise an issue to ask the devs to include the patch so that DOSBox with the joystick patch can be installed using the setup script rather than the command line.
Dudleydes, I thank you greatly for your detailed walkthrough and fix for this issue. I was able to follow your instructions and it worked as intended. I will certainly raise an issue about this. Its essential to be able to use our keyboard to joystick project as intended on the Retropie.
-
Please test and report on whether the joystick binding patch (as well as dosbox in general) works as expected: https://github.com/RetroPie/RetroPie-Setup/pull/2646
-
@psyke83 said in DOSBox does not detect axis 4 or 5 on PS4 and XBox 360 controller:
Please test and report on whether the joystick binding patch (as well as dosbox in general) works as expected: https://github.com/RetroPie/RetroPie-Setup/pull/2646
I am not good enough. I was able to follow Dudleydes instructions above and that worked, but I do not know how to get this patch to my retropie. I tried to update "dosbox from source" but that did not work.
-
@JemyM said in DOSBox does not detect axis 4 or 5 on PS4 and XBox 360 controller:
@psyke83 said in DOSBox does not detect axis 4 or 5 on PS4 and XBox 360 controller:
Please test and report on whether the joystick binding patch (as well as dosbox in general) works as expected: https://github.com/RetroPie/RetroPie-Setup/pull/2646
I am not good enough. I was able to follow Dudleydes instructions above and that worked, but I do not know how to get this patch to my retropie. I tried to update "dosbox from source" but that did not work.
The PR already been merged, so update your Retropie-Setup script and then update dosbox to get the patched version.
Have you tried
dosbox-sdl2
? It might have better joystick handling. -
@psyke83 said in DOSBox does not detect axis 4 or 5 on PS4 and XBox 360 controller:
@JemyM said in DOSBox does not detect axis 4 or 5 on PS4 and XBox 360 controller:
@psyke83 said in DOSBox does not detect axis 4 or 5 on PS4 and XBox 360 controller:
Please test and report on whether the joystick binding patch (as well as dosbox in general) works as expected: https://github.com/RetroPie/RetroPie-Setup/pull/2646
I am not good enough. I was able to follow Dudleydes instructions above and that worked, but I do not know how to get this patch to my retropie. I tried to update "dosbox from source" but that did not work.
The PR already been merged, so update your Retropie-Setup script and then update dosbox to get the patched version.
Have you tried
dosbox-sdl2
? It might have better joystick handling.I forgot about this because I updated and I can verify that it works. We are not using dosbox-sdl2 in our keyboard 2 joypad project since its not needed. The keyb2joy.pad project document and index keys assigned to functions. We basically fill in columns with the keys used for things like "jump", "move" or "fire". I have then made an utility that produce authentic DOSBox .map files with full Retropie-support based on these profiles. So far we made 550 platform games fully playable on joypad and we are 20% through the 600 shoot-em ups on the DOS platform.
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.