PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
input.h
Go to the documentation of this file.
1
6#ifndef __INPUT_H__
7#define __INPUT_H__
8
9#include <libpad.h>
10
11#define MODE_DIGITAL 0
12#define MODE_ANALOG 1
13
14#define MODE_UNLOCKED 0
15#define MODE_LOCKED 1
16
17#define PAD_LEFT 0x0080
18#define PAD_DOWN 0x0040
19#define PAD_RIGHT 0x0020
20#define PAD_UP 0x0010
21#define PAD_START 0x0008
22#define PAD_R3 0x0004
23#define PAD_L3 0x0002
24#define PAD_SELECT 0x0001
25#define PAD_SQUARE 0x8000
26#define PAD_CROSS 0x4000
27#define PAD_CIRCLE 0x2000
28#define PAD_TRIANGLE 0x1000
29#define PAD_R1 0x0800
30#define PAD_L1 0x0400
31#define PAD_R2 0x0200
32#define PAD_L2 0x0100
33
34typedef struct {
35 char small;
36 unsigned char large;
37 char status[6];
39
40typedef struct {
41
42 char port;
43 char slot;
44 char mode;
45 char lock;
46
47 int type;
48
49 char state;
50 char last_state;
51 char exec_cmd;
52 char num_modes;
53 char sensitivity;
54
55 struct padButtonStatus *buttons;
56
57 actuator_t *actuator;
58 char *buffer;
59
60} pad_t;
61
62#ifdef __cplusplus
63extern "C" {
64#endif
65
67pad_t *pad_open(unsigned int port, unsigned int slot, unsigned int mode, unsigned int lock);
68
70static inline void pad_get_buttons(pad_t *pad)
71{
72 padRead(pad->port,pad->slot,pad->buttons);
73}
74
76void pad_close(pad_t *pad);
77
79void pad_wait(pad_t *pad);
80
81#ifdef DEBUG
83void pad_print_state(pad_t *pad);
84
86void pad_print_supported_modes(pad_t *pad);
87#endif
89void pad_set_mode(pad_t *pad, int mode, int lock);
90
92void pad_set_sensitivity(pad_t *pad, int enable);
93
95void pad_init_actuators(pad_t *pad);
96
98void pad_set_actuators(pad_t *pad, int small, unsigned char large);
99
101int pad_get_state(pad_t *pad);
102
104int pad_get_num_modes(pad_t *pad);
105
107int pad_has_type(pad_t *pad, int type);
108
110int pad_get_type(pad_t *pad);
111
114
115#ifdef __cplusplus
116};
117#endif
118
119#endif /* __INPUT_H__ */
void pad_close(pad_t *pad)
Definition input.c:82
int pad_has_type(pad_t *pad, int type)
Definition input.c:178
void pad_wait(pad_t *pad)
Definition input.c:122
int pad_get_state(pad_t *pad)
Definition input.c:103
int pad_get_type(pad_t *pad)
Definition input.c:206
pad_t * pad_open(unsigned int port, unsigned int slot, unsigned int mode, unsigned int lock)
Definition input.c:10
void pad_set_actuators(pad_t *pad, int small, unsigned char large)
Definition input.c:326
static void pad_get_buttons(pad_t *pad)
Definition input.h:70
void pad_set_sensitivity(pad_t *pad, int enable)
Definition input.c:261
void pad_init_actuators(pad_t *pad)
Definition input.c:288
int pad_get_mode(pad_t *pad)
void pad_set_mode(pad_t *pad, int mode, int lock)
Definition input.c:215
int pad_get_num_modes(pad_t *pad)
Definition input.c:145
Definition input.h:40
unsigned char padRead(int port, int slot, struct padButtonStatus *data)
Definition libpad.c:472