RInput Library v1.31
RInput allows you to override low definition windows mouse input (accurate untill 400cpi) with high definition mouse input (raw input, which is more accurate for high cpi mice). This is certainly useful for older games as those engines only support low definition windows mouse input.
Sorry for posting the source this late, I never found the time to find the correct backup, write some comments and add a licensing. The injector still might become open source if I find the time some day. You can use my previous injector in case you just want to edit the source of the library. Otherwise you can use the instructions below with your own injection stub.
The code as presented (the last version I released in 2009) supports X86 architecture only. After Valve embedded Raw Input into their games, I did not see the urge of rewriting the projects for the X64 architecture.
Compile with Visual Studio (or Visual C++ Express);
- Link the library to MS Detours (MS Detours 1.5 was used back then; http://home.comcast.net/~wiccaan/downloads/Detours.rar)
- Make sure you compile the library with a Multi-Byte Character Set
How it works
As most of the developers are not into Win32 API these days, I'll just sum up how the process works:
- The library gets injected into a process by an injector
- The injector creates a windows event to communicate with the injected library
- The injector calls the "entryPoint" function remotely
- The library initializes the hook and raw mouse input
- The library raises the event that has been created by the injector
- The injector gives the user feedback, based on whether the event was raised or not
I never added x64 architecture support, due to old games being 32-bit. Windows XP came out in 2001 and was the first Windows OS to support raw input for input devices. In 2003, 64-bit CPUs were introduced. Building applications for x64 specifically and using the old Win32 cursor API calls, would be contradictory in terms of progressiveness. There is little chance a company would do so (unless quality input data is not important at all). For those that are still interested in implementing this, here is what needs to change at least (perhaps I forgot something):
- The detouring/hooking mechanism needs to support the x64 architectures. This is mainly due to the jumping mechanism for larger pointers. The jumps need to support the whole memory address span over 32-bit
- The injector for RInput needs to support 64-bit injection and support for finding 64-bit processes
- This library obviously has to get recompiled to 64-bit (might require some changes to Win32 API calls for the Rinput HWND)
Dr3am: for the icons Microsoft: for preventing me from writing my own detour/hooking stub