1212#include " json/json.hpp"
1313
1414namespace recomp {
15- // x-macros to build input enums and arrays.
16- // First parameter is the enum name, second parameter is the bit field for the input (or 0 if there is no associated one), third is the readable name.
17- // TODO refactor this to allow projects to rename these, or get rid of the readable name and leave that up to individual projects to map.
18- #define DEFINE_N64_BUTTON_INPUTS () \
19- DEFINE_INPUT (A, 0x8000 , " Action" ) \
20- DEFINE_INPUT (B, 0x4000 , " Attack/Cancel" ) \
21- DEFINE_INPUT (Z, 0x2000 , " Target" ) \
22- DEFINE_INPUT (START, 0x1000 , " Start" ) \
23- DEFINE_INPUT (L, 0x0020 , " Toggle map" ) \
24- DEFINE_INPUT (R, 0x0010 , " Shield" ) \
25- DEFINE_INPUT (C_UP, 0x0008 , " Look/Fairy" ) \
26- DEFINE_INPUT (C_LEFT, 0x0002 , " Item 1" ) \
27- DEFINE_INPUT (C_DOWN, 0x0004 , " Item 2" ) \
28- DEFINE_INPUT (C_RIGHT, 0x0001 , " Item 3" ) \
29- DEFINE_INPUT (DPAD_UP, 0x0800 , " Special Item 1" ) \
30- DEFINE_INPUT (DPAD_RIGHT, 0x0100 , " Special Item 2" ) \
31- DEFINE_INPUT (DPAD_DOWN, 0x0400 , " Special Item 3" ) \
32- DEFINE_INPUT (DPAD_LEFT, 0x0200 , " Special Item 4" )
33-
34- #define DEFINE_N64_AXIS_INPUTS () \
35- DEFINE_INPUT (Y_AXIS_POS, 0 , " Up" ) \
36- DEFINE_INPUT (Y_AXIS_NEG, 0 , " Down" ) \
37- DEFINE_INPUT (X_AXIS_NEG, 0 , " Left" ) \
38- DEFINE_INPUT (X_AXIS_POS, 0 , " Right" ) \
39-
40- #define DEFINE_ALL_INPUTS () \
41- DEFINE_N64_BUTTON_INPUTS () \
42- DEFINE_N64_AXIS_INPUTS ()
43-
44- // Enum containing every recomp input.
45- #define DEFINE_INPUT (name, value, readable ) name,
15+ // x-macros to build input enums and arrays.
16+ // First parameter is the enum name, second parameter is the bit field for the input (or 0 if there is no associated one), third is the
17+ // readable name.
18+ // TODO refactor this to allow projects to rename these, or get rid of the readable name and leave that up to individual projects to map.
19+ #define DEFINE_N64_BUTTON_INPUTS () \
20+ DEFINE_INPUT (A, 0x8000 , " Action" ) \
21+ DEFINE_INPUT (B, 0x4000 , " Attack/Cancel" ) \
22+ DEFINE_INPUT (Z, 0x2000 , " Target" ) \
23+ DEFINE_INPUT (START, 0x1000 , " Start" ) \
24+ DEFINE_INPUT (L, 0x0020 , " Toggle map" ) \
25+ DEFINE_INPUT (R, 0x0010 , " Shield" ) \
26+ DEFINE_INPUT (C_UP, 0x0008 , " Look/Fairy" ) \
27+ DEFINE_INPUT (C_LEFT, 0x0002 , " Item 1" ) \
28+ DEFINE_INPUT (C_DOWN, 0x0004 , " Item 2" ) \
29+ DEFINE_INPUT (C_RIGHT, 0x0001 , " Item 3" ) \
30+ DEFINE_INPUT (DPAD_UP, 0x0800 , " Special Item 1" ) \
31+ DEFINE_INPUT (DPAD_RIGHT, 0x0100 , " Special Item 2" ) \
32+ DEFINE_INPUT (DPAD_DOWN, 0x0400 , " Special Item 3" ) \
33+ DEFINE_INPUT (DPAD_LEFT, 0x0200 , " Special Item 4" )
34+
35+ #define DEFINE_N64_AXIS_INPUTS () \
36+ DEFINE_INPUT (Y_AXIS_POS, 0 , " Up" ) \
37+ DEFINE_INPUT (Y_AXIS_NEG, 0 , " Down" ) \
38+ DEFINE_INPUT (X_AXIS_NEG, 0 , " Left" ) \
39+ DEFINE_INPUT (X_AXIS_POS, 0 , " Right" )
40+
41+ #define DEFINE_ALL_INPUTS () \
42+ DEFINE_N64_BUTTON_INPUTS () \
43+ DEFINE_N64_AXIS_INPUTS ()
44+
45+ // Enum containing every recomp input.
46+ #define DEFINE_INPUT (name, value, readable ) name,
4647 enum class GameInput {
4748 DEFINE_ALL_INPUTS ()
4849
@@ -52,7 +53,7 @@ namespace recomp {
5253 N64_AXIS_START = X_AXIS_NEG,
5354 N64_AXIS_COUNT = Y_AXIS_POS - N64_AXIS_START + 1 ,
5455 };
55- #undef DEFINE_INPUT
56+ #undef DEFINE_INPUT
5657
5758 struct InputField {
5859 uint32_t input_type;
0 commit comments