Controllers cause erratic movement when enabled.
tdis8629 opened this issue · 2 comments
Operating System: Manjaro Linux
Controllers/drivers used:
- Logic3 XBox 360 compatible controller (xpad/xboxdrv)
- PDP XBox One controller (xpad)
- Steam Controller (sc-controller, generic gamepad) yields no results until I set it to keyboard mapping, which defeats the purpose of enabling controllers
Connecting a game controller causes the PC to jump and move to the right, while constantly jumping. Moving the joystick(s) in any direction, pressing/releasing the triggers, an pressing any of the buttons fails to control the character most of the time, and the keyboard controls yields the same result until the controller is unplugged.
I have a sneaking suspicion that it's an issue with SDL and improper deadzoning of analog joysticks, but am unable to verify, since the original OSA does not compile on my machine.
I ran a few more checks, and can confirm it's an issue with deadzoning. Linked below are three videos for proof, using jstest to see the direct events (axis 0/1 is the X and Y for left joystick), AntiMicro for a visual aid (default deadzone), and the reaction in OSA. In general, the two XBox controllers are not properly centered, and rely on software deadzoning to keep them center, while the wired Steam Controller (no sc-controller driver) is perfectly centered, and can run the game perfectly fine.
I'm combing over the current port's DxLib.cpp (I'm not a C++ developer), but my guess is that it is taking an absolute direction without taking into account of controller defect. Obviously, this is an issue upstream, but if SDL can either use d-pad only or define an acceptable deadzone, this issue would be solved.
Videos:
XBox 1
XBox 360
Steam Controller
EDIT: Attached is a patch to hardcode a deadzone of ±1024 to the horizontal and vertical axis of the joystick. It's quick and dirty, but it works (apparently, you cannot submit .patch files).
DxLib_manual_deadzone.txt
Apologies for the ignorance. I've applied the patch!