1
0
mirror of https://github.com/switchbrew/libnx.git synced 2025-07-14 23:12:15 +02:00
libnx/nx/source/kernel/version.c

36 lines
780 B
C

// Copyright 2017 plutoo
#include <switch.h>
static bool g_IsAbove200;
static bool g_IsAbove300;
static bool g_IsAbove400;
static bool g_HasCached = 0;
static void _CacheValues()
{
// This is actually thread safe, might cache twice but that's fine.
if (!g_HasCached)
{
u64 tmp;
g_IsAbove200 = (svcGetInfo(&tmp, 12, INVALID_HANDLE, 0) != 0xF001);
g_IsAbove300 = (svcGetInfo(&tmp, 18, INVALID_HANDLE, 0) != 0xF001);
g_IsAbove400 = (svcGetInfo(&tmp, 19, INVALID_HANDLE, 0) != 0xF001);
g_HasCached = true;
}
}
bool kernelAbove200() {
_CacheValues();
return g_IsAbove200;
}
bool kernelAbove300() {
_CacheValues();
return g_IsAbove300;
}
bool kernelAbove400() {
_CacheValues();
return g_IsAbove300;
}