RInput Library v1.44 by Vols and Jezuz
RInput is an alternative to in-game raw input, which some users perceive as having input lag or other shortcomings. It also allows for raw input in games which do not have a native raw input implementation. In either case, RInput will only work for x86 (32-bit) games that control aim using the Win32 API functions GetCursorPos and SetCursorPos.
Requirements
- OS: Windows XP or later
- CPU: Intel Pentium 4 or later; or, AMD Opteron, Athlon 64 or later
- Microsoft Visual C++ 2008 Redistributable - x86 9.0.21022.218 or later (included in RInput release downloads starting with v1.34 but only needed if you get a pop-up error like "MSVCR90.dll is missing" when trying to run RInput)
Note
This is a fork of RInput Library v1.31 as originally authored by abort. x64 architecture support was never added by him, but here are some notes on what would need to be changed to accomplish this, in case someone is interested:
- 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)
Building
Compiled with Visual Studio 2008, though you may be able to get it to work with other versions or compilers (Visual C++ 2008 Express Edition is available for free @ https://go.microsoft.com/?linkid=7729279). If you want to start from scratch with your own project file, here's what seem to be the most important compiler and project options:
- Pick Dynamic Library (.dll) as the configuration type
- Compile using Multi-Byte Character Set
- Add the Microsoft SDK (I used v6.0A that came with VS2008/VC++2008) folders as additional Include directory and additional linker library directory
- Add the Microsoft DirectX SDK (https://www.microsoft.com/en-us/download/confirmation.aspx?id=6812) folders as additional Include directory and additional linker library directory (the x86 folder)
- Compiled with Multi-threaded DLL runtime library for linking
- Set Enable C++ Exceptions to Yes (/EHsc), as several of the included standard C++ headers use exception handlers
- Set Calling Convention __cdecl (/Gd), as it seems to be the only one that performs well and allows D3D9 to be hooked
- Set the Entry Point as DllMain
- Add shlwapi.lib, dxguid.lib, comctl32.lib, and detours.lib to the Additional Dependency list in the Linker options
- Use x86 architecture for compiling (i.e., RInput does not support x64 applications)
- MS Detours 1.5 header and library were acquired from http://home.comcast.net/~wiccaan/downloads/Detours.rar
How it works
Summary of the process by the original author:
- 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
Credits
- BuSheeZy - helping me understand Visual C++ IDE and Git
- qsxcv - ideas for how to improve the mouse data handling and information about how mouse input works
- abort - original author
- Dr3am - for the icons