mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
hidsys: Added support for all of the [10.0.0+] ButtonConfig cmds, and the required enum/structs.
This commit is contained in:
parent
06bebed819
commit
cc7fb493e1
@ -9,6 +9,33 @@
|
||||
#include "../services/hid.h"
|
||||
#include "../sf/service.h"
|
||||
|
||||
/// ButtonConfig. Selects what button to map to.
|
||||
typedef enum {
|
||||
HidcfgButtonConfig_A = 0, ///< A
|
||||
HidcfgButtonConfig_B = 1, ///< B
|
||||
HidcfgButtonConfig_X = 2, ///< X
|
||||
HidcfgButtonConfig_Y = 3, ///< Y
|
||||
HidcfgButtonConfig_LStick = 4, ///< Left Stick Button
|
||||
HidcfgButtonConfig_RStick = 5, ///< Right Stick Button
|
||||
HidcfgButtonConfig_L = 6, ///< L
|
||||
HidcfgButtonConfig_R = 7, ///< R
|
||||
HidcfgButtonConfig_ZL = 8, ///< ZL
|
||||
HidcfgButtonConfig_ZR = 9, ///< ZR
|
||||
HidcfgButtonConfig_Minus = 10, ///< Minus
|
||||
HidcfgButtonConfig_Plus = 11, ///< Plus
|
||||
HidcfgButtonConfig_DLeft = 12, ///< DLeft
|
||||
HidcfgButtonConfig_DUp = 13, ///< DUp
|
||||
HidcfgButtonConfig_DRight = 14, ///< DRight
|
||||
HidcfgButtonConfig_DDown = 15, ///< DDown
|
||||
HidcfgButtonConfig_SL_Left = 16, ///< SL on Left controller.
|
||||
HidcfgButtonConfig_SR_Left = 17, ///< SR on Left controller.
|
||||
HidcfgButtonConfig_SL_Right = 18, ///< SL on Right controller.
|
||||
HidcfgButtonConfig_SR_Right = 19, ///< SR on Right controller.
|
||||
HidcfgButtonConfig_HOME = 20, ///< HOME
|
||||
HidcfgButtonConfig_Capture = 21, ///< Capture
|
||||
HidcfgButtonConfig_Disabled = 22, ///< Disabled
|
||||
} HidcfgButtonConfig;
|
||||
|
||||
/// Mini Cycle struct for \ref HidsysNotificationLedPattern.
|
||||
typedef struct {
|
||||
u8 ledIntensity; ///< Mini Cycle X LED Intensity.
|
||||
@ -32,6 +59,57 @@ typedef struct {
|
||||
u8 pad_x46[0x2]; ///< Padding
|
||||
} HidsysNotificationLedPattern;
|
||||
|
||||
/// ButtonConfigEmbedded
|
||||
typedef struct {
|
||||
u8 unk_x0[0x2C8];
|
||||
} HidsysButtonConfigEmbedded;
|
||||
|
||||
/// ButtonConfigFull
|
||||
typedef struct {
|
||||
u8 unk_x0[0x2C8];
|
||||
} HidsysButtonConfigFull;
|
||||
|
||||
/// ButtonConfigLeft
|
||||
typedef struct {
|
||||
u8 unk_x0[0x1C8];
|
||||
} HidsysButtonConfigLeft;
|
||||
|
||||
/// ButtonConfigRight
|
||||
typedef struct {
|
||||
u8 unk_x0[0x1A0];
|
||||
} HidsysButtonConfigRight;
|
||||
|
||||
/// JoystickConfig
|
||||
typedef struct {
|
||||
u32 unk_x0; ///< Orientation. 0 = default, 1 = enabled for Left, 2 = enabled for Right.
|
||||
u8 stick_change; ///< StickChange
|
||||
u8 pad[3]; ///< Padding
|
||||
} HidcfgJoystickConfig;
|
||||
|
||||
/// ButtonConfigEmbedded
|
||||
typedef struct {
|
||||
u32 button_config[17]; ///< \ref HidcfgButtonConfig, for the following buttons: DLeft, DUp, DRight, DDown, A, B, X, Y, LStick, RStick, L, R, ZL, ZR, Minus, Plus, Capture.
|
||||
HidcfgJoystickConfig joystick_config[2]; ///< \ref HidcfgJoystickConfig, for the left and right stick.
|
||||
} HidcfgButtonConfigEmbedded;
|
||||
|
||||
/// ButtonConfigFull
|
||||
typedef struct {
|
||||
u32 button_config[17]; ///< \ref HidcfgButtonConfig, for the following buttons: DLeft, DUp, DRight, DDown, A, B, X, Y, LStick, RStick, L, R, ZL, ZR, Minus, Plus, Capture.
|
||||
HidcfgJoystickConfig joystick_config[2]; ///< \ref HidcfgJoystickConfig, for the left and right stick.
|
||||
} HidcfgButtonConfigFull;
|
||||
|
||||
/// ButtonConfigLeft
|
||||
typedef struct {
|
||||
u32 button_config[11]; ///< \ref HidcfgButtonConfig, for the following buttons: DLeft, DUp, DRight, DDown, LStick, L, ZL, Minus, SL_Left, SR_Left, Capture.
|
||||
HidcfgJoystickConfig joystick_config; ///< \ref HidcfgJoystickConfig
|
||||
} HidcfgButtonConfigLeft;
|
||||
|
||||
/// ButtonConfigRight
|
||||
typedef struct {
|
||||
u32 button_config[10]; ///< \ref HidcfgButtonConfig, for the following buttons: A, B, X, Y, RStick, R, ZR, Plus, SL_Right, SR_Right.
|
||||
HidcfgJoystickConfig joystick_config; ///< \ref HidcfgJoystickConfig
|
||||
} HidcfgButtonConfigRight;
|
||||
|
||||
/// Initialize hidsys.
|
||||
Result hidsysInitialize(void);
|
||||
|
||||
@ -133,3 +211,357 @@ Result hidsysSetNotificationLedPattern(const HidsysNotificationLedPattern *patte
|
||||
* @param[in] timeout Timeout in nanoseconds.
|
||||
*/
|
||||
Result hidsysSetNotificationLedPatternWithTimeout(const HidsysNotificationLedPattern *pattern, u64 UniquePadId, u64 timeout);
|
||||
|
||||
/**
|
||||
* @brief IsButtonConfigSupported
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[out] out Output bool flag.
|
||||
*/
|
||||
Result hidsysIsButtonConfigSupported(u64 unique_pad_id, bool *out);
|
||||
|
||||
/**
|
||||
* @brief DeleteButtonConfig
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
*/
|
||||
Result hidsysDeleteButtonConfig(u64 unique_pad_id);
|
||||
|
||||
/**
|
||||
* @brief SetButtonConfigEnabled
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[in] flag Input flag.
|
||||
*/
|
||||
Result hidsysSetButtonConfigEnabled(u64 unique_pad_id, bool flag);
|
||||
|
||||
/**
|
||||
* @brief IsButtonConfigEnabled
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[out] out Output bool flag.
|
||||
*/
|
||||
Result hidsysIsButtonConfigEnabled(u64 unique_pad_id, bool *out);
|
||||
|
||||
/**
|
||||
* @brief SetButtonConfigEmbedded
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[in] config \ref HidsysButtonConfigEmbedded
|
||||
*/
|
||||
Result hidsysSetButtonConfigEmbedded(u64 unique_pad_id, const HidsysButtonConfigEmbedded *config);
|
||||
|
||||
/**
|
||||
* @brief SetButtonConfigFull
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[in] config \ref HidsysButtonConfigFull
|
||||
*/
|
||||
Result hidsysSetButtonConfigFull(u64 unique_pad_id, const HidsysButtonConfigFull *config);
|
||||
|
||||
/**
|
||||
* @brief SetButtonConfigLeft
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[in] config \ref HidsysButtonConfigLeft
|
||||
*/
|
||||
Result hidsysSetButtonConfigLeft(u64 unique_pad_id, const HidsysButtonConfigLeft *config);
|
||||
|
||||
/**
|
||||
* @brief SetButtonConfigRight
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[in] config \ref HidsysButtonConfigRight
|
||||
*/
|
||||
Result hidsysSetButtonConfigRight(u64 unique_pad_id, const HidsysButtonConfigRight *config);
|
||||
|
||||
/**
|
||||
* @brief GetButtonConfigEmbedded
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[out] config \ref HidsysButtonConfigEmbedded
|
||||
*/
|
||||
Result hidsysGetButtonConfigEmbedded(u64 unique_pad_id, HidsysButtonConfigEmbedded *config);
|
||||
|
||||
/**
|
||||
* @brief GetButtonConfigFull
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[out] config \ref HidsysButtonConfigFull
|
||||
*/
|
||||
Result hidsysGetButtonConfigFull(u64 unique_pad_id, HidsysButtonConfigFull *config);
|
||||
|
||||
/**
|
||||
* @brief GetButtonConfigLeft
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[out] config \ref HidsysButtonConfigLeft
|
||||
*/
|
||||
Result hidsysGetButtonConfigLeft(u64 unique_pad_id, HidsysButtonConfigLeft *config);
|
||||
|
||||
/**
|
||||
* @brief GetButtonConfigRight
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[out] config \ref HidsysButtonConfigRight
|
||||
*/
|
||||
Result hidsysGetButtonConfigRight(u64 unique_pad_id, HidsysButtonConfigRight *config);
|
||||
|
||||
/**
|
||||
* @brief IsCustomButtonConfigSupported
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[out] out Output bool flag.
|
||||
*/
|
||||
Result hidsysIsCustomButtonConfigSupported(u64 unique_pad_id, bool *out);
|
||||
|
||||
/**
|
||||
* @brief IsDefaultButtonConfigEmbedded
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] config \ref HidcfgButtonConfigEmbedded
|
||||
* @param[out] out Output bool flag.
|
||||
*/
|
||||
Result hidsysIsDefaultButtonConfigEmbedded(const HidcfgButtonConfigEmbedded *config, bool *out);
|
||||
|
||||
/**
|
||||
* @brief IsDefaultButtonConfigFull
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] config \ref HidcfgButtonConfigFull
|
||||
* @param[out] out Output bool flag.
|
||||
*/
|
||||
Result hidsysIsDefaultButtonConfigFull(const HidcfgButtonConfigFull *config, bool *out);
|
||||
|
||||
/**
|
||||
* @brief IsDefaultButtonConfigLeft
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] config \ref HidcfgButtonConfigLeft
|
||||
* @param[out] out Output bool flag.
|
||||
*/
|
||||
Result hidsysIsDefaultButtonConfigLeft(const HidcfgButtonConfigLeft *config, bool *out);
|
||||
|
||||
/**
|
||||
* @brief IsDefaultButtonConfigRight
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] config \ref HidcfgButtonConfigRight
|
||||
* @param[out] out Output bool flag.
|
||||
*/
|
||||
Result hidsysIsDefaultButtonConfigRight(const HidcfgButtonConfigRight *config, bool *out);
|
||||
|
||||
/**
|
||||
* @brief IsButtonConfigStorageEmbeddedEmpty
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] index Array index for an array which contains a total of 5 entries.
|
||||
* @param[out] out Output bool flag.
|
||||
*/
|
||||
Result hidsysIsButtonConfigStorageEmbeddedEmpty(s32 index, bool *out);
|
||||
|
||||
/**
|
||||
* @brief IsButtonConfigStorageFullEmpty
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] index Array index for an array which contains a total of 5 entries.
|
||||
* @param[out] out Output bool flag.
|
||||
*/
|
||||
Result hidsysIsButtonConfigStorageFullEmpty(s32 index, bool *out);
|
||||
|
||||
/**
|
||||
* @brief IsButtonConfigStorageLeftEmpty
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] index Array index for an array which contains a total of 5 entries.
|
||||
* @param[out] out Output bool flag.
|
||||
*/
|
||||
Result hidsysIsButtonConfigStorageLeftEmpty(s32 index, bool *out);
|
||||
|
||||
/**
|
||||
* @brief IsButtonConfigStorageRightEmpty
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] index Array index for an array which contains a total of 5 entries.
|
||||
* @param[out] out Output bool flag.
|
||||
*/
|
||||
Result hidsysIsButtonConfigStorageRightEmpty(s32 index, bool *out);
|
||||
|
||||
/**
|
||||
* @brief GetButtonConfigStorageEmbedded
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] index Array index for an array which contains a total of 5 entries.
|
||||
* @param[out] config \ref HidcfgButtonConfigEmbedded
|
||||
*/
|
||||
Result hidsysGetButtonConfigStorageEmbedded(s32 index, HidcfgButtonConfigEmbedded *config);
|
||||
|
||||
/**
|
||||
* @brief GetButtonConfigStorageFull
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] index Array index for an array which contains a total of 5 entries.
|
||||
* @param[out] config \ref HidcfgButtonConfigFull
|
||||
*/
|
||||
Result hidsysGetButtonConfigStorageFull(s32 index, HidcfgButtonConfigFull *config);
|
||||
|
||||
/**
|
||||
* @brief GetButtonConfigStorageLeft
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] index Array index for an array which contains a total of 5 entries.
|
||||
* @param[out] config \ref HidcfgButtonConfigLeft
|
||||
*/
|
||||
Result hidsysGetButtonConfigStorageLeft(s32 index, HidcfgButtonConfigLeft *config);
|
||||
|
||||
/**
|
||||
* @brief GetButtonConfigStorageRight
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] index Array index for an array which contains a total of 5 entries.
|
||||
* @param[out] config \ref HidcfgButtonConfigRight
|
||||
*/
|
||||
Result hidsysGetButtonConfigStorageRight(s32 index, HidcfgButtonConfigRight *config);
|
||||
|
||||
/**
|
||||
* @brief SetButtonConfigStorageEmbedded
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] index Array index for an array which contains a total of 5 entries.
|
||||
* @param[in] config \ref HidcfgButtonConfigEmbedded
|
||||
*/
|
||||
Result hidsysSetButtonConfigStorageEmbedded(s32 index, const HidcfgButtonConfigEmbedded *config);
|
||||
|
||||
/**
|
||||
* @brief SetButtonConfigStorageFull
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] index Array index for an array which contains a total of 5 entries.
|
||||
* @param[in] config \ref HidcfgButtonConfigFull
|
||||
*/
|
||||
Result hidsysSetButtonConfigStorageFull(s32 index, const HidcfgButtonConfigFull *config);
|
||||
|
||||
/**
|
||||
* @brief SetButtonConfigStorageLeft
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] index Array index for an array which contains a total of 5 entries.
|
||||
* @param[in] config \ref HidcfgButtonConfigLeft
|
||||
*/
|
||||
Result hidsysSetButtonConfigStorageLeft(s32 index, const HidcfgButtonConfigLeft *config);
|
||||
|
||||
/**
|
||||
* @brief SetButtonConfigStorageRight
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] index Array index for an array which contains a total of 5 entries.
|
||||
* @param[in] config \ref HidcfgButtonConfigRight
|
||||
*/
|
||||
Result hidsysSetButtonConfigStorageRight(s32 index, const HidcfgButtonConfigRight *config);
|
||||
|
||||
/**
|
||||
* @brief DeleteButtonConfigStorageEmbedded
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] index Array index for an array which contains a total of 5 entries.
|
||||
*/
|
||||
Result hidsysDeleteButtonConfigStorageEmbedded(s32 index);
|
||||
|
||||
/**
|
||||
* @brief DeleteButtonConfigStorageFull
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] index Array index for an array which contains a total of 5 entries.
|
||||
*/
|
||||
Result hidsysDeleteButtonConfigStorageFull(s32 index);
|
||||
|
||||
/**
|
||||
* @brief DeleteButtonConfigStorageLeft
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] index Array index for an array which contains a total of 5 entries.
|
||||
*/
|
||||
Result hidsysDeleteButtonConfigStorageLeft(s32 index);
|
||||
|
||||
/**
|
||||
* @brief DeleteButtonConfigStorageRight
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] index Array index for an array which contains a total of 5 entries.
|
||||
*/
|
||||
Result hidsysDeleteButtonConfigStorageRight(s32 index);
|
||||
|
||||
/**
|
||||
* @brief IsUsingCustomButtonConfig
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[out] out Output bool flag.
|
||||
*/
|
||||
Result hidsysIsUsingCustomButtonConfig(u64 unique_pad_id, bool *out);
|
||||
|
||||
/**
|
||||
* @brief IsAnyCustomButtonConfigEnabled
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[out] out Output bool flag.
|
||||
*/
|
||||
Result hidsysIsAnyCustomButtonConfigEnabled(u64 unique_pad_id, bool *out);
|
||||
|
||||
/**
|
||||
* @brief SetAllCustomButtonConfigEnabled
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] AppletResourceUserId AppletResourceUserId
|
||||
* @param[in] flag Input bool flag.
|
||||
*/
|
||||
Result hidsysSetAllCustomButtonConfigEnabled(u64 AppletResourceUserId, bool flag);
|
||||
|
||||
/**
|
||||
* @brief SetAllDefaultButtonConfig
|
||||
* @note Only available on [10.0.0+].
|
||||
*/
|
||||
Result hidsysSetAllDefaultButtonConfig(void);
|
||||
|
||||
/**
|
||||
* @brief SetHidButtonConfigEmbedded
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[in] config \ref HidcfgButtonConfigEmbedded
|
||||
*/
|
||||
Result hidsysSetHidButtonConfigEmbedded(u64 unique_pad_id, const HidcfgButtonConfigEmbedded *config);
|
||||
|
||||
/**
|
||||
* @brief SetHidButtonConfigFull
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[in] config \ref HidcfgButtonConfigFull
|
||||
*/
|
||||
Result hidsysSetHidButtonConfigFull(u64 unique_pad_id, const HidcfgButtonConfigFull *config);
|
||||
|
||||
/**
|
||||
* @brief SetHidButtonConfigLeft
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[in] config \ref HidcfgButtonConfigLeft
|
||||
*/
|
||||
Result hidsysSetHidButtonConfigLeft(u64 unique_pad_id, const HidcfgButtonConfigLeft *config);
|
||||
|
||||
/**
|
||||
* @brief SetHidButtonConfigRight
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[in] config \ref HidcfgButtonConfigRight
|
||||
*/
|
||||
Result hidsysSetHidButtonConfigRight(u64 unique_pad_id, const HidcfgButtonConfigRight *config);
|
||||
|
||||
/**
|
||||
* @brief GetHidButtonConfigEmbedded
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[out] config \ref HidcfgButtonConfigEmbedded
|
||||
*/
|
||||
Result hidsysGetHidButtonConfigEmbedded(u64 unique_pad_id, HidcfgButtonConfigEmbedded *config);
|
||||
|
||||
/**
|
||||
* @brief GetHidButtonConfigFull
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[out] config \ref HidcfgButtonConfigFull
|
||||
*/
|
||||
Result hidsysGetHidButtonConfigFull(u64 unique_pad_id, HidcfgButtonConfigFull *config);
|
||||
|
||||
/**
|
||||
* @brief GetHidButtonConfigLeft
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[out] config \ref HidcfgButtonConfigLeft
|
||||
*/
|
||||
Result hidsysGetHidButtonConfigLeft(u64 unique_pad_id, HidcfgButtonConfigLeft *config);
|
||||
|
||||
/**
|
||||
* @brief GetHidButtonConfigRight
|
||||
* @note Only available on [10.0.0+].
|
||||
* @param[in] unique_pad_id UniquePadId for the controller.
|
||||
* @param[out] config \ref HidcfgButtonConfigRight
|
||||
*/
|
||||
Result hidsysGetHidButtonConfigRight(u64 unique_pad_id, HidcfgButtonConfigRight *config);
|
||||
|
||||
|
@ -34,6 +34,53 @@ static Result _hidsysCmdWithResIdAndPid(u32 cmd_id) {
|
||||
);
|
||||
}
|
||||
|
||||
static Result _hidsysCmdNoIO(u32 cmd_id) {
|
||||
return serviceDispatch(&g_hidsysSrv, cmd_id);
|
||||
}
|
||||
|
||||
static Result _hidsysCmdInU32NoOut(u32 inval, u32 cmd_id) {
|
||||
return serviceDispatchIn(&g_hidsysSrv, cmd_id, inval);
|
||||
}
|
||||
|
||||
static Result _hidsysCmdInU64NoOut(u64 inval, u32 cmd_id) {
|
||||
return serviceDispatchIn(&g_hidsysSrv, cmd_id, inval);
|
||||
}
|
||||
|
||||
static Result _hidsysCmdInU64InBoolNoOut(u64 inval, bool flag, u32 cmd_id) {
|
||||
const struct {
|
||||
u8 flag;
|
||||
u8 pad[7];
|
||||
u64 inval;
|
||||
} in = { flag!=0, {0}, inval };
|
||||
|
||||
return serviceDispatchIn(&g_hidsysSrv, cmd_id, in);
|
||||
}
|
||||
|
||||
static Result _hidsysCmdNoInOutU8(u8 *out, u32 cmd_id) {
|
||||
return serviceDispatchOut(&g_hidsysSrv, cmd_id, *out);
|
||||
}
|
||||
|
||||
static Result _hidsysCmdNoInOutBool(bool *out, u32 cmd_id) {
|
||||
u8 tmp=0;
|
||||
Result rc = _hidsysCmdNoInOutU8(&tmp, cmd_id);
|
||||
if (R_SUCCEEDED(rc) && out) *out = tmp & 1;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static Result _hidsysCmdInU32OutBool(u32 inval, bool *out, u32 cmd_id) {
|
||||
u8 tmp=0;
|
||||
Result rc = serviceDispatchInOut(&g_hidsysSrv, cmd_id, inval, tmp);
|
||||
if (R_SUCCEEDED(rc) && out) *out = tmp & 1;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static Result _hidsysCmdInU64OutBool(u64 inval, bool *out, u32 cmd_id) {
|
||||
u8 tmp=0;
|
||||
Result rc = serviceDispatchInOut(&g_hidsysSrv, cmd_id, inval, tmp);
|
||||
if (R_SUCCEEDED(rc) && out) *out = tmp & 1;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static Result _hidsysCmdGetHandle(Handle* handle_out, u32 cmd_id) {
|
||||
return serviceDispatchIn(&g_hidsysSrv, cmd_id, g_hidsysAppletResourceUserId,
|
||||
.in_send_pid = true,
|
||||
@ -51,6 +98,44 @@ static Result _hidsysCmdGetEvent(Event* out_event, bool autoclear, u32 cmd_id) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
static Result _hidsysCmdInU64InBufNoOut(u64 inval, const void* buf, size_t size, u32 cmd_id) {
|
||||
return serviceDispatchIn(&g_hidsysSrv, cmd_id, inval,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_In },
|
||||
.buffers = { { buf, size } },
|
||||
);
|
||||
}
|
||||
|
||||
static Result _hidsysCmdInBufOutBool(const void* buf, size_t size, bool *out, u32 cmd_id) {
|
||||
u8 tmp=0;
|
||||
Result rc = serviceDispatchOut(&g_hidsysSrv, cmd_id, tmp,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_In },
|
||||
.buffers = { { buf, size } },
|
||||
);
|
||||
if (R_SUCCEEDED(rc) && out) *out = tmp & 1;
|
||||
return rc;
|
||||
}
|
||||
|
||||
static Result _hidsysCmdInU32InBufNoOut(u32 inval, const void* buf, size_t size, u32 cmd_id) {
|
||||
return serviceDispatchIn(&g_hidsysSrv, cmd_id, inval,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_In },
|
||||
.buffers = { { buf, size } },
|
||||
);
|
||||
}
|
||||
|
||||
static Result _hidsysCmdInU32OutBuf(u32 inval, void* buf, size_t size, u32 cmd_id) {
|
||||
return serviceDispatchIn(&g_hidsysSrv, cmd_id, inval,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||
.buffers = { { buf, size } },
|
||||
);
|
||||
}
|
||||
|
||||
static Result _hidsysCmdInU64OutBuf(u64 inval, void* buf, size_t size, u32 cmd_id) {
|
||||
return serviceDispatchIn(&g_hidsysSrv, cmd_id, inval,
|
||||
.buffer_attrs = { SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
|
||||
.buffers = { { buf, size } },
|
||||
);
|
||||
}
|
||||
|
||||
Result hidsysAcquireHomeButtonEventHandle(Event* out_event) {
|
||||
return _hidsysCmdGetEvent(out_event, false, 101);
|
||||
}
|
||||
@ -164,3 +249,326 @@ Result hidsysSetNotificationLedPatternWithTimeout(const HidsysNotificationLedPat
|
||||
|
||||
return serviceDispatchIn(&g_hidsysSrv, 831, in);
|
||||
}
|
||||
|
||||
Result hidsysIsButtonConfigSupported(u64 unique_pad_id, bool *out) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64OutBool(unique_pad_id, out, 1200);
|
||||
}
|
||||
|
||||
Result hidsysDeleteButtonConfig(u64 unique_pad_id) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64NoOut(unique_pad_id, 1201);
|
||||
}
|
||||
|
||||
Result hidsysSetButtonConfigEnabled(u64 unique_pad_id, bool flag) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64InBoolNoOut(unique_pad_id, flag, 1202);
|
||||
}
|
||||
|
||||
Result hidsysIsButtonConfigEnabled(u64 unique_pad_id, bool *out) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64OutBool(unique_pad_id, out, 1203);
|
||||
}
|
||||
|
||||
Result hidsysSetButtonConfigEmbedded(u64 unique_pad_id, const HidsysButtonConfigEmbedded *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64InBufNoOut(unique_pad_id, config, sizeof(*config), 1204);
|
||||
}
|
||||
|
||||
Result hidsysSetButtonConfigFull(u64 unique_pad_id, const HidsysButtonConfigFull *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64InBufNoOut(unique_pad_id, config, sizeof(*config), 1205);
|
||||
}
|
||||
|
||||
Result hidsysSetButtonConfigLeft(u64 unique_pad_id, const HidsysButtonConfigLeft *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64InBufNoOut(unique_pad_id, config, sizeof(*config), 1206);
|
||||
}
|
||||
|
||||
Result hidsysSetButtonConfigRight(u64 unique_pad_id, const HidsysButtonConfigRight *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64InBufNoOut(unique_pad_id, config, sizeof(*config), 1207);
|
||||
}
|
||||
|
||||
Result hidsysGetButtonConfigEmbedded(u64 unique_pad_id, HidsysButtonConfigEmbedded *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64OutBuf(unique_pad_id, config, sizeof(*config), 1208);
|
||||
}
|
||||
|
||||
Result hidsysGetButtonConfigFull(u64 unique_pad_id, HidsysButtonConfigFull *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64OutBuf(unique_pad_id, config, sizeof(*config), 1209);
|
||||
}
|
||||
|
||||
Result hidsysGetButtonConfigLeft(u64 unique_pad_id, HidsysButtonConfigLeft *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64OutBuf(unique_pad_id, config, sizeof(*config), 1210);
|
||||
}
|
||||
|
||||
Result hidsysGetButtonConfigRight(u64 unique_pad_id, HidsysButtonConfigRight *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64OutBuf(unique_pad_id, config, sizeof(*config), 1211);
|
||||
}
|
||||
|
||||
Result hidsysIsCustomButtonConfigSupported(u64 unique_pad_id, bool *out) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64OutBool(unique_pad_id, out, 1250);
|
||||
}
|
||||
|
||||
Result hidsysIsDefaultButtonConfigEmbedded(const HidcfgButtonConfigEmbedded *config, bool *out) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInBufOutBool(config, sizeof(*config), out, 1251);
|
||||
}
|
||||
|
||||
Result hidsysIsDefaultButtonConfigFull(const HidcfgButtonConfigFull *config, bool *out) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInBufOutBool(config, sizeof(*config), out, 1252);
|
||||
}
|
||||
|
||||
Result hidsysIsDefaultButtonConfigLeft(const HidcfgButtonConfigLeft *config, bool *out) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInBufOutBool(config, sizeof(*config), out, 1253);
|
||||
}
|
||||
|
||||
Result hidsysIsDefaultButtonConfigRight(const HidcfgButtonConfigRight *config, bool *out) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInBufOutBool(config, sizeof(*config), out, 1254);
|
||||
}
|
||||
|
||||
Result hidsysIsButtonConfigStorageEmbeddedEmpty(s32 index, bool *out) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU32OutBool((u32)index, out, 1255);
|
||||
}
|
||||
|
||||
Result hidsysIsButtonConfigStorageFullEmpty(s32 index, bool *out) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU32OutBool((u32)index, out, 1256);
|
||||
}
|
||||
|
||||
Result hidsysIsButtonConfigStorageLeftEmpty(s32 index, bool *out) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU32OutBool((u32)index, out, 1257);
|
||||
}
|
||||
|
||||
Result hidsysIsButtonConfigStorageRightEmpty(s32 index, bool *out) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU32OutBool((u32)index, out, 1258);
|
||||
}
|
||||
|
||||
Result hidsysGetButtonConfigStorageEmbedded(s32 index, HidcfgButtonConfigEmbedded *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU32OutBuf((u32)index, config, sizeof(*config), 1259);
|
||||
}
|
||||
|
||||
Result hidsysGetButtonConfigStorageFull(s32 index, HidcfgButtonConfigFull *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU32OutBuf((u32)index, config, sizeof(*config), 1260);
|
||||
}
|
||||
|
||||
Result hidsysGetButtonConfigStorageLeft(s32 index, HidcfgButtonConfigLeft *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU32OutBuf((u32)index, config, sizeof(*config), 1261);
|
||||
}
|
||||
|
||||
Result hidsysGetButtonConfigStorageRight(s32 index, HidcfgButtonConfigRight *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU32OutBuf((u32)index, config, sizeof(*config), 1262);
|
||||
}
|
||||
|
||||
Result hidsysSetButtonConfigStorageEmbedded(s32 index, const HidcfgButtonConfigEmbedded *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU32InBufNoOut((u32)index, config, sizeof(*config), 1263);
|
||||
}
|
||||
|
||||
Result hidsysSetButtonConfigStorageFull(s32 index, const HidcfgButtonConfigFull *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU32InBufNoOut((u32)index, config, sizeof(*config), 1264);
|
||||
}
|
||||
|
||||
Result hidsysSetButtonConfigStorageLeft(s32 index, const HidcfgButtonConfigLeft *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU32InBufNoOut((u32)index, config, sizeof(*config), 1265);
|
||||
}
|
||||
|
||||
Result hidsysSetButtonConfigStorageRight(s32 index, const HidcfgButtonConfigRight *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU32InBufNoOut((u32)index, config, sizeof(*config), 1266);
|
||||
}
|
||||
|
||||
Result hidsysDeleteButtonConfigStorageEmbedded(s32 index) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU32NoOut((u32)index, 1267);
|
||||
}
|
||||
|
||||
Result hidsysDeleteButtonConfigStorageFull(s32 index) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU32NoOut((u32)index, 1268);
|
||||
}
|
||||
|
||||
Result hidsysDeleteButtonConfigStorageLeft(s32 index) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU32NoOut((u32)index, 1269);
|
||||
}
|
||||
|
||||
Result hidsysDeleteButtonConfigStorageRight(s32 index) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU32NoOut((u32)index, 1270);
|
||||
}
|
||||
|
||||
Result hidsysIsUsingCustomButtonConfig(u64 unique_pad_id, bool *out) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64OutBool(unique_pad_id, out, 1271);
|
||||
}
|
||||
|
||||
Result hidsysIsAnyCustomButtonConfigEnabled(u64 unique_pad_id, bool *out) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdNoInOutBool(out, 1272);
|
||||
}
|
||||
|
||||
Result hidsysSetAllCustomButtonConfigEnabled(u64 AppletResourceUserId, bool flag) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64InBoolNoOut(AppletResourceUserId, flag, 1273);
|
||||
}
|
||||
|
||||
Result hidsysSetDefaultButtonConfig(u64 unique_pad_id) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64NoOut(unique_pad_id, 1274);
|
||||
}
|
||||
|
||||
Result hidsysSetAllDefaultButtonConfig(void) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdNoIO(1275);
|
||||
}
|
||||
|
||||
Result hidsysSetHidButtonConfigEmbedded(u64 unique_pad_id, const HidcfgButtonConfigEmbedded *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64InBufNoOut(unique_pad_id, config, sizeof(*config), 1276);
|
||||
}
|
||||
|
||||
Result hidsysSetHidButtonConfigFull(u64 unique_pad_id, const HidcfgButtonConfigFull *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64InBufNoOut(unique_pad_id, config, sizeof(*config), 1277);
|
||||
}
|
||||
|
||||
Result hidsysSetHidButtonConfigLeft(u64 unique_pad_id, const HidcfgButtonConfigLeft *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64InBufNoOut(unique_pad_id, config, sizeof(*config), 1278);
|
||||
}
|
||||
|
||||
Result hidsysSetHidButtonConfigRight(u64 unique_pad_id, const HidcfgButtonConfigRight *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64InBufNoOut(unique_pad_id, config, sizeof(*config), 1279);
|
||||
}
|
||||
|
||||
Result hidsysGetHidButtonConfigEmbedded(u64 unique_pad_id, HidcfgButtonConfigEmbedded *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64OutBuf(unique_pad_id, config, sizeof(*config), 1280);
|
||||
}
|
||||
|
||||
Result hidsysGetHidButtonConfigFull(u64 unique_pad_id, HidcfgButtonConfigFull *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64OutBuf(unique_pad_id, config, sizeof(*config), 1281);
|
||||
}
|
||||
|
||||
Result hidsysGetHidButtonConfigLeft(u64 unique_pad_id, HidcfgButtonConfigLeft *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64OutBuf(unique_pad_id, config, sizeof(*config), 1282);
|
||||
}
|
||||
|
||||
Result hidsysGetHidButtonConfigRight(u64 unique_pad_id, HidcfgButtonConfigRight *config) {
|
||||
if (hosversionBefore(10,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _hidsysCmdInU64OutBuf(unique_pad_id, config, sizeof(*config), 1283);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user