SSBM Decomp
Loading...
Searching...
No Matches
pad.h
Go to the documentation of this file.
1#ifndef _DOLPHIN_PAD_H_
2#define _DOLPHIN_PAD_H_
3
4#include <dolphin/types.h>
5
6#define PAD_SPEC_0 0
7#define PAD_SPEC_1 1
8#define PAD_SPEC_2 2
9#define PAD_SPEC_3 3
10#define PAD_SPEC_4 4
11#define PAD_SPEC_5 5
12
13#define PAD_MOTOR_STOP 0
14#define PAD_MOTOR_RUMBLE 1
15#define PAD_MOTOR_STOP_HARD 2
16
17#define PAD_CHAN0_BIT 0x80000000
18#define PAD_CHAN1_BIT 0x40000000
19#define PAD_CHAN2_BIT 0x20000000
20#define PAD_CHAN3_BIT 0x10000000
21
22#define PAD_MAX_CONTROLLERS 4
23
24#define PAD_BUTTON_LEFT (1 << 0) // 0x0001
25#define PAD_BUTTON_RIGHT (1 << 1) // 0x0002
26#define PAD_BUTTON_DOWN (1 << 2) // 0x0004
27#define PAD_BUTTON_UP (1 << 3) // 0x0008
28#define PAD_TRIGGER_Z (1 << 4) // 0x0010
29#define PAD_TRIGGER_R (1 << 5) // 0x0020
30#define PAD_TRIGGER_L (1 << 6) // 0x0040
31#define PAD_BUTTON_A (1 << 8) // 0x0100
32#define PAD_BUTTON_B (1 << 9) // 0x0200
33#define PAD_BUTTON_X (1 << 10) // 0x0400
34#define PAD_BUTTON_Y (1 << 11) // 0x0800
35#define PAD_BUTTON_MENU (1 << 12) // 0x1000
36#define PAD_BUTTON_START (1 << 12) // 0x1000
37#define PAD_STICK_UP (1 << 16) // 0x10000
38#define PAD_STICK_DOWN (1 << 17) // 0x20000
39#define PAD_STICK_LEFT (1 << 18) // 0x40000
40#define PAD_STICK_RIGHT (1 << 19) // 0x80000
41#define PAD_SUBSTICK_UP (1 << 20) // 0x100000
42#define PAD_SUBSTICK_DOWN (1 << 21) // 0x200000
43#define PAD_SUBSTICK_LEFT (1 << 22) // 0x400000
44#define PAD_SUBSTICK_RIGHT (1 << 23) // 0x800000
45#define PAD_TRIGGER_LR (1 << 31) // 0x80000000
46#define PAD_CONFIRM (1ULL << 32) // 0x100000000
47#define PAD_CANCEL (1ULL << 33) // 0x200000000
48#define PAD_LR_START (1ULL << 34) // 0x400000000
49#define PAD_LRA_START (1ULL << 35) // 0x800000000
50#define PAD_ANY_UP (1ULL << 36) // 0x1000000000
51#define PAD_ANY_DOWN (1ULL << 37) // 0x2000000000
52#define PAD_ANY_LEFT (1ULL << 38) // 0x4000000000
53#define PAD_ANY_RIGHT (1ULL << 39) // 0x8000000000
54
55#define PAD_ERR_NONE 0
56#define PAD_ERR_NO_CONTROLLER -1
57#define PAD_ERR_NOT_READY -2
58#define PAD_ERR_TRANSFER -3
59
60#define RES_WIRELESS_LITE 0x40000
61
62typedef struct PADStatus {
63 /*0x00*/ u16 button;
64 /*0x02*/ s8 stickX;
65 /*0x03*/ s8 stickY;
66 /*0x04*/ s8 substickX;
67 /*0x05*/ s8 substickY;
68 /*0x06*/ u8 triggerLeft;
69 /*0x07*/ u8 triggerRight;
70 /*0x08*/ u8 analogA;
71 /*0x09*/ u8 analogB;
72 /*0x0A*/ s8 err;
73} PADStatus;
74
75// PAD.c
76int PADReset(unsigned long mask);
79u32 PADRead(struct PADStatus* status);
80void PADSetSamplingRate(unsigned long msec);
81void __PADTestSamplingRate(unsigned long tvmode);
82void PADControlAllMotors(const u32* commandArray);
83void PADControlMotor(s32 chan, u32 command);
84void PADSetSpec(u32 spec);
85unsigned long PADGetSpec();
86int PADGetType(long chan, unsigned long* type);
91
92// Padclamp.c
93void PADClamp(PADStatus* status);
94
95#endif
int BOOL
Definition types.h:20
unsigned long u32
Definition types.h:9
unsigned short int u16
Definition types.h:7
signed char s8
Definition hsd_3B2B.h:3
signed long s32
Definition hsd_3B2B.h:1
unsigned char u8
Definition hsd_3B2B.h:2
void PADControlAllMotors(const u32 *commandArray)
u32 PADRead(struct PADStatus *status)
void SIRefreshSamplingRate(void)
int PADGetType(long chan, unsigned long *type)
BOOL PADSync(void)
void PADControlMotor(s32 chan, u32 command)
BOOL PADInit()
void PADSetSamplingRate(unsigned long msec)
int PADReset(unsigned long mask)
BOOL PADRecalibrate(u32 mask)
BOOL __PADDisableRecalibration(int arg0)
void PADSetSpec(u32 spec)
void PADClamp(PADStatus *status)
unsigned long PADGetSpec()
void PADSetAnalogMode(u32 mode)
void __PADTestSamplingRate(unsigned long tvmode)
int mask
Definition state.c:133
Definition pad.h:62
u8 triggerLeft
Definition pad.h:68
s8 stickY
Definition pad.h:65
s8 substickY
Definition pad.h:67
s8 stickX
Definition pad.h:64
u8 analogA
Definition pad.h:70
u8 triggerRight
Definition pad.h:69
u16 button
Definition pad.h:63
u8 analogB
Definition pad.h:71
s8 substickX
Definition pad.h:66
s8 err
Definition pad.h:72