Skip to content

Commit

Permalink
hidsys: add version checking to removed commands
Browse files Browse the repository at this point in the history
  • Loading branch information
SciresM authored and fincs committed May 30, 2024
1 parent ff2e76d commit 510d85b
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 44 deletions.
56 changes: 28 additions & 28 deletions nx/include/switch/services/hidsys.h
Original file line number Diff line number Diff line change
Expand Up @@ -448,214 +448,214 @@ Result hidsysIsFirmwareUpdateNeededForNotification(HidsysUniquePadId unique_pad_

/**
* @brief Legacy IsButtonConfigSupported.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysIsButtonConfigSupported instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysIsButtonConfigSupported instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[out] out Output bool flag.
*/
Result hidsysLegacyIsButtonConfigSupported(HidsysUniquePadId unique_pad_id, bool *out);

/**
* @brief IsButtonConfigSupported
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacyIsButtonConfigSupported instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacyIsButtonConfigSupported instead.
* @param[in] addr \ref BtdrvAddress
* @param[out] out Output bool flag.
*/
Result hidsysIsButtonConfigSupported(BtdrvAddress addr, bool *out);

/**
* @brief IsButtonConfigEmbeddedSupported
* @note Only available on [11.0.0+].
* @note Only available on [11.0.0-17.0.1].
* @param[out] out Output bool flag.
*/
Result hidsysIsButtonConfigEmbeddedSupported(bool *out);

/**
* @brief Legacy DeleteButtonConfig.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysDeleteButtonConfig instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysDeleteButtonConfig instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
*/
Result hidsysLegacyDeleteButtonConfig(HidsysUniquePadId unique_pad_id);

/**
* @brief DeleteButtonConfig
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacyDeleteButtonConfig instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacyDeleteButtonConfig instead.
* @param[in] addr \ref BtdrvAddress
*/
Result hidsysDeleteButtonConfig(BtdrvAddress addr);

/**
* @brief DeleteButtonConfigEmbedded
* @note Only available on [11.0.0+].
* @note Only available on [11.0.0-17.0.1].
*/
Result hidsysDeleteButtonConfigEmbedded(void);

/**
* @brief Legacy SetButtonConfigEnabled.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysSetButtonConfigEnabled instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysSetButtonConfigEnabled instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[in] flag Input flag.
*/
Result hidsysLegacySetButtonConfigEnabled(HidsysUniquePadId unique_pad_id, bool flag);

/**
* @brief SetButtonConfigEnabled
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacySetButtonConfigEnabled instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacySetButtonConfigEnabled instead.
* @param[in] addr \ref BtdrvAddress
* @param[in] flag Input flag.
*/
Result hidsysSetButtonConfigEnabled(BtdrvAddress addr, bool flag);

/**
* @brief SetButtonConfigEmbeddedEnabled
* @note Only available on [11.0.0+].
* @note Only available on [11.0.0-17.0.1].
* @param[in] flag Input flag.
*/
Result hidsysSetButtonConfigEmbeddedEnabled(bool flag);

/**
* @brief Legacy IsButtonConfigEnabled.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysIsButtonConfigEnabled instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysIsButtonConfigEnabled instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[out] out Output bool flag.
*/
Result hidsysLegacyIsButtonConfigEnabled(HidsysUniquePadId unique_pad_id, bool *out);

/**
* @brief IsButtonConfigEnabled
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacyIsButtonConfigEnabled instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacyIsButtonConfigEnabled instead.
* @param[in] addr \ref BtdrvAddress
* @param[in] out Output bool flag.
*/
Result hidsysIsButtonConfigEnabled(BtdrvAddress addr, bool *out);

/**
* @brief IsButtonConfigEmbeddedEnabled
* @note Only available on [11.0.0+].
* @note Only available on [11.0.0-17.0.1].
* @param[out] out Output bool flag.
*/
Result hidsysIsButtonConfigEmbeddedEnabled(bool *out);

/**
* @brief Legacy SetButtonConfigEmbedded.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysSetButtonConfigEmbedded instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysSetButtonConfigEmbedded instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[in] config \ref HidsysButtonConfigEmbedded
*/
Result hidsysLegacySetButtonConfigEmbedded(HidsysUniquePadId unique_pad_id, const HidsysButtonConfigEmbedded *config);

/**
* @brief SetButtonConfigEmbedded
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacySetButtonConfigEmbedded instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacySetButtonConfigEmbedded instead.
* @param[in] config \ref HidsysButtonConfigEmbedded
*/
Result hidsysSetButtonConfigEmbedded(const HidsysButtonConfigEmbedded *config);

/**
* @brief Legacy SetButtonConfigFull.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysSetButtonConfigFull instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysSetButtonConfigFull instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[in] config \ref HidsysButtonConfigFull
*/
Result hidsysLegacySetButtonConfigFull(HidsysUniquePadId unique_pad_id, const HidsysButtonConfigFull *config);

/**
* @brief SetButtonConfigFull
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacySetButtonConfigFull instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacySetButtonConfigFull instead.
* @param[in] addr \ref BtdrvAddress
* @param[in] config \ref HidsysButtonConfigFull
*/
Result hidsysSetButtonConfigFull(BtdrvAddress addr, const HidsysButtonConfigFull *config);

/**
* @brief Legacy SetButtonConfigLeft.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysSetButtonConfigLeft instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysSetButtonConfigLeft instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[in] config \ref HidsysButtonConfigLeft
*/
Result hidsysLegacySetButtonConfigLeft(HidsysUniquePadId unique_pad_id, const HidsysButtonConfigLeft *config);

/**
* @brief SetButtonConfigLeft
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacySetButtonConfigLeft instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacySetButtonConfigLeft instead.
* @param[in] addr \ref BtdrvAddress
* @param[in] config \ref HidsysButtonConfigLeft
*/
Result hidsysSetButtonConfigLeft(BtdrvAddress addr, const HidsysButtonConfigLeft *config);

/**
* @brief Legacy SetButtonConfigRight.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysSetButtonConfigRight instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysSetButtonConfigRight instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[in] config \ref HidsysButtonConfigRight
*/
Result hidsysLegacySetButtonConfigRight(HidsysUniquePadId unique_pad_id, const HidsysButtonConfigRight *config);

/**
* @brief SetButtonConfigRight
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacySetButtonConfigRight instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacySetButtonConfigRight instead.
* @param[in] addr \ref BtdrvAddress
* @param[in] config \ref HidsysButtonConfigRight
*/
Result hidsysSetButtonConfigRight(BtdrvAddress addr, const HidsysButtonConfigRight *config);

/**
* @brief Legacy GetButtonConfigEmbedded.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysGetButtonConfigEmbedded instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysGetButtonConfigEmbedded instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[out] config \ref HidsysButtonConfigEmbedded
*/
Result hidsysLegacyGetButtonConfigEmbedded(HidsysUniquePadId unique_pad_id, HidsysButtonConfigEmbedded *config);

/**
* @brief GetButtonConfigEmbedded
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacyGetButtonConfigEmbedded instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacyGetButtonConfigEmbedded instead.
* @param[out] config \ref HidsysButtonConfigEmbedded
*/
Result hidsysGetButtonConfigEmbedded(HidsysButtonConfigEmbedded *config);

/**
* @brief Legacy GetButtonConfigFull.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysGetButtonConfigFull instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysGetButtonConfigFull instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[out] config \ref HidsysButtonConfigFull
*/
Result hidsysLegacyGetButtonConfigFull(HidsysUniquePadId unique_pad_id, HidsysButtonConfigFull *config);

/**
* @brief GetButtonConfigFull
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacyGetButtonConfigFull instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacyGetButtonConfigFull instead.
* @param[in] addr \ref BtdrvAddress
* @param[out] config \ref HidsysButtonConfigFull
*/
Result hidsysGetButtonConfigFull(BtdrvAddress addr, HidsysButtonConfigFull *config);

/**
* @brief Legacy GetButtonConfigLeft.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysGetButtonConfigLeft instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysGetButtonConfigLeft instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[out] config \ref HidsysButtonConfigLeft
*/
Result hidsysLegacyGetButtonConfigLeft(HidsysUniquePadId unique_pad_id, HidsysButtonConfigLeft *config);

/**
* @brief GetButtonConfigLeft
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacyGetButtonConfigLeft instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacyGetButtonConfigLeft instead.
* @param[in] addr \ref BtdrvAddress
* @param[out] config \ref HidsysButtonConfigLeft
*/
Result hidsysGetButtonConfigLeft(BtdrvAddress addr, HidsysButtonConfigLeft *config);

/**
* @brief Legacy GetButtonConfigRight.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0+], use \ref hidsysGetButtonConfigRight instead.
* @note Only available on [10.0.0-10.2.0]. On [11.0.0-17.0.1], use \ref hidsysGetButtonConfigRight instead.
* @param[in] unique_pad_id \ref HidsysUniquePadId
* @param[out] config \ref HidsysButtonConfigRight
*/
Result hidsysLegacyGetButtonConfigRight(HidsysUniquePadId unique_pad_id, HidsysButtonConfigRight *config);

/**
* @brief GetButtonConfigRight
* @note Only available on [11.0.0+]. On [10.0.0-10.2.0], use \ref hidsysLegacyGetButtonConfigRight instead.
* @note Only available on [11.0.0-17.0.1]. On [10.0.0-10.2.0], use \ref hidsysLegacyGetButtonConfigRight instead.
* @param[in] addr \ref BtdrvAddress
* @param[out] config \ref HidsysButtonConfigRight
*/
Expand Down
32 changes: 16 additions & 16 deletions nx/source/services/hidsys.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,14 +497,14 @@ Result hidsysLegacyIsButtonConfigSupported(HidsysUniquePadId unique_pad_id, bool
}

Result hidsysIsButtonConfigSupported(BtdrvAddress addr, bool *out) {
if (hosversionBefore(11,0,0))
if (hosversionBefore(11,0,0) || hosversionAtLeast(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

return _hidsysCmdInAddrOutBool(addr, out, 1200);
}

Result hidsysIsButtonConfigEmbeddedSupported(bool *out) {
if (hosversionBefore(11,0,0))
if (hosversionBefore(11,0,0) || hosversionAtLeast(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

return _hidsysCmdNoInOutBool(out, 1201);
Expand All @@ -518,14 +518,14 @@ Result hidsysLegacyDeleteButtonConfig(HidsysUniquePadId unique_pad_id) {
}

Result hidsysDeleteButtonConfig(BtdrvAddress addr) {
if (hosversionBefore(11,0,0))
if (hosversionBefore(11,0,0) || hosversionAtLeast(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

return _hidsysCmdInAddrNoOut(addr, 1202);
}

Result hidsysDeleteButtonConfigEmbedded(void) {
if (hosversionBefore(11,0,0))
if (hosversionBefore(11,0,0) || hosversionAtLeast(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

return _hidsysCmdNoIO(1203);
Expand All @@ -539,14 +539,14 @@ Result hidsysLegacySetButtonConfigEnabled(HidsysUniquePadId unique_pad_id, bool
}

Result hidsysSetButtonConfigEnabled(BtdrvAddress addr, bool flag) {
if (hosversionBefore(11,0,0))
if (hosversionBefore(11,0,0) || hosversionAtLeast(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

return _hidsysCmdInAddrInBoolNoOut(addr, flag, 1204);
}

Result hidsysSetButtonConfigEmbeddedEnabled(bool flag) {
if (hosversionBefore(11,0,0))
if (hosversionBefore(11,0,0) || hosversionAtLeast(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

return _hidsysCmdInBoolNoOut(flag, 1205);
Expand All @@ -560,14 +560,14 @@ Result hidsysLegacyIsButtonConfigEnabled(HidsysUniquePadId unique_pad_id, bool *
}

Result hidsysIsButtonConfigEnabled(BtdrvAddress addr, bool *out) {
if (hosversionBefore(11,0,0))
if (hosversionBefore(11,0,0) || hosversionAtLeast(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

return _hidsysCmdInAddrInBoolNoOut(addr, out, 1206);
}

Result hidsysIsButtonConfigEmbeddedEnabled(bool *out) {
if (hosversionBefore(11,0,0))
if (hosversionBefore(11,0,0) || hosversionAtLeast(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

return _hidsysCmdNoInOutBool(out, 1207);
Expand All @@ -581,7 +581,7 @@ Result hidsysLegacySetButtonConfigEmbedded(HidsysUniquePadId unique_pad_id, cons
}

Result hidsysSetButtonConfigEmbedded(const HidsysButtonConfigEmbedded *config) {
if (hosversionBefore(11,0,0))
if (hosversionBefore(11,0,0) || hosversionAtLeast(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

return serviceDispatch(&g_hidsysSrv, 1208,
Expand All @@ -598,7 +598,7 @@ Result hidsysLegacySetButtonConfigFull(HidsysUniquePadId unique_pad_id, const Hi
}

Result hidsysSetButtonConfigFull(BtdrvAddress addr, const HidsysButtonConfigFull *config) {
if (hosversionBefore(11,0,0))
if (hosversionBefore(11,0,0) || hosversionAtLeast(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

return _hidsysCmdInAddrInBufFixedNoOut(addr, config, sizeof(*config), 1209);
Expand All @@ -612,7 +612,7 @@ Result hidsysLegacySetButtonConfigLeft(HidsysUniquePadId unique_pad_id, const Hi
}

Result hidsysSetButtonConfigLeft(BtdrvAddress addr, const HidsysButtonConfigLeft *config) {
if (hosversionBefore(11,0,0))
if (hosversionBefore(11,0,0) || hosversionAtLeast(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

return _hidsysCmdInAddrInBufFixedNoOut(addr, config, sizeof(*config), 12010);
Expand All @@ -626,7 +626,7 @@ Result hidsysLegacySetButtonConfigRight(HidsysUniquePadId unique_pad_id, const H
}

Result hidsysSetButtonConfigRight(BtdrvAddress addr, const HidsysButtonConfigRight *config) {
if (hosversionBefore(11,0,0))
if (hosversionBefore(11,0,0) || hosversionAtLeast(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

return _hidsysCmdInAddrInBufFixedNoOut(addr, config, sizeof(*config), 1211);
Expand All @@ -640,7 +640,7 @@ Result hidsysLegacyGetButtonConfigEmbedded(HidsysUniquePadId unique_pad_id, Hids
}

Result hidsysGetButtonConfigEmbedded(HidsysButtonConfigEmbedded *config) {
if (hosversionBefore(11,0,0))
if (hosversionBefore(11,0,0) || hosversionAtLeast(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

return serviceDispatch(&g_hidsysSrv, 1212,
Expand All @@ -657,7 +657,7 @@ Result hidsysLegacyGetButtonConfigFull(HidsysUniquePadId unique_pad_id, HidsysBu
}

Result hidsysGetButtonConfigFull(BtdrvAddress addr, HidsysButtonConfigFull *config) {
if (hosversionBefore(11,0,0))
if (hosversionBefore(11,0,0) || hosversionAtLeast(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

return _hidsysCmdInAddrOutBufFixedNoOut(addr, config, sizeof(*config), 1213);
Expand All @@ -671,7 +671,7 @@ Result hidsysLegacyGetButtonConfigLeft(HidsysUniquePadId unique_pad_id, HidsysBu
}

Result hidsysGetButtonConfigLeft(BtdrvAddress addr, HidsysButtonConfigLeft *config) {
if (hosversionBefore(11,0,0))
if (hosversionBefore(11,0,0) || hosversionAtLeast(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

return _hidsysCmdInAddrOutBufFixedNoOut(addr, config, sizeof(*config), 1214);
Expand All @@ -685,7 +685,7 @@ Result hidsysLegacyGetButtonConfigRight(HidsysUniquePadId unique_pad_id, HidsysB
}

Result hidsysGetButtonConfigRight(BtdrvAddress addr, HidsysButtonConfigRight *config) {
if (hosversionBefore(11,0,0))
if (hosversionBefore(11,0,0) || hosversionAtLeast(18,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);

return _hidsysCmdInAddrOutBufFixedNoOut(addr, config, sizeof(*config), 1215);
Expand Down

0 comments on commit 510d85b

Please sign in to comment.