From 6ef26bff1a77e2ac0c9d026024a4f010889a67e6 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sun, 9 Sep 2018 06:52:50 -0700 Subject: [PATCH] Implement kernelAbove600() --- nx/include/switch/kernel/detect.h | 2 ++ nx/source/kernel/detect.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/nx/include/switch/kernel/detect.h b/nx/include/switch/kernel/detect.h index 6d86a09e..9061acce 100644 --- a/nx/include/switch/kernel/detect.h +++ b/nx/include/switch/kernel/detect.h @@ -15,5 +15,7 @@ bool kernelAbove300(void); bool kernelAbove400(void); /// Returns true if the kernel version is equal to or above 5.0.0. bool kernelAbove500(void); +/// Returns true if the kernel version is equal to or above 6.0.0. +bool kernelAbove600(void); /// Returns true if the process has a debugger attached. bool detectDebugger(void); diff --git a/nx/source/kernel/detect.c b/nx/source/kernel/detect.c index 9deadeac..34d1b20c 100644 --- a/nx/source/kernel/detect.c +++ b/nx/source/kernel/detect.c @@ -8,6 +8,7 @@ static bool g_IsAbove200; static bool g_IsAbove300; static bool g_IsAbove400; static bool g_IsAbove500; +static bool g_IsAbove600; static bool g_HasCached = 0; static Mutex g_Mutex; @@ -28,7 +29,9 @@ static void _CacheValues(void) g_IsAbove300 = (svcGetInfo(&tmp, 18, INVALID_HANDLE, 0) != 0xF001); g_IsAbove400 = (svcGetInfo(&tmp, 19, INVALID_HANDLE, 0) != 0xF001); g_IsAbove500 = (svcGetInfo(&tmp, 20, INVALID_HANDLE, 0) != 0xF001); + g_IsAbove600 = (svcGetInfo(&tmp, 21, INVALID_HANDLE, 0) != 0xF001); + g_IsAbove500 |= g_IsAbove600; g_IsAbove400 |= g_IsAbove500; g_IsAbove300 |= g_IsAbove400; g_IsAbove200 |= g_IsAbove300; @@ -58,6 +61,11 @@ bool kernelAbove500(void) { return g_IsAbove500; } +bool kernelAbove600(void) { + _CacheValues(); + return g_IsAbove600; +} + bool detectDebugger(void) { u64 tmp; svcGetInfo(&tmp, 8, 0, 0);