Skip to main content

DirectInput Game Device Specification

The DirectInput game device is a game device supported by DirectInput.
This refers to devices listed in the USB Game Controllers found in the control panel, i.e. the devices listed in joy.cpl.
This is the specification for the built-in device driver for DirectInput Game Device.

Parameters for mapper.device()

type Parameter

dinput

identifier Parameter

The mapper.device() function takes an associative array type table with the following keys specified as the identifier parameter.

KeyTypeDescription
namestringThe product name of device.
Exclusive with other keys.
guidstringThe GUID of device.
Exclusive with other keys.
indexnumberThe index value within the list of DirectInput game devices managed by Windows.
Exclusive with other keys.
NOT RECOMMENDED AT ALL

options Parameter

The mapper.device() function takes an associative array type table with the following keys specified as the options parameter.

KeyTypeDescription
allowlisttableDisable everything except the specified Device Units.
Specify an array of Device Unit names like {‘x’,‘button1’}.
Mutually exclusive with the denylist.
denylisttableDisable the specified Device Units.
Specify an array of Device Unit names like {‘x’,‘button1’}.
Mutually exclusive with the allowlist.
vpovstableDefine virtual Device Units that emulates a POV, treating two orthogonal analog axes, such as joysticks.
Specify an array of tables in the VirtualPov definition table format.

VirtualPov definition table

KeyTypeDescription
namestringThe name assigned to this virtual Device Unit
yaxisstringThe Device Unit name serving as the source for the virtual POV's Y-axis
xaxisstringThe Device Unit name serving as the source for the virtual POV's X-axis
resolutionnumberThe resolution of the POV, indicating the number of directions it can represent.
The default is 4
disable_sourcebooleanIf set to true, it prevents events from the xaxis and yaxis specified Device Units.
The default is false.

Device Units

note

DirectInput game devices consist solely of Input type Device Units.

Analog Axes

AttributeDescription
NameDirectInput supports a maximum of eight analog axes, each with the following names:
'x', 'y', 'z', 'rx', 'ry', 'rz', 'slider1', 'slider2'
Which axes are supported depends on the device.
DirectionInput
Value TypeAbsolute
Precision32-bit integre
Value Range-50,000 to 50,000

Buttons

AttributeDescription
NameThe naming convention for the button type Device Unit involves appending a number starting from 1 after the word button.
For instance, it would be named as button1 or button2.
DirectionInput
Value TypeAbsolute
Precision32-bit integer
Value Range1 for ON, 0 for OFF

POVs

AttributeDescription
NameThe naming convention for the POV type Device Unit involves appending a number starting from 1 after the word pov.
For instance, it would be named as pov1 or pov2.
DirectionInput
Value TypeAbsolute
Precision32-bit integer
Value RangeThe direction of POV expressed in degrees, meaning values ranging from 0 to less than 360.
If no direction is selected, it is represented as -1.