KurtE
Senior Member+
@mjs513 - Wondering. I know it is probably my screw up... But I was wondering about the PS4 and my mapping of Button bits and was thinking maybe they are screwed up?
Did I/we think the 10 is correct? I can see maybe 0x10, but this sets two multiple bits, which I was noticing and the values just feel wrong...
And if I fix was wondering if I should hack up the bits for D-PAD instead of 8 value for nothing pressed maybe quick map to bits like PS3?
Thoughts?
Code:
/*
* [1] LX, [2] = LY, [3] = RX, [4] = RY
* [5] combo, tri, cir, x, sqr, D-PAD (4bits, 0-3
* [6] R3,L3, opt, share, R2, L2, R1, L1
* [7] Counter (bit7-2), T-PAD, PS
* [8] Left Trigger, [9] Right Trigger
* [10-11] Timestamp
* [12] Battery (0 to 0xff)
* [13-14] acceleration x
* [15-16] acceleration y
* [17-18] acceleration z
* [19-20] gyro x
* [21-22] gyro y
* [23-24] gyro z
* [25-29] unknown
* [30] 0x00,phone,mic, usb, battery level (4bits)
* rest is trackpad? to do implement?
*/
//PS Bit
tmp_data[7] = (tmp_data[7] >> 0) & 1;
//set arrow buttons to axis[0]
tmp_data[10] = tmp_data[5] & ((1 << 4) - 1);
//set buttons for last 4bits in the axis[5]
tmp_data[5] = tmp_data[5] >> 4;
// Quick and dirty hack to match PS4 HID data
uint32_t cur_buttons = tmp_data[7] | (tmp_data[10]) | ((tmp_data[6]*10)) | ((uint16_t)tmp_data[5] << 16) ;
if (cur_buttons != buttons) {
buttons = cur_buttons;
joystickEvent = true; // something changed.
}
And if I fix was wondering if I should hack up the bits for D-PAD instead of 8 value for nothing pressed maybe quick map to bits like PS3?
Thoughts?