mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 20:42:44 +02:00
hid: Updated structs/enums.
This commit is contained in:
parent
a45b951db2
commit
09bcd32fbc
@ -31,6 +31,13 @@ typedef enum {
|
|||||||
HidDebugPadButton_Down = BIT(13), ///< D-Pad Down button
|
HidDebugPadButton_Down = BIT(13), ///< D-Pad Down button
|
||||||
} HidDebugPadButton;
|
} HidDebugPadButton;
|
||||||
|
|
||||||
|
/// HidTouchScreenModeForNx
|
||||||
|
typedef enum {
|
||||||
|
HidTouchScreenModeForNx_UseSystemSetting = 0, ///< UseSystemSetting
|
||||||
|
HidTouchScreenModeForNx_Finger = 1, ///< Finger
|
||||||
|
HidTouchScreenModeForNx_Heat2 = 2, ///< Heat2
|
||||||
|
} HidTouchScreenModeForNx;
|
||||||
|
|
||||||
/// HidMouseButton
|
/// HidMouseButton
|
||||||
typedef enum {
|
typedef enum {
|
||||||
HidMouseButton_Left = BIT(0),
|
HidMouseButton_Left = BIT(0),
|
||||||
@ -232,6 +239,19 @@ typedef enum {
|
|||||||
KBD_MEDIA_CALC = 0xfb
|
KBD_MEDIA_CALC = 0xfb
|
||||||
} HidKeyboardScancode;
|
} HidKeyboardScancode;
|
||||||
|
|
||||||
|
/// KeyboardLockKeyEvent
|
||||||
|
typedef enum {
|
||||||
|
HidKeyboardLockKeyEvent_NumLockOn = BIT(0), ///< NumLockOn
|
||||||
|
HidKeyboardLockKeyEvent_NumLockOff = BIT(1), ///< NumLockOff
|
||||||
|
HidKeyboardLockKeyEvent_NumLockToggle = BIT(2), ///< NumLockToggle
|
||||||
|
HidKeyboardLockKeyEvent_CapsLockOn = BIT(3), ///< CapsLockOn
|
||||||
|
HidKeyboardLockKeyEvent_CapsLockOff = BIT(4), ///< CapsLockOff
|
||||||
|
HidKeyboardLockKeyEvent_CapsLockToggle = BIT(5), ///< CapsLockToggle
|
||||||
|
HidKeyboardLockKeyEvent_ScrollLockOn = BIT(6), ///< ScrollLockOn
|
||||||
|
HidKeyboardLockKeyEvent_ScrollLockOff = BIT(7), ///< ScrollLockOff
|
||||||
|
HidKeyboardLockKeyEvent_ScrollLockToggle = BIT(8), ///< ScrollLockToggle
|
||||||
|
} HidKeyboardLockKeyEvent;
|
||||||
|
|
||||||
/// HID controller IDs
|
/// HID controller IDs
|
||||||
typedef enum {
|
typedef enum {
|
||||||
HidNpadIdType_No1 = 0, ///< Player 1 controller
|
HidNpadIdType_No1 = 0, ///< Player 1 controller
|
||||||
@ -483,10 +503,10 @@ typedef enum {
|
|||||||
|
|
||||||
/// NpadCommunicationMode
|
/// NpadCommunicationMode
|
||||||
typedef enum {
|
typedef enum {
|
||||||
HidNpadCommunicationMode_Unknown0 = 0, ///< Unknown
|
HidNpadCommunicationMode_5ms = 0, ///< 5ms
|
||||||
HidNpadCommunicationMode_Unknown1 = 1, ///< Unknown
|
HidNpadCommunicationMode_10ms = 1, ///< 10ms
|
||||||
HidNpadCommunicationMode_Unknown2 = 2, ///< Unknown
|
HidNpadCommunicationMode_15ms = 2, ///< 15ms
|
||||||
HidNpadCommunicationMode_Unknown3 = 3, ///< Unknown
|
HidNpadCommunicationMode_Default = 3, ///< Default
|
||||||
} HidNpadCommunicationMode;
|
} HidNpadCommunicationMode;
|
||||||
|
|
||||||
/// DeviceType (system)
|
/// DeviceType (system)
|
||||||
@ -744,7 +764,8 @@ typedef struct HidTouchScreenSharedMemoryFormat {
|
|||||||
|
|
||||||
/// HidTouchScreenConfigurationForNx
|
/// HidTouchScreenConfigurationForNx
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u8 config[0x10]; ///< Unknown
|
u8 mode; ///< \ref HidTouchScreenModeForNx
|
||||||
|
u8 reserved[0xF]; ///< Reserved
|
||||||
} HidTouchScreenConfigurationForNx;
|
} HidTouchScreenConfigurationForNx;
|
||||||
|
|
||||||
// End HidTouchScreen
|
// End HidTouchScreen
|
||||||
@ -1175,8 +1196,8 @@ typedef union HidSixAxisSensorHandle {
|
|||||||
u32 type_value; ///< TypeValue
|
u32 type_value; ///< TypeValue
|
||||||
struct {
|
struct {
|
||||||
u32 npad_style_index : 8; ///< NpadStyleIndex
|
u32 npad_style_index : 8; ///< NpadStyleIndex
|
||||||
u32 npad_id_type : 8; ///< PlayerNumber / NpadIdType
|
u32 player_number : 8; ///< PlayerNumber
|
||||||
u32 idx : 8; ///< Idx
|
u32 device_idx : 8; ///< DeviceIdx
|
||||||
u32 pad : 8; ///< Padding
|
u32 pad : 8; ///< Padding
|
||||||
};
|
};
|
||||||
} HidSixAxisSensorHandle;
|
} HidSixAxisSensorHandle;
|
||||||
@ -1553,7 +1574,7 @@ bool hidGetHandheldMode(void);
|
|||||||
* @brief SendKeyboardLockKeyEvent
|
* @brief SendKeyboardLockKeyEvent
|
||||||
* @note Same as \ref hidsysSendKeyboardLockKeyEvent.
|
* @note Same as \ref hidsysSendKeyboardLockKeyEvent.
|
||||||
* @note Only available on [6.0.0+].
|
* @note Only available on [6.0.0+].
|
||||||
* @param[in] events Bitfield of KeyboardLockKeyEvent.
|
* @param[in] events Bitfield of \ref HidKeyboardLockKeyEvent.
|
||||||
*/
|
*/
|
||||||
Result hidSendKeyboardLockKeyEvent(u32 events);
|
Result hidSendKeyboardLockKeyEvent(u32 events);
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ Service* hidsysGetServiceSession(void);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SendKeyboardLockKeyEvent
|
* @brief SendKeyboardLockKeyEvent
|
||||||
* @param[in] events Bitfield of KeyboardLockKeyEvent.
|
* @param[in] events Bitfield of \ref HidKeyboardLockKeyEvent.
|
||||||
*/
|
*/
|
||||||
Result hidsysSendKeyboardLockKeyEvent(u32 events);
|
Result hidsysSendKeyboardLockKeyEvent(u32 events);
|
||||||
|
|
||||||
|
@ -668,7 +668,7 @@ size_t hidGetNpadStatesSystem(HidNpadIdType id, HidNpadSystemState *states, size
|
|||||||
|
|
||||||
size_t hidGetSixAxisSensorStates(HidSixAxisSensorHandle handle, HidSixAxisSensorState *states, size_t count) {
|
size_t hidGetSixAxisSensorStates(HidSixAxisSensorHandle handle, HidSixAxisSensorState *states, size_t count) {
|
||||||
HidNpadSixAxisSensorLifo *lifo = NULL;
|
HidNpadSixAxisSensorLifo *lifo = NULL;
|
||||||
HidNpadInternalState *npad = _hidGetNpadInternalState(handle.npad_id_type);
|
HidNpadInternalState *npad = _hidGetNpadInternalState(handle.player_number);
|
||||||
switch(_hidGetSixAxisSensorHandleNpadStyleIndex(handle)) {
|
switch(_hidGetSixAxisSensorHandleNpadStyleIndex(handle)) {
|
||||||
default:
|
default:
|
||||||
diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_ShouldNotHappen));
|
diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_ShouldNotHappen));
|
||||||
@ -683,8 +683,8 @@ size_t hidGetSixAxisSensorStates(HidSixAxisSensorHandle handle, HidSixAxisSensor
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // NpadJoyDual
|
case 2: // NpadJoyDual
|
||||||
if (handle.idx==0) lifo = &npad->joy_dual_left_six_axis_sensor_lifo;
|
if (handle.device_idx==0) lifo = &npad->joy_dual_left_six_axis_sensor_lifo;
|
||||||
else if (handle.idx==1) lifo = &npad->joy_dual_right_six_axis_sensor_lifo;
|
else if (handle.device_idx==1) lifo = &npad->joy_dual_right_six_axis_sensor_lifo;
|
||||||
else diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_ShouldNotHappen));
|
else diagAbortWithResult(MAKERESULT(Module_Libnx, LibnxError_ShouldNotHappen));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1648,12 +1648,12 @@ Result hidIsVibrationDeviceMounted(HidVibrationDeviceHandle handle, bool *flag)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HidVibrationDeviceHandle _hidMakeVibrationDeviceHandle(u8 npad_style_index, u8 npad_id_type, u8 device_idx) {
|
static HidVibrationDeviceHandle _hidMakeVibrationDeviceHandle(u8 npad_style_index, u8 player_number, u8 device_idx) {
|
||||||
return (HidVibrationDeviceHandle){.npad_style_index = npad_style_index, .player_number = npad_id_type, .device_idx = device_idx, .pad = 0};
|
return (HidVibrationDeviceHandle){.npad_style_index = npad_style_index, .player_number = player_number, .device_idx = device_idx, .pad = 0};
|
||||||
}
|
}
|
||||||
|
|
||||||
static HidSixAxisSensorHandle _hidMakeSixAxisSensorHandle(u8 npad_style_index, u8 npad_id_type, u8 idx) {
|
static HidSixAxisSensorHandle _hidMakeSixAxisSensorHandle(u8 npad_style_index, u8 player_number, u8 device_idx) {
|
||||||
return (HidSixAxisSensorHandle){.npad_style_index = npad_style_index, .npad_id_type = npad_id_type, .idx = idx, .pad = 0};
|
return (HidSixAxisSensorHandle){.npad_style_index = npad_style_index, .player_number = player_number, .device_idx = device_idx, .pad = 0};
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 _hidGetSixAxisSensorHandleNpadStyleIndex(HidSixAxisSensorHandle handle) {
|
static u8 _hidGetSixAxisSensorHandleNpadStyleIndex(HidSixAxisSensorHandle handle) {
|
||||||
@ -1664,7 +1664,7 @@ static Result _hidGetVibrationDeviceHandles(HidVibrationDeviceHandle *handles, s
|
|||||||
Result rc=0;
|
Result rc=0;
|
||||||
s32 max_handles=1;
|
s32 max_handles=1;
|
||||||
u32 style_index=0;
|
u32 style_index=0;
|
||||||
u8 idx=0;
|
u8 device_idx=0;
|
||||||
|
|
||||||
if (total_handles <= 0 || total_handles > 2)
|
if (total_handles <= 0 || total_handles > 2)
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
return MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
||||||
@ -1686,7 +1686,7 @@ static Result _hidGetVibrationDeviceHandles(HidVibrationDeviceHandle *handles, s
|
|||||||
}
|
}
|
||||||
else if (style & HidNpadStyleTag_NpadJoyRight) {
|
else if (style & HidNpadStyleTag_NpadJoyRight) {
|
||||||
style_index = 7;
|
style_index = 7;
|
||||||
idx = 0x1;
|
device_idx = 0x1;
|
||||||
}
|
}
|
||||||
else if (style & HidNpadStyleTag_NpadGc) {
|
else if (style & HidNpadStyleTag_NpadGc) {
|
||||||
style_index = 8;
|
style_index = 8;
|
||||||
@ -1716,7 +1716,7 @@ static Result _hidGetVibrationDeviceHandles(HidVibrationDeviceHandle *handles, s
|
|||||||
return MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
return MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
handles[0] = _hidMakeVibrationDeviceHandle(style_index, id, idx);
|
handles[0] = _hidMakeVibrationDeviceHandle(style_index, id, device_idx);
|
||||||
|
|
||||||
if (total_handles > 1) {
|
if (total_handles > 1) {
|
||||||
if (max_handles > 1) {
|
if (max_handles > 1) {
|
||||||
@ -1734,18 +1734,18 @@ static Result _hidGetSixAxisSensorHandles(HidSixAxisSensorHandle *handles, s32 t
|
|||||||
Result rc=0;
|
Result rc=0;
|
||||||
s32 max_handles=1;
|
s32 max_handles=1;
|
||||||
u32 style_index=0;
|
u32 style_index=0;
|
||||||
u8 idx=0;
|
u8 device_idx=0;
|
||||||
|
|
||||||
if (total_handles <= 0 || total_handles > 2)
|
if (total_handles <= 0 || total_handles > 2)
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
return MAKERESULT(Module_Libnx, LibnxError_BadInput);
|
||||||
|
|
||||||
if (style & HidNpadStyleTag_NpadFullKey) {
|
if (style & HidNpadStyleTag_NpadFullKey) {
|
||||||
style_index = 3;
|
style_index = 3;
|
||||||
idx = 0x2;
|
device_idx = 0x2;
|
||||||
}
|
}
|
||||||
else if (style & HidNpadStyleTag_NpadHandheld) {
|
else if (style & HidNpadStyleTag_NpadHandheld) {
|
||||||
style_index = 4;
|
style_index = 4;
|
||||||
idx = 0x2;
|
device_idx = 0x2;
|
||||||
}
|
}
|
||||||
else if (style & HidNpadStyleTag_NpadJoyDual) {
|
else if (style & HidNpadStyleTag_NpadJoyDual) {
|
||||||
style_index = 5;
|
style_index = 5;
|
||||||
@ -1756,11 +1756,11 @@ static Result _hidGetSixAxisSensorHandles(HidSixAxisSensorHandle *handles, s32 t
|
|||||||
}
|
}
|
||||||
else if (style & HidNpadStyleTag_NpadJoyRight) {
|
else if (style & HidNpadStyleTag_NpadJoyRight) {
|
||||||
style_index = 7;
|
style_index = 7;
|
||||||
idx = 0x1;
|
device_idx = 0x1;
|
||||||
}
|
}
|
||||||
else if (style & HidNpadStyleTag_NpadGc) {
|
else if (style & HidNpadStyleTag_NpadGc) {
|
||||||
style_index = 3;
|
style_index = 3;
|
||||||
idx = 0x2;
|
device_idx = 0x2;
|
||||||
}
|
}
|
||||||
else if (style & HidNpadStyleTag_Npad10) {
|
else if (style & HidNpadStyleTag_Npad10) {
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_BadInput); // sdknso would return 0, and return no handles.
|
return MAKERESULT(Module_Libnx, LibnxError_BadInput); // sdknso would return 0, and return no handles.
|
||||||
@ -1770,7 +1770,7 @@ static Result _hidGetSixAxisSensorHandles(HidSixAxisSensorHandle *handles, s32 t
|
|||||||
}
|
}
|
||||||
else if (style & HidNpadStyleTag_NpadHandheldLark) {
|
else if (style & HidNpadStyleTag_NpadHandheldLark) {
|
||||||
style_index = 4;
|
style_index = 4;
|
||||||
idx = 0x2;
|
device_idx = 0x2;
|
||||||
}
|
}
|
||||||
else if (style & HidNpadStyleTag_NpadSystem) {
|
else if (style & HidNpadStyleTag_NpadSystem) {
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_BadInput); // sdknso would return 0, and return no handles.
|
return MAKERESULT(Module_Libnx, LibnxError_BadInput); // sdknso would return 0, and return no handles.
|
||||||
@ -1780,13 +1780,13 @@ static Result _hidGetSixAxisSensorHandles(HidSixAxisSensorHandle *handles, s32 t
|
|||||||
}
|
}
|
||||||
else if (style & HidNpadStyleTag_NpadPalma) {
|
else if (style & HidNpadStyleTag_NpadPalma) {
|
||||||
style_index = 3;
|
style_index = 3;
|
||||||
idx = 0x2;
|
device_idx = 0x2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return MAKERESULT(Module_Libnx, LibnxError_BadInput); // sdknso would return 0, and return no handles.
|
return MAKERESULT(Module_Libnx, LibnxError_BadInput); // sdknso would return 0, and return no handles.
|
||||||
}
|
}
|
||||||
|
|
||||||
handles[0] = _hidMakeSixAxisSensorHandle(style_index, id, idx);
|
handles[0] = _hidMakeSixAxisSensorHandle(style_index, id, device_idx);
|
||||||
|
|
||||||
if (total_handles > 1) {
|
if (total_handles > 1) {
|
||||||
if (max_handles > 1) {
|
if (max_handles > 1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user