Skip to content

About

Godot bindings of nefarius/ViGEmBus: emulate well-known USB game controllers with ease.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Gamepad Emulator (ViGEm Client)

"Do you not have an XBox or Dual Shock controller? You get one free."

This addon wraps the famous nefarius/ViGEmBus driver in a node-like API.

showcase.gif

Use cases:

  • Testing your game's controller support when you don't have an XBox or Sony controller.
  • Making up and replaying controller input sequences accurately (to polish the feeling of your combat system etc.).
  • Hijacking inputs of a controller at system level and forward to a virtual one (HidHide is recommended as a companion for this use case).
  • And more, you get the idea.

Disclaimer:

  • Not to be confused with "virtual joystick" and "virtual gamepad", which is typically an input widget that allows touchscreen players to interact with your game in a console-like manner.
  • This addon is for Windows only.
  • ViGEm is no longer maintained by its original author, but as a time-tested project it has served its users well. This addon only supports emulating controllers that ViGEm can, which are XBox 360 Controller and Dual Shock 4.

Installation

To install the addon:

  1. Make sure you have ViGEmBus driver installed (typically you'll need to reboot after installing it),
  2. Grab the latest godot-vigem.zip in addon release page,
  3. Unzip to get a folder named addons, put it in your project's root directory,
  4. Open your project in Godot Editor, a line should have been printed: "Connected to ViGEm bus driver.", meaning everything's ready.

Usage

  1. Add a XBox360ControllerEmulator or DualShock4Emulator node into the scene tree to create a virtual controller device,
  2. Call its send_event method with an InputEventJoypadButton or InputEventJoypadMotion of your definition: emulator.send_event(my_event),
  3. Your virtual controller will send the event to your system, emulating a real controller connected to one of your USB ports,
  4. Of course that event will loop back into your game, because the virtual device ACTS LIKE A REAL ONE,
  5. Removing the node from scene tree frees the virtual controller device.

Contributing

  • Please note that this addon is for Windows only.
  • Requires Visual Studio with "Desktop development with C++" workload.
  • Clone the repo with submodules: git clone --recursive git@github.com:lfod1997/godot-vigem.git.
  • It is recommended to use the now-free CLion IDE, because build profiles and a run configuration have been added for the project.
  • Alternatively, make sure you have CMake ≥ 3.25:
    • To build for template_debug with Debug config:
      • Configure: cmake -S . -B cmake-build-debug -DCMAKE_BUILD_TYPE=Debug
      • Build: cmake --build cmake-build-debug --target gdvigem --config Debug
    • To build for template_release with Release config:
      • Configure: cmake -S . -B cmake-build-release -DCMAKE_BUILD_TYPE=Release -DGODOTCPP_TARGET=template_release
      • Build: cmake --build cmake-build-release --target gdvigem --config Release
    • To build for double-precision Godot, add -DGODOTCPP_PRECISION=double when configuring.
  • Demo project at /project/project.godot.

About

Godot bindings of nefarius/ViGEmBus: emulate well-known USB game controllers with ease.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages