brlin-tw / OpenSyobonAction-snap

Unofficial Snap Packaging for Open Syobon Action (オープンしょぼんのアクション)
https://github.com/Lin-Buo-Ren/OpenSyobonAction-snap
MIT License
5 stars 1 forks source link

Controllers cause erratic movement when enabled. #5

Closed tdis8629 closed 5 years ago

tdis8629 commented 5 years ago

Operating System: Manjaro Linux

Controllers/drivers used:

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.

tdis8629 commented 5 years ago

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

brlin-tw commented 2 months ago

Apologies for the ignorance. I've applied the patch!