Fix for Logitech/HID FPS problem without disabling devices

Instructions

[EDIT] I've updated the fix so it should no longer require to install the Visual C++ Redistributable package. It would be nice if someone who hasn't installed the package yet could confirm that this version works. If it doesn't, just use the old version.

Download the following zip-file [community.pcgamingwiki.com] from PCGamingWiki.

Extract the file 'dinput8.dll' to your FEAR main game folder. For steam this in most cases is 'Steam\steamapps\common'. For example: 'D:\Games\Steam\steamapps\common\FEAR Ultimate Shooter Edition'.

Start the game like you would normally, for example through Steam or GOG-Galaxy.

What you should know

I say possible fix because up to this point I only tested this myself. Since I didn't do a longer play session (> few hours) I can't say for certain if this will work in all cases and if there are some unanticipated problems with different hardware configurations. However, even if it turns out that it does not work for all people right now, the problem should definitely be fixable using the approach I used here. Feedback would be highly appreciated.

How this works

[EDIT] Now also available as a Steam-Guide It as a well-known problem that there is a bug in FEAR and its expansions where the FPS will drop to around 20-30 after a few minutes of play. This is especially common with people using Logitech devices. Although this can be fixed by disabling most/all HID-Devices in the device manager, it bothered me a lot that his has to be done, even when using the script someone came up with.I took some time to investigate this problem and came up with a possible fix that removes the problem without having to disable any HID-Device.I only tested this on Steam but it should in theory work with every version including the retail one.[EDIT] I replaced the old version with the new one since it has confirmed to be working by several people.[EDIT] Fix has been confirmed to be working by several people.Also since this is an executable DLL-File I could have put any harmful shenanigans in there. You just have to trust me that the file is clean. Be aware however, that the file could trigger anti-virus software, although I didn't have any problems on my end.[EDIT] If you don't trust me -- and why should you -- feel free to use a meta online virus scanner like VirusTotal to verify the file. Be aware however, that the file could trigger anti-virus software without being harmful. Although nobody reported any problems up to this point.The fix is implemented using a common technique known as 'DLL hooking'.User input in FEAR is realized via DirectInput, an API by Microsoft for interacting with HID-Devices. The library is ancient and not really relevant today, because there are other ways to get mouse and keyboard input, especially for games.The fps drops happen because the thread that runs DirectInput massively slows down after a while (as can be seen in tools like 'ProcessExplorer').If an application uses a library like DirectInput, it needs a so called DLL (dynamic-link library) where the functionality of the library is stored. In many cases, especially for libraries provided by Microsoft, these DLLs usually reside in the Windows folder.However, there is an order of how an application searches for the DLLs it needs. Since the DLL of the fix gets copied into the main folder of the application and has the same name of a DLL needed by the game (the one of DirectInput), it gets loaded instead of the one in the windows folder.This means that all calls to DirectInput go through the Hook-DLL and can either be directed to the original DLL in the Windows folder or changed as necessary. This also allows some insight in how exactly the library is used by the game.As it turned out the game not only unnecessarily registers all HID-devices it also calls several functions every frame that usually only should be called once during initialization. The latter seems to apply only to devices that are not keyboards or mice. This eventually leads to circumstances where a lot of time is spent opening and closing device connections.The fix changes the DirectInput initialization in such a way that only keyboard and pointer devices get registered.