Menu

Data Representation

 
      The Titan One device is capable to understand many formats of protocols found in game controllers. Devices that can be classified as game controllers include (but not limited to) gamepads, joysticks, keyboards, mice. Inside Titan One's main core lies the protocol converter, which accepts messages of any compatible protocol, interprets and delivers them in one of any supported protocol format. The messages conversion can occur in both directions: from game controller to console, as well as from console to game controller.
 
      The task of working directly with the raw data of game controller protocol is far from be easy and intuitive, as each manufacturer implements it's own communication protocol. To make this raw data more understandable and easy to deal, the GPC uses the concept of data normalization, thus allowing underlying characteristics of different data sets to be compared, by bringing them to a common scale. After normalization all values are represented by its percentage form, meaning the state of a button can vary from 0%, when it is not being pressed, up to 100% when it is fully pressed. Some entries, such of analog stick, can range from -100% to 100%, where 0% is the resting position. The normalization aims to make the values more intuitive and easy to read, and to support the conversion of data between different protocols.
 
 
 
GPC Data Normalization Process
 

  1. Normalized Data Structure

      Each normalized entry (e.g.: buttons, analog thumb sticks, sensors) of a game controller has its own data structure that stores its state information, such as current value, previous value and activation elapsed time. Take as an example the R2 button of a Dualshock 4 controller, the reference to this button in GPC language is given by the predefined constant PS4_R2. The PS4_R2 has the following data structure:
 
PS4_R2 (normalized data index 4)
 
    - nValue (signed 8 bits integer)
    current value, on rest = 0, max = 100
 
    - lValue (signed 8 bits integer)
    previous value, the range is same of nValue
 
    - pTime  (unsigned 32 bits integer)
    monitors the activation elapsed time. On the R2 example, it represents the amount of time the button is being, or was being, pressed. The value is expressed in milliseconds and, due to system's architecture limitations, the maximum registered time is 4000 ms.
 
Internally the normalized data structure is defined as:
 
struct {
    int8_t nValue;
    int8_t lValue;
    uint32_t pTime;
} nData[36];
 
      The normalized data structure can be accessed through a special set of GPC functions, such as: get_val, set_val, get_lval, get_ptime and so on. Beyond of basic operations for reading and writing, also are provided more complex functions, such as for event detection. You can find more detailed information about this set of functions in the "I/O Functions" topic.
 

  2. Indexing the Normalized Data Structure

      All GPC functions that handles with the normalized data structure receives as argument the index of which entry will be the object of operation. For this there is a set to predefined constants, where each one refers to a particular entry. The following table lists all available index constants and the value range of each one can take.
 
Index
PS4
PS3
XB1
XB360
WII/NUNCHUNCK
CLASSIC CTRLPRO
0
PS4_PS
0 | 100
PS3_PS
0 | 100
XB1_XBOX
0 | 100
XB360_XBOX
0 | 100
WII_HOME
0 | 100
WII_HOME
0 | 100
1
PS4_SHARE
0 | 100
PS3_SELECT
0 | 100
XB1_VIEW
0 | 100
XB360_BACK
0 | 100
WII_MINUS
0 | 100
WII_MINUS
0 | 100
2
PS4_OPTIONS
0 | 100
PS3_START
0 | 100
XB1_MENU
0 | 100
XB360_START
0 | 100
WII_PLUS
0 | 100
WII_PLUS
0 | 100
3
PS4_R1
0 | 100
PS3_R1
0 ~ 100
XB1_RB
0 | 100
XB360_RB
0 | 100
 
 
WII_RT
0 ~ 100
4
PS4_R2
0 ~ 100
PS3_R2
0 ~ 100
XB1_RT
0 ~ 100
XB360_RT
0 ~ 100
 
 
WII_ZR
0 | 100
5
PS4_R3
0 | 100
PS3_R3
0 ~ 100
XB1_RS
0 | 100
XB360_RS
0 | 100
WII_ONE
0 | 100
 
 
6
PS4_L1
0 | 100
PS3_L1
0 ~ 100
XB1_LB
0 | 100
XB360_LB
0 | 100
WII_C
0 | 100
WII_LT
0 ~ 100
7
PS4_L2
0 ~ 100
PS3_L2
0 ~ 100
XB1_LT
0 ~ 100
XB360_LT
0 ~ 100
WII_Z
0 | 100
WII_ZL
0 | 100
8
PS4_L3
0 | 100
PS3_L3
0 ~ 100
XB1_LS
0 | 100
XB360_LS
0 | 100
WII_TWO
0 | 100
 
 
9
PS4_RX
-100 ~ 100
PS3_RX
-100 ~ 100
XB1_RX
-100 ~ 100
XB360_RX
-100 ~ 100
 
 
WII_RX
-100 ~ 100
10
PS4_RY
-100 ~ 100
PS3_RY
-100 ~ 100
XB1_RY
-100 ~ 100
XB360_RY
-100 ~ 100
 
 
WII_RY
-100 ~ 100
11
PS4_LX
-100 ~ 100
PS3_LX
-100 ~ 100
XB1_LX
-100 ~ 100
XB360_LX
-100 ~ 100
WII_NX
-100 ~ 100
WII_LX
-100 ~ 100
12
PS4_LY
-100 ~ 100
PS3_LY
-100 ~ 100
XB1_LY
-100 ~ 100
XB360_LY
-100 ~ 100
WII_NY
-100 ~ 100
WII_LY
-100 ~ 100
13
PS4_UP
0 | 100
PS3_UP
0 ~ 100
XB1_UP
0 | 100
XB360_UP
0 | 100
WII_UP
0 | 100
WII_UP
0 | 100
14
PS4_DOWN
0 | 100
PS3_DOWN
0 ~ 100
XB1_DOWN
0 | 100
XB360_DOWN
0 | 100
WII_DOWN
0 | 100
WII_DOWN
0 | 100
15
PS4_LEFT
0 | 100
PS3_LEFT
0 ~ 100
XB1_LEFT
0 | 100
XB360_LEFT
0 | 100
WII_LEFT
0 | 100
WII_LEFT
0 | 100
16
PS4_RIGHT
0 | 100
PS3_RIGHT
0 ~ 100
XB1_RIGHT
0 | 100
XB360_RIGHT
0 | 100
WII_RIGHT
0 | 100
WII_RIGHT
0 | 100
17
PS4_TRIANGLE
0 | 100
PS3_TRIANGLE
0 ~ 100
XB1_Y
0 | 100
XB360_Y
0 | 100
 
 
WII_X
0 | 100
18
PS4_CIRCLE
0 | 100
PS3_CIRCLE
0 ~ 100
XB1_B
0 | 100
XB360_B
0 | 100
WII_B
0 | 100
WII_B
0 | 100
19
PS4_CROSS
0 | 100
PS3_CROSS
0 ~ 100
XB1_A
0 | 100
XB360_A
0 | 100
WII_A
0 | 100
WII_A
0 | 100
20
PS4_SQUARE
0 | 100
PS3_SQUARE
0 ~ 100
XB1_X
0 | 100
XB360_X
0 | 100
 
 
WII_Y
0 | 100
21
PS4_ACCX
-100 ~ 100
PS3_ACCX
-100 ~ 100
 
 
 
 
WII_ACCX
-100 ~ 100
 
 
22
PS4_ACCY
-100 ~ 100
PS3_ACCY
-100 ~ 100
 
 
 
 
WII_ACCY
-100 ~ 100
 
 
23
PS4_ACCZ
-100 ~ 100
PS3_ACCZ
-100 ~ 100
 
 
 
 
WII_ACCZ
-100 ~ 100
 
 
24
PS4_GYROX
-100 ~ 100
PS3_GYRO
-100 ~ 100
XB1_P1
0 | 100
 
 
 
 
 
 
25
PS4_GYROY
-100 ~ 100
 
 
XB1_P2
0 | 100
 
 
WII_ACCNX
-100 ~ 100
 
 
26
PS4_GYROZ
-100 ~ 100
 
 
XB1_P3
0 | 100
 
 
WII_ACCNY
-100 ~ 100
 
 
27
PS4_TOUCH
0 | 100
 
 
XB1_P4
0 | 100
 
 
WII_ACCNZ
-100 ~ 100
 
 
28
PS4_TOUCHX
-100 ~ 100
 
 
 
 
 
 
WII_IRX
-100 ~ 100
 
 
29
PS4_TOUCHY
-100 ~ 100
 
 
 
 
 
 
WII_IRY
-100 ~ 100
 
 
Index
DEBUG FIELDS
30
TRACE_1           -128 ~ 127
31
TRACE_2           -128 ~ 127
32
TRACE_3           -128 ~ 127
33
TRACE_4           -128 ~ 127
34
TRACE_5           -128 ~ 127
35
TRACE_6           -128 ~ 127
 
-- Values Range --
( 0 | 100 ) means 0 or 100
( 0 ~ 100 ) means any value between 0 and 100
( -100 ~ 100 ) means any value between -100 and 100
Accelerometers: 25% represents 1G; 100% == 4G