Game Controller Collective Wiki
Advertisement

See Sony DualShock 4/Data Structures

Input Reports[]

struct GetStateData {
    uint8_t LeftStickX;
    uint8_t LeftStickY;
    uint8_t RightStickX;
    uint8_t RightStickY;
    Direction DPad : 4;
    uint8_t ButtonSquare : 1;
    uint8_t ButtonCross : 1;
    uint8_t ButtonCircle : 1;
    uint8_t ButtonTriangle : 1;
    uint8_t ButtonL1 : 1;
    uint8_t ButtonR1 : 1;
    uint8_t ButtonL2 : 1;
    uint8_t ButtonR2 : 1;
    uint8_t ButtonShare : 1;
    uint8_t ButtonOptions : 1;
    uint8_t ButtonL3 : 1;
    uint8_t ButtonR3 : 1;
    uint8_t ButtonHome : 1;
    uint8_t ButtonPad : 1;
    union {
        uint8_t ButtonClear : 1; // this button shares a bit with Counter, so it can give false highs
        uint8_t Counter : 6; // always 0 on USB, counts up with some skips on BT
    }
    uint8_t TriggerLeft;
    uint8_t TriggerRight;
    uint16_t Timestamp; // in 5.33us units?
    uint8_t Temperture;
    int16_t AngularVelocityX;
    int16_t AngularVelocityZ;
    int16_t AngularVelocityY;
    int16_t AccelerometerX;
    int16_t AccelerometerY;
    int16_t AccelerometerZ;
    uint8_t[5] ExtData; // range can be set by EXT device
    uint8_t PowerPercent : 4; // 0x00-0x0A or 0x01-0x0B if plugged int
    uint8_t PluggedPowerCable : 1;
    uint8_t PluggedHeadphones : 1;
    uint8_t PluggedMic : 1;
    uint8_t PluggedExt : 1;
    uint8_t UnkExt1 : 1; // ExtCapableOfExtraData?
    uint8_t UnkExt2 : 1; // ExtHasExtraData?
    uint8_t NotConnected : 1; // Used by dongle to indicate no controller
    uint8_t Unk1 : 5;
    uint8_t Unk2; // unused?
    uint8_t TouchCount;
};
Advertisement