Raw input plugin - auto detect new device

anonymous_user_33d428af
Tue, 21 Feb 2017 13:23:59 +0000
Plugins

I am trying to build in a auto detect feature into my game for the raw input plugin. Currently it only detects new devices at startup, but we want our users to be able to plugin their controller at any time. I tried a lot but the problem is that the registered device list within FRawInputWindows needs to be updated and it can only be done the first time through FRawInputWindows::RegisterInputDevice. Afterwards the input device type is registered and no new devices will be detected. I tried using RemoveRegisteredInputDevice, but the handle number is impossible to obtain for a device that is not connected… For example: URawInputFunctionLibrary::GetRegisteredDevices() only returns currently connected devices. A very dirty hack would be to try to remove all registered input devices from handles 1 till 1000 or so, that would work in most cases but is of course no acceptable and safe solution.

Another problem: when a device is disconnected after being connected it keeps sending input on axis. It should automatically disconnect or at least not send data…

3 posts - 3 participants