mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-22 13:02:38 +02:00
hid: Updated/added structs/enums.
This commit is contained in:
parent
902af6cce0
commit
d28776e4d9
@ -245,10 +245,12 @@ typedef enum {
|
|||||||
HidNpadStyleTag_NpadSystem = BIT(30), ///< Generic controller
|
HidNpadStyleTag_NpadSystem = BIT(30), ///< Generic controller
|
||||||
} HidNpadStyleTag;
|
} HidNpadStyleTag;
|
||||||
|
|
||||||
/// HidControllerColorDescription
|
/// HidColorAttribute
|
||||||
typedef enum {
|
typedef enum {
|
||||||
COLORS_NONEXISTENT = BIT(1),
|
HidColorAttribute_Ok = 0, ///< Ok
|
||||||
} HidControllerColorDescription;
|
HidColorAttribute_ReadError = 1, ///< ReadError
|
||||||
|
HidColorAttribute_NoController = 2, ///< NoController
|
||||||
|
} HidColorAttribute;
|
||||||
|
|
||||||
/// HidControllerKeys
|
/// HidControllerKeys
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -312,11 +314,62 @@ typedef enum {
|
|||||||
JOYSTICK_NUM_STICKS = 2,
|
JOYSTICK_NUM_STICKS = 2,
|
||||||
} HidControllerJoystick;
|
} HidControllerJoystick;
|
||||||
|
|
||||||
/// HidControllerConnectionState
|
/// HidTouchAttribute
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CONTROLLER_STATE_CONNECTED = BIT(0),
|
HidTouchAttribute_Start = BIT(0), ///< Start
|
||||||
CONTROLLER_STATE_WIRED = BIT(1),
|
HidTouchAttribute_End = BIT(1), ///< End
|
||||||
} HidControllerConnectionState;
|
} HidTouchAttribute;
|
||||||
|
|
||||||
|
/// HidMouseAttribute
|
||||||
|
typedef enum {
|
||||||
|
HidMouseAttribute_Transferable = BIT(0), ///< Transferable
|
||||||
|
HidMouseAttribute_IsConnected = BIT(1), ///< IsConnected
|
||||||
|
} HidMouseAttribute;
|
||||||
|
|
||||||
|
/// HidNpadAttribute
|
||||||
|
typedef enum {
|
||||||
|
NpadAttribute_IsConnected = BIT(0), ///< IsConnected
|
||||||
|
NpadAttribute_IsWired = BIT(1), ///< IsWired
|
||||||
|
NpadAttribute_IsLeftConnected = BIT(2), ///< IsLeftConnected
|
||||||
|
NpadAttribute_IsLeftWired = BIT(3), ///< IsLeftWired
|
||||||
|
NpadAttribute_IsRightConnected = BIT(4), ///< IsRightConnected
|
||||||
|
NpadAttribute_IsRightWired = BIT(5), ///< IsRightWired
|
||||||
|
} HidNpadAttribute;
|
||||||
|
|
||||||
|
/// HidSixAxisSensorAttribute
|
||||||
|
typedef enum {
|
||||||
|
HidSixAxisSensorAttribute_IsConnected = BIT(0), ///< IsConnected
|
||||||
|
HidSixAxisSensorAttribute_IsInterpolated = BIT(1), ///< IsInterpolated
|
||||||
|
} HidSixAxisSensorAttribute;
|
||||||
|
|
||||||
|
/// HidGestureAttribute
|
||||||
|
typedef enum {
|
||||||
|
HidGestureAttribute_IsNewTouch = BIT(0), ///< IsNewTouch
|
||||||
|
HidGestureAttribute_IsDoubleTap = BIT(1), ///< IsDoubleTap
|
||||||
|
} HidGestureAttribute;
|
||||||
|
|
||||||
|
/// HidGestureDirection
|
||||||
|
typedef enum {
|
||||||
|
HidGestureDirection_None = 0, ///< None
|
||||||
|
HidGestureDirection_Left = 1, ///< Left
|
||||||
|
HidGestureDirection_Up = 2, ///< Up
|
||||||
|
HidGestureDirection_Right = 3, ///< Right
|
||||||
|
HidGestureDirection_Down = 4, ///< Down
|
||||||
|
} HidGestureDirection;
|
||||||
|
|
||||||
|
/// HidGestureType
|
||||||
|
typedef enum {
|
||||||
|
HidGestureType_Idle = 0, ///< Idle
|
||||||
|
HidGestureType_Complete = 1, ///< Complete
|
||||||
|
HidGestureType_Cancel = 2, ///< Cancel
|
||||||
|
HidGestureType_Touch = 3, ///< Touch
|
||||||
|
HidGestureType_Press = 4, ///< Press
|
||||||
|
HidGestureType_Tap = 5, ///< Tap
|
||||||
|
HidGestureType_Pan = 6, ///< Pan
|
||||||
|
HidGestureType_Swipe = 7, ///< Swipe
|
||||||
|
HidGestureType_Pinch = 8, ///< Pinch
|
||||||
|
HidGestureType_Rotate = 9, ///< Rotate
|
||||||
|
} HidGestureType;
|
||||||
|
|
||||||
/// HidControllerID
|
/// HidControllerID
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -389,6 +442,31 @@ typedef enum {
|
|||||||
HidDeviceType_System21 = 21, ///< ::HidDeviceTypeBits_System with \ref HidNpadStyleTag |= ::HidNpadStyleTag_NpadJoyDual.
|
HidDeviceType_System21 = 21, ///< ::HidDeviceTypeBits_System with \ref HidNpadStyleTag |= ::HidNpadStyleTag_NpadJoyDual.
|
||||||
} HidDeviceType;
|
} HidDeviceType;
|
||||||
|
|
||||||
|
/// AppletFooterUiType
|
||||||
|
typedef enum {
|
||||||
|
HidAppletFooterUiType_None = 0, ///< None
|
||||||
|
HidAppletFooterUiType_HandheldNone = 1, ///< HandheldNone
|
||||||
|
HidAppletFooterUiType_HandheldJoyConLeftOnly = 2, ///< HandheldJoyConLeftOnly
|
||||||
|
HidAppletFooterUiType_HandheldJoyConRightOnly = 3, ///< HandheldJoyConRightOnly
|
||||||
|
HidAppletFooterUiType_HandheldJoyConLeftJoyConRight = 4, ///< HandheldJoyConLeftJoyConRight
|
||||||
|
HidAppletFooterUiType_JoyDual = 5, ///< JoyDual
|
||||||
|
HidAppletFooterUiType_JoyDualLeftOnly = 6, ///< JoyDualLeftOnly
|
||||||
|
HidAppletFooterUiType_JoyDualRightOnly = 7, ///< JoyDualRightOnly
|
||||||
|
HidAppletFooterUiType_JoyLeftHorizontal = 8, ///< JoyLeftHorizontal
|
||||||
|
HidAppletFooterUiType_JoyLeftVertical = 9, ///< JoyLeftVertical
|
||||||
|
HidAppletFooterUiType_JoyRightHorizontal = 10, ///< JoyRightHorizontal
|
||||||
|
HidAppletFooterUiType_JoyRightVertical = 11, ///< JoyRightVertical
|
||||||
|
HidAppletFooterUiType_SwitchProController = 12, ///< SwitchProController
|
||||||
|
HidAppletFooterUiType_CompatibleProController = 13, ///< CompatibleProController
|
||||||
|
HidAppletFooterUiType_CompatibleJoyCon = 14, ///< CompatibleJoyCon
|
||||||
|
HidAppletFooterUiType_LarkHvc1 = 15, ///< LarkHvc1
|
||||||
|
HidAppletFooterUiType_LarkHvc2 = 16, ///< LarkHvc2
|
||||||
|
HidAppletFooterUiType_LarkNesLeft = 17, ///< LarkNesLeft
|
||||||
|
HidAppletFooterUiType_LarkNesRight = 18, ///< LarkNesRight
|
||||||
|
HidAppletFooterUiType_Lucia = 19, ///< Lucia
|
||||||
|
HidAppletFooterUiType_Verification = 20 , ///< Verification
|
||||||
|
} HidAppletFooterUiType;
|
||||||
|
|
||||||
/// NpadInterfaceType
|
/// NpadInterfaceType
|
||||||
typedef enum {
|
typedef enum {
|
||||||
HidNpadInterfaceType_Bluetooth = 1, ///< Bluetooth.
|
HidNpadInterfaceType_Bluetooth = 1, ///< Bluetooth.
|
||||||
@ -405,6 +483,23 @@ typedef enum {
|
|||||||
XcdInterfaceType_FieldSet = BIT(7),
|
XcdInterfaceType_FieldSet = BIT(7),
|
||||||
} XcdInterfaceType;
|
} XcdInterfaceType;
|
||||||
|
|
||||||
|
/// NpadLarkType
|
||||||
|
typedef enum {
|
||||||
|
HidNpadLarkType_Invalid = 0, ///< Invalid
|
||||||
|
HidNpadLarkType_H1 = 1, ///< H1
|
||||||
|
HidNpadLarkType_H2 = 2, ///< H2
|
||||||
|
HidNpadLarkType_NL = 3, ///< NL
|
||||||
|
HidNpadLarkType_NR = 4, ///< NR
|
||||||
|
} HidNpadLarkType;
|
||||||
|
|
||||||
|
/// NpadLuciaType
|
||||||
|
typedef enum {
|
||||||
|
HidNpadLuciaType_Invalid = 0, ///< Invalid
|
||||||
|
HidNpadLuciaType_J = 1, ///< J
|
||||||
|
HidNpadLuciaType_E = 2, ///< E
|
||||||
|
HidNpadLuciaType_U = 3, ///< U
|
||||||
|
} HidNpadLuciaType;
|
||||||
|
|
||||||
/// touchPosition
|
/// touchPosition
|
||||||
typedef struct touchPosition {
|
typedef struct touchPosition {
|
||||||
u32 id;
|
u32 id;
|
||||||
@ -453,45 +548,45 @@ typedef struct SixAxisSensorValues {
|
|||||||
|
|
||||||
/// HidCommonLifoHeader
|
/// HidCommonLifoHeader
|
||||||
typedef struct HidCommonLifoHeader {
|
typedef struct HidCommonLifoHeader {
|
||||||
u64 sampling_number;
|
u64 sampling_number; ///< SamplingNumber
|
||||||
u64 buffer_count;
|
u64 buffer_count; ///< BufferCount
|
||||||
u64 tail;
|
u64 tail; ///< Tail
|
||||||
u64 count;
|
u64 count; ///< Count
|
||||||
} HidCommonLifoHeader;
|
} HidCommonLifoHeader;
|
||||||
|
|
||||||
// Begin HidTouchScreen
|
// Begin HidTouchScreen
|
||||||
|
|
||||||
/// HidTouchState
|
/// HidTouchState
|
||||||
typedef struct HidTouchState {
|
typedef struct HidTouchState {
|
||||||
u64 delta_time;
|
u64 delta_time; ///< DeltaTime
|
||||||
u32 attributes;
|
u32 attributes; ///< Bitfield of \ref HidTouchAttribute.
|
||||||
u32 finger_id;
|
u32 finger_id; ///< FingerId
|
||||||
u32 x;
|
u32 x; ///< X
|
||||||
u32 y;
|
u32 y; ///< Y
|
||||||
u32 diameter_x;
|
u32 diameter_x; ///< DiameterX
|
||||||
u32 diameter_y;
|
u32 diameter_y; ///< DiameterY
|
||||||
u32 rotation_angle;
|
u32 rotation_angle; ///< RotationAngle
|
||||||
u32 reserved;
|
u32 reserved; ///< Reserved
|
||||||
} HidTouchState;
|
} HidTouchState;
|
||||||
|
|
||||||
/// HidTouchScreenState
|
/// HidTouchScreenState
|
||||||
typedef struct HidTouchScreenState {
|
typedef struct HidTouchScreenState {
|
||||||
u64 sampling_number;
|
u64 sampling_number; ///< SamplingNumber
|
||||||
s32 count;
|
s32 count; ///< Number of entries in the touches array.
|
||||||
u32 reserved;
|
u32 reserved; ///< Reserved
|
||||||
HidTouchState touches[16];
|
HidTouchState touches[16]; ///< Array of \ref HidTouchState, with the above count.
|
||||||
} HidTouchScreenState;
|
} HidTouchScreenState;
|
||||||
|
|
||||||
/// HidTouchScreenStateAtomicStorage
|
/// HidTouchScreenStateAtomicStorage
|
||||||
typedef struct HidTouchScreenStateAtomicStorage {
|
typedef struct HidTouchScreenStateAtomicStorage {
|
||||||
u64 sampling_number;
|
u64 sampling_number; ///< SamplingNumber
|
||||||
HidTouchScreenState state;
|
HidTouchScreenState state; ///< \ref HidTouchScreenState
|
||||||
} HidTouchScreenStateAtomicStorage;
|
} HidTouchScreenStateAtomicStorage;
|
||||||
|
|
||||||
/// HidTouchScreenLifo
|
/// HidTouchScreenLifo
|
||||||
typedef struct HidTouchScreenLifo {
|
typedef struct HidTouchScreenLifo {
|
||||||
HidCommonLifoHeader header;
|
HidCommonLifoHeader header; ///< \ref HidCommonLifoHeader
|
||||||
HidTouchScreenStateAtomicStorage storage[17];
|
HidTouchScreenStateAtomicStorage storage[17]; ///< \ref HidTouchScreenStateAtomicStorage
|
||||||
} HidTouchScreenLifo;
|
} HidTouchScreenLifo;
|
||||||
|
|
||||||
/// HidTouchScreenSharedMemoryFormat
|
/// HidTouchScreenSharedMemoryFormat
|
||||||
@ -506,15 +601,15 @@ typedef struct HidTouchScreenSharedMemoryFormat {
|
|||||||
|
|
||||||
/// HidMouseState
|
/// HidMouseState
|
||||||
typedef struct HidMouseState {
|
typedef struct HidMouseState {
|
||||||
u64 sampling_number;
|
u64 sampling_number; ///< SamplingNumber
|
||||||
MousePosition position;
|
MousePosition position; ///< \ref MousePosition
|
||||||
u32 buttons;
|
u32 buttons; ///< Bitfield of \ref HidMouseButton.
|
||||||
u32 attributes;
|
u32 attributes; ///< Bitfield of \ref HidMouseAttribute.
|
||||||
} HidMouseState;
|
} HidMouseState;
|
||||||
|
|
||||||
/// HidMouseStateAtomicStorage
|
/// HidMouseStateAtomicStorage
|
||||||
typedef struct HidMouseStateAtomicStorage {
|
typedef struct HidMouseStateAtomicStorage {
|
||||||
u64 sampling_number;
|
u64 sampling_number; ///< SamplingNumber
|
||||||
HidMouseState state;
|
HidMouseState state;
|
||||||
} HidMouseStateAtomicStorage;
|
} HidMouseStateAtomicStorage;
|
||||||
|
|
||||||
@ -536,14 +631,14 @@ typedef struct HidMouseSharedMemoryFormat {
|
|||||||
|
|
||||||
/// HidKeyboardState
|
/// HidKeyboardState
|
||||||
typedef struct HidKeyboardState {
|
typedef struct HidKeyboardState {
|
||||||
u64 sampling_number;
|
u64 sampling_number; ///< SamplingNumber
|
||||||
u64 modifier;
|
u64 modifiers; ///< Bitfield of \ref HidKeyboardModifier.
|
||||||
u32 keys[8];
|
u64 keys[4];
|
||||||
} HidKeyboardState;
|
} HidKeyboardState;
|
||||||
|
|
||||||
/// HidKeyboardStateAtomicStorage
|
/// HidKeyboardStateAtomicStorage
|
||||||
typedef struct HidKeyboardStateAtomicStorage {
|
typedef struct HidKeyboardStateAtomicStorage {
|
||||||
u64 sampling_number;
|
u64 sampling_number; ///< SamplingNumber
|
||||||
HidKeyboardState state;
|
HidKeyboardState state;
|
||||||
} HidKeyboardStateAtomicStorage;
|
} HidKeyboardStateAtomicStorage;
|
||||||
|
|
||||||
@ -566,27 +661,29 @@ typedef struct HidKeyboardSharedMemoryFormat {
|
|||||||
/// Npad colors.
|
/// Npad colors.
|
||||||
/// Color fields are zero when not set.
|
/// Color fields are zero when not set.
|
||||||
typedef struct HidNpadControllerColor {
|
typedef struct HidNpadControllerColor {
|
||||||
u32 color_body; ///< RGBA Body Color
|
u32 main; ///< RGBA Body Color
|
||||||
u32 color_buttons; ///< RGBA Buttons Color
|
u32 sub; ///< RGBA Buttons Color
|
||||||
} HidNpadControllerColor;
|
} HidNpadControllerColor;
|
||||||
|
|
||||||
/// HidNpadStateHeader
|
/// HidNpadFullKeyColorState
|
||||||
typedef struct HidNpadStateHeader {
|
typedef struct HidNpadFullKeyColorState {
|
||||||
u32 style_set;
|
u32 attribute; ///< \ref HidColorAttribute
|
||||||
u32 npad_joy_assignment_mode;
|
HidNpadControllerColor full_key; ///< \ref HidNpadControllerColor FullKey
|
||||||
u32 single_colors_descriptor;
|
} HidNpadFullKeyColorState;
|
||||||
HidNpadControllerColor single_colors;
|
|
||||||
u32 split_colors_descriptor;
|
/// HidNpadJoyColorState
|
||||||
HidNpadControllerColor left_colors;
|
typedef struct HidNpadJoyColorState {
|
||||||
HidNpadControllerColor right_colors;
|
u32 attribute; ///< \ref HidColorAttribute
|
||||||
} HidNpadStateHeader;
|
HidNpadControllerColor left; ///< \ref HidNpadControllerColor Left
|
||||||
|
HidNpadControllerColor right; ///< \ref HidNpadControllerColor Right
|
||||||
|
} HidNpadJoyColorState;
|
||||||
|
|
||||||
/// HidNpadCommonState
|
/// HidNpadCommonState
|
||||||
typedef struct HidNpadCommonState {
|
typedef struct HidNpadCommonState {
|
||||||
u64 sampling_number;
|
u64 sampling_number; ///< SamplingNumber
|
||||||
u64 buttons;
|
u64 buttons; ///< Bitfield of \ref HidControllerKeys.
|
||||||
JoystickPosition joysticks[JOYSTICK_NUM_STICKS];
|
JoystickPosition joysticks[JOYSTICK_NUM_STICKS];
|
||||||
u32 attributes;
|
u32 attributes; ///< Bitfield of \ref HidNpadAttribute.
|
||||||
u32 reserved;
|
u32 reserved;
|
||||||
} HidNpadCommonState;
|
} HidNpadCommonState;
|
||||||
|
|
||||||
@ -598,12 +695,12 @@ typedef HidNpadCommonState HidNpadJoyRightState;
|
|||||||
|
|
||||||
/// HidNpadGcState
|
/// HidNpadGcState
|
||||||
typedef struct HidNpadGcState {
|
typedef struct HidNpadGcState {
|
||||||
u64 sampling_number;
|
u64 sampling_number; ///< SamplingNumber
|
||||||
u64 buttons;
|
u64 buttons; ///< Bitfield of \ref HidControllerKeys.
|
||||||
JoystickPosition joysticks[JOYSTICK_NUM_STICKS];
|
JoystickPosition joysticks[JOYSTICK_NUM_STICKS];
|
||||||
u32 attributes;
|
u32 attributes; ///< Bitfield of \ref HidNpadAttribute.
|
||||||
u32 l_trigger; ///< L analog trigger. Valid range: 0x0-0x7FFF.
|
u32 trigger_l; ///< L analog trigger. Valid range: 0x0-0x7FFF.
|
||||||
u32 r_trigger; ///< R analog trigger. Valid range: 0x0-0x7FFF.
|
u32 trigger_r; ///< R analog trigger. Valid range: 0x0-0x7FFF.
|
||||||
u32 pad;
|
u32 pad;
|
||||||
} HidNpadGcState;
|
} HidNpadGcState;
|
||||||
|
|
||||||
@ -611,31 +708,31 @@ typedef HidNpadCommonState HidNpadPalmaState;
|
|||||||
|
|
||||||
/// HidNpadLarkState
|
/// HidNpadLarkState
|
||||||
typedef struct HidNpadLarkState {
|
typedef struct HidNpadLarkState {
|
||||||
u64 sampling_number;
|
u64 sampling_number; ///< SamplingNumber
|
||||||
u64 buttons;
|
u64 buttons; ///< Bitfield of \ref HidControllerKeys.
|
||||||
JoystickPosition joysticks[JOYSTICK_NUM_STICKS]; ///< Joysticks state are always zero.
|
JoystickPosition joysticks[JOYSTICK_NUM_STICKS]; ///< Joysticks state are always zero.
|
||||||
u32 attributes;
|
u32 attributes; ///< Bitfield of \ref HidNpadAttribute.
|
||||||
u32 lark_type_l_and_main; ///< LarkTypeLAndMain
|
HidNpadLarkType lark_type_l_and_main; ///< \ref HidNpadLarkType LarkTypeLAndMain
|
||||||
} HidNpadLarkState;
|
} HidNpadLarkState;
|
||||||
|
|
||||||
/// HidNpadHandheldLarkState
|
/// HidNpadHandheldLarkState
|
||||||
typedef struct HidNpadHandheldLarkState {
|
typedef struct HidNpadHandheldLarkState {
|
||||||
u64 sampling_number;
|
u64 sampling_number; ///< SamplingNumber
|
||||||
u64 buttons;
|
u64 buttons; ///< Bitfield of \ref HidControllerKeys.
|
||||||
JoystickPosition joysticks[JOYSTICK_NUM_STICKS];
|
JoystickPosition joysticks[JOYSTICK_NUM_STICKS];
|
||||||
u32 attributes;
|
u32 attributes; ///< Bitfield of \ref HidNpadAttribute.
|
||||||
u32 lark_type_l_and_main; ///< LarkTypeLAndMain
|
HidNpadLarkType lark_type_l_and_main; ///< \ref HidNpadLarkType LarkTypeLAndMain
|
||||||
u32 lark_type_r; ///< LarkTypeR
|
u32 lark_type_r; ///< \ref HidNpadLarkType LarkTypeR
|
||||||
u32 pad;
|
u32 pad;
|
||||||
} HidNpadHandheldLarkState;
|
} HidNpadHandheldLarkState;
|
||||||
|
|
||||||
/// HidNpadLuciaState
|
/// HidNpadLuciaState
|
||||||
typedef struct HidNpadLuciaState {
|
typedef struct HidNpadLuciaState {
|
||||||
u64 sampling_number;
|
u64 sampling_number; ///< SamplingNumber
|
||||||
u64 buttons;
|
u64 buttons; ///< Bitfield of \ref HidControllerKeys.
|
||||||
JoystickPosition joysticks[JOYSTICK_NUM_STICKS]; ///< Joysticks state are always zero.
|
JoystickPosition joysticks[JOYSTICK_NUM_STICKS]; ///< Joysticks state are always zero.
|
||||||
u32 attributes;
|
u32 attributes; ///< Bitfield of \ref HidNpadAttribute.
|
||||||
u32 lucia_type; ///< LuciaType
|
HidNpadLuciaType lucia_type; ///< \ref HidNpadLuciaType
|
||||||
} HidNpadLuciaState;
|
} HidNpadLuciaState;
|
||||||
|
|
||||||
typedef HidNpadCommonState HidNpadSystemExtState;
|
typedef HidNpadCommonState HidNpadSystemExtState;
|
||||||
@ -643,7 +740,7 @@ typedef HidNpadCommonState HidNpadSystemState; ///< Joysticks state are always z
|
|||||||
|
|
||||||
/// HidNpadCommonStateAtomicStorage
|
/// HidNpadCommonStateAtomicStorage
|
||||||
typedef struct HidNpadCommonStateAtomicStorage {
|
typedef struct HidNpadCommonStateAtomicStorage {
|
||||||
u64 sampling_number;
|
u64 sampling_number; ///< SamplingNumber
|
||||||
HidNpadCommonState state;
|
HidNpadCommonState state;
|
||||||
} HidNpadCommonStateAtomicStorage;
|
} HidNpadCommonStateAtomicStorage;
|
||||||
|
|
||||||
@ -655,14 +752,14 @@ typedef struct HidNpadCommonLifo {
|
|||||||
|
|
||||||
/// HidNpadGcTriggerState
|
/// HidNpadGcTriggerState
|
||||||
typedef struct HidNpadGcTriggerState {
|
typedef struct HidNpadGcTriggerState {
|
||||||
u64 sampling_number;
|
u64 sampling_number; ///< SamplingNumber
|
||||||
u32 l_trigger;
|
u32 trigger_l;
|
||||||
u32 r_trigger;
|
u32 trigger_r;
|
||||||
} HidNpadGcTriggerState;
|
} HidNpadGcTriggerState;
|
||||||
|
|
||||||
/// HidNpadGcTriggerStateAtomicStorage
|
/// HidNpadGcTriggerStateAtomicStorage
|
||||||
typedef struct HidNpadGcTriggerStateAtomicStorage {
|
typedef struct HidNpadGcTriggerStateAtomicStorage {
|
||||||
u64 sampling_number;
|
u64 sampling_number; ///< SamplingNumber
|
||||||
HidNpadGcTriggerState state;
|
HidNpadGcTriggerState state;
|
||||||
} HidNpadGcTriggerStateAtomicStorage;
|
} HidNpadGcTriggerStateAtomicStorage;
|
||||||
|
|
||||||
@ -674,16 +771,16 @@ typedef struct HidNpadGcTriggerLifo {
|
|||||||
|
|
||||||
/// HidSixAxisSensorState
|
/// HidSixAxisSensorState
|
||||||
typedef struct HidSixAxisSensorState {
|
typedef struct HidSixAxisSensorState {
|
||||||
u64 delta_time;
|
u64 delta_time; ///< DeltaTime
|
||||||
u64 sampling_number;
|
u64 sampling_number; ///< SamplingNumber
|
||||||
SixAxisSensorValues values;
|
SixAxisSensorValues values;
|
||||||
u32 attributes;
|
u32 attributes; ///< Bitfield of \ref HidSixAxisSensorAttribute.
|
||||||
u32 reserved;
|
u32 reserved; ///< Reserved
|
||||||
} HidSixAxisSensorState;
|
} HidSixAxisSensorState;
|
||||||
|
|
||||||
/// HidSixAxisSensorStateAtomicStorage
|
/// HidSixAxisSensorStateAtomicStorage
|
||||||
typedef struct HidSixAxisSensorStateAtomicStorage {
|
typedef struct HidSixAxisSensorStateAtomicStorage {
|
||||||
u64 sampling_number;
|
u64 sampling_number; ///< SamplingNumber
|
||||||
HidSixAxisSensorState state;
|
HidSixAxisSensorState state;
|
||||||
} HidSixAxisSensorStateAtomicStorage;
|
} HidSixAxisSensorStateAtomicStorage;
|
||||||
|
|
||||||
@ -695,79 +792,86 @@ typedef struct HidNpadSixAxisSensorLifo {
|
|||||||
|
|
||||||
/// NpadSystemProperties
|
/// NpadSystemProperties
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u32 powerInfo : 6; ///< Use \ref hidGetNpadPowerInfo instead of accessing this directly.
|
u64 powerInfo : 6; ///< Use \ref hidGetNpadPowerInfo instead of accessing this directly.
|
||||||
|
|
||||||
u32 bit6 : 1; ///< Unused
|
u64 bit6 : 1; ///< Unused
|
||||||
u32 bit7 : 1; ///< Unused
|
u64 bit7 : 1; ///< Unused
|
||||||
u32 bit8 : 1; ///< Unused
|
u64 bit8 : 1; ///< Unused
|
||||||
u32 unsupportedButtonPressed_NpadSystem : 1; ///< Unsupported button pressed with controller NpadSystem.
|
u64 is_unsuported_button_pressed_on_npad_system : 1; ///< IsUnsuportedButtonPressedOnNpadSystem
|
||||||
u32 unsupportedButtonPressed_NpadSystemExt : 1; ///< Unsupported button pressed with controller NpadSystemExt.
|
u64 is_unsuported_button_pressed_on_npad_system_ext : 1; ///< IsUnsuportedButtonPressedOnNpadSystemExt
|
||||||
|
|
||||||
u32 abxyButtonOriented : 1;
|
u64 is_abxy_button_oriented : 1; ///< IsAbxyButtonOriented
|
||||||
u32 slSrButtonOriented : 1;
|
u64 is_sl_sr_button_oriented : 1; ///< IsSlSrButtonOriented
|
||||||
u32 plusButtonCapability : 1; ///< [4.0.0+]
|
u64 is_plus_available : 1; ///< [4.0.0+] IsPlusAvailable
|
||||||
u32 minusButtonCapability : 1; ///< [4.0.0+]
|
u64 is_minus_available : 1; ///< [4.0.0+] IsMinusAvailable
|
||||||
u32 directionalButtonsSupported : 1; ///< [8.0.0+]
|
u64 is_directional_buttons_available : 1; ///< [8.0.0+] IsDirectionalButtonsAvailable
|
||||||
|
|
||||||
u32 unused;
|
u64 unused : 48; ///< Unused
|
||||||
} HidNpadSystemProperties;
|
} HidNpadSystemProperties;
|
||||||
|
|
||||||
/// NpadSystemButtonProperties
|
/// NpadSystemButtonProperties
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u32 unintendedHomeButtonInputProtectionDisabled : 1;
|
u32 is_unintended_home_button_input_protection_enabled : 1; ///< IsUnintendedHomeButtonInputProtectionEnabled
|
||||||
} HidNpadSystemButtonProperties;
|
} HidNpadSystemButtonProperties;
|
||||||
|
|
||||||
/// HidPowerInfo
|
/// HidPowerInfo
|
||||||
typedef struct {
|
typedef struct {
|
||||||
bool powerConnected;
|
bool is_powered; ///< IsPowered
|
||||||
bool isCharging;
|
bool is_charging; ///< IsCharging
|
||||||
u32 batteryCharge; ///< Battery charge, always 0-4.
|
u8 reserved[6]; ///< Reserved
|
||||||
|
u32 battery_level; ///< BatteryLevel, always 0-4.
|
||||||
} HidPowerInfo;
|
} HidPowerInfo;
|
||||||
|
|
||||||
/// HidNfcXcdDeviceHandleState
|
/// HidNfcXcdDeviceHandleStateImpl
|
||||||
typedef struct HidNfcXcdDeviceHandleState {
|
typedef struct HidNfcXcdDeviceHandleStateImpl {
|
||||||
u64 handle;
|
u64 handle;
|
||||||
u8 is_available;
|
u8 is_available;
|
||||||
u8 is_activated;
|
u8 is_activated;
|
||||||
u8 reserved[6];
|
u8 reserved[6];
|
||||||
u64 sampling_number;
|
u64 sampling_number; ///< SamplingNumber
|
||||||
} HidNfcXcdDeviceHandleState;
|
} HidNfcXcdDeviceHandleStateImpl;
|
||||||
|
|
||||||
/// HidNfcXcdDeviceHandleStateEntry
|
/// HidNfcXcdDeviceHandleStateImplAtomicStorage
|
||||||
typedef struct HidNfcXcdDeviceHandleStateEntry {
|
typedef struct HidNfcXcdDeviceHandleStateImplAtomicStorage {
|
||||||
u64 sampling_number;
|
u64 sampling_number; ///< SamplingNumber
|
||||||
HidNfcXcdDeviceHandleState state;
|
HidNfcXcdDeviceHandleStateImpl state; ///< \ref HidNfcXcdDeviceHandleStateImpl
|
||||||
} HidNfcXcdDeviceHandleStateEntry;
|
} HidNfcXcdDeviceHandleStateImplAtomicStorage;
|
||||||
|
|
||||||
|
/// HidNfcXcdDeviceHandleState
|
||||||
|
typedef struct HidNfcXcdDeviceHandleState {
|
||||||
|
HidCommonLifoHeader header;
|
||||||
|
HidNfcXcdDeviceHandleStateImplAtomicStorage storage[2];
|
||||||
|
} HidNfcXcdDeviceHandleState;
|
||||||
|
|
||||||
/// HidNpad
|
/// HidNpad
|
||||||
typedef struct HidNpad {
|
typedef struct HidNpad {
|
||||||
HidNpadStateHeader header;
|
u32 style_set; ///< Bitfield of \ref HidNpadStyleTag.
|
||||||
|
u32 joy_assignment_mode; ///< \ref HidNpadJoyAssignmentMode
|
||||||
|
HidNpadFullKeyColorState full_key_color; ///< \ref HidNpadFullKeyColorState
|
||||||
|
HidNpadJoyColorState joy_color; ///< \ref HidNpadJoyColorState
|
||||||
HidNpadCommonLifo layouts[7];
|
HidNpadCommonLifo layouts[7];
|
||||||
HidNpadSixAxisSensorLifo sixaxis[6];
|
HidNpadSixAxisSensorLifo sixaxis[6];
|
||||||
u32 device_type;
|
u32 device_type; ///< Bitfield of \ref HidDeviceTypeBits.
|
||||||
u32 reserved;
|
u32 reserved; ///< Reserved
|
||||||
HidNpadSystemProperties system_properties;
|
HidNpadSystemProperties system_properties;
|
||||||
HidNpadSystemButtonProperties system_button_properties;
|
HidNpadSystemButtonProperties system_button_properties;
|
||||||
u32 battery_level[3];
|
u32 battery_level[3];
|
||||||
union {
|
union {
|
||||||
struct { // [1.0.0-3.0.2]
|
struct { // [1.0.0-3.0.2]
|
||||||
u8 nfc_xcd_device_handle_header[0x20];
|
HidNfcXcdDeviceHandleState nfc_xcd_device_handle;
|
||||||
HidNfcXcdDeviceHandleStateEntry nfc_xcd_device_handle_state[2];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
u32 applet_footer_ui_attribute;
|
u32 applet_footer_ui_attribute; ///< Bitfield of AppletFooterUiAttribute.
|
||||||
u8 applet_footer_ui_type;
|
u8 applet_footer_ui_type; ///< \ref HidAppletFooterUiType
|
||||||
u8 pad2[3];
|
u8 unk_x41AD[0x5B];
|
||||||
u8 unk_x41B0[0x58];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
u8 mutex[0x8];
|
u8 unk_x4208[0x20];
|
||||||
u8 unk_x4210[0x18];
|
|
||||||
HidNpadGcTriggerLifo gc_trigger_lifo;
|
HidNpadGcTriggerLifo gc_trigger_lifo;
|
||||||
u32 lark_type_l_and_main; ///< LarkTypeLAndMain
|
u32 lark_type_l_and_main; ///< \ref HidNpadLarkType
|
||||||
u32 lark_type_r; ///< LarkTypeR
|
u32 lark_type_r; ///< \ref HidNpadLarkType
|
||||||
u32 lucia_type; ///< LuciaType
|
u32 lucia_type; ///< \ref HidNpadLuciaType
|
||||||
u32 unk_x43EC;
|
u32 unk_x43EC;
|
||||||
u8 unk_x43F0[0xC10];
|
u8 unk_x43F0[0xC10];
|
||||||
} HidNpad;
|
} HidNpad;
|
||||||
@ -776,12 +880,12 @@ typedef struct HidNpad {
|
|||||||
|
|
||||||
/// HidConsoleSixAxisSensor
|
/// HidConsoleSixAxisSensor
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u64 sampling_number; ///< Timestamp in samples
|
u64 sampling_number; ///< SamplingNumber
|
||||||
u8 is_at_rest; ///< IsSevenSixAxisSensorAtRest
|
u8 is_seven_six_axis_sensor_at_rest; ///< IsSevenSixAxisSensorAtRest
|
||||||
u8 pad[0x3];
|
u8 pad[0x3]; ///< Padding
|
||||||
float verticalization_error; ///< VerticalizationError
|
float verticalization_error; ///< VerticalizationError
|
||||||
UtilFloat3 gyro_bias; ///< GyroBias
|
UtilFloat3 gyro_bias; ///< GyroBias
|
||||||
u8 pad2[0x4];
|
u8 pad2[0x4]; ///< Padding
|
||||||
} HidConsoleSixAxisSensor;
|
} HidConsoleSixAxisSensor;
|
||||||
|
|
||||||
/// HidSharedMemory
|
/// HidSharedMemory
|
||||||
@ -911,7 +1015,7 @@ Result hidGetNpadControllerColorSingle(HidNpadIdType id, HidNpadControllerColor
|
|||||||
/// Gets the left/right \ref HidNpadControllerColor for the specified controller (Joy-Con pair in dual mode).
|
/// Gets the left/right \ref HidNpadControllerColor for the specified controller (Joy-Con pair in dual mode).
|
||||||
Result hidGetNpadControllerColorSplit(HidNpadIdType id, HidNpadControllerColor *color_left, HidNpadControllerColor *color_right);
|
Result hidGetNpadControllerColorSplit(HidNpadIdType id, HidNpadControllerColor *color_left, HidNpadControllerColor *color_right);
|
||||||
|
|
||||||
/// Gets the \ref HidDeviceTypeBits for the specified controller.
|
/// Gets the bitfield of \ref HidDeviceTypeBits for the specified controller.
|
||||||
u32 hidGetNpadDeviceType(HidNpadIdType id);
|
u32 hidGetNpadDeviceType(HidNpadIdType id);
|
||||||
|
|
||||||
/// Gets the \ref HidNpadSystemProperties for the specified controller.
|
/// Gets the \ref HidNpadSystemProperties for the specified controller.
|
||||||
@ -926,13 +1030,13 @@ void hidGetNpadPowerInfoSingle(HidNpadIdType id, HidPowerInfo *info);
|
|||||||
/// Gets the left/right \ref HidPowerInfo for the specified controller (Joy-Con pair in dual mode).
|
/// Gets the left/right \ref HidPowerInfo for the specified controller (Joy-Con pair in dual mode).
|
||||||
void hidGetNpadPowerInfoSplit(HidNpadIdType id, HidPowerInfo *info_left, HidPowerInfo *info_right);
|
void hidGetNpadPowerInfoSplit(HidNpadIdType id, HidPowerInfo *info_left, HidPowerInfo *info_right);
|
||||||
|
|
||||||
/// Gets a bitfield of AppletFooterUiAttributes for the specified Npad.
|
/// Gets a bitfield of AppletFooterUiAttribute for the specified Npad.
|
||||||
/// Only available on [9.0.0+].
|
/// Only available on [9.0.0+].
|
||||||
u32 hidGetAppletFooterUiAttributesSet(HidNpadIdType id);
|
u32 hidGetAppletFooterUiAttributesSet(HidNpadIdType id);
|
||||||
|
|
||||||
/// Gets AppletFooterUiTypes for the specified Npad.
|
/// Gets \ref HidAppletFooterUiType for the specified Npad.
|
||||||
/// Only available on [9.0.0+].
|
/// Only available on [9.0.0+].
|
||||||
u8 hidGetAppletFooterUiTypes(HidNpadIdType id);
|
HidAppletFooterUiType hidGetAppletFooterUiTypes(HidNpadIdType id);
|
||||||
|
|
||||||
size_t hidGetNpadStatesFullKey(HidNpadIdType id, HidNpadFullKeyState *states, size_t count);
|
size_t hidGetNpadStatesFullKey(HidNpadIdType id, HidNpadFullKeyState *states, size_t count);
|
||||||
size_t hidGetNpadStatesHandheld(HidNpadIdType id, HidNpadHandheldState *states, size_t count);
|
size_t hidGetNpadStatesHandheld(HidNpadIdType id, HidNpadHandheldState *states, size_t count);
|
||||||
|
@ -32,7 +32,7 @@ static HidNpadCommonState g_controllerEntries[10];
|
|||||||
|
|
||||||
static u64 g_mouseOld, g_mouseHeld, g_mouseDown, g_mouseUp;
|
static u64 g_mouseOld, g_mouseHeld, g_mouseDown, g_mouseUp;
|
||||||
static u64 g_keyboardModOld, g_keyboardModHeld, g_keyboardModDown, g_keyboardModUp;
|
static u64 g_keyboardModOld, g_keyboardModHeld, g_keyboardModDown, g_keyboardModUp;
|
||||||
static u32 g_keyboardOld[8], g_keyboardHeld[8], g_keyboardDown[8], g_keyboardUp[8];
|
static u64 g_keyboardOld[4], g_keyboardHeld[4], g_keyboardDown[4], g_keyboardUp[4];
|
||||||
static u64 g_controllerOld[10], g_controllerHeld[10], g_controllerDown[10], g_controllerUp[10];
|
static u64 g_controllerOld[10], g_controllerHeld[10], g_controllerDown[10], g_controllerUp[10];
|
||||||
|
|
||||||
static HidControllerID g_controllerP1AutoID;
|
static HidControllerID g_controllerP1AutoID;
|
||||||
@ -92,9 +92,9 @@ static void _hidReset(void) {
|
|||||||
|
|
||||||
g_mouseOld = g_mouseHeld = g_mouseDown = g_mouseUp = 0;
|
g_mouseOld = g_mouseHeld = g_mouseDown = g_mouseUp = 0;
|
||||||
g_keyboardModOld = g_keyboardModHeld = g_keyboardModDown = g_keyboardModUp = 0;
|
g_keyboardModOld = g_keyboardModHeld = g_keyboardModDown = g_keyboardModUp = 0;
|
||||||
for (int i = 0; i < 8; i++)
|
for (u32 i = 0; i < 4; i++)
|
||||||
g_keyboardOld[i] = g_keyboardHeld[i] = g_keyboardDown[i] = g_keyboardUp[i] = 0;
|
g_keyboardOld[i] = g_keyboardHeld[i] = g_keyboardDown[i] = g_keyboardUp[i] = 0;
|
||||||
for (int i = 0; i < 10; i++)
|
for (u32 i = 0; i < 10; i++)
|
||||||
g_controllerOld[i] = g_controllerHeld[i] = g_controllerDown[i] = g_controllerUp[i] = 0;
|
g_controllerOld[i] = g_controllerHeld[i] = g_controllerDown[i] = g_controllerUp[i] = 0;
|
||||||
|
|
||||||
g_controllerP1AutoID = CONTROLLER_HANDHELD;
|
g_controllerP1AutoID = CONTROLLER_HANDHELD;
|
||||||
@ -179,13 +179,13 @@ void hidScanInput(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hidGetKeyboardStates(&g_keyboardState, 1)) {
|
if (hidGetKeyboardStates(&g_keyboardState, 1)) {
|
||||||
g_keyboardModHeld = g_keyboardState.modifier;
|
g_keyboardModHeld = g_keyboardState.modifiers;
|
||||||
for (u32 i = 0; i < 8; i++) {
|
for (u32 i = 0; i < 4; i++) {
|
||||||
g_keyboardHeld[i] = g_keyboardState.keys[i];
|
g_keyboardHeld[i] = g_keyboardState.keys[i];
|
||||||
}
|
}
|
||||||
g_keyboardModDown = (~g_keyboardModOld) & g_keyboardModHeld;
|
g_keyboardModDown = (~g_keyboardModOld) & g_keyboardModHeld;
|
||||||
g_keyboardModUp = g_keyboardModOld & (~g_keyboardModHeld);
|
g_keyboardModUp = g_keyboardModOld & (~g_keyboardModHeld);
|
||||||
for (u32 i = 0; i < 8; i++) {
|
for (u32 i = 0; i < 4; i++) {
|
||||||
g_keyboardDown[i] = (~g_keyboardOld[i]) & g_keyboardHeld[i];
|
g_keyboardDown[i] = (~g_keyboardOld[i]) & g_keyboardHeld[i];
|
||||||
g_keyboardUp[i] = g_keyboardOld[i] & (~g_keyboardHeld[i]);
|
g_keyboardUp[i] = g_keyboardOld[i] & (~g_keyboardHeld[i]);
|
||||||
}
|
}
|
||||||
@ -258,7 +258,7 @@ void hidScanInput(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_controllerP1AutoID = CONTROLLER_HANDHELD;
|
g_controllerP1AutoID = CONTROLLER_HANDHELD;
|
||||||
if (g_controllerEntries[CONTROLLER_PLAYER_1].attributes & CONTROLLER_STATE_CONNECTED)
|
if (g_controllerEntries[CONTROLLER_PLAYER_1].attributes & NpadAttribute_IsConnected)
|
||||||
g_controllerP1AutoID = CONTROLLER_PLAYER_1;
|
g_controllerP1AutoID = CONTROLLER_PLAYER_1;
|
||||||
|
|
||||||
rwlockWriteUnlock(&g_hidLock);
|
rwlockWriteUnlock(&g_hidLock);
|
||||||
@ -280,13 +280,13 @@ static HidNpad* _hidGetNpadInternalState(HidNpadIdType id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u32 hidGetNpadStyleSet(HidNpadIdType id) {
|
u32 hidGetNpadStyleSet(HidNpadIdType id) {
|
||||||
return atomic_load_explicit(&_hidGetNpadInternalState(id)->header.style_set, memory_order_acquire);
|
return atomic_load_explicit(&_hidGetNpadInternalState(id)->style_set, memory_order_acquire);
|
||||||
}
|
}
|
||||||
|
|
||||||
HidNpadJoyAssignmentMode hidGetNpadJoyAssignment(HidNpadIdType id) {
|
HidNpadJoyAssignmentMode hidGetNpadJoyAssignment(HidNpadIdType id) {
|
||||||
HidNpad *npad = _hidGetNpadInternalState(id);
|
HidNpad *npad = _hidGetNpadInternalState(id);
|
||||||
|
|
||||||
HidNpadJoyAssignmentMode tmp = atomic_load_explicit(&npad->header.npad_joy_assignment_mode, memory_order_acquire);
|
HidNpadJoyAssignmentMode tmp = atomic_load_explicit(&npad->joy_assignment_mode, memory_order_acquire);
|
||||||
if (tmp != HidNpadJoyAssignmentMode_Dual && tmp != HidNpadJoyAssignmentMode_Single)
|
if (tmp != HidNpadJoyAssignmentMode_Dual && tmp != HidNpadJoyAssignmentMode_Single)
|
||||||
diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_ShouldNotHappen));
|
diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_ShouldNotHappen));
|
||||||
|
|
||||||
@ -297,13 +297,13 @@ Result hidGetNpadControllerColorSingle(HidNpadIdType id, HidNpadControllerColor
|
|||||||
Result rc = 0;
|
Result rc = 0;
|
||||||
HidNpad *npad = _hidGetNpadInternalState(id);
|
HidNpad *npad = _hidGetNpadInternalState(id);
|
||||||
|
|
||||||
u32 tmp = npad->header.single_colors_descriptor;
|
HidColorAttribute attribute = npad->full_key_color.attribute;
|
||||||
if (tmp==2) rc = MAKERESULT(202, 604);
|
if (attribute==HidColorAttribute_NoController) rc = MAKERESULT(202, 604);
|
||||||
else if (tmp==1) rc = MAKERESULT(202, 603);
|
else if (attribute==HidColorAttribute_ReadError) rc = MAKERESULT(202, 603);
|
||||||
else if (tmp!=0) diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_ShouldNotHappen));
|
else if (attribute!=HidColorAttribute_Ok) diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_ShouldNotHappen));
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc))
|
if (R_SUCCEEDED(rc))
|
||||||
*color = npad->header.single_colors;
|
*color = npad->full_key_color.full_key;
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -312,14 +312,14 @@ Result hidGetNpadControllerColorSplit(HidNpadIdType id, HidNpadControllerColor *
|
|||||||
Result rc = 0;
|
Result rc = 0;
|
||||||
HidNpad *npad = _hidGetNpadInternalState(id);
|
HidNpad *npad = _hidGetNpadInternalState(id);
|
||||||
|
|
||||||
u32 tmp = npad->header.split_colors_descriptor;
|
HidColorAttribute attribute = npad->joy_color.attribute;
|
||||||
if (tmp==2) rc = MAKERESULT(202, 604);
|
if (attribute==HidColorAttribute_NoController) rc = MAKERESULT(202, 604);
|
||||||
else if (tmp==1) rc = MAKERESULT(202, 603);
|
else if (attribute==HidColorAttribute_ReadError) rc = MAKERESULT(202, 603);
|
||||||
else if (tmp!=0) diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_ShouldNotHappen));
|
else if (attribute!=HidColorAttribute_Ok) diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_ShouldNotHappen));
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc)) {
|
if (R_SUCCEEDED(rc)) {
|
||||||
*color_left = npad->header.left_colors;
|
*color_left = npad->joy_color.left;
|
||||||
*color_right = npad->header.right_colors;
|
*color_right = npad->joy_color.right;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@ -338,11 +338,11 @@ void hidGetNpadSystemButtonProperties(HidNpadIdType id, HidNpadSystemButtonPrope
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void _hidGetNpadPowerInfo(HidNpad *npad, HidPowerInfo *info, u32 powerInfo, u32 i) {
|
static void _hidGetNpadPowerInfo(HidNpad *npad, HidPowerInfo *info, u32 powerInfo, u32 i) {
|
||||||
info->batteryCharge = atomic_load_explicit(&npad->battery_level[i], memory_order_acquire);
|
info->battery_level = atomic_load_explicit(&npad->battery_level[i], memory_order_acquire);
|
||||||
if (info->batteryCharge > 4) info->batteryCharge = 4; // sdknso would Abort when this occurs.
|
if (info->battery_level > 4) info->battery_level = 4; // sdknso would Abort when this occurs.
|
||||||
|
|
||||||
info->isCharging = (powerInfo & BIT(i)) != 0;
|
info->is_charging = (powerInfo & BIT(i)) != 0;
|
||||||
info->powerConnected = (powerInfo & BIT(i+3)) != 0;
|
info->is_powered = (powerInfo & BIT(i+3)) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void hidGetNpadPowerInfoSingle(HidNpadIdType id, HidPowerInfo *info) {
|
void hidGetNpadPowerInfoSingle(HidNpadIdType id, HidPowerInfo *info) {
|
||||||
@ -368,7 +368,7 @@ u32 hidGetAppletFooterUiAttributesSet(HidNpadIdType id) {
|
|||||||
return atomic_load_explicit(&_hidGetNpadInternalState(id)->applet_footer_ui_attribute, memory_order_acquire);
|
return atomic_load_explicit(&_hidGetNpadInternalState(id)->applet_footer_ui_attribute, memory_order_acquire);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 hidGetAppletFooterUiTypes(HidNpadIdType id) {
|
HidAppletFooterUiType hidGetAppletFooterUiTypes(HidNpadIdType id) {
|
||||||
return atomic_load_explicit(&_hidGetNpadInternalState(id)->applet_footer_ui_type, memory_order_acquire);
|
return atomic_load_explicit(&_hidGetNpadInternalState(id)->applet_footer_ui_type, memory_order_acquire);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -526,8 +526,8 @@ size_t hidGetNpadStatesGc(HidNpadIdType id, HidNpadGcState *states, size_t count
|
|||||||
memcpy(states[i].joysticks, tmp_entries[i].joysticks, sizeof(tmp_entries[i].joysticks)); // sdknso uses index 0 for the src here.
|
memcpy(states[i].joysticks, tmp_entries[i].joysticks, sizeof(tmp_entries[i].joysticks)); // sdknso uses index 0 for the src here.
|
||||||
states[i].attributes = tmp_entries[i].attributes;
|
states[i].attributes = tmp_entries[i].attributes;
|
||||||
|
|
||||||
states[i].l_trigger = tmp_entries_trigger[i].l_trigger;
|
states[i].trigger_l = tmp_entries_trigger[i].trigger_l;
|
||||||
states[i].r_trigger = tmp_entries_trigger[i].r_trigger;
|
states[i].trigger_r = tmp_entries_trigger[i].trigger_r;
|
||||||
}
|
}
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
@ -706,7 +706,7 @@ bool hidIsControllerConnected(HidControllerID id) {
|
|||||||
if (id < 0 || id > 9) return 0;
|
if (id < 0 || id > 9) return 0;
|
||||||
|
|
||||||
rwlockReadLock(&g_hidLock);
|
rwlockReadLock(&g_hidLock);
|
||||||
bool flag = (g_controllerEntries[id].attributes & CONTROLLER_STATE_CONNECTED) != 0;
|
bool flag = (g_controllerEntries[id].attributes & NpadAttribute_IsConnected) != 0;
|
||||||
rwlockReadUnlock(&g_hidLock);
|
rwlockReadUnlock(&g_hidLock);
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
@ -817,7 +817,7 @@ bool hidKeyboardModifierUp(HidKeyboardModifier modifier) {
|
|||||||
|
|
||||||
bool hidKeyboardHeld(HidKeyboardScancode key) {
|
bool hidKeyboardHeld(HidKeyboardScancode key) {
|
||||||
rwlockReadLock(&g_hidLock);
|
rwlockReadLock(&g_hidLock);
|
||||||
u32 tmp = g_keyboardHeld[key / 32] & (1 << (key % 32));
|
u32 tmp = g_keyboardHeld[key / 64] & (1 << (key % 64));
|
||||||
rwlockReadUnlock(&g_hidLock);
|
rwlockReadUnlock(&g_hidLock);
|
||||||
|
|
||||||
return !!tmp;
|
return !!tmp;
|
||||||
@ -825,7 +825,7 @@ bool hidKeyboardHeld(HidKeyboardScancode key) {
|
|||||||
|
|
||||||
bool hidKeyboardDown(HidKeyboardScancode key) {
|
bool hidKeyboardDown(HidKeyboardScancode key) {
|
||||||
rwlockReadLock(&g_hidLock);
|
rwlockReadLock(&g_hidLock);
|
||||||
u32 tmp = g_keyboardDown[key / 32] & (1 << (key % 32));
|
u32 tmp = g_keyboardDown[key / 64] & (1 << (key % 64));
|
||||||
rwlockReadUnlock(&g_hidLock);
|
rwlockReadUnlock(&g_hidLock);
|
||||||
|
|
||||||
return !!tmp;
|
return !!tmp;
|
||||||
@ -833,7 +833,7 @@ bool hidKeyboardDown(HidKeyboardScancode key) {
|
|||||||
|
|
||||||
bool hidKeyboardUp(HidKeyboardScancode key) {
|
bool hidKeyboardUp(HidKeyboardScancode key) {
|
||||||
rwlockReadLock(&g_hidLock);
|
rwlockReadLock(&g_hidLock);
|
||||||
u32 tmp = g_keyboardUp[key / 32] & (1 << (key % 32));
|
u32 tmp = g_keyboardUp[key / 64] & (1 << (key % 64));
|
||||||
rwlockReadUnlock(&g_hidLock);
|
rwlockReadUnlock(&g_hidLock);
|
||||||
|
|
||||||
return !!tmp;
|
return !!tmp;
|
||||||
@ -1613,7 +1613,7 @@ Result hidIsSevenSixAxisSensorAtRest(bool *out) {
|
|||||||
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
return MAKERESULT(Module_Libnx, LibnxError_NotInitialized);
|
||||||
|
|
||||||
HidSharedMemory *shared_mem = (HidSharedMemory*)hidGetSharedmemAddr();
|
HidSharedMemory *shared_mem = (HidSharedMemory*)hidGetSharedmemAddr();
|
||||||
*out = shared_mem->console_six_axis_sensor.is_at_rest & 1;
|
*out = shared_mem->console_six_axis_sensor.is_seven_six_axis_sensor_at_rest & 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user