PuriPuri Live

Home of the Puri Stream and PSXplosion
PuriPuri Live

PS1 and PS2 controller data structures for input monitors

FOR ANALOG VALUES:

unsigned char getAnalogValue_Stick(byte in)
{
unsigned char t1 = in;
unsigned char revT1 = reverseBits(t1);

return revT1;
}

unsigned char reverseBits(unsigned char b) {
b = (b & 0xF0) >> 4 | (b & 0x0F) << 4; 

b = (b & 0xCC) >> 2 | (b & 0x33) << 2; 

b = (b & 0xAA) >> 1 | (b & 0x55) << 1;
return b;
}

PS1 Digital

Byte 0 0xFF
Byte 1 0x82 (Controller Identifier)
Byte 2 0x5A (Controller Data Follows)
Byte 3 Left, Right, Down, Up              Start, Select, NULL, NULL
Byte 4 Square, Cross, Circle, Triangle    R1, R2, L1, L2

 

PS1/2 Analog/Dual Shock

Byte 0 0xFF
Byte 1 0xCE (Controller Identifier)
Byte 2 0x5A (Controller Data Follows)
Byte 3 Left, Right, Down, Up               Start, Select, L3, R3
Byte 4 Square, Cross, Circle, Triangle     R1, R2, L1, L2
Byte 5 Right Stick X (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 6 Right Stick Y (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 7 Left Stick X (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 8 Left Stick Y (Analog 0-255, Use reverseBits function to get the 0-255 value)

 

PS1 Analog Flight Joystick (SCPH-1110) [Toggle Switch in Analog mode, Digital mode appears as regular Digital controller]


Byte 0 0xFF
Byte 1 0xCA (Controller Identifier)
Byte 2 0x5A (Controller Data Follows)
Byte 3 Left, Right, Down, Up               Start, Select, NULL, NULL
Byte 4 Square, Cross, Circle, Triangle     R1, R2, L1, L2
Byte 5 Right Stick X (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 6 Right Stick Y (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 7 Left Stick X (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 8 Left Stick Y (Analog 0-255, Use reverseBits function to get the 0-255 value)


PS2 Dual Shock 2 with Pressure data


Byte 0 0xFF
Byte 1 0x9E OR 0x1E (Controller Identifier)
Byte 2 0x5A (Controller Data Follows)
Byte 3 Left, Right, Down, Up                Start, Select, L3, R3
Byte 4 Square, Cross, Circle, Triangle      R1, R2, L1, L2
Byte 5 Right Stick X (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 6 Right Stick Y (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 7 Left Stick X (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 8 Left Stick Y (Analog 0-255, Use reverseBits function to get the 0-255 value)

Byte 9 D-Pad Right pressure (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 10 D-Pad Left pressure (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 11 D-Pad Up pressure (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 12 D-Pad Down pressure (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 13 Triangle pressure (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 14 Circle pressure (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 15 Cross pressure (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 16 Square pressure (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 17 L1 pressure (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 18 R1 pressure (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 19 L2 pressure (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 20 R2 pressure (Analog 0-255, Use reverseBits function to get the 0-255 value)


PS1/2 GunCon (Namco Lightgun) [This might not work very well, if at all, I didn’t test it much]


Byte 0 0xFF
Byte 1 0xC6 (Controller Identifier)
Byte 2 0x5A (Controller Data Follows)
Byte 3 NULL, NULL, NULL, A       NULL, NULL, NULL, NULL
Byte 4 NULL, NULL, NULL, NULL    NULL, Trigger, B, NULL
Byte 5 X value (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 6 NULL, NULL, NULL, NULL    NULL, NULL, NULL, NULL
Byte 7 Y value (Analog 0-255, Use reverseBits function to get the 0-255 value)

[NOTE: My code for the X and Y values looks like the following]
Serial.print( getAnalogValue_Stick(dataArr[5]),DEC );
Serial.print(“,”);
Serial.print( getAnalogValue_Stick(dataArr[7]),DEC );
Serial.print(“,”);



PS1/2 Lightgun (Konami-style Lightgun) [This might not work very well, if at all, I didn’t test it much]

Byte 0 0xFF
Byte 1 0x8C (Controller Identifier)
Byte 2 0x5A (Controller Data Follows)
Byte 3 NULL, NULL, NULL, Start           NULL, NULL, NULL, NULL
Byte 4 NULL, NULL, NULL, NULL            NULL, NULL, Special, Trigger
Byte 5 X value (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 6 NULL
Byte 7 Y value (Analog 0-255, Use reverseBits function to get the 0-255 value)

[NOTE: My code for the X and Y values looks like the following]
Serial.print( getAnalogValue_Stick(dataArr[5]),DEC ); 
Serial.print(“,”);
Serial.print( getAnalogValue_Stick(dataArr[7]),DEC ); 
Serial.print(“,”);



PS1/2 NegCon (Namco Twisty Driving Analog controller NPC-101)

Byte 0 0xFF
Byte 1 0xC4 (Controller Identifier)
Byte 2 0x5A (Controller Data Follows)
Byte 3 Left, Right, Down, Up       Start, NULL, NULL, NULL
Byte 4 NULL, NULL, A, B            R, NULL, NULL, NULL
Byte 5 Twist (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 6 Button I (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 7 Button II (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 6 Button L (Analog 0-255, Use reverseBits function to get the 0-255 value)



PS1 JogCon (Namco Force Feedback Dial controller NPC-105)

Byte 0 0xFF
Byte 1 0xC7 (Controller Identifier)
Byte 2 0x5A (Controller Data Follows)
Byte 3 Left, Right, Down, Up              Start, Select, NULL, NULL
Byte 4 Square, Cross, Circle, Triangle    R1, R2, L1, L2
Byte 5 JogDial value (Analog 0-255, Use reverseBits function to get the 0-255 value)



PS1 Mouse (SCPH-1090)

Byte 0 0xFF
Byte 1 0x48 (Controller Identifier)
Byte 2 0x5A (Controller Data Follows)
Byte 3 NULL, NULL, NULL, NULL         NULL, NULL, NULL, NULL
Byte 4 NULL, NULL, RMB, LMB           NULL, NULL, NULL, NULL
Byte 5 X Mouse Delta (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 6 Y Mouse Delta (Analog 0-255, Use reverseBits function to get the 0-255 value)

[Note: code for the mouse delta below]
int d_mouse_x = getAnalogValue_Stick(dataArr[5]);
if (d_mouse_x > 128) { d_mouse_x = (256 – d_mouse_x) * -1; }

int d_mouse_y = getAnalogValue_Stick(dataArr[6]);
if (d_mouse_y > 128) { d_mouse_y = (256 – d_mouse_y) * -1; }



PS1 Agetec Bass Landing Fishing controller (#8670)

Byte 0 0xFF
Byte 1 0xA7 (Controller Identifier)
Byte 2 0x5A (Controller Data Follows)
Byte 3 NULL, NULL, NULL, NULL             Start, Select, L3, NULL
Byte 4 Square, Cross, Circle, Triangle    R1, R2, L1, L2
Byte 5 NULL, NULL, NULL, NULL             NULL, NULL, NULL, NULL
Byte 6 NULL, NULL, NULL, NULL             NULL, NULL, NULL, NULL
Byte 7 Stick X (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 8 Stick Y (Analog 0-255, Use reverseBits function to get the 0-255 value)
Byte 9 Yaw? (Analog 0-255, Use reverseBits function to get the 0-255 value) [Yes this thing has motion controls lol]
Byte 10 Pitch? (Analog 0-255, Use reverseBits function to get the 0-255 value) [Yes this thing has motion controls lol]
Byte 11 Roll? (Analog 0-255, Use reverseBits function to get the 0-255 value) [Yes this thing has motion controls lol]
Byte 12 Reel delta value (Analog 0-255, Use reverseBits function to get the 0-255 value)