main
controller_info.h
1#ifndef CONTROLLER_INFO_H_
2#define CONTROLLER_INFO_H_
3#include <stdint.h>
4
5enum {
6 TYPE_UNKNOWN,
7 TYPE_GENERIC_MAPPING,
8 TYPE_XBOX,
9 TYPE_PSX,
10 TYPE_NINTENDO,
11 TYPE_SEGA
12};
13
14enum {
15 SUBTYPE_UNKNOWN,
16 SUBTYPE_XBOX,
17 SUBTYPE_X360,
18 SUBTYPE_XBONE,
19 SUBTYPE_PS2,
20 SUBTYPE_PS3,
21 SUBTYPE_PS4,
22 SUBTYPE_WIIU,
23 SUBTYPE_SWITCH,
24 SUBTYPE_GENESIS,
25 SUBTYPE_SATURN,
26 SUBTYPE_NUM
27};
28
29enum {
30 VARIANT_NORMAL,
31 VARIANT_6B_BUMPERS, //C and Z positions are RB and LB respectively
32 VARIANT_6B_RIGHT, //C and Z positions are RT and RB respectively
33 VARIANT_NUM
34};
35
36typedef struct {
37 char const *name;
38 uint8_t type;
39 uint8_t subtype;
40 uint8_t variant;
41} controller_info;
42
43controller_info get_controller_info(int index);
44const char *get_button_label(controller_info *info, int button);
45const char *get_axis_label(controller_info *info, int axis);
46void save_controller_info(int joystick, controller_info *info);
47void save_controller_mapping(int joystick, char *mapping_string);
48void controller_add_mappings(void);
49char *make_controller_type_key(controller_info *info);
50char *make_human_readable_type_name(controller_info *info);
51
52#endif //CONTROLLER_INFO_H_