mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
36 lines
796 B
C
36 lines
796 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(void)
|
|
{
|
|
// 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(void) {
|
|
_CacheValues();
|
|
return g_IsAbove200;
|
|
}
|
|
|
|
bool kernelAbove300(void) {
|
|
_CacheValues();
|
|
return g_IsAbove300;
|
|
}
|
|
|
|
bool kernelAbove400(void) {
|
|
_CacheValues();
|
|
return g_IsAbove400;
|
|
}
|