joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.78k stars 381 forks source link

Joystick (XBox 360 Controller Wireless) does not work #1789

Closed usergithub64 closed 2 years ago

usergithub64 commented 4 years ago

Describe the bug Joystick (XBox 360 Controller Wireless) does not work at all in DOSBox-X with standard configuration, while in DOSBox-Staging v0.75.0, DOSBox ECE r4356, DOSBox SVN-Daum everything works fine.

Environment (please complete the following information):

Wengier commented 4 years ago

Have you used the key mapper to map the joystick buttons? What happens when you try to do so?

usergithub64 commented 4 years ago

In the mapper, the assigned joystick buttons are saved (they are highlighted in white), but when you press them on the joystick, nothing happens (they do not blink in the mapper).

Wengier commented 4 years ago

My Logitech Dual Action Gamepad does work with the key mapper however. When I press some button on the joystick that is saved it will blink in the mapper. I have only one joystick to test at this time though. Perhaps you have more than one joysticks?

usergithub64 commented 4 years ago

No, just one joystick.

Wengier commented 4 years ago

I don’t have XBox 360 Controller Wireless to test myself, so I cannot say what exactly happened. Either it is unsupported in some way, or there is something wrong in the system configuration.

joncampbell123 commented 4 years ago

I have a wired XBox 360 controller, and here on Linux it seems to work just fine, except for some reason SDL1 is mapping LT as one of the axises of the second analog joystick.

usergithub64 commented 4 years ago

I don't quite have an XBox 360 Controller Wireless. I have a Sony Dualshock 3 connected via Bluetooth to a PC via program SCP Server, it works like an XBox 360 Controller in XInput mode. All games under Windows 10 x64 work fine. Also it works fine in DOSBox-Staging v0.75.0, DOSBox ECE r4356, DOSBox SVN-Daum, 86Box.

usergithub64 commented 4 years ago

By the way, in the game Paratrooper (1982), if you play with a joystick, then the muzzle of the cannon does not turn completely to the right. This is observed in DOSBox-Staging v0.75.0, DOSBox ECE r4356, DOSBox SVN-Daum, 86Box, both on Sony Dualshock 3 and on the original XBox 360 Controller Wireless. I used to have the original XBox 360 Controller Wireless. Also in the game Digger (1983), if played with a joystick, then Digger also does not go to the right. Is it something to do with joystick calibration or is there a problem in emulating DOSBox or 86Box joysticks?

joncampbell123 commented 4 years ago

@maximus105 Try setting the timed= setting under the joystick section to true or false and see if that helps.

Condor-2-4-2 commented 4 years ago

Hello,

I have the same problem with an XBOX360 controller which is connected via USB. I also tried both timed settings in the joystick section, but it doesn't work. In the previous version (DOSBox-X 0.83.3 x64 SDL1) the controller was recognized and worked without problems.

Environment:

Windows 10 Home x64 Version 1909 DOSBox-X 0.83.4 x64 SDL1

Wengier commented 4 years ago

@Condor-2-4-2 I cannot think of any changes between 0.83.3 and 0.83.4 that may be related to joystick handling at this time. And the joystick I have works fine even with the latest code. If possible, can you check since which commit (between 0.83.3 and 0.83.4) that your controller becomes unrecognized?

Condor-2-4-2 commented 4 years ago

Are there binary packages of versions between 0.83.3 and 0.83.4? I cannot compile from source code by myself.

I have tested DOSBox-X 0.83.4 x64 SDL2 just now with my controller and here it works. The input of the buttons and sticks are also shown in the mapper.

Condor-2-4-2 commented 4 years ago

Have you tested DOSBox-X 0.83.4 x64 SDL1 with your wired XBOX360 controller also under Windows 10?

Wengier commented 4 years ago

So your issue is more related to SDL1 vs SDL2 I think. For me both SDL1 and SDL2 builds of DOSBox-X 0.83.4 work for my Logitech gamepad under Windows 10. On the other hand, there are no binary packages of versions between 0.83.3 and 0.83.4 at this time (which need to be compiled manually), and I really don't think there are changes between 0.83.3 and 0.83.4 that are directly related to joystick handling.

usergithub64 commented 4 years ago

@maximus105 Try setting the timed= setting under the joystick section to true or false and see if that helps.

No, it didn't help. When set to timed = false, the cannon muzzle does not turn completely to the right, and when timed = true, it does not turn completely to the left.

usergithub64 commented 4 years ago

I checked the joystick again. In DOSBox-X v0.83.3, the joystick works in both SDL1 and SDL2. In DOSBox-X v0.83.4 the joystick works in SDL2, but in SDL1 it does not work at all. And in SDL2 in the mapper on AXIS 3/4, "X-" the the strip is completely full is always lit with bright white.

Wengier commented 4 years ago

@maximus105 I think I see the problem with SDL1. I believe you are using a non-US keyboard layout, and with "usescancodes" set to "auto" (the new default) in such case the joystick did not work in SDL1 build. Try setting "usescancodes" to "false" and see if it makes a difference. I did not use a non-US keyboard layout and that is why it worked for me in both SDL1 and SDL2 builds.

usergithub64 commented 4 years ago

@Wengier I have set usescancodes = true. The joystick now works in SDL1. Also the joystick works in SDL1 with usescancodes = false. And in SDL2 in the mapper on AXIS 3/4, "X-" the the strip is completely full is always lit with bright white.

Wengier commented 4 years ago

@maximus105 The setting "usescancodes=auto" does dynamic switching between "true" and "false" at run-time (instead of only at start), but it should be an easy fix for joystick. As for the issue with SDL2, I will check that.

Wengier commented 4 years ago

@maximus105 I just tried the mapper in SDL2 build, and "X-" on AXIS 3/4 looks fine here. Perhaps it is related to some setting on your computer.

Wengier commented 4 years ago

I have already fixed the said issue in SDL1 build as part of my latest pull request.

usergithub64 commented 4 years ago

Can you test Paratrooper (1982) and Digger (1983) games on your controller? I never managed to get the joystick to work properly in these games. I've tried changing the value of timed = true / false. No, it didn't help. When set to timed = false, the cannon muzzle does not turn completely to the right, and when timed = true, it does not turn completely to the left. In Digger, moving the joystick to the right does not work either. Although in Shamus the joystick works correctly with the default settings for joystick in the .conf file.

rderooy commented 4 years ago

I just tried it on Linux myself.

When I connect a PS4 controller (via USB, did not try Bluetooth), I can see the controller listed with lsusb.

Bus 003 Device 008: ID 054c:09cc Sony Corp. DualShock 4 [CUH-ZCT2x]

When I then start DOSBox-X, I see the following in the log:

LOG: One joystick reported, initializing with 4axis
LOG: Using joystick Sony Interactive Entertainment Wireless Controller with 6 axes, 13 buttons and 1 hat(s)

And starting a game with joystick support, it works fine.

However, when I instead connect a xbox360 wireless controller (again over USB), I can see the controller listed with lsusb.

Bus 003 Device 007: ID 045e:028f Microsoft Corp. Xbox360 Wireless Controller

But when I start DOSBox-X, there is no mention that a joystick is found. When I plug both the PS4 and xbox360 controller in at the same time, it only reports the PS4 controller.

Running the Mapper Editor, I can map keys to the PS4 controller, but not to the xbox360 controller.

rderooy commented 4 years ago

I compiled https://gitlab.com/sdl-jstest/sdl-jstest and running sdl-jstest --list and sdl2-jstest --list also only finds the PS4 controller.

After some more googling, I found the reason. The xbox360 wireless controller does not work when plugged in over USB. The USB cable is for charging only, even though it identifies itself. To use a xbox360 wireless controller on a PC (Linux or Windows) you must use the proprietary Xbox 360 Gaming Receiver USB dongle. The xbox360 wired controller will instead work just fine.

rderooy commented 4 years ago

I have started creating a draft wiki page for Joystick support, in case there are any suggestions on things to add/change... https://github.com/Wengier/dosbox-x-wiki/wiki/Guide%3ASetting-up-joysticks-in-DOSBox%E2%80%90X

usergithub64 commented 4 years ago

I connected a Dualshock 4 gamepad via bluetooth to my PC using DS4WINDOWS software. The gamepad works like an XBox 360 Controller. And checked in DOSBox-X v0.83.5 games Paratrooper (1982), Digger (1983), Buck Rogers Planet Of Zoom (1984), Shamus (1984). Only Shamus game works fine on a gamepad. Can you test the games Paratrooper (1982), Digger (1983), Buck Rogers Planet Of Zoom (1984) on your controller? I have not been able to get the joystick to work properly in these games. I've tried changing the value of timed = true / false. No, it didn't help. When timed = false, the muzzle of the cannon does not rotate fully to the right, and when timed = true, it does not rotate fully to the left. In Digger, you can't move the joystick to the right either. In Buck Rogers, the spaceship goes constantly to the left. Although in Shamus the joystick works correctly with the default joystick settings in the .conf file.

rderooy commented 4 years ago

I just tried Paratrooper with a wireless DS4 controller on Linux. A few things I immediately noticed.

I then disconnected the controller, and connected it directly via USB and restarted DOSBox-X and the game. It behaved exactly the same. And as another test, I tried a DS3 controller, and again the game behaved the same.

I then changed joysticktype= from auto to 2axis, and that solved the auto-start issue. But the other issue remained.

I did not notice any barrel rotation range issue, compared to the keyboard.

usergithub64 commented 4 years ago

Compared to the keyboard, the joystick is much easier and more convenient to play in Paratrooper, since you can hold down the fire key and just move the gun muzzle left / right. And you can't do that on the keyboard, why, when firing, the muzzle of the gun stops immediately. The whole point boils down to playing on the joystick. But because of these problems with turning the gun barrel not completely to the right, it is impossible to play on the joystick. I remember that the joystick worked fine in Paratrooper only on a real 8088 XT 4.77 MHz machine, when I still had this machine.

rderooy commented 4 years ago

Some more testing with Paratrooper

rderooy commented 4 years ago

I have added some more text on the draft wiki page to hopefully explain the different options better: https://github.com/Wengier/dosbox-x-wiki/wiki/Guide%3ASetting-up-joysticks-in-DOSBox%E2%80%90X

rderooy commented 4 years ago

Paratrooper with joystick_type=2axis and timed=false

Max range left ptrooper_000

Max range right ptrooper_001

auto centred ptrooper_002

As you mentioned, the cannon range right is less then left. And the cannon does not centre properly when you let go of the stick.

Running JOYCHECK.EXE inside DOSBox-X also shows that the calibration is off. You can perform calibration inside JOYCHECK (just press "j" and "i"), but that is not retained when you exit the program. It also seems like the calibration problem that JOYCHECK is showing is contrary to that experienced by Paratrooper (unless it is being mirrored) joycheck_000

TMSCOPE.EXE instead seems to show perfect calibration. tmscope_000

rderooy commented 4 years ago

Since Paratrooper is a very old DOS game, meant for the XT, I thought that perhaps its joystick routines may have some timing issue when run too fast. So I tried setting cycles=245 (and also tried core=normal), but it made no difference.

rderooy commented 4 years ago

I found that Paratrooper also auto-starts the game if 2 joysticks are attached, and it's running in 2axis mode. So for game-specific config files it would be nice if you could specifically disable one of the joysticks.

rderooy commented 4 years ago

I had a look at J-Bird, a slightly later game from the same developer (and publisher). It adds a joystick calibration option to the menu, and with timed=false and using the calibration option, the game works (no need for joystick_type=2axis). So I'm guessing the Paratrooper game is just a bit buggy with regards to the Joystick, and the developer fixed the problems with his next game.

rderooy commented 4 years ago

I also tried "PC-Man", which is another 1982 game from the same developer. It also has serious joystick problems. with the default timed=true you suffer major drift to the right (just like Paratrooper), with timed=false that issue is solved, but you can no longer go right. Setting joystick_type= seems to have no effect.

usergithub64 commented 4 years ago

If we assume that only the developer of these games has problems with the joystick, then why then the games: Digger (1983), Rollo And The Brush Bros (1984), Buck Rogers Planet Of Zoom (1984) also have problems with the joystick. These are games from another developers.

usergithub64 commented 3 years ago

Are there resident programs to calibrate the joystick so that they can be applied in DOSBox-X and 86Box? Where can I download them? With preservation of the calibration state in MS-DOS. For example, the Digger game works very poorly with a joystick. I would like to try to calibrate the joystick and see if that helps.

Wengier commented 3 years ago

@maximus105 Can you try the joystick test programs linked below? They are DOS programs that run in DOSBox-X, and you are also able to calibrate the joystick with them, although they are not resident programs.

https://www.vogons.org/download/file.php?id=7643

aybe commented 2 years ago

If both of these changes are accepted then OOBE will be better for XInput devices:

3747

3748

Otherwise, to fix the triggers being mapped to right stick and have both joysticks each mapped to a thumbstick (which makes way more sense IMO), do the following:

SDL1:

[joystick]
joy1axis2=3
joy1axis3=2

SDL2:

[joystick]
joy1axis2=4
joy1axis4=2
AlfredoDore commented 3 months ago

I have a USB converter from NGC to USB and it has a PC switch and WiiU/Switch. In it I have I can play old PC 95/98/XP games played natively on the PC (Windows 11) without a virtual machine without problems as if it were a period control, but DOSBOX is impossible