Added AppletTvPowerStateMatchingMode and AppletSystemButtonType. Added appletSetLcdBacklightOffEnabled, appletGetDefaultDisplayResolution, appletGetDefaultDisplayResolutionChangeEvent, appletGetHdcpAuthenticationState, appletGetHdcpAuthenticationStateChangeEvent, appletSetTvPowerStateMatchingMode, and appletPerformSystemButtonPressingIfInFocus. Minor other changes.

This commit is contained in:
yellows8 2019-07-25 21:39:59 -04:00
parent 3b2e484d88
commit 31d34a6915
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 154 additions and 4 deletions

View File

@ -130,6 +130,20 @@ typedef enum {
AppletThemeColorType_Unknown3 = 3, AppletThemeColorType_Unknown3 = 3,
} AppletThemeColorType; } AppletThemeColorType;
/// Mode values for \ref appletSetTvPowerStateMatchingMode.
typedef enum {
AppletTvPowerStateMatchingMode_Unknown0 = 0, ///< Unknown.
AppletTvPowerStateMatchingMode_Unknown1 = 1, ///< Unknown.
} AppletTvPowerStateMatchingMode;
/// Type values for \ref PerformSystemButtonPressingIfInFocus.
typedef enum {
AppletSystemButtonType_HomeButtonShortPressing = 1, ///< Short-pressing with the HOME-button.
AppletSystemButtonType_HomeButtonLongPressing = 2, ///< Long-pressing with the HOME-button.
AppletSystemButtonType_CaptureButtonShortPressing = 6, ///< Short-pressing with the Capture-button.
AppletSystemButtonType_CaptureButtonLongPressing = 7, ///< Long-pressing with the Capture-button.
} AppletSystemButtonType;
/// Permission values for \ref appletSetScreenShotPermission. /// Permission values for \ref appletSetScreenShotPermission.
typedef enum { typedef enum {
AppletScreenShotPermission_Inherit = 0, ///< Inherit from parent applet. AppletScreenShotPermission_Inherit = 0, ///< Inherit from parent applet.
@ -252,6 +266,51 @@ Result appletIsVrModeEnabled(bool *out);
*/ */
Result appletSetVrModeEnabled(bool flag); Result appletSetVrModeEnabled(bool flag);
/**
* @brief Sets whether the LCD screen backlight is turned off.
* @note Only available with [4.0.0+].
* @param[in] flag Flag
*/
Result appletSetLcdBacklightOffEnabled(bool flag);
/**
* @brief Gets the DefaultDisplayResolution.
* @note Only available with [3.0.0+].
* @param[out] width Output width.
* @param[out] height Output height.
*/
Result appletGetDefaultDisplayResolution(s32 *width, s32 *height);
/**
* @brief Gets an Event which is signaled when the output from \ref appletGetDefaultDisplayResolution changes.
* @note Only available with [3.0.0+].
* @note The Event must be closed by the user once finished with it.
* @param[out] out_event Output Event with autoclear=true.
*/
Result appletGetDefaultDisplayResolutionChangeEvent(Event *out_event);
/**
* @brief Gets the HdcpAuthenticationState.
* @note Only available with [4.0.0+].
* @param[out] state Output state.
*/
Result appletGetHdcpAuthenticationState(s32 *state);
/**
* @brief Gets an Event which is signaled when the output from \ref appletGetHdcpAuthenticationState changes.
* @note Only available with [4.0.0+].
* @note The Event must be closed by the user once finished with it.
* @param[out] out_event Output Event with autoclear=true.
*/
Result appletGetHdcpAuthenticationStateChangeEvent(Event *out_event);
/**
* @brief Sets the \ref AppletTvPowerStateMatchingMode.
* @note Only available with [5.0.0+].
* @param[in] mode \ref AppletTvPowerStateMatchingMode
*/
Result appletSetTvPowerStateMatchingMode(AppletTvPowerStateMatchingMode mode);
/** /**
* @brief Sets the \ref ApmCpuBoostMode. * @brief Sets the \ref ApmCpuBoostMode.
* @note Only available with [7.0.0+] (not fully usable system-side with 6.x). * @note Only available with [7.0.0+] (not fully usable system-side with 6.x).
@ -259,6 +318,13 @@ Result appletSetVrModeEnabled(bool flag);
*/ */
Result appletSetCpuBoostMode(ApmCpuBoostMode mode); Result appletSetCpuBoostMode(ApmCpuBoostMode mode);
/**
* @brief Perform SystemButtonPressing with the specified \ref AppletSystemButtonType.
* @note Only available with [6.0.0+].
* @param[in] type \ref AppletSystemButtonType
*/
Result appletPerformSystemButtonPressingIfInFocus(AppletSystemButtonType type);
/** /**
* @brief Gets the current PerformanceConfiguration. * @brief Gets the current PerformanceConfiguration.
* @note Only available with [7.0.0+]. * @note Only available with [7.0.0+].
@ -827,7 +893,7 @@ Result appletQueryApplicationPlayStatisticsByUid(u128 userID, PdmApplicationPlay
* @note Only available with AppletType_*Application on [8.0.0+]. * @note Only available with AppletType_*Application on [8.0.0+].
* @note The Event must be closed by the user once finished with it. * @note The Event must be closed by the user once finished with it.
* @note Official sw waits on this Event from a seperate thread, triggering an abort when it's signaled. * @note Official sw waits on this Event from a seperate thread, triggering an abort when it's signaled.
* @param[out] event_out Output Event with autoclear=false. * @param[out] out_event Output Event with autoclear=false.
*/ */
Result appletGetGpuErrorDetectedSystemEvent(Event *out_event); Result appletGetGpuErrorDetectedSystemEvent(Event *out_event);

View File

@ -75,7 +75,7 @@ static AppletThemeColorType g_appletThemeColorType = AppletThemeColorType_Defaul
static ApmCpuBoostMode g_appletCpuBoostMode = ApmCpuBoostMode_Disabled; static ApmCpuBoostMode g_appletCpuBoostMode = ApmCpuBoostMode_Disabled;
static Result _appletGetHandle(Service* srv, Handle* handle_out, u64 cmd_id); static Result _appletGetHandle(Service* srv, Handle* handle_out, u64 cmd_id);
static Result _appletGetEvent(Service* srv, Event* event_out, u64 cmd_id, bool autoclear); static Result _appletGetEvent(Service* srv, Event* out_event, u64 cmd_id, bool autoclear);
static Result _appletGetSession(Service* srv, Service* srv_out, u64 cmd_id); static Result _appletGetSession(Service* srv, Service* srv_out, u64 cmd_id);
static Result _appletGetSessionProxy(Service* srv_out, u64 cmd_id, Handle prochandle, u8 *AppletAttribute); static Result _appletGetSessionProxy(Service* srv_out, u64 cmd_id, Handle prochandle, u8 *AppletAttribute);
@ -513,12 +513,12 @@ static Result _appletGetHandle(Service* srv, Handle* handle_out, u64 cmd_id) {
return rc; return rc;
} }
static Result _appletGetEvent(Service* srv, Event* event_out, u64 cmd_id, bool autoclear) { static Result _appletGetEvent(Service* srv, Event* out_event, u64 cmd_id, bool autoclear) {
Handle tmp_handle=0; Handle tmp_handle=0;
Result rc = 0; Result rc = 0;
rc = _appletGetHandle(srv, &tmp_handle, cmd_id); rc = _appletGetHandle(srv, &tmp_handle, cmd_id);
if (R_SUCCEEDED(rc)) eventLoadRemote(event_out, tmp_handle, autoclear); if (R_SUCCEEDED(rc)) eventLoadRemote(out_event, tmp_handle, autoclear);
return rc; return rc;
} }
@ -1198,6 +1198,83 @@ Result appletSetVrModeEnabled(bool flag) {
return _appletCmdNoIO(&g_appletICommonStateGetter, flag ? 53 : 54); return _appletCmdNoIO(&g_appletICommonStateGetter, flag ? 53 : 54);
} }
Result appletSetLcdBacklightOffEnabled(bool flag) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _appletCmdInBool(&g_appletICommonStateGetter, flag, 52);
}
Result appletGetDefaultDisplayResolution(s32 *width, s32 *height) {
if (hosversionBefore(3,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
IpcCommand c;
ipcInitialize(&c);
struct {
u64 magic;
u64 cmd_id;
} *raw;
raw = serviceIpcPrepareHeader(&g_appletICommonStateGetter, &c, sizeof(*raw));
raw->magic = SFCI_MAGIC;
raw->cmd_id = 60;
Result rc = serviceIpcDispatch(&g_appletICommonStateGetter);
if (R_SUCCEEDED(rc)) {
IpcParsedCommand r;
struct {
u64 magic;
u64 result;
s32 width;
s32 height;
} *resp;
serviceIpcParse(&g_appletICommonStateGetter, &r, sizeof(*resp));
resp = r.Raw;
rc = resp->result;
if (R_SUCCEEDED(rc)) {
if (width) *width = resp->width;
if (width) *height = resp->height;
}
}
return rc;
}
Result appletGetDefaultDisplayResolutionChangeEvent(Event *out_event) {
if (hosversionBefore(3,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _appletGetEvent(&g_appletICommonStateGetter, out_event, 61, true);
}
Result appletGetHdcpAuthenticationState(s32 *state) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _appletCmdNoInOut32(&g_appletICommonStateGetter, (u32*)state, 62);
}
Result appletGetHdcpAuthenticationStateChangeEvent(Event *out_event) {
if (hosversionBefore(4,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _appletGetEvent(&g_appletICommonStateGetter, out_event, 63, true);
}
Result appletSetTvPowerStateMatchingMode(AppletTvPowerStateMatchingMode mode) {
if (hosversionBefore(5,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _appletCmdInU32(&g_appletICommonStateGetter, mode, 64);
}
Result appletSetCpuBoostMode(ApmCpuBoostMode mode) { Result appletSetCpuBoostMode(ApmCpuBoostMode mode) {
Result rc=0; Result rc=0;
if (hosversionBefore(7,0,0)) if (hosversionBefore(7,0,0))
@ -1208,6 +1285,13 @@ Result appletSetCpuBoostMode(ApmCpuBoostMode mode) {
return rc; return rc;
} }
Result appletPerformSystemButtonPressingIfInFocus(AppletSystemButtonType type) {
if (hosversionBefore(6,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
return _appletCmdInU32(&g_appletICommonStateGetter, type, 80);
}
Result appletGetCurrentPerformanceConfiguration(u32 *PerformanceConfiguration) { Result appletGetCurrentPerformanceConfiguration(u32 *PerformanceConfiguration) {
if (hosversionBefore(7,0,0)) if (hosversionBefore(7,0,0))
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);