summaryrefslogtreecommitdiff
path: root/controller_info.h
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2018-07-22 17:48:46 -0700
committerMichael Pavone <pavone@retrodev.com>2018-07-22 17:48:46 -0700
commit47d77ef9201c0ebe2c443a98d53b563657d9f7ed (patch)
tree8c39ffb718c9244fdb2b131550c99fce59f52216 /controller_info.h
parent480b9bb35341fb64afbd0ab6e18b978b2cd6d4f8 (diff)
Initial heuristics for detecting controller types and showing different labels in UI. Modified controller settings view to first display a list of controllers, only showing mapping after selecting controller
Diffstat (limited to 'controller_info.h')
-rw-r--r--controller_info.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/controller_info.h b/controller_info.h
new file mode 100644
index 0000000..0bef684
--- /dev/null
+++ b/controller_info.h
@@ -0,0 +1,45 @@
+#ifndef CONTROLLER_INFO_H_
+#define CONTROLLER_INFO_H_
+#include <stdint.h>
+
+enum {
+ TYPE_UNKNOWN,
+ TYPE_GENERIC_MAPPING,
+ TYPE_XBOX,
+ TYPE_PSX,
+ TYPE_NINTENDO,
+ TYPE_SEGA
+};
+
+enum {
+ SUBTYPE_UNKNOWN,
+ SUBTYPE_XBOX,
+ SUBTYPE_X360,
+ SUBTYPE_XBONE,
+ SUBTYPE_PS2,
+ SUBTYPE_PS3,
+ SUBTYPE_PS4,
+ SUBTYPE_WIIU,
+ SUBTYPE_SWITCH,
+ SUBTYPE_GENESIS,
+ SUBTYPE_SATURN
+};
+
+enum {
+ VARIANT_NORMAL,
+ VARIANT_6B_BUMPERS, //C and Z positions are RB and LB respectively
+ VARIANT_6B_RIGHT //C and Z positions are RT and RB respectively
+};
+
+typedef struct {
+ char const *name;
+ uint8_t type;
+ uint8_t subtype;
+ uint8_t variant;
+} controller_info;
+
+controller_info get_controller_info(int index);
+const char *get_button_label(controller_info *info, int button);
+const char *get_axis_label(controller_info *info, int axis);
+
+#endif //CONTROLLER_INFO_H_ \ No newline at end of file