hidsys: Updated the {Home/Sleep/Capture}Button cmds.

This commit is contained in:
yellows8 2020-11-29 01:45:36 -05:00 committed by fincs
parent 4010c70b1e
commit 49183c9953
No known key found for this signature in database
GPG Key ID: 62C7609ADA219C60
2 changed files with 42 additions and 34 deletions

View File

@ -196,38 +196,47 @@ Service* hidsysGetServiceSession(void);
Result hidsysSendKeyboardLockKeyEvent(u32 events);
/**
* @brief Returns an event that fires when the home button is pressed, this will prevent the home menu from opening when the button is pressed.
* @brief Gets an Event which is signaled when HidHomeButtonState is updated.
* @note The Event must be closed by the user once finished with it.
* @param[out] out_event Output Event with autoclear=false.
* @note This generally shouldn't be used, since AM-sysmodule uses it internally.
* @param[out] out_event Output Event.
* @param[in] Event autoclear.
**/
Result hidsysAcquireHomeButtonEventHandle(Event* out_event);
Result hidsysAcquireHomeButtonEventHandle(Event* out_event, bool autoclear);
/**
* @brief Returns an event that fires when the sleep button is pressed.
* @note The Event must be closed by the user once finished with it.
* @param[out] out_event Output Event with autoclear=false.
**/
Result hidsysAcquireSleepButtonEventHandle(Event* out_event);
/**
* @brief Returns an event that fires when the capture button is pressed.
* @note The Event must be closed by the user once finished with it.
* @param[out] out_event Output Event with autoclear=false.
**/
Result hidsysAcquireCaptureButtonEventHandle(Event* out_event);
/**
* @brief ActivateHomeButton
* @brief Activates the HomeButton sharedmem.
* @note This generally shouldn't be used, since AM-sysmodule uses it internally.
**/
Result hidsysActivateHomeButton(void);
/**
* @brief ActivateSleepButton
* @brief Gets an Event which is signaled when HidSleepButtonState is updated.
* @note The Event must be closed by the user once finished with it.
* @note This generally shouldn't be used, since AM-sysmodule uses it internally.
* @param[out] out_event Output Event.
* @param[in] Event autoclear.
**/
Result hidsysAcquireSleepButtonEventHandle(Event* out_event, bool autoclear);
/**
* @brief Activates the SleepButton sharedmem.
* @note This generally shouldn't be used, since AM-sysmodule uses it internally.
**/
Result hidsysActivateSleepButton(void);
/**
* @brief ActivateCaptureButton
* @brief Gets an Event which is signaled when HidCaptureButtonState is updated.
* @note The Event must be closed by the user once finished with it.
* @note This generally shouldn't be used, since AM-sysmodule uses it internally.
* @param[out] out_event Output Event.
* @param[in] Event autoclear.
**/
Result hidsysAcquireCaptureButtonEventHandle(Event* out_event, bool autoclear);
/**
* @brief Activates the CaptureButton sharedmem.
* @note This generally shouldn't be used, since AM-sysmodule uses it internally.
**/
Result hidsysActivateCaptureButton(void);

View File

@ -108,7 +108,7 @@ static Result _hidsysCmdInU64OutBool(u64 inval, bool *out, u32 cmd_id) {
return rc;
}
static Result _hidsysCmdGetHandle(Handle* handle_out, u32 cmd_id) {
static Result _hidsysCmdInPidAruidOutHandle(Handle* handle_out, u32 cmd_id) {
return serviceDispatchIn(&g_hidsysSrv, cmd_id, g_hidsysAppletResourceUserId,
.in_send_pid = true,
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
@ -116,11 +116,11 @@ static Result _hidsysCmdGetHandle(Handle* handle_out, u32 cmd_id) {
);
}
static Result _hidsysCmdGetEvent(Event* out_event, bool autoclear, u32 cmd_id) {
static Result _hidsysCmdInPidAruidOutEvent(Event* out_event, bool autoclear, u32 cmd_id) {
Handle tmp_handle = INVALID_HANDLE;
Result rc = 0;
rc = _hidsysCmdGetHandle(&tmp_handle, cmd_id);
rc = _hidsysCmdInPidAruidOutHandle(&tmp_handle, cmd_id);
if (R_SUCCEEDED(rc)) eventLoadRemote(out_event, tmp_handle, autoclear);
return rc;
}
@ -167,27 +167,26 @@ Result hidsysSendKeyboardLockKeyEvent(u32 events) {
return _hidsysCmdInU32NoOut(events, 31);
}
Result hidsysAcquireHomeButtonEventHandle(Event* out_event) {
return _hidsysCmdGetEvent(out_event, false, 101);
}
//These functions don't seem to work in the overlaydisp applet context
Result hidsysAcquireSleepButtonEventHandle(Event* out_event) {
return _hidsysCmdGetEvent(out_event, false, 121);
}
Result hidsysAcquireCaptureButtonEventHandle(Event* out_event) {
return _hidsysCmdGetEvent(out_event, false, 141);
Result hidsysAcquireHomeButtonEventHandle(Event* out_event, bool autoclear) {
return _hidsysCmdInPidAruidOutEvent(out_event, autoclear, 101);
}
Result hidsysActivateHomeButton(void) {
return _hidsysCmdWithResIdAndPid(111);
}
Result hidsysAcquireSleepButtonEventHandle(Event* out_event, bool autoclear) {
return _hidsysCmdInPidAruidOutEvent(out_event, autoclear, 121);
}
Result hidsysActivateSleepButton(void) {
return _hidsysCmdWithResIdAndPid(131);
}
Result hidsysAcquireCaptureButtonEventHandle(Event* out_event, bool autoclear) {
return _hidsysCmdInPidAruidOutEvent(out_event, autoclear, 141);
}
Result hidsysActivateCaptureButton(void) {
return _hidsysCmdWithResIdAndPid(151);
}