GSoC: Joysticks
Constants Reverse Engineering

DirectInput8 action mapping is actually a big ugly job of matching the descriptions of virtual controls to real hardware devices. Mouse and Keyboard is not really a problem BUT the genre specific actions plus their mappping to generic device objects is really a mystery as of this moment.

I strongly suspect that it’s possible to devise an algorithm that systematically reads the flags in a DICONSTANT and can at least say for a given device object and an action if they match. Here’ll dump some information I find about the subject.

Example of the flags for the DIVIRTUAL_DRIVING_RACE genre

DI CONSTANT                              Hex                  Binary
DIVIRTUAL_DRIVING_RACE                0x01000000   00000001000000000000000000000000
DIAXIS_DRIVINGR_STEER                 0x01008A01   00000001000000001000101000000001 // lsb is 1st axis
DIAXIS_DRIVINGR_ACCELERATE            0x01039202   00000001000000111001001000000010 // lsb is 2nd
DIAXIS_DRIVINGR_BRAKE                 0x01041203   00000001000001000001001000000011 // lsb is 3rd
DIBUTTON_DRIVINGR_SHIFTUP             0x01000C01   00000001000000000000110000000001 // lsb is 1st button
DIBUTTON_DRIVINGR_SHIFTDOWN           0x01000C02   00000001000000000000110000000010
DIBUTTON_DRIVINGR_VIEW                0x01001C03   00000001000000000001110000000011
DIBUTTON_DRIVINGR_MENU                0x010004FD   00000001000000000000010011111101

DIAXIS_DRIVINGR_ACCEL_AND_BRAKE       0x01014A04   00000001000000010100101000000100
DIHATSWITCH_DRIVINGR_GLANCE           0x01004601   00000001000000000100011000000001
DIBUTTON_DRIVINGR_BRAKE               0x01004C04   00000001000000000100110000000100
DIBUTTON_DRIVINGR_DASHBOARD           0x01004405   00000001000000000100010000000101
DIBUTTON_DRIVINGR_AIDS                0x01004406   00000001000000000100010000000110
DIBUTTON_DRIVINGR_MAP                 0x01004407   00000001000000000100010000000111
DIBUTTON_DRIVINGR_BOOST               0x01004408   00000001000000000100010000001000
DIBUTTON_DRIVINGR_PIT                 0x01004409   00000001000000000100010000001001
DIBUTTON_DRIVINGR_ACCELERATE_LINK     0x0103D4E0   00000001000000111101010011100000
DIBUTTON_DRIVINGR_STEER_LEFT_LINK     0x0100CCE4   00000001000000001100110011100100
DIBUTTON_DRIVINGR_STEER_RIGHT_LINK    0x0100CCEC   00000001000000001100110011101100
DIBUTTON_DRIVINGR_GLANCE_LEFT_LINK    0x0107C4E4   00000001000001111100010011100100
DIBUTTON_DRIVINGR_GLANCE_RIGHT_LINK   0x0107C4EC   00000001000001111100010011101100
DIBUTTON_DRIVINGR_DEVICE              0x010044FE   00000001000000000100010011111110
DIBUTTON_DRIVINGR_PAUSE               0x010044FC   00000001000000000100010011111100