libnx  v4.6.0
detect.h
Go to the documentation of this file.
1 /**
2  * @file detect.h
3  * @brief Kernel capability detection
4  * @author plutoo
5  * @copyright libnx Authors
6  */
7 #pragma once
8 #include "../types.h"
9 #include "../result.h"
10 #include "svc.h"
11 
12 /// Returns true if the process has a debugger attached.
14  u64 tmp = 0;
16  return R_SUCCEEDED(rc) && tmp != 0;
17 }
18 
19 /// Returns true if the underlying kernel is Mesosphère.
21  u64 dummy = 0;
22  Result rc = svcGetInfo(&dummy, 65000, INVALID_HANDLE, 0); // InfoType_MesosphereMeta
23  return R_SUCCEEDED(rc);
24 }
static bool detectMesosphere(void)
Returns true if the underlying kernel is Mesosphère.
Definition: detect.h:20
static bool detectDebugger(void)
Returns true if the process has a debugger attached.
Definition: detect.h:13
#define R_SUCCEEDED(res)
Checks whether a result code indicates success.
Definition: result.h:10
Wrappers for kernel syscalls.
@ InfoType_DebuggerAttached
Whether current process is being debugged.
Definition: svc.h:193
Result svcGetInfo(u64 *out, u32 id0, Handle handle, u64 id1)
Retrieves information about the system, or a certain kernel object.
#define NX_INLINE
Flags a function as (always) inline.
Definition: types.h:86
uint64_t u64
64-bit unsigned integer.
Definition: types.h:22
#define INVALID_HANDLE
Invalid handle.
Definition: types.h:96
u32 Result
Function error code result type.
Definition: types.h:44