SDL_SetRelativeMouseMode - Crazy beeping

Hi,

In the menus I use the mouse as normal. When a game starts I call SDL_SetRelativeMouseMode to keep the mouse in the window.

Some players are reporting a massive lag in fps and crazy beeping coming from their PC at this point.

Any ideas?

Cheers,
Steve

1 Like

You only need to execute SDL_SetRelativeMouseMode once, at the startup of the program/game, and not every frame. As long as the mode isnā€™t changed again, the mode will stay as it is.

I donā€™t know if the continuously call of SDL_SetRelativeMouseMode will cause the lag etc, but it might be worth checking it out.

1 Like

I only call SDL_SetRelativeMouseMode once when I transition into game play.

Yesterday I added a command line option to disable this call and it fixed the problem for those players. So thereā€™s definitely something wrong with this call.

Hereā€™s the thread where the problem is explained:

1 Like

Googling suggests this is a bug in an Xinput driver, fwiw.

(the beeping is, if I recall correctly, a Windows thing that means ā€œthe input queue for the mouse is full and not being emptied fast enough,ā€ which tends to mean some kernel-level driver is hanging for whatever reason.)

SDL_SetRelativeMouseMode on Windows calls RegisterRawInputDevices() to get mouse input outside of the usual Windows mouse events. I donā€™t know why it would cause this specific bug, but I could see it tickling parts of the system that might.

2 Likes

Thanks for the info. Do you know a way I could detect this so the game can counter it? Itā€™s simple enough to do by not ā€˜grabbingā€™ the mouse.