Added appletGetCradleStatus and appletGetBootMode. Added _appletCmdNoInOutU8 for internal use, which _appletCmdNoInOutBool now uses. Fixed docs.

This commit is contained in:
yellows8 2019-07-27 12:33:56 -04:00
parent 79fa22fdbd
commit 93eaa74131
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 38 additions and 6 deletions

View File

@ -11,6 +11,7 @@
#include "../services/apm.h"
#include "../services/pdm.h"
#include "../services/caps.h"
#include "../services/pm.h"
#include "../kernel/tmem.h"
#include "../kernel/event.h"
@ -136,7 +137,7 @@ typedef enum {
AppletTvPowerStateMatchingMode_Unknown1 = 1, ///< Unknown.
} AppletTvPowerStateMatchingMode;
/// Type values for \ref PerformSystemButtonPressingIfInFocus.
/// Type values for \ref appletPerformSystemButtonPressingIfInFocus.
typedef enum {
AppletSystemButtonType_HomeButtonShortPressing = 1, ///< Short-pressing with the HOME-button.
AppletSystemButtonType_HomeButtonLongPressing = 2, ///< Long-pressing with the HOME-button.
@ -242,6 +243,18 @@ AppletThemeColorType appletGetThemeColorType(void);
*/
Result appletHomeButtonReaderLockAccessorGetEvent(Event *out_event);
/**
* @brief Gets the CradleStatus.
* @param[out] status Output Dock status.
*/
Result appletGetCradleStatus(u8 *status);
/**
* @brief Gets the BootMode which originated from \ref pmbmGetBootMode.
* @param[out] mode \ref PmBootMode
*/
Result appletGetBootMode(PmBootMode *mode);
/**
* @brief Pushes a storage to the general channel. Used for sending requests to qlaunch.
* @note This is not usable under an Application, however it is usable under a LibraryApplet.
@ -910,14 +923,14 @@ Result appletGetGpuErrorDetectedSystemEvent(Event *out_event);
/**
* @brief Gets the \ref AppletIdentityInfo for the MainApplet.
* @note Only available with AppletType_LibraryApplet.
* @param[out] \ref AppletIdentityInfo
* @param[out] info \ref AppletIdentityInfo
*/
Result appletGetMainAppletIdentityInfo(AppletIdentityInfo *info);
/**
* @brief Gets the \ref AppletIdentityInfo for the CallerApplet.
* @note Only available with AppletType_LibraryApplet.
* @param[out] \ref AppletIdentityInfo
* @param[out] info \ref AppletIdentityInfo
*/
Result appletGetCallerAppletIdentityInfo(AppletIdentityInfo *info);
@ -933,7 +946,7 @@ Result appletGetCallerAppletIdentityInfoStack(AppletIdentityInfo *stack, s32 cou
/**
* @brief Gets the \ref AppletIdentityInfo for the NextReturnDestinationApplet.
* @note Only available with AppletType_LibraryApplet on [4.0.0+].
* @param[out] \ref AppletIdentityInfo
* @param[out] info \ref AppletIdentityInfo
*/
Result appletGetNextReturnDestinationAppletIdentityInfo(AppletIdentityInfo *info);

View File

@ -10,6 +10,7 @@
#include "services/applet.h"
#include "services/apm.h"
#include "services/caps.h"
#include "services/pm.h"
#include "services/sm.h"
#include "runtime/env.h"
#include "runtime/hosversion.h"
@ -744,7 +745,7 @@ static Result _appletCmdNoInOut32(Service* srv, u32 *out, u64 cmd_id) {
return rc;
}
static Result _appletCmdNoInOutBool(Service* srv, bool *out, u64 cmd_id) {
static Result _appletCmdNoInOutU8(Service* srv, u8 *out, u64 cmd_id) {
IpcCommand c;
ipcInitialize(&c);
@ -774,13 +775,20 @@ static Result _appletCmdNoInOutBool(Service* srv, bool *out, u64 cmd_id) {
rc = resp->result;
if (R_SUCCEEDED(rc) && out) {
*out = resp->out!=0;
*out = resp->out;
}
}
return rc;
}
static Result _appletCmdNoInOutBool(Service* srv, bool *out, u64 cmd_id) {
u8 tmp=0;
Result rc = _appletCmdNoInOutU8(srv, &tmp, cmd_id);
if (R_SUCCEEDED(rc) && out) *out = tmp!=0;
return rc;
}
static Result _appletCmdInU8(Service* srv, u8 inval, u64 cmd_id) {
IpcCommand c;
ipcInitialize(&c);
@ -1140,6 +1148,17 @@ static Result _appletGetPerformanceMode(u32 *out) {
return rc;
}
Result appletGetCradleStatus(u8 *status) {
return _appletCmdNoInOutU8(&g_appletICommonStateGetter, status, 7);
}
Result appletGetBootMode(PmBootMode *mode) {
u8 tmp=0;
Result rc = _appletCmdNoInOutU8(&g_appletICommonStateGetter, &tmp, 8);
if (R_SUCCEEDED(rc) && mode) *mode = tmp;
return rc;
}
static Result _appletGetCurrentFocusState(u8 *out) {
IpcCommand c;
ipcInitialize(&c);