Open SRSaunders opened 4 days ago
I haven't tested the gamepad code for a very long time on Linux. I'll have a look at it next week. IIRC most button mappings were wrong compared to the handling on Windows.
Using a PS4 controller attached via USB, I have tested using Win10+DS4Windows, Manjaro Linux, and macOS Ventura. With my change above (i.e. remove highlighted second call to joystick_polls.Append()
in sysEvent_t Sys_GetEvent()
), the mappings and behaviour on Linux and macOS (i.e. SDL2) are almost identical to Windows. Seems to work fine.
I don't have a modern Xbox controller to test with, so I can't confirm for that input device.
When testing controller/joytick input using SDL, there is something strange that adds controller button input events twice in
sysEvent_t Sys_GetEvent()
and causes an assert later insideidUsercmdGenLocal::Joystick()
:The first call to
joystick_polls.Append()
properly adds a mapped joystickJ_*
value for the joystick buttons. The second call tojoystick_polls.Append()
incorrectly adds a mapped keyK_*
value (>= 256) which is out of bounds foridUsercmdGenLocal::Joystick()
and causes an assert in that code. Commenting out the above line results in correct behaviour in my testing.Why is this second call to
joystick_polls.Append()
in the code? Is there some reason for this that I am missing, or can we comment out or remove this line?