.NET bindings for the ViGEmClient
native library.
Users of this software are encouraged to read the end-of-life statement. So long, cheers 🖖
.NET API to interact with features offered by ViGEm Bus Driver.
This library can be consumed via pre-built NuGet:
Install-Package Nefarius.ViGEm.Client
Requires ViGEmBus v1.19.418 or newer.
using Nefarius.ViGEm.Client;
// initializes the SDK instance
var client = new ViGEmClient();
// prepares a new DS4
var ds4 = client.CreateDualShock4Controller();
// brings the DS4 online
ds4.Connect();
// recommended: run this in its own thread
while (true)
try
{
// blocks for 250ms to not burn CPU cycles if no report is available
// an overload is available that blocks indefinitely until the device is disposed, your choice!
var buffer = ds4.AwaitRawOutputReport(250, out var timedOut);
if (timedOut)
{
Console.WriteLine("Timed out");
continue;
}
// you got a new report, parse it and do whatever you need to do :)
// here we simply hex-dump the contents
Console.WriteLine($"[OUT] {string.Join(" ", buffer.Select(b => b.ToString("X2")))}");
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
Thread.Sleep(1000);
}
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 our support channels.
Please respect that the GitHub issue tracker isn't a helpdesk. We offer support resources, where you're welcome to check out and engage in discussions!
This project uses Fody Costura to embed the native SDK DLLs into the resulting assembly ❤️