From 44f52b445e9154a18fc0e99b9efc6be78b859495 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Mon, 27 May 2019 11:42:33 -0700 Subject: [PATCH] libstrat: add IsEmunand() helper --- include/stratosphere/utilities.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/stratosphere/utilities.hpp b/include/stratosphere/utilities.hpp index 98ccdccf..51b82c95 100644 --- a/include/stratosphere/utilities.hpp +++ b/include/stratosphere/utilities.hpp @@ -118,6 +118,23 @@ static inline bool ShouldBlankProdInfo() { return should_blank_prodinfo; } +static inline Result GetEmunandConfig(u64 *out) { + u64 tmp = 0; + Result rc = SmcGetConfig((SplConfigItem)65100, &tmp); + if (R_SUCCEEDED(rc)) { + *out = tmp; + } + return rc; +} + +static inline bool IsEmunand() { + u64 emunand; + if (R_FAILED(GetEmunandConfig(&emunand))) { + std::abort(); + } + return emunand != 0; +} + HosRecursiveMutex &GetSmSessionMutex(); HosRecursiveMutex &GetSmMitmSessionMutex();