mirror of
https://github.com/switchbrew/libnx.git
synced 2025-08-06 08:19:22 +02:00
hidsys: Updated the {Home/Sleep/Capture}Button cmds.
This commit is contained in:
parent
4010c70b1e
commit
49183c9953
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user