5 releases

✓ Uses Rust 2018 edition

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

#17 in Windows APIs

Download history 10/week @ 2019-04-25 5/week @ 2019-05-02 4/week @ 2019-05-09 11/week @ 2019-05-16 8/week @ 2019-05-23 8/week @ 2019-06-06 28/week @ 2019-06-20 12/week @ 2019-06-27 28/week @ 2019-07-04 32/week @ 2019-07-11 4/week @ 2019-07-18 4/week @ 2019-07-25 24/week @ 2019-08-01

56 downloads per month

Apache-2.0

53KB
1.5K SLoC

dhc

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.

Installation

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.

Compatibility

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

Configuration

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.

Compiling

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
./build/generate.sh
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.

Dependencies

~3–4.5MB
~84K SLoC