🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Properly re-acquiring a DirectInput device for force feedback on focus loss

Started by
1 comment, last by ikt 2 years, 5 months ago

Hello!

I've been adding steering wheel support for a game which doesn't support it, by writing a DLL which gets loaded when the game starts.

The basics work great - all kinds of DirectInput devices are supported and while the game is running, nothing feels wrong. However when alt-tabbing and losing focus, on a specific brand/wheel base (Fanatec CSL DD), the forces seem to randomly disappear for a few milliseconds and then come back, frequently, resulting in a very lumpy feeling FFB.

My current strategy is to figure out if the game window gets re-focused to un-acquire and re-acquire the device. This has worked great for most wheels from Logitech and Thrustmaster. Sadly, for this Fanatec, it seems to not work properly.

I've followed Microsoft's [DirectInput samples for FFConst ( https://github.com/walbourn/directx-sdk-samples/tree/main/DirectInput/FFConst​ ), though I've had to deviate. The game application seems to request focus of connected devices, as I lose FFB when the game window gets focus back, even if I call SetCooperativeLevel with the DISCL_BACKGROUND flag.

Calling Unacquire and Acquire seems to be the only thing that works, though I can't seem to get the lumpiness to go away.

I'm kind of out of ideas, has anyone ever seen something similar and if so, any fix to this behavior?

The best I can do is "don't alt-tab if you've got a wheel from Fanatec", but that's not really a solution ;)

Advertisement

I ended up contacting Fanatec, and got suggested to use INFINITE for the effect duration. I used 500ms as a cheap workaround to stop the effect when the game is paused, as my plugin didn't have the plumbing to detect game pausing.

This solved the issue I was having.

This topic is closed to new replies.

Advertisement