Menu

I/O Functions

 
      In GPC scripting language, input/output (I/O) refers to the communication between the Titan One device and the "outside world". In our case, Inputs are the data coming from controller, and outputs are the data send to console. Each controller entry (buttons, analog sticks, sensors) has an data structure that stores its state information, such as current value, previous value and the elapsed time of activation. The I/O functions are mainly intended to read and write on this data structure.
 
  Related GPC Functions:
 
get_val       Returns the current value of a controller entry
set_val       Overwrites the current value of a controller entry
get_lval      Returns the previous value of a controller entry
get_ptime     Returns the elapsed activation time (pressing) of a controller entry
event_press   Returns TRUE when detected activation (pressing) of a controller entry
event_release Returns TRUE when detected deactivation (releasing) of a controller entry
swap          Swap the values between two controller entries
block         Blocks forwarding of a controller entry for a short period of time
sensitivity   Adjust the sensitivity of a controller entry
deadzone      Remove the deadzone of a pair of entries, usually of analog sticks
stickize      Transform the values of mouse input (or Wiimote IR) to analog stick
 

  1. get_val

      Returns the current value of a controller entry.
 
  Prototype:
 
int get_val ( <identifier> )
 
  Parameters:
 
<identifier> : the identifier of a controller entry
 
  Return:
 
Current value of the controller entry specified by identifier, can range from -100 to 100, depending on entry type
 
  Example:
 
a = get_val(PS3_SQUARE);
 
if( !get_val(WII_UP) )
 
if( abs(get_val(XB360_RX)) > 40 || abs(get_val(XB360_RY)) > 40 )
 

  2. set_val

      Overwrite the current value of a controller entry.
 
  Prototype:
 
set_val ( <identifier>, <value> )
 
  Parameters:
 
<identifier> : the identifier of a controller entry
<value>      : the value to be written, can range from -100 to 100, depending on entry type
 
  Return:
 
None
 
  Example:
 
set_val(PS4_SQUARE, 80);
 

  3. get_lval

      Returns the previous value of a controller entry.
 
  Prototype:
 
int get_lval ( <identifier> )
 
  Parameters:
 
<identifier> : the identifier of a controller entry
 
  Return:
 
Previous value of the controller entry specified by identifier, can range from -100 to 100, depending on entry type
 
  Example:
 
b = get_lval(PS3_CROSS);
 
if( get_lval(XB1_Y) )
 

  4. get_ptime

      Returns the elapsed activation time (pressing) of a controller entry.
 
  Prototype:
 
int get_ptime ( <identifier> )
 
  Parameters:
 
<identifier> : the identifier of a controller entry
 
  Return:
 
The elapsed time of activation, e.g.: when the controller entry goes out of its rest position. The value is expressed in milliseconds and, due to hardware limitations, the maximum registered time is 4000 ms (4 seconds).
 
  Example:
 
c = get_ptime(XB360_X);
 
if( get_ptime(PS4_SHARE) >= 2000 )
 

  5. event_press

      Returns TRUE when detected an activation event (pressing) of a controller entry.
 
  Prototype:
 
int event_press ( <identifier> )
 
  Parameters:
 
<identifier> : the identifier of a controller entry
 
  Return:
 
TRUE on the interaction that the specified controller entry gets out of its resting position; FALSE otherwise.
 
  Example:
 
if( event_press(XB1_MENU) )
 

  6. event_release

      Returns TRUE when detected a deactivation event (releasing) of a controller entry.
 
  Prototype:
 
int event_release ( <identifier> )
 
  Parameters:
 
<identifier> : the identifier of a controller entry
 
  Return:
 
TRUE on the interaction that the specified controller entry returns to its resting position; FALSE otherwise.
 
  Example:
 
if( event_release(PS4_TOUCH) )
 

  7. swap

      Swap the values between two controller entries.
 
  Prototype:
 
swap ( <identifier1>, <identifier2> )
 
  Parameters:
 
<identifier1>: the identifier of a controller entry
<identifier2>: the identifier of a controller entry
 
  Return:
 
None
 
  Example:
 
swap(PS3_SQUARE, PS3_CROSS);
 

  8. block

      Blocks forwarding of a controller entry for a short period of time. Useful to assign two functions to a single button, where a quick button press can shoot some function in your GPC script, and a longer pressing maintain the original purpose of the button.
 
  Prototype:
 
block ( <identifier>, <time> )
 
  Parameters:
 
<identifier> : the identifier of a controller entry
<time>       : amount of time in milliseconds, allowed range from 20 to 4000 ms
 
  Return:
 
None
 
  Example:
 
block(PS3_START, 200);  // Blocks START for 200ms
 

  9. sensitivity

      Adjust the sensitivity of a controller entry.
 
  Prototype:
 
sensitivity ( <identifier>, <midpoint>, <sensitivity> )
 
  Parameters:
 
<identifier> : the identifier of a controller entry
 
<midpoint>   : change the midpoint value of an entry, e.g.: the default midpoint is 50%, if you change it to 35 you are defining two sensitivity ranges, a high sensitivity range (close to rest position) and a low sensitivity range (when far from rest position), as shown in the figure below:
 
If you configure this parameter with 80 you are defining a zone of low sensitivity when close to the rest position (better accuracy), and a zone of high sensitivity when far from rest position (fast movements).
 
<sensitivity>: angular adjustment, the value is multiplied to the current value of specified entry. 100 means multiply for 1, 143 means multiply for 1.43, 72 means multiply for 0.72
 
  Return:
 
None
 
  Example:
 
sensitivity(PS3_RX, 38, NOT_USE);
 
sensitivity(PS4_RY, 38, 125);
 

  10. deadzone

      Removes the deadzone of a pair of entries, usually of analog sticks.
 
  Prototype:
 
deadzone ( <identifierX>, <identifierY>, <xdz_cir>, <ydz_rad> )
 
  Parameters:
 
<identifierX>: a controller entry which represents the X axis. (PS3_RX, WII_IRX, XB360_RX)
<identifierY>: a controller entry which represents the Y axis. (PS3_RY, WII_IRY, XB360_RY)
<xdz_cir>    : X axis deadzone value or the DZ_CIRCLE constant
<ydz_rad>    : Y axis deadzone value or the radius value of the circle
 
  Return:
 
None
 
  Example:
 
// SQUARE Shape Deadzone
deadzone(PS3_RX, PS3_RY, 20, 22);
 
// CIRCLE Shape Deadzone
deadzone(XB360_RX, XB360_RY, DZ_CIRCLE, 26);
 

  11. stickize

      Transforms the values of a mouse input (or Wiimote IR) to analog stick.
 
     
 
  Prototype:
 
stickize ( <identifierX>, <identifierY>, <radius> )
 
  Parameters:
 
<identifierX>: a controller entry which represents the X axis. (PS3_RX, WII_IRX, XB360_RX)
<identifierY>: a controller entry which represents the Y axis. (PS3_RY, WII_IRY, XB360_RY)
<radius>     : the radius of the circle, as showed in the picture above. Allowed values range from 100 to 141. We suggest using 129 for PS3 and 113 for XBox 360
 
  Return:
 
None
 
  Example:
 
stickize(PS3_RX, PS3_RY, 129);
 

  12. Identifiers

0   PS4_PS        PS3_PS        XB1_XBOX   XB360_XBOX   WII_HOME   WII_HOME
1   PS4_SHARE     PS3_SELECT    XB1_VIEW   XB360_BACK   WII_MINUS  WII_MINUS
2   PS4_OPTIONS   PS3_START     XB1_MENU   XB360_START  WII_PLUS   WII_PLUS
3   PS4_R1        PS3_R1        XB1_RB     XB360_RB                WII_RT
4   PS4_R2        PS3_R2        XB1_RT     XB360_RT                WII_ZR
5   PS4_R3        PS3_R3        XB1_RS     XB360_RS     WII_ONE
6   PS4_L1        PS3_L1        XB1_LB     XB360_LB     WII_C      WII_LT
7   PS4_L2        PS3_L2        XB1_LT     XB360_LT     WII_Z      WII_ZL
8   PS4_L3        PS3_L3        XB1_LS     XB360_LS     WII_TWO
9   PS4_RX        PS3_RX        XB1_RX     XB360_RX                WII_RX
10  PS4_RY        PS3_RY        XB1_RY     XB360_RY                WII_RY
11  PS4_LX        PS3_LX        XB1_LX     XB360_LX     WII_NX     WII_LX
12  PS4_LY        PS3_LY        XB1_LY     XB360_LY     WII_NY     WII_LY
13  PS4_UP        PS3_UP        XB1_UP     XB360_UP     WII_UP     WII_UP
14  PS4_DOWN      PS3_DOWN      XB1_DOWN   XB360_DOWN   WII_DOWN   WII_DOWN
15  PS4_LEFT      PS3_LEFT      XB1_LEFT   XB360_LEFT   WII_LEFT   WII_LEFT
16  PS4_RIGHT     PS3_RIGHT     XB1_RIGHT  XB360_RIGHT  WII_RIGHT  WII_RIGHT
17  PS4_TRIANGLE  PS3_TRIANGLE  XB1_Y      XB360_Y                 WII_X
18  PS4_CIRCLE    PS3_CIRCLE    XB1_B      XB360_B      WII_B      WII_B
19  PS4_CROSS     PS3_CROSS     XB1_A      XB360_A      WII_A      WII_A
20  PS4_SQUARE    PS3_SQUARE    XB1_X      XB360_X                 WII_Y
21  PS4_ACCX      PS3_ACCX                              WII_ACCX
22  PS4_ACCY      PS3_ACCY                              WII_ACCY
23  PS4_ACCZ      PS3_ACCZ                              WII_ACCZ
24  PS4_GYROX     PS3_GYRO      XB1_P1
25  PS4_GYROY                   XB1_P2                  WII_ACCNX
26  PS4_GYROZ                   XB1_P3                  WII_ACCNY
27  PS4_TOUCH                   XB1_P4                  WII_ACCNZ
28  PS4_TOUCHX                                          WII_IRX
29  PS4_TOUCHY                                          WII_IRY
--------------------------------------------------------------------------
30  TRACE_1
31  TRACE_2
32  TRACE_3
33  TRACE_4
34  TRACE_5
35  TRACE_6