From 297e9d97a0364698e6be2327852efb4487ae98dd Mon Sep 17 00:00:00 2001 From: yellows8 Date: Wed, 13 Nov 2019 20:07:26 -0500 Subject: [PATCH] Added appletGetSettingsPlatformRegion/appletSetHdcpAuthenticationActivated and improved docs. --- nx/include/switch/services/applet.h | 15 +++++++++++++++ nx/include/switch/services/set.h | 1 + nx/source/services/applet.c | 11 +++++++++++ 3 files changed, 27 insertions(+) diff --git a/nx/include/switch/services/applet.h b/nx/include/switch/services/applet.h index 3a78d632..d9d784fe 100644 --- a/nx/include/switch/services/applet.h +++ b/nx/include/switch/services/applet.h @@ -14,6 +14,7 @@ #include "../services/pm.h" #include "../services/ncm_types.h" #include "../services/acc.h" +#include "../services/set.h" #include "../kernel/tmem.h" #include "../kernel/event.h" #include "../nacp.h" @@ -556,6 +557,13 @@ Result appletGetCurrentPerformanceConfiguration(u32 *PerformanceConfiguration); */ Result appletGetOperationModeSystemInfo(u32 *info); +/** + * @brief This uses \ref setsysGetPlatformRegion internally. + * @note Only available with [9.0.0+]. + * @param[out] out \ref SetSysPlatformRegion + */ +Result appletGetSettingsPlatformRegion(SetSysPlatformRegion *out); + ///@} ///@name ISelfController @@ -1457,6 +1465,13 @@ Result appletRestartProgram(const void* buffer, size_t size); */ Result appletGetPreviousProgramIndex(s32 *programIndex); +/** + * @brief SetHdcpAuthenticationActivated + * @note Only available with AppletType_*Application on [9.0.0+]. + * @param[in] flag Whether HdcpAuthentication is activated. + */ +Result appletSetHdcpAuthenticationActivated(bool flag); + /** * @brief CreateMovieMaker. Do not use this directly, use \ref grcCreateMovieMaker instead. * @note Only available with AppletType_*Application on [5.0.0+]. diff --git a/nx/include/switch/services/set.h b/nx/include/switch/services/set.h index dabc5f2d..d4d7a201 100644 --- a/nx/include/switch/services/set.h +++ b/nx/include/switch/services/set.h @@ -439,6 +439,7 @@ Result setsysGetHomeMenuScheme(SetSysHomeMenuScheme *out); /** * @brief Gets the \ref SetSysPlatformRegion. + * @note This is used internally by \ref appletGetSettingsPlatformRegion. * @note Only available on [9.0.0+]. * @param[out] out \ref SetSysPlatformRegion */ diff --git a/nx/source/services/applet.c b/nx/source/services/applet.c index dd9cf6f9..b171656c 100644 --- a/nx/source/services/applet.c +++ b/nx/source/services/applet.c @@ -962,6 +962,16 @@ IPC_MAKE_CMD_IMPL_HOSVER(Result appletSetPerformanceConfigurationChangedNotifica IPC_MAKE_CMD_IMPL_HOSVER(Result appletGetCurrentPerformanceConfiguration(u32 *PerformanceConfiguration), &g_appletICommonStateGetter, 91, _appletCmdNoInOutU32, (7,0,0), PerformanceConfiguration) IPC_MAKE_CMD_IMPL_HOSVER(Result appletGetOperationModeSystemInfo(u32 *info), &g_appletICommonStateGetter, 200, _appletCmdNoInOutU32, (7,0,0), info) +Result appletGetSettingsPlatformRegion(SetSysPlatformRegion *out) { + if (hosversionBefore(9,0,0)) + return MAKERESULT(Module_Libnx, LibnxError_IncompatSysVer); + + u8 tmp=0; + Result rc = _appletCmdNoInOutU8(&g_appletICommonStateGetter, &tmp, 300); + if (R_SUCCEEDED(rc) && out) *out = tmp; + return rc; +} + // ISelfController IPC_MAKE_CMD_IMPL(static Result _appletSelfExit(void), &g_appletISelfController, 0, _appletCmdNoIO) @@ -2219,6 +2229,7 @@ Result appletRestartProgram(const void* buffer, size_t size) { } IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletGetPreviousProgramIndex(s32 *programIndex), &g_appletIFunctions, 123, _appletCmdNoInOutU32, !_appletIsApplication(), (5,0,0), (u32*)programIndex) +IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletSetHdcpAuthenticationActivated(bool flag), &g_appletIFunctions, 170, _appletCmdInBoolNoOut, !_appletIsApplication(), (9,0,0), flag) IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletCreateMovieMaker(Service* srv_out, TransferMemory *tmem), &g_appletIFunctions, 1000, _appletCmdInTmemOutSession, !_appletIsApplication(), (5,0,0), srv_out, tmem) IPC_MAKE_CMD_IMPL_INITEXPR_HOSVER(Result appletPrepareForJit(void), &g_appletIFunctions, 1001, _appletCmdNoIO, !_appletIsApplication(), (5,0,0))