6#ifndef __LIBDRAGON_CONTROLLER_H
7#define __LIBDRAGON_CONTROLLER_H
23#define CONTROLLER_1_INSERTED 0xF000
25#define CONTROLLER_2_INSERTED 0x0F00
27#define CONTROLLER_3_INSERTED 0x00F0
29#define CONTROLLER_4_INSERTED 0x000F
38#define ACCESSORY_NONE 0
40#define ACCESSORY_MEMPAK 1
42#define ACCESSORY_RUMBLEPAK 2
44#define ACCESSORY_VRU 3
46#define ACCESSORY_TRANSFERPAK 4
56#define ERROR_BAD_COMMAND 0x1
58#define ERROR_NOT_PRESENT 0x2
66typedef struct SI_condat
80 unsigned int data : 32;
113 unsigned C_right : 1;
127typedef struct SI_condat_gc
139 unsigned origin_unchecked : 1;
145 unsigned unused2 : 1;
153 unsigned stick_x : 8;
154 unsigned stick_y : 8;
156 unsigned cstick_x : 8;
157 unsigned cstick_y : 8;
158 unsigned analog_l : 8;
159 unsigned analog_r : 8;
170 struct SI_condat_gc data;
181typedef struct controller_data
184 struct SI_condat c[4];
186 struct SI_condat_gc gc[4];
190typedef struct controller_origin_data
217void execute_raw_command(
int controller,
int command,
int bytesout,
int bytesin,
unsigned char *out,
unsigned char *in );
unsigned err
Status of the last command.
Definition controller.h:71
void controller_scan(void)
Fetch the current controller state.
Definition controller.c:240
struct controller_data get_keys_held(void)
Get keys that were held since the last inspection.
Definition controller.c:304
void controller_read_gc_origin(struct controller_origin_data *outdata)
Read the controller origin status for all controllers, GC version.
Definition controller.c:204
int write_mempak_address(int controller, uint16_t address, uint8_t *data)
Write a chunk of data to a mempak.
Definition controller.c:711
void rumble_start(int controller)
Turn rumble on for a particular controller.
Definition controller.c:862
void controller_read(struct controller_data *output)
Read the controller button status for all controllers.
Definition controller.c:130
int get_accessories_present(struct controller_data *out)
Return a bitmask specifying which controllers have recognized accessories.
Definition controller.c:519
struct controller_data get_keys_pressed(void)
Get keys that are currently pressed, regardless of previous state.
Definition controller.c:326
int identify_accessory(int controller)
Identify the accessory connected to a controller.
Definition controller.c:806
void execute_raw_command(int controller, int command, int bytesout, int bytesin, unsigned char *out, unsigned char *in)
Execute a raw PIF command.
Definition controller.c:407
void rumble_stop(int controller)
Turn rumble off for a particular controller.
Definition controller.c:879
struct controller_data get_keys_down(void)
Get keys that were pressed since the last inspection.
Definition controller.c:259
int get_dpad_direction(int controller)
Return the DPAD calculated direction.
Definition controller.c:343
struct controller_data get_keys_up(void)
Get keys that were released since the last inspection.
Definition controller.c:281
void controller_init(void)
Initialize the controller subsystem.
Definition controller.c:109
void controller_read_gc(struct controller_data *outdata, const uint8_t rumble[4])
Read the controller button status for all controllers, GC version.
Definition controller.c:158
int get_controllers_present(void)
Return a bitmask representing which controllers are present.
Definition controller.c:437
int read_mempak_address(int controller, uint16_t address, uint8_t *data)
Read a chunk of data from a mempak.
Definition controller.c:637
SI GameCube controller origin data for all controller ports.
Definition controller.h:191
SI controller data for all controller ports.
Definition controller.h:182
SI GameCube controller origin data.
Definition controller.h:169
SI Nintendo 64 controller data.
Definition controller.h:67
SI GameCube controller data.
Definition controller.h:128