From eecf2a9d32bf2c992ac1f1d6788237d3b06fa333 Mon Sep 17 00:00:00 2001 From: fincs Date: Thu, 29 Oct 2020 16:52:16 +0100 Subject: [PATCH] Add detectMesosphere() --- nx/include/switch/kernel/detect.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nx/include/switch/kernel/detect.h b/nx/include/switch/kernel/detect.h index a5580aba..3fef6592 100644 --- a/nx/include/switch/kernel/detect.h +++ b/nx/include/switch/kernel/detect.h @@ -6,6 +6,7 @@ */ #pragma once #include "../types.h" +#include "../result.h" #include "svc.h" /// Returns true if the process has a debugger attached. @@ -14,3 +15,10 @@ NX_INLINE bool detectDebugger(void) { Result rc = svcGetInfo(&tmp, InfoType_DebuggerAttached, INVALID_HANDLE, 0); return R_SUCCEEDED(rc) && tmp != 0; } + +/// Returns true if the underlying kernel is Mesosphère. +NX_INLINE bool detectMesosphere(void) { + u64 dummy = 0; + Result rc = svcGetInfo(&dummy, 65000, INVALID_HANDLE, 0); // InfoType_MesosphereMeta + return R_SUCCEEDED(rc); +}