Skip to content

Instantly share code, notes, and snippets.

View nefarius's full-sized avatar
😇
I may be slow to respond.

Benjamin Höglinger-Stelzer nefarius

😇
I may be slow to respond.
View GitHub Profile
@V6ser
V6ser / Vape.ps1
Created June 30, 2024 13:07
Vapour Server Util
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
$exePath = "path\to\Vapour.Server.Host.exe" # Replace with your actual path
# Create and configure the notify icon
$notifyIcon = New-Object System.Windows.Forms.NotifyIcon
$notifyIcon.Text = "Vapour Server Host"
$notifyIcon.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon($exePath)
$notifyIcon.Visible = $true
@TheNathannator
TheNathannator / main.cpp
Last active May 19, 2024 01:45
Using GameInput to read raw Xbox One controller data
#include <cassert>
#include <iostream>
#include <iomanip>
#include <memory>
#include <windows.h>
#include <wrl.h>
// Install the https://www.nuget.org/packages/Microsoft.GameInput package for this example
#include <GameInput.h>

Xbox One Controller Protocol Notes

The Xbox One controller protocol is quite in-depth. This is a collection of all the information I've gathered over time about it, most of which is sourced from medusalix's xone driver for Linux. There's a little bit of my own research/reverse engineering in there too, but a majority of the information comes from xone.

The info here refers to the USB/wireless side of things, it does not fully apply to the interface the Xbox One controller driver on Windows exposes. That interface is covered here. The wireless receiver protocol is also not documented here, as that's its own beast to handle.

Struct definitions and code examples are not guaranteed to be valid C/C++ code, and are meant mainly for efficiently defining how things are structured or handled. All structs are assumed to be packed with 1-byte alignment.

Table of Contents

@TheNathannator
TheNathannator / GIP Interface Writeup.md
Last active April 23, 2024 21:46
A writeup on how to interact with the Xbox One driver on Windows directly

GIP Interface

A writeup on how to directly communicate with GIP (Xbox One) devices on a basic level.

I tried Windows.Gaming.Input.Custom and was unable to get it to work, so I resorted to this. Would have liked if I could do things more legitimately with what little documentation was provided, but oh well.

This writeup is not at all comprehensive of every possibilty with the interface, otherwise there'd be far too much to go through.

Thanks to the XInputHooker project for having a bunch of function detours set up, made my life easier when doing all of this.

#include "Windows.h"
#include "stdio.h"
#include "strsafe.h"
#include "winternl.h"
#define STATUS_INFO_LENGTH_MISMATCH 0xC0000004
typedef struct _FILE_PROCESS_IDS_USING_FILE_INFORMATION
{
ULONG NumberOfProcessIdsInList;
@Nielk1
Nielk1 / ExtendInput.DataTools.DualSense.TriggerEffectGenerator.cs
Last active July 13, 2024 16:11
Factories for all DualSense trigger effects
/*
* MIT License
*
* Copyright (c) 2021-2022 John "Nielk1" Klein
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@r15ch13
r15ch13 / iommu.sh
Last active July 23, 2024 00:52
List IOMMU Groups and the connected USB Devices
#!/usr/bin/env bash
shopt -s nullglob
lastgroup=""
for g in `find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V`; do
for d in $g/devices/*; do
if [ "${g##*/}" != "$lastgroup" ]; then
echo -en "Group ${g##*/}:\t"
else
echo -en "\t\t"
@Ohjurot
Ohjurot / DualSense_WASAPI_Vibration.cpp
Created November 28, 2020 18:03
Minimal demo to get the DualSense controller vibrating using the haptic feedback (Audio device channel 3 and 4)
#include <Windows.h>
#include <avrt.h>
#include <string>
#include <sstream>
#include <initguid.h>
#include <Mmdeviceapi.h>
#include <audioclient.h>
@dogtopus
dogtopus / ds5.desc.xml
Last active June 27, 2024 08:43
DualSense descriptor
<?xml version="1.0"?>
<!--
DualSense (DS5) USB HID Report Descriptor
Documentation WIP
TODO: Extract info from hid-playstation and cross-verify with us.
-->
@DJm00n
DJm00n / gipHidGamepadDescriptor.txt
Last active May 8, 2021 02:16
xusb.sys HID Report Descriptors
//--------------------------------------------------------------------------------
// Report descriptor data in hex (length 262 bytes)
//--------------------------------------------------------------------------------
// 05010905 A101A100 09300931 150027FF FF000095 02751081 02C0A100 09330934
// 150027FF FF000095 02751081 02C00501 09321500 26FF0395 01750A81 02150025
// 00750695 01810305 01093515 0026FF03 9501750A 81021500 25007506 95018103
// 05091901 290A950A 75018102 15002500 75069501 81030501 09391501 25083500