hid: Added HidNpadButton enum

This commit is contained in:
fincs 2020-11-23 20:59:28 +01:00
parent 3c13d353b0
commit aa77de9f71
No known key found for this signature in database
GPG Key ID: 62C7609ADA219C60

View File

@ -251,58 +251,95 @@ typedef enum {
HidColorAttribute_NoController = 2, ///< NoController HidColorAttribute_NoController = 2, ///< NoController
} HidColorAttribute; } HidColorAttribute;
/// HidNpadButton
typedef enum {
HidNpadButton_A = BIT(0), ///< A button / Right face button
HidNpadButton_B = BIT(1), ///< B button / Down face button
HidNpadButton_X = BIT(2), ///< X button / Up face button
HidNpadButton_Y = BIT(3), ///< Y button / Left face button
HidNpadButton_StickL = BIT(4), ///< Left Stick button
HidNpadButton_StickR = BIT(5), ///< Right Stick button
HidNpadButton_L = BIT(6), ///< L button
HidNpadButton_R = BIT(7), ///< R button
HidNpadButton_ZL = BIT(8), ///< ZL button
HidNpadButton_ZR = BIT(9), ///< ZR button
HidNpadButton_Plus = BIT(10), ///< Plus button
HidNpadButton_Minus = BIT(11), ///< Minus button
HidNpadButton_Left = BIT(12), ///< D-Pad Left button
HidNpadButton_Up = BIT(13), ///< D-Pad Up button
HidNpadButton_Right = BIT(14), ///< D-Pad Right button
HidNpadButton_Down = BIT(15), ///< D-Pad Down button
HidNpadButton_StickLLeft = BIT(16), ///< Left Stick pseudo-button when moved Left
HidNpadButton_StickLUp = BIT(17), ///< Left Stick pseudo-button when moved Up
HidNpadButton_StickLRight = BIT(18), ///< Left Stick pseudo-button when moved Right
HidNpadButton_StickLDown = BIT(19), ///< Left Stick pseudo-button when moved Down
HidNpadButton_StickRLeft = BIT(20), ///< Right Stick pseudo-button when moved Left
HidNpadButton_StickRUp = BIT(21), ///< Right Stick pseudo-button when moved Up
HidNpadButton_StickRRight = BIT(22), ///< Right Stick pseudo-button when moved Right
HidNpadButton_StickRDown = BIT(23), ///< Right Stick pseudo-button when moved Left
HidNpadButton_LeftSL = BIT(24), ///< SL button on Left Joy-Con
HidNpadButton_LeftSR = BIT(25), ///< SR button on Left Joy-Con
HidNpadButton_RightSL = BIT(26), ///< SL button on Right Joy-Con
HidNpadButton_RightSR = BIT(27), ///< SR button on Right Joy-Con
HidNpadButton_Palma = BIT(28), ///< Top button on Poké Ball Plus (Palma) controller
HidNpadButton_29 = BIT(29),
HidNpadButton_HandheldLeftB = BIT(30), ///< B button on Left NES/HVC controller in Handheld mode
HidNpadButton_AnyLeft = HidNpadButton_Left | HidNpadButton_StickLLeft | HidNpadButton_StickRLeft, ///< Bitmask containing all buttons that are considered Left (D-Pad, Sticks)
HidNpadButton_AnyUp = HidNpadButton_Up | HidNpadButton_StickLUp | HidNpadButton_StickRUp, ///< Bitmask containing all buttons that are considered Up (D-Pad, Sticks)
HidNpadButton_AnyRight = HidNpadButton_Right | HidNpadButton_StickLRight | HidNpadButton_StickRRight, ///< Bitmask containing all buttons that are considered Right (D-Pad, Sticks)
HidNpadButton_AnyDown = HidNpadButton_Down | HidNpadButton_StickLDown | HidNpadButton_StickRDown, ///< Bitmask containing all buttons that are considered Down (D-Pad, Sticks)
HidNpadButton_AnySL = HidNpadButton_LeftSL | HidNpadButton_RightSL, ///< Bitmask containing SL buttons on both Joy-Cons (Left/Right)
HidNpadButton_AnySR = HidNpadButton_LeftSR | HidNpadButton_RightSR, ///< Bitmask containing SR buttons on both Joy-Cons (Left/Right)
} HidNpadButton;
/// HidControllerKeys /// HidControllerKeys
typedef enum { typedef enum {
KEY_A = BIT(0), ///< A KEY_A = HidNpadButton_A,
KEY_B = BIT(1), ///< B KEY_B = HidNpadButton_B,
KEY_X = BIT(2), ///< X KEY_X = HidNpadButton_X,
KEY_Y = BIT(3), ///< Y KEY_Y = HidNpadButton_Y,
KEY_LSTICK = BIT(4), ///< Left Stick Button KEY_LSTICK = HidNpadButton_StickL,
KEY_RSTICK = BIT(5), ///< Right Stick Button KEY_RSTICK = HidNpadButton_StickR,
KEY_L = BIT(6), ///< L KEY_L = HidNpadButton_L,
KEY_R = BIT(7), ///< R KEY_R = HidNpadButton_R,
KEY_ZL = BIT(8), ///< ZL KEY_ZL = HidNpadButton_ZL,
KEY_ZR = BIT(9), ///< ZR KEY_ZR = HidNpadButton_ZR,
KEY_PLUS = BIT(10), ///< Plus KEY_PLUS = HidNpadButton_Plus,
KEY_MINUS = BIT(11), ///< Minus KEY_MINUS = HidNpadButton_Minus,
KEY_DLEFT = BIT(12), ///< D-Pad Left KEY_DLEFT = HidNpadButton_Left,
KEY_DUP = BIT(13), ///< D-Pad Up KEY_DUP = HidNpadButton_Up,
KEY_DRIGHT = BIT(14), ///< D-Pad Right KEY_DRIGHT = HidNpadButton_Right,
KEY_DDOWN = BIT(15), ///< D-Pad Down KEY_DDOWN = HidNpadButton_Down,
KEY_LSTICK_LEFT = BIT(16), ///< Left Stick Left KEY_LSTICK_LEFT = HidNpadButton_StickLLeft,
KEY_LSTICK_UP = BIT(17), ///< Left Stick Up KEY_LSTICK_UP = HidNpadButton_StickLUp,
KEY_LSTICK_RIGHT = BIT(18), ///< Left Stick Right KEY_LSTICK_RIGHT = HidNpadButton_StickLRight,
KEY_LSTICK_DOWN = BIT(19), ///< Left Stick Down KEY_LSTICK_DOWN = HidNpadButton_StickLDown,
KEY_RSTICK_LEFT = BIT(20), ///< Right Stick Left KEY_RSTICK_LEFT = HidNpadButton_StickRLeft,
KEY_RSTICK_UP = BIT(21), ///< Right Stick Up KEY_RSTICK_UP = HidNpadButton_StickRUp,
KEY_RSTICK_RIGHT = BIT(22), ///< Right Stick Right KEY_RSTICK_RIGHT = HidNpadButton_StickRRight,
KEY_RSTICK_DOWN = BIT(23), ///< Right Stick Down KEY_RSTICK_DOWN = HidNpadButton_StickRDown,
KEY_SL_LEFT = BIT(24), ///< SL on Left Joy-Con KEY_SL_LEFT = HidNpadButton_LeftSL,
KEY_SR_LEFT = BIT(25), ///< SR on Left Joy-Con KEY_SR_LEFT = HidNpadButton_LeftSR,
KEY_SL_RIGHT = BIT(26), ///< SL on Right Joy-Con KEY_SL_RIGHT = HidNpadButton_RightSL,
KEY_SR_RIGHT = BIT(27), ///< SR on Right Joy-Con KEY_SR_RIGHT = HidNpadButton_RightSR,
KEY_NES_HANDHELD_LEFT_B = HidNpadButton_HandheldLeftB,
KEY_HOME = BIT(18), ///< HOME button, only available for use with HiddbgHdlsState::buttons. KEY_HOME = BIT(18), ///< HOME button, only available for use with HiddbgHdlsState::buttons.
KEY_CAPTURE = BIT(19), ///< Capture button, only available for use with HiddbgHdlsState::buttons. KEY_CAPTURE = BIT(19), ///< Capture button, only available for use with HiddbgHdlsState::buttons.
KEY_TOUCH = BIT(28), ///< Pseudo-key for at least one finger on the touch screen
// Pseudo-key for at least one finger on the touch screen KEY_JOYCON_RIGHT = HidNpadButton_A,
KEY_TOUCH = BIT(28), KEY_JOYCON_DOWN = HidNpadButton_B,
KEY_JOYCON_UP = HidNpadButton_X,
KEY_JOYCON_LEFT = HidNpadButton_Y,
KEY_NES_HANDHELD_LEFT_B = BIT(30), ///< Left B button on NES controllers in Handheld mode. KEY_UP = HidNpadButton_AnyUp,
KEY_DOWN = HidNpadButton_AnyDown,
// Buttons by orientation (for single Joy-Con), also works with Joy-Con pairs, Pro Controller KEY_LEFT = HidNpadButton_AnyLeft,
KEY_JOYCON_RIGHT = BIT(0), KEY_RIGHT = HidNpadButton_AnyRight,
KEY_JOYCON_DOWN = BIT(1), KEY_SL = HidNpadButton_AnySL,
KEY_JOYCON_UP = BIT(2), KEY_SR = HidNpadButton_AnySR,
KEY_JOYCON_LEFT = BIT(3),
// Generic catch-all directions, also works for single Joy-Con
KEY_UP = KEY_DUP | KEY_LSTICK_UP | KEY_RSTICK_UP, ///< D-Pad Up or Sticks Up
KEY_DOWN = KEY_DDOWN | KEY_LSTICK_DOWN | KEY_RSTICK_DOWN, ///< D-Pad Down or Sticks Down
KEY_LEFT = KEY_DLEFT | KEY_LSTICK_LEFT | KEY_RSTICK_LEFT, ///< D-Pad Left or Sticks Left
KEY_RIGHT = KEY_DRIGHT | KEY_LSTICK_RIGHT | KEY_RSTICK_RIGHT, ///< D-Pad Right or Sticks Right
KEY_SL = KEY_SL_LEFT | KEY_SL_RIGHT, ///< SL on Left or Right Joy-Con
KEY_SR = KEY_SR_LEFT | KEY_SR_RIGHT, ///< SR on Left or Right Joy-Con
} HidControllerKeys; } HidControllerKeys;
/// HidControllerJoystick /// HidControllerJoystick