11 s32 state = PadGetState(p & 0xFF);
29 case PadStateFindCTP1:
31 case PadStateFindCTP2:
42 s32 mode = PadInfoMode(
id, InfoModeCurExID, 0);
43 u32 pad = (
id >> 4) & 1;
48 s16 circle, cross, triangle;
54 for (i = 0; i < 4; i++) {
64 buttons = ~data->buttons & ~FACE_BUTTONS;
74#elif VERSION_EU || VERSION_JP
77 buttons = ~data->buttons;
83 buttons &= ~FACE_BUTTONS;
97 for (i = 0; i < 4; i++) {
116 for (; i < 16; i++) {
121 if ((buttons >> bit) & 1) {
138 slot->
held = buttons;
140 slot->
pressed = buttons & (b ^ buttons);
149 PAD.
slots[(
id >> 4) & 1][port & 3].pressed = 0;
150 PAD.
slots[(
id >> 4) & 1][port & 3].repeated = 0;
151 PAD.
slots[(
id >> 4) & 1][port & 3].held = 0;
154 mode = PadInfoMode(
id & 0xFF, InfoModeCurExID, 0);
164 u32 id = port & 0xFF;
169 mode = PadInfoMode(
id, InfoModeCurExID, 0);
171 bit = ((
id >> 4) << 2) | (port & 3);
174 PadSetMainMode(
id, PadInfoMode(
id, InfoModeCurExOffs, 0),
PAD_MODE_LOCKED);
189 s32 count = PadInfoAct(
id, -1, 0);
193 for (i = 0; i < count; i++) {
194 act = PadInfoAct(
id, i, InfoActSub);
196 PAD.
act[
id >> 4][i] = act & 1;
199 return PadSetActAlign(port & 0xFF,
PAD.
act[(port & 0xFF) >> 4]);
208 for (i = 0; i < 2; i++) {
214 PadSetAct(port & 0xFF,
PAD.
act[
id >> 4], 2);
GfxState GFX
GFX: the graphics state and its methods.
s32 LANGUAGE
The European version's settings, in the small data (.sdata) between file/file_table....
PadState PAD
Controller input: cleared by initPad, then the methods.
#define STICK_LOW
A stick at or below LOW, or at or above HIGH, also presses the d-pad.
#define PAD_MODE_UNLOCKED
PadSetMainMode's lock: the analog button may change the mode, or not.
#define RAW_TRIANGLE
Raw bits of circle, cross and triangle, which readPadButtons rotates.
#define PAD_FLAG_VIBRATION
the actuators are aligned
#define PAD_FLAG_DEMO_PLAYBACK
PadState.flags: bits 0-7 hold the mode lock of each port/slot (lockPadMode), the rest are these.
#define PAD_FLAG_ALIGNING
PadSetActAlign sent, not yet stable.
#define PAD_ID_DIGITAL
PadInfoMode(InfoModeCurExID) of a DualShock in digital and analog mode.
s32 pollPadState(u32 port)
The libpad state of a port while it can be read (0 otherwise); a stable pad gets its actuators aligne...
s32 readPad(u16 port, PadData *data)
Reads one pad (vibration included), or clears its buttons when it is missing.
void updateVibration(u16 port)
Counts down a pad's vibration timers and stops each motor whose time is up.
void readPadButtons(s32 port, PadData *data, PadData *record)
Builds held/pressed/repeated from the raw data (the demo record replaces all but Start)
s32 lockPadMode(s32 port, s32 lock)
Locks or unlocks the analog button of a DualShock, keeping its current mode.
s32 alignActuators(u16 port)
Sends a DualShock its actuator alignment, so setVibration can drive the motors.
s32(* getFrameTime)(void)
What a pad sends (libpad's receive buffer)
u16 buttons
raw: a bit is clear while its button is pressed
One controller: a port, or one of the four multitap slots behind it.
u16 repeated
pressed, or held long enough to repeat