5#define DEFAULT_REPEAT_RATE 0x10
15 for (i = 0; i < 2; i++) {
16 for (j = 0; j < 4; j++) {
28 count = (
u8)repeatRate;
77 for (i = 0; i < 2; i++) {
80 for (j = 0; j < 4; j++) {
112 mode = PadInfoMode(
id, InfoModeCurExID, 0);
116 PAD.
act[pad][motor & 1] = value;
126 PadSetAct(
id,
PAD.
act[pad], 2);
149 for (i = 0; i < 16; i++) {
156 u8 bit =
PAD.
slots[(
u8)port >> 4][port & 3].buttonMap[a];
159 PAD.
slots[(
u8)port >> 4][port & 3].buttonMap[b] = bit;
169 0, { { { 0 } } }, { { { 0 } } }, { { 0 } }, 0, 0,
NULL, 0,
179 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
180 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
s32 startDemoRecording(void)
Demo recording was left out of the release: it never starts.
s32 isDemoRecording(s32 pad)
1 while pad pad records a demo, -1 while another pad does, 0 otherwise (never set)
void stopDemoRecording(void)
Does nothing: demo recording was left out.
void stopDemoPlayback(void)
Gives the pads back to the players.
s32 isDemoPlaying(s32 pad)
1 while pad pad replays a demo, -1 while another pad does, 0 otherwise
s32 startDemoPlayback(s16 pad, PadBuffer *data)
Replays data (one raw buffer a frame) as the input of pad.
Heap HEAP
The functions that return what a call left in v0 (allocMemHigh, findTask) and the ones that take othe...
s32 getButtonBit(s32 pad, s32 index)
The bit that logical button index sets on pad 1 or 2.
s32 setVibration(u16 port, s32 motor, s16 time, u8 value)
Starts a motor for time vsyncs (0 stops it)
void updatePad(void)
Reads every pad, or the demo data while a demo plays.
void shutdownPad(void)
Stops reading the pads and forgets every flag, so the next startPad opens them again.
s32 getPadHeld(s32 pad)
The logical buttons held on pad 1 or 2.
void initPad(s32 multitap, s32 repeatRate)
Opens the pads (PadInitMtap or PadInitDirect); repeatRate 0 means DEFAULT_REPEAT_RATE.
s32 getPadPressed(s32 pad)
The logical buttons newly pressed on pad 1 or 2 this frame.
PadState PAD
Controller input: cleared by initPad, then the methods.
void stopPad(void)
Stops reading the pads every vsync.
u8 DEFAULT_BUTTON_MAP[16]
The identity: logical button i is bit i.
s32 getPadRepeated(s32 pad)
The logical buttons pressed on pad 1 or 2, repeating while held.
void swapButtons(u16 port, s32 a, s32 b)
Swaps two logical buttons in a pad slot's button map.
void startPad(void)
Opens the pads with the defaults if needed, then starts reading them every vsync.
void resetButtonMap(u16 port)
Gives a pad slot the default button map, where button i is bit i.
#define DEFAULT_REPEAT_RATE
The vsyncs a held button takes to repeat, unless initPad is told otherwise.
#define PAD_FLAG_STARTED
PadStartCom done.
#define PAD_FLAG_MULTITAP
#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_DATA_SIZE
The bytes PadState keeps before its methods, which initPad clears.
#define PAD_MULTITAP_ID
The second byte of the raw buffer when a multitap answers.
#define PAD_ID_DIGITAL
PadInfoMode(InfoModeCurExID) of a DualShock in digital and analog mode.
#define DEMO_FRAME_COUNT
A demo replays recorded pad data (one raw buffer a frame, up to DEMO_FRAME_COUNT frames) instead of t...
#define PAD_FLAG_INITIALIZED
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 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.
void(* fill)(void *ptr, s32 value, s32 size)
void(* zero)(void *ptr, s32 size)
One controller: a port, or one of the four multitap slots behind it.
u16 repeated
pressed, or held long enough to repeat
PadBuffer * demoData
a buffer a frame
A port's receive buffer, and a frame of a demo: a pad, or a multitap and the four pads behind it.
struct PadBuffer::@11 tap