The GUID after an effect’s DIEFFECT says what kind of effect it is, and
so what is in its parameters chunk. DirectInput defines twelve of them in
dinput.h. All twelve share the last 12 bytes of the GUID,
-8E33-11D0-9AD0-00A0C9A06E35, and differ in the first number.
The twelve standard effects
| GUID | Name | Parameters | Size | In the SDK’s files |
|---|---|---|---|---|
{13541C20-…} | GUID_ConstantForce | DICONSTANTFORCE | 4 | 16 |
{13541C21-…} | GUID_RampForce | DIRAMPFORCE | 8 | 41 |
{13541C22-…} | GUID_Square | DIPERIODIC | 16 | 43 |
{13541C23-…} | GUID_Sine | DIPERIODIC | 16 | 113 |
{13541C24-…} | GUID_Triangle | DIPERIODIC | 16 | 18 |
{13541C25-…} | GUID_SawtoothUp | DIPERIODIC | 16 | 14 |
{13541C26-…} | GUID_SawtoothDown | DIPERIODIC | 16 | 11 |
{13541C27-…} | GUID_Spring | DICONDITION | 24 × axes | 1 |
{13541C28-…} | GUID_Damper | DICONDITION | 24 × axes | 0 |
{13541C29-…} | GUID_Inertia | DICONDITION | 24 × axes | 0 |
{13541C2A-…} | GUID_Friction | DICONDITION | 24 × axes | 5 |
{13541C2B-…} | GUID_CustomForce | DICUSTOMFORCE and samples | 16 + 4 × samples | 0 |
In the file the GUID is stored in the usual way, so GUID_Sine is the bytes
23 1C 54 13 33 8E D0 11 9A D0 00 A0 C9 A0 6E 35. The explorer names the
standard types and tells you the type is “not a standard effect” for any other GUID.
The DIFEF_INCLUDENONSTANDARD flag of EnumEffectsInFile is
there for effects of that kind, which a device maker can define; none is in the
files on this Mac, so what such an effect’s parameters hold is not known, and the
explorer shows them as bytes.
Constant force
A DICONSTANTFORCE: one signed number.
| Offset | Size | Field | Description |
|---|---|---|---|
0 | 4 | lMagnitude | The strength, −10000 to 10000. Its sign turns the force round, so −10000 is full strength the other way. |
Ramp force
A DIRAMPFORCE: the strength changes in a straight line over the duration.
| Offset | Size | Field | Description |
|---|---|---|---|
0 | 4 | lStart | The strength at the start, −10000 to 10000. |
4 | 4 | lEnd | The strength at the end. |
Waves
Square, sine, triangle and the two sawtooth effects share a DIPERIODIC.
The GUID gives the shape.
| Offset | Size | Field | Description |
|---|---|---|---|
0 | 4 | dwMagnitude | The height of the wave, 0 to 10000. |
4 | 4 | lOffset | The level the wave swings around, signed. |
8 | 4 | dwPhase | Where in the cycle the effect starts, in hundredths of a degree: 0 to 35999: for example 0 and 9000 (90°). |
12 | 4 | dwPeriod | The length of one cycle in microseconds: 32258 is about 31 Hz. |
Spring, damper, inertia and friction
These depend on what the player does to the stick, not on time: a spring pushes back
the further the stick is from its neutral point, a damper resists speed, inertia
resists acceleration and friction resists movement by a fixed amount. The parameters
are one DICONDITION for each axis (the files all have two, so 48 bytes),
or a single one for all.
| Offset | Size | Field | Description |
|---|---|---|---|
0 | 4 | lOffset | The neutral point, −10000 to 10000. |
4 | 4 | lPositiveCoefficient | How strongly the force grows on the positive side of the neutral point, −10000 to 10000. |
8 | 4 | lNegativeCoefficient | The same on the negative side. |
12 | 4 | dwPositiveSaturation | The most force on the positive side, 0 to 10000. |
16 | 4 | dwNegativeSaturation | The most force on the negative side. |
20 | 4 | lDeadBand | The width of the zone each side of the neutral point where there is no force. |
The six condition effects in the SDK’s files (sliding.ffe,
skatea.ffe, swim1.ffe to swim3.ffe) all have a
saturation of 0; their coefficients are −10000 or 2600, and some are 0. What a device does with a
saturation of 0 is not documented here and was not tested.
Custom force
A DICUSTOMFORCE describes a force given as samples: cChannels,
dwSamplePeriod, cSamples and a pointer to the samples. How a
file holds the samples is not confirmed: no file on this Mac has a custom
force. The explorer reads the 16 bytes of the structure and, when the rest of the
parameters chunk is exactly cSamples signed 32-bit numbers, takes them as
the samples and draws them; otherwise it shows the rest as bytes.
The only other account of the file, E. Vanderstuyft’s 2014 reverse engineering for Wine
(a Python reader checked against 190 files), also found no custom force in any file and
could not make one, because Force Editor cannot create them. It supposes that the
samples follow in a data chunk of their own, after the parameters chunk, with
cSamples signed numbers, and that the rglForceData pointer
field of the structure holds 0x200. That is a supposition with no file
behind it, and the explorer reads this layout as well, marking it as supposed.
The same account notes that the parameters chunk of a condition effect may hold one
DICONDITION (24 bytes) or one for each axis (48 for two), and that Force
Editor shows the positive and negative saturation fields the wrong way round against the
structure, and fails to reload a multi-axis effect that has a single condition.
Not described
Only some of the types appear in real files, so the rest rests on dinput.h alone.
Known, not yet covered
- Reference and viewer: damper and inertia.
dinput.hdefines theirDICONDITIONparameters, but no real file has one, so the layout is unchecked; the viewer reads and draws them from the header. - Viewer: it draws no picture for an effect whose parameters it cannot read, and shows only the fields.
Unknown
- Reference and viewer: how a file stores custom force samples. Two layouts are supposed (inside the parameters chunk, or in a chunk of their own) and no file or source settles it; the viewer draws them when the sizes fit either guess, otherwise it shows bytes.
- Reference and viewer: the parameters of non-standard effect GUIDs. The viewer shows them as bytes, with no picture.
- Reference and viewer: what a device does with a saturation of 0, which every condition effect in the files has. The viewer draws it as no limit.