PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
input.h File Reference
#include <libpad.h>
+ Include dependency graph for input.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  actuator_t
 
struct  pad_t
 

Macros

#define MODE_DIGITAL   0
 
#define MODE_ANALOG   1
 
#define MODE_UNLOCKED   0
 
#define MODE_LOCKED   1
 
#define PAD_LEFT   0x0080
 
#define PAD_DOWN   0x0040
 
#define PAD_RIGHT   0x0020
 
#define PAD_UP   0x0010
 
#define PAD_START   0x0008
 
#define PAD_R3   0x0004
 
#define PAD_L3   0x0002
 
#define PAD_SELECT   0x0001
 
#define PAD_SQUARE   0x8000
 
#define PAD_CROSS   0x4000
 
#define PAD_CIRCLE   0x2000
 
#define PAD_TRIANGLE   0x1000
 
#define PAD_R1   0x0800
 
#define PAD_L1   0x0400
 
#define PAD_R2   0x0200
 
#define PAD_L2   0x0100
 

Functions

pad_tpad_open (unsigned int port, unsigned int slot, unsigned int mode, unsigned int lock)
 
static void pad_get_buttons (pad_t *pad)
 
void pad_close (pad_t *pad)
 
void pad_wait (pad_t *pad)
 
void pad_set_mode (pad_t *pad, int mode, int lock)
 
void pad_set_sensitivity (pad_t *pad, int enable)
 
void pad_init_actuators (pad_t *pad)
 
void pad_set_actuators (pad_t *pad, int small, unsigned char large)
 
int pad_get_state (pad_t *pad)
 
int pad_get_num_modes (pad_t *pad)
 
int pad_has_type (pad_t *pad, int type)
 
int pad_get_type (pad_t *pad)
 
int pad_get_mode (pad_t *pad)
 

Detailed Description

Input library

Definition in file input.h.


Data Structure Documentation

◆ actuator_t

struct actuator_t

Definition at line 34 of file input.h.

Data Fields
char small
unsigned char large
char status[6]

◆ pad_t

struct pad_t

Definition at line 40 of file input.h.

+ Collaboration diagram for pad_t:
Data Fields
char port
char slot
char mode
char lock
int type
char state
char last_state
char exec_cmd
char num_modes
char sensitivity
struct padButtonStatus * buttons
actuator_t * actuator
char * buffer

Macro Definition Documentation

◆ MODE_DIGITAL

#define MODE_DIGITAL   0

Definition at line 11 of file input.h.

◆ MODE_ANALOG

#define MODE_ANALOG   1

Definition at line 12 of file input.h.

◆ MODE_UNLOCKED

#define MODE_UNLOCKED   0

Definition at line 14 of file input.h.

◆ MODE_LOCKED

#define MODE_LOCKED   1

Definition at line 15 of file input.h.

◆ PAD_LEFT

#define PAD_LEFT   0x0080

Definition at line 17 of file input.h.

◆ PAD_DOWN

#define PAD_DOWN   0x0040

Definition at line 18 of file input.h.

◆ PAD_RIGHT

#define PAD_RIGHT   0x0020

Definition at line 19 of file input.h.

◆ PAD_UP

#define PAD_UP   0x0010

Definition at line 20 of file input.h.

◆ PAD_START

#define PAD_START   0x0008

Definition at line 21 of file input.h.

◆ PAD_R3

#define PAD_R3   0x0004

Definition at line 22 of file input.h.

◆ PAD_L3

#define PAD_L3   0x0002

Definition at line 23 of file input.h.

◆ PAD_SELECT

#define PAD_SELECT   0x0001

Definition at line 24 of file input.h.

◆ PAD_SQUARE

#define PAD_SQUARE   0x8000

Definition at line 25 of file input.h.

◆ PAD_CROSS

#define PAD_CROSS   0x4000

Definition at line 26 of file input.h.

◆ PAD_CIRCLE

#define PAD_CIRCLE   0x2000

Definition at line 27 of file input.h.

◆ PAD_TRIANGLE

#define PAD_TRIANGLE   0x1000

Definition at line 28 of file input.h.

◆ PAD_R1

#define PAD_R1   0x0800

Definition at line 29 of file input.h.

◆ PAD_L1

#define PAD_L1   0x0400

Definition at line 30 of file input.h.

◆ PAD_R2

#define PAD_R2   0x0200

Definition at line 31 of file input.h.

◆ PAD_L2

#define PAD_L2   0x0100

Definition at line 32 of file input.h.

Function Documentation

◆ pad_open()

pad_t * pad_open ( unsigned int  port,
unsigned int  slot,
unsigned int  mode,
unsigned int  lock 
)

Open and initialize a pad

Definition at line 10 of file input.c.

References mtapGetConnection(), pad_open(), pad_set_mode(), pad_wait(), and padPortOpen().

Referenced by pad_open().

◆ pad_get_buttons()

static void pad_get_buttons ( pad_t pad)
inlinestatic

Get the pad's current button status

Definition at line 70 of file input.h.

References padRead().

◆ pad_close()

void pad_close ( pad_t pad)

Close the pad

Definition at line 82 of file input.c.

References padPortClose().

◆ pad_wait()

void pad_wait ( pad_t pad)

Wait until the pad is ready to accept commands

Definition at line 122 of file input.c.

References pad_get_state(), and pad_wait().

Referenced by pad_init_actuators(), pad_open(), pad_set_mode(), pad_set_sensitivity(), and pad_wait().

◆ pad_set_mode()

void pad_set_mode ( pad_t pad,
int  mode,
int  lock 
)

Set the pad's mode and mode lock

Definition at line 215 of file input.c.

References pad_has_type(), pad_wait(), and padSetMainMode().

Referenced by pad_open().

◆ pad_set_sensitivity()

void pad_set_sensitivity ( pad_t pad,
int  enable 
)

Set the pad's pressure sensitivity

Definition at line 261 of file input.c.

References pad_wait(), padEnterPressMode(), padExitPressMode(), and padInfoPressMode().

◆ pad_init_actuators()

void pad_init_actuators ( pad_t pad)

Init actuators

Definition at line 288 of file input.c.

References pad_wait(), padInfoAct(), padInfoMode(), and padSetActAlign().

◆ pad_set_actuators()

void pad_set_actuators ( pad_t pad,
int  small,
unsigned char  large 
)

Set actuators

Definition at line 326 of file input.c.

References padSetActDirect().

◆ pad_get_state()

int pad_get_state ( pad_t pad)

Get the pad's state

Definition at line 103 of file input.c.

References padGetState().

Referenced by pad_wait().

◆ pad_get_num_modes()

int pad_get_num_modes ( pad_t pad)

Get number of modes supported by pad

Definition at line 145 of file input.c.

References padInfoMode().

Referenced by pad_has_type().

◆ pad_has_type()

int pad_has_type ( pad_t pad,
int  type 
)

Check if a type is supported by pad

Definition at line 178 of file input.c.

References pad_get_num_modes(), and padInfoMode().

Referenced by pad_set_mode().

◆ pad_get_type()

int pad_get_type ( pad_t pad)

Get the pad's type

Definition at line 206 of file input.c.

References padInfoMode().

◆ pad_get_mode()

int pad_get_mode ( pad_t pad)

Get the pad's current mode