summaryrefslogtreecommitdiff
path: root/global_defs.h
diff options
context:
space:
mode:
authorClay Smith <claysmith158@gmail.com>2023-01-30 22:08:33 -0600
committerClay Smith <claysmith158@gmail.com>2023-01-30 22:08:33 -0600
commitf2bea22f979015b439f0f9347f2fad8c7babc481 (patch)
treede9c9c811f9f8cff7dc2e5b6313e19789d68fa76 /global_defs.h
parent2548e88a53e9a4cebab8ca77eb696ae1e85aadb9 (diff)
refactored by adding a seperate file and functions to reduce duplication
Diffstat (limited to 'global_defs.h')
-rw-r--r--global_defs.h68
1 files changed, 48 insertions, 20 deletions
diff --git a/global_defs.h b/global_defs.h
index 248da05..7649dbf 100644
--- a/global_defs.h
+++ b/global_defs.h
@@ -7,28 +7,56 @@
#include <stdint.h>
//magic numbers
-#define NUM_EVENTS 14 //steam + xbox + ps4 * 6 + wii * 4 + mouse
-#define NUM_EVENTS_PS4 3
-#define NUM_EVENTS_WII 4
+#define NUM_EVENTS_PS4 3
+#define NUM_EVENTS_WII 4
+#define NUM_EVENTS 13 //steam + xbox + ps4 * 6 + wii * 4 + mouse
+
+
+// WIRED PS4
+#define PS4_WIRED_TOUCH_BIT 4
+#define PS4_WIRED_GYRO_BIT 8
+#define PS4_WIRED_BUTTONS_BIT 16
+
+#define PS4_WIRED_TOUCH_AND_GYRO 12 // 4 + 8
+#define PS4_WIRED_TOUCH_AND_BUTTONS 20 // 4 + 16
+#define PS4_WIRED_GYRO_AND_BUTTONS 24 // 8 + 16
+#define PS4_WIRED_ALL_BITS 28 // 4 + 8 + 16
-#define PS4_BT_TOUCH_BIT 32
-#define PS4_BT_GYRO_BIT 64
-#define PS4_BT_BUTTONS_BIT 128
-#define PS4_BT_ALL_BITS 224 // 128 + 64 + 32
-
-#define PS4_WIRED_TOUCH_BIT 4
-#define PS4_WIRED_GYRO_BIT 8
-#define PS4_WIRED_BUTTONS_BIT 16
-#define PS4_WIRED_ALL_BITS 28 // 16 + 8 + 4
-
-#define NINTENDO_GYRO_BIT 256
-#define NINTENDO_IR_BIT 512
-#define NINTENDO_BUTTONS_BIT 1024
-#define NINTENDO_NUNCHUCK_BIT 2048
-#define NINTENDO_ALL_BITS 3840 // 2048 + 1024 + 512 + 256
+
+// Bluetooth PS4
+#define PS4_BT_TOUCH_BIT 32
+#define PS4_BT_GYRO_BIT 64
+#define PS4_BT_BUTTONS_BIT 128
+
+#define PS4_BT_TOUCH_AND_GYRO 96 // 32 + 64
+#define PS4_BT_TOUCH_AND_BUTTONS 160 // 32 + 128
+#define PS4_BT_GYRO_AND_BUTTONS 192 // 64 + 128
+#define PS4_BT_ALL_BITS 224 // 32 + 64 + 128
+
+
+// NINTENDO WII
+#define NINTENDO_GYRO_BIT 256
+#define NINTENDO_IR_BIT 512
+#define NINTENDO_BUTTONS_BIT 1024
+
+#define NINTENDO_NUNCHUK_BIT 2048
+
+#define NINTENDO_GYRO_AND_IR 768 // 256 + 512
+#define NINTENDO_GYRO_AND_BUTTONS 1280 // 256 + 1024
+#define NINTENDO_GYRO_AND_NUNCHUK 2304 // 256 + 2048
+#define NINTENDO_IR_AND_BUTTONS 1536 // 512 + 1024
+#define NINTENDO_IR_AND_NUNCHUK 2560 // 512 + 2048
+#define NINTENDO_BUTTONS_AND_NUNCHUK 3072 // 1024 + 2048
+
+#define NINTENDO_GYRO_IR_AND_BUTTONS 1792 // 256 + 512 + 1024
+#define NINTENDO_GYRO_IR_AND_NUNCHUK 2816 // 256 + 512 + 2048
+#define NINTENDO_GYRO_BUTTONS_AND_NUNCHUK 3328 // 256 + 1024 + 2048
+#define NINTENDO_IR_BUTTONS_AND_NUNCHUK 3584 // 512 + 1024 + 2048
+#define NINTENDO_ALL_BITS 3840 // 256 + 512 + 1024 + 2048
+
enum {
- IR = 0, TOUCHPAD = 0, GYRO = 1, BUTTONS = 2, NUNCHUCK = 3
+ IR = 0, TOUCHPAD = 0, GYRO = 1, BUTTONS = 2, NUNCHUK = 3
};
enum {
@@ -36,7 +64,7 @@ enum {
XBOX_360 = 1,
PS4_WIRED_GYRO = 2, PS4_WIRED_BUTTONS = 3, PS4_WIRED_TOUCH = 4,
PS4_BT_GYRO = 5, PS4_BT_BUTTONS = 6, PS4_BT_TOUCH = 7,
- WII_GYRO = 8, WII_IR = 9, WII_BUTTONS = 10, WII_NUNCHUCK = 11,
+ WII_GYRO = 8, WII_IR = 9, WII_BUTTONS = 10, WII_NUNCHUK = 11,
MOUSE = 12
};