Files
tp/include/dolphin/pad.h
T

79 lines
1.7 KiB
C
Raw Normal View History

2021-03-28 22:49:05 +02:00
#ifndef PAD_H
#define PAD_H
2023-05-12 12:10:14 -07:00
#include "dolphin/types.h"
2021-03-28 22:49:05 +02:00
#ifdef __cplusplus
extern "C" {
#endif
2021-05-03 02:03:24 +02:00
2023-05-12 12:10:14 -07:00
typedef struct OSContext OSContext;
2024-01-19 16:22:19 -08:00
#define PAD_CHAN0_BIT 0x80000000
#define PAD_CHAN1_BIT 0x40000000
#define PAD_CHAN2_BIT 0x20000000
#define PAD_CHAN3_BIT 0x10000000
2021-05-03 02:03:24 +02:00
2023-01-02 11:20:10 -08:00
#define PAD_SPEC_0 0
#define PAD_SPEC_1 1
#define PAD_SPEC_2 2
#define PAD_SPEC_3 3
#define PAD_SPEC_4 4
#define PAD_SPEC_5 5
#define PAD_MOTOR_STOP 0
#define PAD_MOTOR_RUMBLE 1
#define PAD_MOTOR_STOP_HARD 2
#define PAD_ERR_NONE 0
#define PAD_ERR_NO_CONTROLLER -1
#define PAD_ERR_NOT_READY -2
#define PAD_ERR_TRANSFER -3
#define PAD_BUTTON_LEFT 0x0001
#define PAD_BUTTON_RIGHT 0x0002
#define PAD_BUTTON_DOWN 0x0004
#define PAD_BUTTON_UP 0x0008
#define PAD_TRIGGER_Z 0x0010
#define PAD_TRIGGER_R 0x0020
#define PAD_TRIGGER_L 0x0040
#define PAD_BUTTON_A 0x0100
#define PAD_BUTTON_B 0x0200
#define PAD_BUTTON_X 0x0400
#define PAD_BUTTON_Y 0x0800
#define PAD_BUTTON_MENU 0x1000
#define PAD_BUTTON_START 0x1000
2021-05-03 02:03:24 +02:00
typedef struct PADStatus {
2022-01-25 12:24:14 -08:00
/* 0x0 */ u16 button;
/* 0x2 */ s8 stick_x;
/* 0x3 */ s8 stick_y;
/* 0x4 */ s8 substick_x;
/* 0x5 */ s8 substick_y;
/* 0x6 */ u8 trigger_left;
/* 0x7 */ u8 trigger_right;
/* 0x8 */ u8 analog_a;
/* 0x9 */ u8 analog_b;
/* 0xA */ s8 error;
2021-05-03 02:03:24 +02:00
} PADStatus;
2023-01-02 11:20:10 -08:00
typedef void (*PADSamplingCallback)(void);
BOOL PADInit(void);
2021-05-03 02:03:24 +02:00
void PADSetAnalogMode(u32 mode);
2023-01-02 11:20:10 -08:00
void PADSetSpec(u32 spec);
BOOL PADReset(u32 mask);
2021-05-03 02:03:24 +02:00
void PADClampCircle(PADStatus* status);
void PADClamp(PADStatus* status);
2022-12-19 11:06:32 -08:00
u32 PADRead(PADStatus* status);
2021-05-03 02:03:24 +02:00
void PADControlMotor(s32 channel, u32 command);
BOOL PADRecalibrate(u32 mask);
extern u32 __PADSpec;
#ifdef __cplusplus
};
#endif
2021-05-03 02:03:24 +02:00
2021-03-28 22:49:05 +02:00
#endif /* PAD_H */