mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
Added appletGetCradleFwVersion, appletIsInControllerFirmwareUpdateSection, appletSetPerformanceConfigurationChangedNotification, and appletGetOperationModeSystemInfo. Moved appletHomeButtonReaderLockAccessorGetEvent to match cmd order. Fixed a check in appletGetDefaultDisplayResolution.
This commit is contained in:
parent
93eaa74131
commit
409957c432
@ -237,12 +237,6 @@ AppletThemeColorType appletGetThemeColorType(void);
|
||||
|
||||
// ICommonStateGetter
|
||||
|
||||
/**
|
||||
* @brief Get an event that fires when the home button is pressed, doesn't interfere with home menu. This event does not auto clear.
|
||||
* @note Doesn't fire for long press.
|
||||
*/
|
||||
Result appletHomeButtonReaderLockAccessorGetEvent(Event *out_event);
|
||||
|
||||
/**
|
||||
* @brief Gets the CradleStatus.
|
||||
* @param[out] status Output Dock status.
|
||||
@ -263,6 +257,22 @@ Result appletGetBootMode(PmBootMode *mode);
|
||||
*/
|
||||
Result appletPushToGeneralChannel(AppletStorage *s);
|
||||
|
||||
/**
|
||||
* @brief Get an event that fires when the home button is pressed, doesn't interfere with home menu. This event does not auto clear.
|
||||
* @note Doesn't fire for long press.
|
||||
*/
|
||||
Result appletHomeButtonReaderLockAccessorGetEvent(Event *out_event);
|
||||
|
||||
/**
|
||||
* @brief Gets the Dock firmware version.
|
||||
* @note Only available with [2.0.0+].
|
||||
* @param[out] out0 First output value.
|
||||
* @param[out] out1 Second output value.
|
||||
* @param[out] out2 Third output value.
|
||||
* @param[out] out3 Fourth output value.
|
||||
*/
|
||||
Result appletGetCradleFwVersion(u32 *out0, u32 *out1, u32 *out2, u32 *out3);
|
||||
|
||||
/**
|
||||
* @brief Gets whether VrMode is enabled.
|
||||
* @note Only available with [3.0.0+].
|
||||
@ -286,6 +296,13 @@ Result appletSetVrModeEnabled(bool flag);
|
||||
*/
|
||||
Result appletSetLcdBacklightOffEnabled(bool flag);
|
||||
|
||||
/**
|
||||
* @brief Gets the ControllerFirmwareUpdateSection flag.
|
||||
* @note Only available with [3.0.0+].
|
||||
* @param[out] out Output flag.
|
||||
*/
|
||||
Result appletIsInControllerFirmwareUpdateSection(bool *out);
|
||||
|
||||
/**
|
||||
* @brief Gets the DefaultDisplayResolution.
|
||||
* @note Only available with [3.0.0+].
|
||||
@ -346,6 +363,13 @@ Result appletSetCpuBoostMode(ApmCpuBoostMode mode);
|
||||
*/
|
||||
Result appletPerformSystemButtonPressingIfInFocus(AppletSystemButtonType type);
|
||||
|
||||
/**
|
||||
* @brief Sets whether PerformanceConfigurationChangedNotification is enabled.
|
||||
* @note Only available with [7.0.0+].
|
||||
* @param[in] flag Whether to enable the notification.
|
||||
*/
|
||||
Result appletSetPerformanceConfigurationChangedNotification(bool flag);
|
||||
|
||||
/**
|
||||
* @brief Gets the current PerformanceConfiguration.
|
||||
* @note Only available with [7.0.0+].
|
||||
@ -353,6 +377,13 @@ Result appletPerformSystemButtonPressingIfInFocus(AppletSystemButtonType type);
|
||||
*/
|
||||
Result appletGetCurrentPerformanceConfiguration(u32 *PerformanceConfiguration);
|
||||
|
||||
/**
|
||||
* @brief Gets the OperationModeSystemInfo.
|
||||
* @note Only available with [7.0.0+].
|
||||
* @param[out] info Output info.
|
||||
*/
|
||||
Result appletGetOperationModeSystemInfo(u32 *info);
|
||||
|
||||
// ISelfController
|
||||
|
||||
/**
|
||||
|
@ -1027,17 +1027,6 @@ static Result _appletGetIdentityInfo(Service* srv, AppletIdentityInfo *info, u64
|
||||
|
||||
// ICommonStateGetter
|
||||
|
||||
Result appletHomeButtonReaderLockAccessorGetEvent(Event *out_event) {
|
||||
Service ILockAccessor = {0};
|
||||
Result rc = _appletGetSession(&g_appletICommonStateGetter, &ILockAccessor, 30);
|
||||
if (R_FAILED(rc))
|
||||
return rc;
|
||||
|
||||
rc = _appletGetEvent(&ILockAccessor, out_event, 3, false);
|
||||
serviceClose(&ILockAccessor);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static Result _appletReceiveMessage(u32 *out) {
|
||||
IpcCommand c;
|
||||
ipcInitialize(&c);
|
||||
@ -1200,6 +1189,63 @@ Result appletPushToGeneralChannel(AppletStorage *s) {
|
||||
return _appletCmdInStorage(&g_appletICommonStateGetter, s, 20);
|
||||
}
|
||||
|
||||
Result appletHomeButtonReaderLockAccessorGetEvent(Event *out_event) {
|
||||
Service ILockAccessor = {0};
|
||||
Result rc = _appletGetSession(&g_appletICommonStateGetter, &ILockAccessor, 30);
|
||||
if (R_FAILED(rc))
|
||||
return rc;
|
||||
|
||||
rc = _appletGetEvent(&ILockAccessor, out_event, 3, false);
|
||||
serviceClose(&ILockAccessor);
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result appletGetCradleFwVersion(u32 *out0, u32 *out1, u32 *out2, u32 *out3) {
|
||||
if (hosversionBefore(2,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 = 40;
|
||||
|
||||
Result rc = serviceIpcDispatch(&g_appletICommonStateGetter);
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
IpcParsedCommand r;
|
||||
struct {
|
||||
u64 magic;
|
||||
u64 result;
|
||||
u32 out0;
|
||||
u32 out1;
|
||||
u32 out2;
|
||||
u32 out3;
|
||||
} *resp;
|
||||
|
||||
serviceIpcParse(&g_appletICommonStateGetter, &r, sizeof(*resp));
|
||||
resp = r.Raw;
|
||||
|
||||
rc = resp->result;
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
if (out0) *out0 = resp->out0;
|
||||
if (out1) *out1 = resp->out1;
|
||||
if (out2) *out2 = resp->out2;
|
||||
if (out3) *out3 = resp->out3;
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
Result appletIsVrModeEnabled(bool *out) {
|
||||
if (hosversionBefore(3,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
@ -1224,6 +1270,13 @@ Result appletSetLcdBacklightOffEnabled(bool flag) {
|
||||
return _appletCmdInBool(&g_appletICommonStateGetter, flag, 52);
|
||||
}
|
||||
|
||||
Result appletIsInControllerFirmwareUpdateSection(bool *out) {
|
||||
if (hosversionBefore(3,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _appletCmdNoInOutBool(&g_appletICommonStateGetter, out, 55);
|
||||
}
|
||||
|
||||
Result appletGetDefaultDisplayResolution(s32 *width, s32 *height) {
|
||||
if (hosversionBefore(3,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
@ -1259,7 +1312,7 @@ Result appletGetDefaultDisplayResolution(s32 *width, s32 *height) {
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
if (width) *width = resp->width;
|
||||
if (width) *height = resp->height;
|
||||
if (height) *height = resp->height;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1351,6 +1404,13 @@ Result appletPerformSystemButtonPressingIfInFocus(AppletSystemButtonType type) {
|
||||
return _appletCmdInU32(&g_appletICommonStateGetter, type, 80);
|
||||
}
|
||||
|
||||
Result appletSetPerformanceConfigurationChangedNotification(bool flag) {
|
||||
if (hosversionBefore(7,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _appletCmdInBool(&g_appletICommonStateGetter, flag, 90);
|
||||
}
|
||||
|
||||
Result appletGetCurrentPerformanceConfiguration(u32 *PerformanceConfiguration) {
|
||||
if (hosversionBefore(7,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
@ -1358,6 +1418,13 @@ Result appletGetCurrentPerformanceConfiguration(u32 *PerformanceConfiguration) {
|
||||
return _appletCmdNoInOut32(&g_appletICommonStateGetter, PerformanceConfiguration, 91);
|
||||
}
|
||||
|
||||
Result appletGetOperationModeSystemInfo(u32 *info) {
|
||||
if (hosversionBefore(7,0,0))
|
||||
return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer);
|
||||
|
||||
return _appletCmdNoInOut32(&g_appletICommonStateGetter, info, 200);
|
||||
}
|
||||
|
||||
// ISelfController
|
||||
|
||||
static Result _appletSelfExit(void) {
|
||||
|
Loading…
Reference in New Issue
Block a user