1

I use DirectInput to handle input devices, I enumerate devices and elements on each device.

When using the analogue sticks on my game pad, they report values in the range 0-65535. Is this always the case for all types of absolute axis?

If not: is there any way to find out the range of an DX8 input element's DIDEVICEOBJECTDATA::dwData (enumerated with DIDFT_ABSAXIS)? The only other option I can think of is to use some home made internal calibration inside my app, and that sound too '80s to be true.

Jonas Byström
  • 25,316
  • 23
  • 100
  • 147

3 Answers3

6

Can't you get the range using GetProperty and passing in an appropriate DIPROPRANGE structure to be filled? Use the DIPROP_RANGE GUID.

Goz
  • 61,365
  • 24
  • 124
  • 204
3

As Goz so sweetly put it, I did the following, which worked:

dev->EnumObjects(EnumElementsCallback, 0, DIDFT_ALL);

BOOL CALLBACK EnumElementsCallback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID)
{
    if ((dev->dwType & DIDFT_ABSAXIS) != 0)
    {
        DIPROPRANGE range;
        range.diph.dwSize = sizeof(DIPROPRANGE);
        range.diph.dwHeaderSize = sizeof(DIPROPHEADER);
        range.diph.dwHow = DIPH_BYID;
        range.diph.dwObj = dev->dwType;
        if (lDevice->mDIDevice->GetProperty(DIPROP_RANGE, &range.diph) == DI_OK)
        {
            ... = range.lMin;
            ... = range.lMax;
        }
    }
}
Jonas Byström
  • 25,316
  • 23
  • 100
  • 147
0

From : http://www.wingmanteam.com/files/Tools/DXTweak/Readme.txt

A game controller driver usually reports axis position information as integer values between 0 and 655 to DirectInput. DirectInput linearly scales these values up to 0 to 65535.

Roman Starkov
  • 59,298
  • 38
  • 251
  • 324
Emmanuel Caradec
  • 2,302
  • 1
  • 19
  • 38