service: hidsys: Implement functions needed by QLaunch

This commit is contained in:
Narr the Reg 2023-08-10 22:11:38 -06:00 committed by fincs
parent e2424fd8bf
commit 4fcdb6eb34
2 changed files with 48 additions and 1 deletions

View File

@ -255,6 +255,17 @@ Result hidsysAcquireCaptureButtonEventHandle(Event* out_event, bool autoclear);
**/ **/
Result hidsysActivateCaptureButton(void); Result hidsysActivateCaptureButton(void);
/**
* @brief Applies npad system common policy.
*/
Result hidsysApplyNpadSystemCommonPolicy(void);
/**
* @brief Gets the npad id type of the last controller that was active.
* @param[out] out of \ref HidNpadIdType.
*/
Result hidsysGetLastActiveNpad(u32 *out);
/** /**
* @brief Gets the SupportedNpadStyleSet for the CallerApplet. applet must be initialized in order to use this (uses \ref appletGetAppletResourceUserIdOfCallerApplet). * @brief Gets the SupportedNpadStyleSet for the CallerApplet. applet must be initialized in order to use this (uses \ref appletGetAppletResourceUserIdOfCallerApplet).
* @note Only available on [6.0.0+]. * @note Only available on [6.0.0+].
@ -326,6 +337,13 @@ Result hidsysAcquireUniquePadConnectionEventHandle(Event *out_event);
*/ */
Result hidsysGetUniquePadIds(HidsysUniquePadId *unique_pad_ids, s32 count, s32 *total_out); Result hidsysGetUniquePadIds(HidsysUniquePadId *unique_pad_ids, s32 count, s32 *total_out);
/**
* @brief AcquireJoyDetachOnBluetoothOffEventHandle
* @param[out] out_event Output Event.
* @param[in] Event autoclear.
*/
Result hidsysAcquireJoyDetachOnBluetoothOffEventHandle(Event *out_event, bool autoclear);
/** /**
* @brief GetUniquePadBluetoothAddress * @brief GetUniquePadBluetoothAddress
* @note Only available on [3.0.0+]. * @note Only available on [3.0.0+].
@ -413,6 +431,13 @@ Result hidsysEnableUsbFullKeyController(bool flag);
*/ */
Result hidsysIsUsbConnected(HidsysUniquePadId unique_pad_id, bool *out); Result hidsysIsUsbConnected(HidsysUniquePadId unique_pad_id, bool *out);
/**
* @brief GetTouchScreenDefaultConfiguration
* @note Only available on [9.0.0+].
* @param[out] touch_screen_configuration \ref HidTouchScreenConfigurationForNx.
*/
Result hidsysGetTouchScreenDefaultConfiguration(HidTouchScreenConfigurationForNx *touch_screen_configuration);
/** /**
* @brief IsFirmwareUpdateNeededForNotification * @brief IsFirmwareUpdateNeededForNotification
* @note Only available on [9.0.0+]. * @note Only available on [9.0.0+].
@ -964,4 +989,3 @@ Result hidsysSetButtonConfigStorageLeft(s32 index, const HidcfgButtonConfigLeft
* @param[in] name \ref HidcfgStorageName * @param[in] name \ref HidcfgStorageName
*/ */
Result hidsysSetButtonConfigStorageRight(s32 index, const HidcfgButtonConfigRight *config, const HidcfgStorageName *name); Result hidsysSetButtonConfigStorageRight(s32 index, const HidcfgButtonConfigRight *config, const HidcfgStorageName *name);

View File

@ -81,6 +81,10 @@ static Result _hidsysCmdNoInOutU8(u8 *out, u32 cmd_id) {
return serviceDispatchOut(&g_hidsysSrv, cmd_id, *out); return serviceDispatchOut(&g_hidsysSrv, cmd_id, *out);
} }
static Result _hidsysCmdNoInOutU32(u32 *out, u32 cmd_id) {
return serviceDispatchOut(&g_hidsysSrv, cmd_id, *out);
}
static Result _hidsysCmdNoInOutBool(bool *out, u32 cmd_id) { static Result _hidsysCmdNoInOutBool(bool *out, u32 cmd_id) {
u8 tmp=0; u8 tmp=0;
Result rc = _hidsysCmdNoInOutU8(&tmp, cmd_id); Result rc = _hidsysCmdNoInOutU8(&tmp, cmd_id);
@ -251,6 +255,14 @@ Result hidsysActivateCaptureButton(void) {
return _hidsysCmdWithResIdAndPid(151); return _hidsysCmdWithResIdAndPid(151);
} }
Result hidsysApplyNpadSystemCommonPolicy(void) {
return _hidsysCmdNoIO(303);
}
Result hidsysGetLastActiveNpad(u32 *out) {
return _hidsysCmdNoInOutU32(out, 306);
}
static Result _hidsysGetMaskedSupportedNpadStyleSet(u64 AppletResourceUserId, u32 *out) { static Result _hidsysGetMaskedSupportedNpadStyleSet(u64 AppletResourceUserId, u32 *out) {
if (hosversionBefore(6,0,0)) if (hosversionBefore(6,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
@ -350,6 +362,10 @@ Result hidsysGetUniquePadIds(HidsysUniquePadId *unique_pad_ids, s32 count, s32 *
return rc; return rc;
} }
Result hidsysAcquireJoyDetachOnBluetoothOffEventHandle(Event *out_event, bool autoclear) {
return _hidsysCmdInPidAruidOutEvent(out_event, autoclear, 751);
}
Result hidsysGetUniquePadBluetoothAddress(HidsysUniquePadId unique_pad_id, BtdrvAddress *address) { Result hidsysGetUniquePadBluetoothAddress(HidsysUniquePadId unique_pad_id, BtdrvAddress *address) {
if (hosversionBefore(3,0,0)) if (hosversionBefore(3,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
@ -445,6 +461,13 @@ Result hidsysIsUsbConnected(HidsysUniquePadId unique_pad_id, bool *out) {
return _hidsysCmdInU64OutBool(unique_pad_id.id, out, 852); return _hidsysCmdInU64OutBool(unique_pad_id.id, out, 852);
} }
Result hidsysGetTouchScreenDefaultConfiguration(HidTouchScreenConfigurationForNx *touch_screen_configuration) {
if (hosversionBefore(9,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return serviceDispatchOut(&g_hidsysSrv, 1153, *touch_screen_configuration);
}
Result hidsysIsFirmwareUpdateNeededForNotification(HidsysUniquePadId unique_pad_id, bool *out) { Result hidsysIsFirmwareUpdateNeededForNotification(HidsysUniquePadId unique_pad_id, bool *out) {
if (hosversionBefore(9,0,0)) if (hosversionBefore(9,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);