Convert Figma logo to code with AI

nefarius logoViGEmBus

Windows kernel-mode driver emulating well-known USB game controllers.

3,073
285
3,073
9

Top Related Projects

Virtual HID Mini-user-mode-driver for Sony DualShock 3 Controllers

Like those other ds4tools, but sexier

Quick Overview

ViGEmBus is a Windows kernel-mode driver that emulates USB game controllers. It allows developers to create and manage virtual Xbox 360 controllers, DualShock 4 controllers, and other HID-compliant devices. This project enables software-based controller emulation for various applications, including game development, testing, and accessibility solutions.

Pros

  • Enables creation of virtual game controllers without physical hardware
  • Supports multiple controller types (Xbox 360, DualShock 4, and generic HID devices)
  • Provides a low-level, kernel-mode solution for better performance and compatibility
  • Open-source and actively maintained

Cons

  • Requires installation of a kernel-mode driver, which may pose security risks
  • Limited to Windows operating systems
  • May require elevated privileges for installation and usage
  • Potential compatibility issues with some anti-cheat systems in games

Code Examples

  1. Creating a virtual Xbox 360 controller:
using Nefarius.ViGEm.Client;
using Nefarius.ViGEm.Client.Targets;
using Nefarius.ViGEm.Client.Targets.Xbox360;

var client = new ViGEmClient();
var controller = client.CreateXbox360Controller();
controller.Connect();
  1. Setting button states on a virtual Xbox 360 controller:
controller.SetButtonState(Xbox360Button.A, true);
controller.SetButtonState(Xbox360Button.B, false);
  1. Setting axis values on a virtual Xbox 360 controller:
controller.SetAxisValue(Xbox360Axis.LeftThumbX, 32767); // Full right
controller.SetAxisValue(Xbox360Axis.LeftThumbY, -32768); // Full down
  1. Creating and manipulating a virtual DualShock 4 controller:
var ds4 = client.CreateDualShock4Controller();
ds4.Connect();
ds4.SetButtonState(DualShock4Button.Circle, true);
ds4.SetAxisValue(DualShock4Axis.LeftThumbX, 128); // Centered

Getting Started

  1. Install the ViGEmBus driver from the releases page.
  2. Add the Nefarius.ViGEm.Client NuGet package to your C# project:
    dotnet add package Nefarius.ViGEm.Client
    
  3. Use the code examples above to create and manipulate virtual controllers in your application.
  4. For more detailed documentation and advanced usage, refer to the ViGEmClient wiki.

Competitor Comparisons

Virtual HID Mini-user-mode-driver for Sony DualShock 3 Controllers

Pros of DsHidMini

  • Specifically designed for DualShock 3 and DualShock 4 controllers
  • Provides native Windows support without additional drivers
  • Offers more precise control over controller features

Cons of DsHidMini

  • Limited to PlayStation controllers
  • May require more configuration for optimal performance
  • Less versatile for emulating other types of input devices

Code Comparison

DsHidMini:

NTSTATUS
DsHidMini_EvtDeviceAdd(
    _In_ WDFDRIVER Driver,
    _Inout_ PWDFDEVICE_INIT DeviceInit
)

ViGEmBus:

NTSTATUS
Bus_EvtDeviceAdd(
    _In_    WDFDRIVER       Driver,
    _Inout_ PWDFDEVICE_INIT DeviceInit
)

Both projects use similar function signatures for device addition, reflecting their nature as Windows drivers. However, DsHidMini's function is specifically tailored for PlayStation controllers, while ViGEmBus is more generic, allowing for various virtual game controller types.

ViGEmBus provides a more versatile solution for emulating multiple types of game controllers, while DsHidMini offers specialized support for PlayStation controllers with potentially better integration and feature control. The choice between them depends on the specific use case and the types of controllers needed to be supported.

Like those other ds4tools, but sexier

Pros of DS4Windows

  • User-friendly GUI for easy configuration and profile management
  • Supports multiple controller types beyond just DualShock 4
  • Extensive customization options for button mapping and macros

Cons of DS4Windows

  • Relies on ViGEmBus as a dependency for virtual controller support
  • May require more system resources due to its higher-level functionality
  • Potential for input lag in some scenarios

Code Comparison

DS4Windows (C#):

public static void CreateDs4Controller()
{
    DS4Device device = new DS4Device();
    device.Connect();
    // Additional setup and mapping logic
}

ViGEmBus (C):

PVIGEM_CLIENT client = vigem_alloc();
vigem_connect(client);
PVIGEM_TARGET pad = vigem_target_x360_alloc();
vigem_target_add(client, pad);
// Low-level virtual device creation

ViGEmBus provides a lower-level API for creating virtual controllers, while DS4Windows offers a higher-level abstraction with more user-friendly features. ViGEmBus is more lightweight and focused on virtual device emulation, whereas DS4Windows provides a complete solution for controller input management and customization.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

ViGEm Bus Driver

Windows kernel-mode driver emulating well-known USB game controllers.

Build status GitHub All Releases Discord Website GitHub followers Mastodon Follow


🧟 THIS PROJECT HAS BEEN RETIRED 🧟

Users of this software are encouraged to read the end-of-life statement. So long, cheers 🖖


About

The ViGEmBus driver and ViGEmClient libraries represent the core of the Virtual Gamepad Emulation Framework (or ViGEm , for short). ViGEm aims for a 100% accurate emulation of well-known gaming peripherals as pure software-based devices at kernel level. As it mimics "the real thing" games and other processes require no additional modification whatsoever to detect ViGEm-based devices (no Proxy-DLLs or API-Hooking) and simply work out of the box. While the (now obsolete) Scarlett.Crush Productions Virtual Bus Driver is the spiritual father of this project, ViGEm has been designed and written from the ground up utilizing Microsoft's Kernel-Mode Driver Framework.

Emulated devices

Emulation of the following USB Gamepads is supported:

Use cases

A few examples of the most common use cases for ViGEm are:

  • You have an unsupported input device you'd like to use within games without modifying said game.
  • You want the freedom to use a different controller of your choice in PS4 Remote Play.
  • You encountered a game not compatible with x360ce (prior to version 4.x).
  • You want to extend the reach of your input device (like send traffic to a different machine over a network).
  • You want to test/benchmark your game and need a replay mechanism for your user inputs.
  • You want to work around player slot assignment order issues in XInput.

Supported Systems

🛑 Windows Server might work but is not supported 🛑

Bug reports/support requests regarding running on a Server OS will be discarded.

Version 1.16 and below

The driver is built for Windows 7/8.1/10 (x86 and amd64).

Version 1.17 and above

The driver is built for Windows 10/11 only (x86, amd64 and ARM64).

License

The ViGEm Bus Driver is licensed under the BSD-3-Clause, see LICENSE for more information.

How to build

Prerequisites

You can build directly within Visual Studio.

Do bear in mind that you'll need to sign the driver to use it without test mode.

Contribute

Bugs & Features

Found a bug and want it fixed? Open a detailed issue on the GitHub issue tracker!

Have an idea for a new feature? Let's have a chat about your request on Discord.

Questions & Support

Please respect that the GitHub issue tracker isn't a helpdesk. We offer a range of support resources you're welcome to check out!

Installation

Pre-built production-signed binaries for Windows 10/11 are provided by Nefarius Software Solutions e.U. as an all-in-one setup.

Sponsors

Sponsors listed here have helped the project flourish by either financial support or by gifting licenses:

Known users of ViGEm

A brief listing of projects/companies/vendors known to build upon the powers of ViGEm.

This list is non-exhaustive, if you'd like to see your project included, contact us!