XInput - Xbox Controller API

Post your working scripts, libraries and tools
lexikos
Posts: 5938
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

XInput - Xbox Controller API

26 Mar 2017, 06:05

XInput

Originally posted on the old forum.

XInput.ahk wraps a few key functions of XInput, a.k.a. the Microsoft Common Controller API. It provides the following capabilities not otherwise accessible to scripts:
  • The official drivers report to Windows one axis for both analog triggers, making it impossible to detect when both triggers are pulled at once. XInput allows one to retrieve the state of each analog trigger individually.
  • Set level of controller vibration - left and right motor speeds.
Other capabilities of the XInput API that this script does not currently support include:
  • Detect input on attached messenger kits (mini keyboards which can be attached to a controller).
  • Retrieve battery levels of wireless controllers.
  • Access the audio input/output of a given controller's headset.
Required: xinput1_*.dll - You probably already have it.

Usage notes are written above each function.

Code: [Select all] [Expand] [Download] (XInput.ahk)GeSHi © Codebox Plus



Code: [Select all] [Expand] [Download] (XInput-example.ahk)GeSHi © Codebox Plus

User avatar
SnowFlake
Posts: 368
Joined: 28 Apr 2015, 05:41
Google: floowsnaake
GitHub: floowsnaake
Contact:

Re: XInput - Xbox Controller API

11 Apr 2017, 16:15

isn't this similar to the one evilC made?
:yawn:
lexikos
Posts: 5938
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: XInput - Xbox Controller API

11 Apr 2017, 17:03

Clearly not. This is a simple wrapper around the XInput API, with virtually the same usage as the API. The original script apparently predates evilC's library by about 9 years.
alpha0
Posts: 2
Joined: 27 Apr 2017, 23:55

Re: XInput - Xbox Controller API

28 Apr 2017, 02:28

what do these scripts do and how can I use controller key presses in my script
ziggurat
Posts: 1
Joined: 11 Jan 2018, 05:10

Re: XInput - Xbox Controller API

12 Jan 2018, 03:22

Hi I am trying to use This wrapper. I downloaded https://youtu.be/SgFW8WflLng which seams to use the most reason version from the old forum on page 4.
It works great with a Xbox One controller connected via USB or Bluetooth.

The problem I have is when I use Nvidia GameStream. Which is my preferred way to play gamepad games. With Nvidia GameStream it emulates the Xbox controller too, but this wrapper does not detect the controller :( Every other game or program I tried find the Nvidia GameStream Xinput controller. One thing to note, Nvidia does not populate the gamepad list found in control panel. I wonder if this script could be updated for a more universal detection of Xinput controllers?
lexikos
Posts: 5938
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: XInput - Xbox Controller API

12 Jan 2018, 05:28

The script uses the only universal method of detection of Xinput controllers - the official API.

It is likely that Nvidia GameStream does not give you a controller at all, but intercepts the Xinput APIs to pretend you have a controller. Your script may be missing some requirement for GameStream to install its hooks; e.g. the use of Direct3D or OpenGL.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 18 guests