Question

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.

Was it helpful?

Solution 2

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;
        }
    }
}

OTHER TIPS

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

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top