araghon007 / X1nput

Xinput hook for Impulse Trigger emulation
MIT License
320 stars 38 forks source link

X1nput

X1nput is a Xinput hook that emulates Impulse Triggers on the Xbox One controller by sending HID requests to the controller.

There's no way for the game to know whether the controller supports impulse triggers using Xinput API, so this DLL just converts normal vibrations to trigger vibrations.

Usage

  1. Launch X1nputConfigurator.exe

image

  1. Press Refresh. This may take a short while.

image

  1. From the list, select the name of the game you want to use X1nput in and press Inject

image

IMPORTANT: If you're using Steam's Xbox Configuration Support, you need to inject into steam instead
  1. Enjoy trigger rumble

  2. You can unload X1nput from a game at any time by selecting the game and pressing Unload image

Manual Controller Setup

  1. Press the Controller Setup menu option

image

  1. Untick the Automatic checkbox, select a controller from the list and press Test

image

  1. If your controller rumbles, press Use, otherwise try other controllers from the list

image

  1. If you want to use multiple controllers, tick the Multi-Controller Support

image

4a. Select a controller and press Test, to see if it's the one you're using

image

4b. Press Use 1-4 depending on which user index your controller is assigned. It should be the same as the player number in your selected game.

image

  1. Close the window and if X1nput is already injected in a game, select it in the main window and press Refresh

image

Configuration

There are 2 ways to configure X1nput. Through X1nput Configurator, or manually using notepad. To configure X1nput through X1nput Configurator, do the following:

  1. Press the Configure menu option.

image

  1. Here you can see a whole lot of variables which I won't explain here, but you can hover your mouse cursor over them to find out more.

  2. Mess around, have fun and hit Save.

  3. If X1nput is already injected in a game, select it and press Refresh

To manually modify the configuration file, find the X1nput.ini file and edit it with your text editor of choice. You can then manually move X1nput.ini to the folder of the game's executable. This can even allow for per-game configuration, as long as you disable Override Config in X1nput Configurator.

Troubleshooting

Report any unexpected behavior by opening an Issue

Buidling

  1. Open X1nput.sln using Visual Studio 2019 or higher
  2. Build the solution using AnyCPU, 32 and 64-bit X1nput DLLs should be automatically copied to the output folder

Why the switch

Well, I knew from the start that the way X1nput worked wouldn't really be sustainable, so after seeing people mess around with DualSense triggers by messing around with USB requests, I decided to do a bit of my own reverse engineering. Took me a long time and several rabbit holes to get where I am, and the reason I am releasing it in an unfinished state is so that a) I wouldn't lose interest again and let the project die (twice) and b) so that willing people could help me out with actually making this thing work. I was thinking about just making this another Xinput dll replacement, but after coming across r57zone's Xinput hook, that seemed like a way neater option. I'm also hoping that removing the need for all the WinRT stuff, games would no longer refuse to work, and this method might even work on older operating systems (which fun fact, you could actually use Windows.Gaming.Input on Windows 7, but it required copying some WinMD files)

Drawbacks

Xbox One controller drivers use a proprietary form of communication called GIP (Gaming Input Protocol, because Microsoft is all about Gaming) and I thank my lucky stars that Impulse Triggers still work even through the HID protocol.

Sadly, one of the things Microsoft's drivers do is reset vibration every time any app loses focus, so for example whenever you alt tab. This isn't really that bad if you stay in-game, but it's something to keep in mind.

Oh, one very important thing, since this is hooking application code, you should steer clear of any games with anti-cheat.

Todo

Stuff used in this project

r57zone's XInputInjectDLL https://github.com/r57zone/XInputInjectDLL

nefarius XinputHooker https://github.com/nefarius/XInputHooker

libusb hidapi https://github.com/libusb/hidapi/

TasadaKageyu's minhook https://github.com/TsudaKageyu/minhook

scena's PeNet https://github.com/secana/PeNet

and a bunch more tidbits you can see throughout the code

Honorable mentions

CookiePLMonster for helping me out with the original version of X1nput

lindquest for adding pressure-dependent trigger vibration

r57zone for making so many useful projects, you should check out his OpenVR repositories

nefarius for the whole XInputHooker, I wouldn't be able to figure out the DetourDeviceIoControl thing otherwise (probably)

Everyone who was willing to put up with old X1nput and even report issues and whatnot

That one person who tested old X1nput with Cyberpunk 2077 (I thought from the issues page that the old DLL no longer worked)

And thanks to Effieee and others who added X1nput to the PCGamingWiki