DOSBox does not detect axis 4 or 5 on PS4 and XBox 360 controller
-
edited: added segment on xbox 360 after further testing...
I am part of a huge project mapping every DOS action game out there. So far we have covered almost 600 games.
I noted that when I try to assign up and down on the right stick on my Playstation 4 controller in the DOSBox internal mapper (CTRL+F1), nothing happens. No reaction. Nothing is assigned. All other axises works instantly. When I add the axis manually in a .map file it will be displayed as "Key unknown key". Two different PS4 controllers were tested with the same result. Then I tested to assign an xbox 360 controller where y on right stick also is "axis 4" and input_r2_axis is "+5". Lo and behold, same result. These inputs are not detected by the emulator at all.
Example:
key_f3 "stick_0 axis 4 0" "key 284"When I tested the very same procedure with a Playstation 2 controller it worked instantly without issue. The PS2 controller use "Axis 2" for right stick y. When using the same controller on a Windows pc, the Axises are different. Right stick y is axis 3 and right stick x is axis 2. Its only "axis 4" and "axis 5" that are not detected.
This is my "Wireless Controller.cfg", my attached PS4 controller.
input_device = "Wireless Controller"
input_driver = "udev"
input_r_y_plus_axis = "+4"
input_r_x_minus_axis = "-3"
input_l_btn = "4"
input_load_state_btn = "4"
input_start_btn = "9"
input_exit_emulator_btn = "9"
input_r_y_minus_axis = "-4"
input_down_btn = "h0down"
input_l_x_plus_axis = "+0"
input_r_btn = "5"
input_save_state_btn = "5"
input_right_btn = "h0right"
input_state_slot_increase_btn = "h0right"
input_select_btn = "8"
input_left_btn = "h0left"
input_state_slot_decrease_btn = "h0left"
input_l2_btn = "6"
input_l3_btn = "11"
input_l_y_minus_axis = "-1"
input_up_btn = "h0up"
input_a_btn = "0"
input_b_btn = "1"
input_reset_btn = "1"
input_enable_hotkey_btn = "10"
input_l_y_plus_axis = "+1"
input_r2_btn = "7"
input_r3_btn = "12"
input_x_btn = "3"
input_menu_toggle_btn = "3"
input_l_x_minus_axis = "-0"
input_y_btn = "2"
input_r_x_plus_axis = "+3" -
Edit: Sorry remembered it wrong. My Dual shock 4 has the same issue.
-
@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.