fork/GramFirmware

git clone https://git.julia.blue/fork/GramFirmware

Jonathan HaylettReorder InputState structcb07a14

v0.1.0
1.8 KiB81 linesraw
1#ifndef _CORE_STATE_HPP
2#define _CORE_STATE_HPP
3
4#include "stdlib.hpp"
5
6// Button state.
7typedef struct inputstate {
8    // Rectangle inputs.
9    bool left = false;
10    bool right = false;
11    bool down = false;
12    bool up = false;
13    bool c_left = false;
14    bool c_right = false;
15    bool c_down = false;
16    bool c_up = false;
17    bool a = false;
18    bool b = false;
19    bool x = false;
20    bool y = false;
21    bool l = false;
22    bool r = false;
23    bool z = false;
24    bool lightshield = false;
25    bool midshield = false;
26    bool select = false;
27    bool start = false;
28    bool home = false;
29    bool mod_x = false;
30    bool mod_y = false;
31
32    // Nunchuk inputs.
33    bool nunchuk_connected = false;
34    int8_t nunchuk_x = 0;
35    int8_t nunchuk_y = 0;
36    bool nunchuk_c = false;
37    bool nunchuk_z = false;
38} InputState;
39
40// State describing stick direction at the quadrant level.
41typedef struct {
42    bool horizontal;
43    bool vertical;
44    bool diagonal;
45    int8_t x;
46    int8_t y;
47    int8_t cx;
48    int8_t cy;
49} StickDirections;
50
51// Output state.
52typedef struct outputstate {
53    // Digital outputs.
54    bool a = false;
55    bool b = false;
56    bool x = false;
57    bool y = false;
58    bool buttonL = false;
59    bool buttonR = false;
60    bool triggerLDigital = false;
61    bool triggerRDigital = false;
62    bool start = false;
63    bool select = false;
64    bool home = false;
65    bool dpadUp = false;
66    bool dpadDown = false;
67    bool dpadLeft = false;
68    bool dpadRight = false;
69    bool leftStickClick = false;
70    bool rightStickClick = false;
71
72    // Analog outputs.
73    uint8_t leftStickX = 128;
74    uint8_t leftStickY = 128;
75    uint8_t rightStickX = 128;
76    uint8_t rightStickY = 128;
77    uint8_t triggerRAnalog = 0;
78    uint8_t triggerLAnalog = 0;
79} OutputState;
80
81#endif