#xinput #win32 #rawinput #directinput

bin+lib dhc

XInput/rawinput abstraction library for Win32

5 releases

0.2.1 Aug 8, 2019
0.2.0 Aug 7, 2019
0.1.3 Apr 9, 2019
0.0.0 Nov 20, 2018

#117 in Windows APIs

Download history 11/week @ 2023-10-28 2/week @ 2023-11-04 10/week @ 2023-11-11 4/week @ 2023-11-18 15/week @ 2023-11-25 16/week @ 2023-12-02 1/week @ 2023-12-09 6/week @ 2023-12-16 14/week @ 2023-12-23 6/week @ 2023-12-30 8/week @ 2024-01-20 19/week @ 2024-01-27 6/week @ 2024-02-03 34/week @ 2024-02-10

67 downloads per month


1.5K SLoC


CircleCI Docs

dhc is a DirectInput/XInput wrapper DLL that implements controller hotplugging for games that don't do so themselves. It pretends that there are always a fixed number of PS4 controllers plugged in at once, and maps the inputs of real controllers onto the virtual controllers as they are plugged in.


Download the latest release and place the appropriate DLLs in the same folder as the game you want to use dhc with (see the wiki for a table with which architecture to use).

Note that the game binary might be not be the one that's at the top level of the game's directory: if you don't see dhc.log or dhc.toml files being created after you start the game, you probably chose the wrong one. You can right click on the game in Task Manager and use properties to find the location of the actual binary.


See the wiki for a table of tested games and controllers.


On first launch, dhc will create a dhc.toml file in the same directory as dhc.dll, which you can edit with a text editor to change settings.


dhc is implemented in both C++ and rust, so you'll need working toolchains for both languages. Only cross-compilation from Linux has been tested, so if you want to build on a Windows host, you'll either have fun figuring it out, or just use WSL or a Linux VM.

Install the dependencies:

sudo apt-get install ninja-build
sudo apt-get install python3-pip && pip3 install meson
sudo apt-get install mingw-w64

# Install rust
curl https://sh.rustup.rs -sSf | sh -s -- -y
# Restart your shell or source your profile to make sure rustup and cargo are on your $PATH

# Add rust's cross compilation targets
rustup target add i686-pc-windows-gnu x86_64-pc-windows-gnu

# Install cbindgen
cargo install cbindgen

And then build:

git clone https://github.com/jmgao/dhc.git
cd dhc
ninja -C build/i686 install && ninja -C build/x86_64 install

The built DLLs will be copied into dist/{i686, x86_64}.

Known issues

  • XInput controllers only get their triggers forwarded as digital buttons, not analog values.

  • Steam's controller emulation will put itself on top of dhc, which will result in controllers showing up multiple times. To avoid this, either launch the game with no controllers connected, or disable Steam's controller support (View > Settings > Controller > General Controller Settings > uncheck everything).

Reporting bugs

File a bug here, with your dhc.log file attached. Make sure not to restart the game after noticing a crash, as the log file is deleted and recreated on every launch.


~129K SLoC