psl1ght
A free SDK for Sony's PS3 console
Data Structures | Macros | Typedefs | Enumerations | Functions
pad.h File Reference

PS3 pad/controller management. More...

#include <ppu-types.h>

Go to the source code of this file.

Data Structures

struct  _pad_info
 Pad info data structure (old format). More...
 
struct  _pad_info2
 Pad info data structure (new format). More...
 
struct  _pad_data
 Pad data data structure. All 1-bit button fields are zero when inctive, and 1 when active. More...
 
struct  _pad_capability_info
 Pad capability information data structure. All 1-bit values are 1 when the capability is present, 0 otherwise. More...
 
struct  _pad_act_param
 Pad action parameters data structure. More...
 
struct  _pad_periph_info
 Pad peripheral information data structure. More...
 
struct  _pad_periph_data
 Pad peripheral data data structure. More...
 

Macros

#define MAX_PADS   (127)
 
#define MAX_PAD_CODES   (64)
 
#define MAX_PORT_NUM   (7)
 
#define MAX_PAD_CAPABILITY_INFO   (32)
 
#define MAX_PAD_ACTUATOR   (2)
 
#define PAD_TYPE_STANDARD   (0)
 
#define PAD_TYPE_REMOTE   (4)
 
#define PAD_TYPE_LDD   (5)
 

Typedefs

typedef struct _pad_info padInfo
 Pad info data structure (old format).
 
typedef struct _pad_info2 padInfo2
 Pad info data structure (new format).
 
typedef struct _pad_data padData
 Pad data data structure. All 1-bit button fields are zero when inctive, and 1 when active.
 
typedef struct _pad_capability_info padCapabilityInfo
 Pad capability information data structure. All 1-bit values are 1 when the capability is present, 0 otherwise.
 
typedef struct _pad_act_param padActParam
 Pad action parameters data structure.
 
typedef struct _pad_periph_info padPeriphInfo
 Pad peripheral information data structure.
 
typedef struct _pad_periph_data padPeriphData
 Pad peripheral data data structure.
 
typedef enum _io_pad_bd_code ioPadBdCode
 BD remote button codes.
 

Enumerations

enum  _io_pad_bd_code {
  BTN_BD_KEY_1 = 0x00, BTN_BD_KEY_2 = 0x01, BTN_BD_KEY_3 = 0x02, BTN_BD_KEY_4 = 0x03,
  BTN_BD_KEY_5 = 0x04, BTN_BD_KEY_6 = 0x05, BTN_BD_KEY_7 = 0x06, BTN_BD_KEY_8 = 0x07,
  BTN_BD_KEY_9 = 0x08, BTN_BD_KEY_0 = 0x09, BTN_BD_ENTER = 0x0b, BTN_BD_RETURN = 0x0e,
  BTN_BD_CLEAR = 0x0f, BTN_BD_EJECT = 0x16, BTN_BD_TOPMENU = 0x1a, BTN_BD_TIME = 0x28,
  BTN_BD_PREV = 0x30, BTN_BD_NEXT = 0x31, BTN_BD_PLAY = 0x32, BTN_BD_SCAN_REV = 0x33,
  BTN_BD_SCAN_FWD = 0x34, BTN_BD_STOP = 0x38, BTN_BD_PAUSE = 0x39, BTN_BD_POPUP_MENU = 0x40,
  BTN_BD_SELECT = 0x50, BTN_BD_L3 = 0x51, BTN_BD_R3 = 0x52, BTN_BD_START = 0x53,
  BTN_BD_UP = 0x54, BTN_BD_RIGHT = 0x55, BTN_BD_DOWN = 0x56, BTN_BD_LEFT = 0x57,
  BTN_BD_L2 = 0x58, BTN_BD_R2 = 0x59, BTN_BD_L1 = 0x5a, BTN_BD_R1 = 0x5b,
  BTN_BD_TRIANGLE = 0x5c, BTN_BD_CIRCLE = 0x5d, BTN_BD_CROSS = 0x5e, BTN_BD_SQUARE = 0x5f,
  BTN_BD_SLOW_REV = 0x60, BTN_BD_SLOW_FWD = 0x61, BTN_BD_SUBTITLE = 0x63, BTN_BD_AUDIO = 0x64,
  BTN_BD_ANGLE = 0x65, BTN_BD_DISPLAY = 0x70, BTN_BD_BLUE = 0x80, BTN_BD_RED = 0x81,
  BTN_BD_GREEN = 0x82, BTN_BD_YELLOW = 0x83, BTN_BD_RELEASE = 0xff, BTN_BD_NUMBER_11 = 0x101e,
  BTN_BD_NUMBER_12 = 0x101f, BTN_BD_NUMBER_PERIOD = 0x102a, BTN_BD_PROGRAM_UP = 0x1030, BTN_BD_PROGRAM_DOWN = 0x1031,
  BTN_BD_PREV_CHANNEL = 0x1032, BTN_BD_PROGRAM_GUIDE = 0x1053
}
 BD remote button codes.
 

Functions

s32 ioPadInit (u32 max)
 Initialize Pad IO management. More...
 
s32 ioPadEnd ()
 End of Pad IO management. More...
 
s32 ioPadGetInfo (padInfo *info)
 Get pad information. More...
 
s32 ioPadClearBuf (u32 port)
 Clear pad buffer. More...
 
s32 ioPadGetCapabilityInfo (u32 port, padCapabilityInfo *capabilities)
 Get pad capability information. More...
 
s32 ioPadGetData (u32 port, padData *data)
 Get pad data. More...
 
s32 ioPadGetDataExtra (u32 port, u32 *type, padData *data)
 Get pad data. More...
 
s32 ioPadInfoPressMode (u32 port)
 Get pad press mode. More...
 
s32 ioPadSetPressMode (u32 port, u32 mode)
 Set pad press mode. More...
 
s32 ioPadInfoSensorMode (u32 port)
 Get pad sensor mode. More...
 
s32 ioPadSetSensorMode (u32 port, u32 mode)
 Set pad sensor mode. More...
 
u32 ioPadSetActDirect (u32 port, padActParam *actParam)
 Set pad action (rumble) data. More...
 
u32 ioPadLddDataInsert (s32 handle, padData *data)
 Insert pad data into virtual pad. More...
 
s32 ioPadLddGetPortNo (s32 handle)
 Get port number from registered virtual pad handle. More...
 
s32 ioPadLddRegisterController ()
 Register a new virtual pad. More...
 
s32 ioPadLddUnregisterController (s32 handle)
 Unregister a virtual pad. More...
 
s32 ioPadGetInfo2 (padInfo2 *info)
 Get pad information (new format). More...
 
s32 ioPadPeriphGetInfo (padPeriphInfo *periphInfo)
 Get pad peripheral information. More...
 
s32 ioPadPeriphGetData (u32 port, padPeriphData *periphData)
 Get pad peripheral data. More...
 
s32 ioPadSetPortSetting (u32 port, u32 setting)
 Set pad port setting. More...
 

Detailed Description

PS3 pad/controller management.

Macro Definition Documentation

◆ MAX_PAD_ACTUATOR

#define MAX_PAD_ACTUATOR   (2)

controller vibrator actuator

◆ MAX_PAD_CAPABILITY_INFO

#define MAX_PAD_CAPABILITY_INFO   (32)

controller capability information

◆ MAX_PAD_CODES

#define MAX_PAD_CODES   (64)

maximum controller buttons

◆ MAX_PADS

#define MAX_PADS   (127)

maximum controllers

◆ MAX_PORT_NUM

#define MAX_PORT_NUM   (7)

controller port number

◆ PAD_TYPE_LDD

#define PAD_TYPE_LDD   (5)

Custom Controller

◆ PAD_TYPE_REMOTE

#define PAD_TYPE_REMOTE   (4)

BD Remote Controller

◆ PAD_TYPE_STANDARD

#define PAD_TYPE_STANDARD   (0)

standard controller

Function Documentation

◆ ioPadClearBuf()

s32 ioPadClearBuf ( u32  port)

Clear pad buffer.

Parameters
portPad port.
Returns
zero if no error occured, nonzero otherwise.

◆ ioPadEnd()

s32 ioPadEnd ( )

End of Pad IO management.

Returns
zero if no error occured, nonzero otherwise.

◆ ioPadGetCapabilityInfo()

s32 ioPadGetCapabilityInfo ( u32  port,
padCapabilityInfo capabilities 
)

Get pad capability information.

Parameters
portPad port.
capabilitiesPointer to the pad capability information structure.
Returns
zero if no error occured, nonzero otherwise.

◆ ioPadGetData()

s32 ioPadGetData ( u32  port,
padData data 
)

Get pad data.

Parameters
portPad port.
dataPointer to the pad data structure.
Returns
zero if no error occured, nonzero otherwise.

◆ ioPadGetDataExtra()

s32 ioPadGetDataExtra ( u32  port,
u32 *  type,
padData data 
)

Get pad data.

Parameters
portPad port.
typePointer to the device type.
dataPointer to the pad data structure.
Returns
zero if no error occured, nonzero otherwise.

◆ ioPadGetInfo()

s32 ioPadGetInfo ( padInfo info)

Get pad information.

Parameters
infoPointer to the pad info structure.
Returns
zero if no error occured, nonzero otherwise.

◆ ioPadGetInfo2()

s32 ioPadGetInfo2 ( padInfo2 info)

Get pad information (new format).

Parameters
infoPointer to the pad info structure.
Returns
zero if no error occured, nonzero otherwise.

◆ ioPadInfoPressMode()

s32 ioPadInfoPressMode ( u32  port)

Get pad press mode.

Parameters
portPad port.
Returns
The current press mode value, or a negative value in case of error.

◆ ioPadInfoSensorMode()

s32 ioPadInfoSensorMode ( u32  port)

Get pad sensor mode.

Parameters
portPad port.
Returns
The current sensor mode value, or a negative value in case of error.

◆ ioPadInit()

s32 ioPadInit ( u32  max)

Initialize Pad IO management.

Parameters
maxmaximum number of supported pads.
Returns
zero if no error occured, nonzero otherwise.

◆ ioPadLddDataInsert()

u32 ioPadLddDataInsert ( s32  handle,
padData data 
)

Insert pad data into virtual pad.

Parameters
handleThe registered handle for the virtual pad.
padDataPointer to the pad data value.
Returns
zero if no error occured, nonzero otherwise.
Todo:
to be confirmed.

◆ ioPadLddGetPortNo()

s32 ioPadLddGetPortNo ( s32  handle)

Get port number from registered virtual pad handle.

Parameters
handleThe registered handle for the virtual pad.
Returns
The port number for the virtual pad, or a negative value in case of error.

◆ ioPadLddRegisterController()

s32 ioPadLddRegisterController ( )

Register a new virtual pad.

Returns
The handle for the virtual pad, or a negative value in case of error.

◆ ioPadLddUnregisterController()

s32 ioPadLddUnregisterController ( s32  handle)

Unregister a virtual pad.

Parameters
handleThe registered handle for the virtual pad.
Returns
zero if no error occured, nonzero otherwise.

◆ ioPadPeriphGetData()

s32 ioPadPeriphGetData ( u32  port,
padPeriphData periphData 
)

Get pad peripheral data.

Parameters
portPad port.
periphDataPointer to the pad peripheral data structure.
Returns
zero if no error occured, nonzero otherwise.

◆ ioPadPeriphGetInfo()

s32 ioPadPeriphGetInfo ( padPeriphInfo periphInfo)

Get pad peripheral information.

Parameters
periphInfoPointer to the pad peripheral info structure.
Returns
zero if no error occured, nonzero otherwise.

◆ ioPadSetActDirect()

u32 ioPadSetActDirect ( u32  port,
padActParam actParam 
)

Set pad action (rumble) data.

Parameters
portPad port.
actParamPointer to the action data structure.
Returns
zero if no error occured, nonzero otherwise.

◆ ioPadSetPortSetting()

s32 ioPadSetPortSetting ( u32  port,
u32  setting 
)

Set pad port setting.

Parameters
portPad port.
settingSetting value.
Returns
zero if no error occured, nonzero otherwise.
Todo:
confirm this..

◆ ioPadSetPressMode()

s32 ioPadSetPressMode ( u32  port,
u32  mode 
)

Set pad press mode.

Parameters
portPad port.
modeThe selected press mode.
Returns
zero if no error occured, nonzero otherwise.

◆ ioPadSetSensorMode()

s32 ioPadSetSensorMode ( u32  port,
u32  mode 
)

Set pad sensor mode.

Parameters
portPad port.
modeThe selected sensor mode.
Returns
zero if no error occured, nonzero otherwise.