diff --git a/nx/include/switch/services/applet.h b/nx/include/switch/services/applet.h index 43b2aff4..53f6a7d8 100644 --- a/nx/include/switch/services/applet.h +++ b/nx/include/switch/services/applet.h @@ -301,6 +301,22 @@ Result appletHomeButtonReaderLockAccessorGetEvent(Event *out_event); */ Result appletPushToGeneralChannel(AppletStorage *s); +/** + * @brief Gets whether VrMode is enabled. + * @note Only available with [3.0.0+]. + * @param out Output flag + */ +Result appletIsVrModeEnabled(bool *out); + +/** + * @brief Sets whether VrMode is enabled. + * @note This is only fully usable system-side with [6.0.0+]. + * @note For checking Parental Controls, see \ref pctlIsStereoVisionPermitted. + * @note On pre-7.0.0 this uses cmd SetVrModeEnabled internally, while on [7.0.0+] this uses cmds BeginVrModeEx/EndVrModeEx. + * @param flag Flag + */ +Result appletSetVrModeEnabled(bool flag); + /** * @brief Sets the \ref ApmCpuBoostMode. * @note Only available with [7.0.0+] (not fully usable system-side with 6.x). diff --git a/nx/source/services/applet.c b/nx/source/services/applet.c index 6cd4b3f7..0ee932b8 100644 --- a/nx/source/services/applet.c +++ b/nx/source/services/applet.c @@ -1670,6 +1670,23 @@ Result appletPushToGeneralChannel(AppletStorage *s) { return _appletCmdInStorage(&g_appletICommonStateGetter, s, 20); } +Result appletIsVrModeEnabled(bool *out) { + if (hosversionBefore(3,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + return _appletCmdNoInOutBool(&g_appletICommonStateGetter, out, 50); +} + +Result appletSetVrModeEnabled(bool flag) { + if (hosversionBefore(6,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + if (hosversionBefore(7,0,0)) + return _appletCmdInBool(&g_appletICommonStateGetter, flag, 51); + + return _appletCmdNoIO(&g_appletICommonStateGetter, flag ? 53 : 54); +} + Result appletSetCpuBoostMode(ApmCpuBoostMode mode) { Result rc=0; if (hosversionBefore(7,0,0))