diff --git a/nx/include/switch/services/applet.h b/nx/include/switch/services/applet.h index 58ed6b3e..446be1da 100644 --- a/nx/include/switch/services/applet.h +++ b/nx/include/switch/services/applet.h @@ -535,6 +535,12 @@ Result appletGetApplicationIdByContentActionName(u64 *application_id, const char */ Result appletSetCpuBoostMode(ApmCpuBoostMode mode); +/** + * @brief CancelCpuBoostMode + * @note Only available with [10.0.0+]. + */ +Result appletCancelCpuBoostMode(void); + /** * @brief Perform SystemButtonPressing with the specified \ref AppletSystemButtonType. Internally this cmd checks a state field, verifies that the type is allowed, then runs the same func as \ref appletPerformSystemButtonPressing internally. * @note Only available with [6.0.0+]. @@ -570,6 +576,18 @@ Result appletGetOperationModeSystemInfo(u32 *info); */ Result appletGetSettingsPlatformRegion(SetSysPlatformRegion *out); +/** + * @brief ActivateMigrationService + * @note Only available with [10.0.0+]. + */ +Result appletActivateMigrationService(void); + +/** + * @brief DeactivateMigrationService + * @note Only available with [10.0.0+]. + */ +Result appletDeactivateMigrationService(void); + ///@} ///@name ISelfController @@ -667,6 +685,21 @@ Result appletGetSystemSharedLayerHandle(u64 *SharedBufferHandle, u64 *SharedLaye */ Result appletGetSystemSharedBufferHandle(u64 *SharedBufferHandle); +/** + * @brief CreateManagedDisplaySeparableLayer + * @note Only available with [10.0.0+]. + * @param[out] display_layer Output display_layer. + * @param[out] recording_layer Output recording_layer. + */ +Result appletCreateManagedDisplaySeparableLayer(u64 *display_layer, u64 *recording_layer); + +/** + * @brief SetManagedDisplayLayerSeparationMode + * @note Only available with [10.0.0+]. + * @param[in] mode Mode. Must be 0-1. + */ +Result appletSetManagedDisplayLayerSeparationMode(u32 mode); + /** * @brief Sets whether ::AppletMessage_RequestToDisplay is enabled. * @note Sets an internal state flag. When the input flag is 0, this will in additional run the same code as \ref appletApproveToDisplay. @@ -1125,6 +1158,13 @@ LibAppletExitReason appletHolderGetExitReason(AppletHolder *h); */ Result appletHolderSetOutOfFocusApplicationSuspendingEnabled(AppletHolder *h, bool flag); +/** + * @brief PresetLibraryAppletGpuTimeSliceZero + * @note Only available with [10.0.0+]. + * @param h AppletHolder object. + */ +Result appletHolderPresetLibraryAppletGpuTimeSliceZero(AppletHolder *h); + /** * @brief Waits for the PopInteractiveOutDataEvent and StateChangedEvent. * @return false for error / when StateChangedEvent was signaled, and true when PopInteractiveOutDataEvent was signaled. The latter is signaled when a new storage is available with \ref appletHolderPopInteractiveOutData where previously no storage was available (this willl not clear the event), this event is automatically cleared by the system once the last storage is popped. @@ -1386,6 +1426,12 @@ Result appletRequestToShutdown(void); */ Result appletRequestToReboot(void); +/** + * @brief RequestToSleep + * @note Only available with AppletType_*Application on [10.0.0+]. + */ +Result appletRequestToSleep(void); + /** * @brief Exit the application and return to the kiosk demo menu. This terminates the current process. This will enter an infinite-sleep-loop on success. * @note Only available with AppletType_*Application on [4.0.0+], on kiosk systems (QuestFlag set). @@ -1918,6 +1964,20 @@ Result appletApplicationPushToFriendInvitationStorageChannel(AppletApplication * */ Result appletApplicationPushToNotificationStorageChannel(AppletApplication *a, const void* buffer, u64 size); +/** + * @brief RequestApplicationSoftReset + * @note Only available on [10.0.0+]. + * @param a \ref AppletApplication + */ +Result appletApplicationRequestApplicationSoftReset(AppletApplication *a); + +/** + * @brief RestartApplicationTimer + * @note Only available on [10.0.0+]. + * @param a \ref AppletApplication + */ +Result appletApplicationRestartApplicationTimer(AppletApplication *a); + ///@} ///@name ILibraryAppletSelfAccessor @@ -2123,6 +2183,21 @@ Result appletUnreserveResourceForMovieOperation(void); */ Result appletGetMainAppletAvailableUsers(AccountUid *uids, s32 count, bool *flag, s32 *total_out); +/** + * @brief SetApplicationMemoryReservation + * @note Only available with AppletType_LibraryApplet on [10.0.0+]. + * @note An Application must be currently running. + * @param[in] val Input value. + */ +Result appletSetApplicationMemoryReservation(u64 val); + +/** + * @brief ShouldSetGpuTimeSliceManually + * @note Only available with AppletType_LibraryApplet on [10.0.0+]. + * @param[out] out Output flag. + */ +Result appletShouldSetGpuTimeSliceManually(bool *out); + ///@} ///@name IOverlayFunctions: IFunctions for AppletType_OverlayApplet. @@ -2196,6 +2271,13 @@ Result appletStartRebootSequenceForOverlay(void); */ Result appletSetHealthWarningShowingState(bool flag); +/** + * @brief IsHealthWarningRequired + * @note Only available with AppletType_OverlayApplet on [10.0.0+]. + * @param[out] out Output flag. + */ +Result appletIsHealthWarningRequired(bool *out); + /** * @brief Enables HID input for the OverlayApplet, without disabling input for the foreground applet. Generally \ref appletBeginToWatchShortHomeButtonMessage / appletEndToWatchShortHomeButtonMessage should be used instead. * @note Only available with AppletType_OverlayApplet on [5.0.0+]. @@ -2276,6 +2358,13 @@ Result appletSetHomeButtonDoubleClickEnabled(bool flag); */ Result appletGetHomeButtonDoubleClickEnabled(bool *out); +/** + * @brief IsHomeButtonShortPressedBlocked + * @note Only available with AppletType_SystemApplet, AppletType_LibraryApplet, or AppletType_OverlayApplet, on [10.0.0+]. + * @param[out] out Output flag. + */ +Result appletIsHomeButtonShortPressedBlocked(bool *out); + ///@} ///@name IDebugFunctions diff --git a/nx/source/services/applet.c b/nx/source/services/applet.c index 4249343f..d8d0364b 100644 --- a/nx/source/services/applet.c +++ b/nx/source/services/applet.c @@ -998,6 +998,8 @@ Result appletSetCpuBoostMode(ApmCpuBoostMode mode) { return rc; } +IPC_MAKE_CMD_IMPL_HOSVER(Result appletCancelCpuBoostMode(void), &g_appletICommonStateGetter, 67, _appletCmdNoIO, (10,0,0)) + IPC_MAKE_CMD_IMPL_HOSVER(Result appletPerformSystemButtonPressingIfInFocus(AppletSystemButtonType type), &g_appletICommonStateGetter, 80, _appletCmdInU32NoOut, (6,0,0), type) IPC_MAKE_CMD_IMPL_HOSVER(Result appletSetPerformanceConfigurationChangedNotification(bool flag), &g_appletICommonStateGetter, 90, _appletCmdInBoolNoOut, (7,0,0), flag) IPC_MAKE_CMD_IMPL_HOSVER(Result appletGetCurrentPerformanceConfiguration(u32 *PerformanceConfiguration), &g_appletICommonStateGetter, 91, _appletCmdNoInOutU32, (7,0,0), PerformanceConfiguration) @@ -1013,6 +1015,9 @@ Result appletGetSettingsPlatformRegion(SetSysPlatformRegion *out) { return rc; } +IPC_MAKE_CMD_IMPL_HOSVER(Result appletActivateMigrationService(void), &g_appletICommonStateGetter, 400, _appletCmdNoIO, (10,0,0)) +IPC_MAKE_CMD_IMPL_HOSVER(Result appletDeactivateMigrationService(void), &g_appletICommonStateGetter, 401, _appletCmdNoIO, (10,0,0)) + // ISelfController IPC_MAKE_CMD_IMPL(static Result _appletSelfExit(void), &g_appletISelfController, 0, _appletCmdNoIO) @@ -1082,6 +1087,25 @@ Result appletGetSystemSharedLayerHandle(u64 *SharedBufferHandle, u64 *SharedLaye } IPC_MAKE_CMD_IMPL_HOSVER(Result appletGetSystemSharedBufferHandle(u64 *SharedBufferHandle) , &g_appletISelfController, 43, _appletCmdNoInOutU64, (5,0,0), SharedBufferHandle) + +Result appletCreateManagedDisplaySeparableLayer(u64 *display_layer, u64 *recording_layer) { + if (hosversionBefore(10,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + struct { + u64 display_layer; + u64 recording_layer; + } out; + + serviceAssumeDomain(&g_appletISelfController); + Result rc = serviceDispatchOut(&g_appletISelfController, 44, out); + if (R_SUCCEEDED(rc) && display_layer) *display_layer = out.display_layer; + if (R_SUCCEEDED(rc) && recording_layer) *recording_layer = out.recording_layer; + return rc; +} + +IPC_MAKE_CMD_IMPL_HOSVER(Result appletSetManagedDisplayLayerSeparationMode(u32 mode), &g_appletISelfController, 45, _appletCmdInU32NoOut, (10,0,0), mode) + IPC_MAKE_CMD_IMPL( Result appletSetHandlesRequestToDisplay(bool flag), &g_appletISelfController, 50, _appletCmdInBoolNoOut, flag) IPC_MAKE_CMD_IMPL( Result appletApproveToDisplay(void), &g_appletISelfController, 51, _appletCmdNoIO) @@ -1628,6 +1652,7 @@ u32 appletHolderGetExitReason(AppletHolder *h) { } IPC_MAKE_CMD_IMPL_INITEXPR(Result appletHolderSetOutOfFocusApplicationSuspendingEnabled(AppletHolder *h, bool flag), &h->s, 50, _appletCmdInBoolNoOut, !_appletIsApplication(), flag) +IPC_MAKE_CMD_IMPL_HOSVER(Result appletHolderPresetLibraryAppletGpuTimeSliceZero(AppletHolder *h), &h->s, 60, _appletCmdNoIO, (10,0,0)) static Result _appletHolderGetPopInteractiveOutDataEvent(AppletHolder *h) { if (eventActive(&h->PopInteractiveOutDataEvent)) return 0; @@ -2083,6 +2108,8 @@ Result appletRequestToReboot(void) { return rc; } +IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletRequestToSleep(void), &g_appletIFunctions, 72, _appletCmdNoIO, !_appletIsApplication(), (10,0,0)) + Result appletExitAndRequestToShowThanksMessage(void) { Result rc=0; @@ -2547,6 +2574,9 @@ Result appletApplicationPushToNotificationStorageChannel(AppletApplication *a, c return _appletPushToNotificationStorageChannel(&a->s, buffer, size, 190); } +IPC_MAKE_CMD_IMPL_HOSVER(Result appletApplicationRequestApplicationSoftReset(AppletApplication *a), &a->s, 200, _appletCmdNoIO, (10,0,0)) +IPC_MAKE_CMD_IMPL_HOSVER(Result appletApplicationRestartApplicationTimer(AppletApplication *a), &a->s, 201, _appletCmdNoIO, (10,0,0)) + // ILibraryAppletSelfAccessor IPC_MAKE_CMD_IMPL_INITEXPR( Result appletPopInData(AppletStorage *s), &g_appletILibraryAppletSelfAccessor, 0, _appletCmdNoInOutStorage, __nx_applet_type != AppletType_LibraryApplet, s) @@ -2636,6 +2666,9 @@ Result appletGetMainAppletAvailableUsers(AccountUid *uids, s32 count, bool *flag return rc; } +IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletSetApplicationMemoryReservation(u64 val), &g_appletILibraryAppletSelfAccessor, 140, _appletCmdInU64NoOut, __nx_applet_type != AppletType_LibraryApplet, (10,0,0), val) +IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletShouldSetGpuTimeSliceManually(bool *out), &g_appletILibraryAppletSelfAccessor, 150, _appletCmdNoInOutBool, __nx_applet_type != AppletType_LibraryApplet, (10,0,0), out) + // IOverlayFunctions IPC_MAKE_CMD_IMPL_INITEXPR( Result appletBeginToWatchShortHomeButtonMessage(void), &g_appletIFunctions, 0, _appletCmdNoIO, __nx_applet_type != AppletType_OverlayApplet) @@ -2673,6 +2706,7 @@ Result appletStartRebootSequenceForOverlay(void) { } IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletSetHealthWarningShowingState(bool flag), &g_appletIFunctions, 30, _appletCmdInBoolNoOut, __nx_applet_type != AppletType_OverlayApplet, (9,0,0), flag) +IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletIsHealthWarningRequired(bool *out), &g_appletIFunctions, 31, _appletCmdNoInOutBool, __nx_applet_type != AppletType_OverlayApplet, (10,0,0), out) IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletBeginToObserveHidInputForDevelop(void), &g_appletIFunctions, 101, _appletCmdNoIO, __nx_applet_type != AppletType_OverlayApplet, (5,0,0)) // IAppletCommonFunctions @@ -2723,6 +2757,7 @@ Result appletSetDisplayMagnification(float x, float y, float width, float height IPC_MAKE_CMD_IMPL_HOSVER(Result appletSetHomeButtonDoubleClickEnabled(bool flag), &g_appletIAppletCommonFunctions, 50, _appletCmdInBoolNoOut, (8,0,0), flag) IPC_MAKE_CMD_IMPL_HOSVER(Result appletGetHomeButtonDoubleClickEnabled(bool *out), &g_appletIAppletCommonFunctions, 51, _appletCmdNoInOutBool, (8,0,0), out) +IPC_MAKE_CMD_IMPL_HOSVER(Result appletIsHomeButtonShortPressedBlocked(bool *out), &g_appletIAppletCommonFunctions, 52, _appletCmdNoInOutBool, (10,0,0), out) // IDebugFunctions