Hi, just for some context i’m developing using an open source unreal engine 4 plugin that uses SDL2 to add better input support. The full source code is here, though it seems that the problem i’m having isn’t found there. GitHub - tsky1971/UEJoystickPlugin: Unofficial Joystick Plugin for the Unreal Engine
I’m using a while(SDL_PollEvent), (and i have also tried SDL_AddEventWatch to the same effect ), which every frame is consuming the SDL event queue. Sometimes someone will do something like release the trigger on the joystick, or center and release the joystick, and it will get stuck firing forever or get stuck off-center because the last input with trigger press or release, or the center position gets dropped.
I’ve used a debugger to trace this problem down to SDL event poller itself, when this bug happens the event for “press trigger”, “release trigger” or “joystick at 0,0” is never present in sdl’s the event queue to begin with. This happens on multiple devices on multiple testers setups in different countries so while an identical hardware failure is possible it’s very unlikely.
The problem is also framerate dependent, the more frequently we’re pumping events, the less inputs get missed by sdl, at 1 fps 10-25% of inputs get dropped, and at 100 fps about .5% of inputs get dropped which is unfortunately still quite noticable in gameplay, as the problem was noticed by a tester at a high framerate.
As a test i replaced the poll with a pump and peek to check if something else was polling the event queue and eating the events, but in this setup the event queue only increases in size and never drops, staying flat when the joystick is left untouched. Therefore something else isn’t eating the events. Additionally it’s not capping out, since during my testing i never got anywhere near the event queue limit even without polling active, generating about 100 events per second per device.
So, the only conclusion i can make at this point is that all 3 versions of sdl2 i’ve tried(2.0.8, 10, 14) are somehow broken, or something else is consuming the OS events before sdl can pull them into it’s event queue. Or i’m badly misunderstanding something.
Can anyone help figure this out? Im not sure i would even start with how to check if something else is eating the OS(windows in this case) event queue before sdl is getting to them. Unreal engine doesn’t even have directinput support without other plugins (which i have disabled) so if it’s unreal engine somehow eating the inputs from the OS queue im not sure where it would be doing that from.