nlib
Config_ctr.h
1 
2 #pragma once
3 #ifndef INCLUDE_NN_NLIB_CONFIG_CTR_H_
4 #define INCLUDE_NN_NLIB_CONFIG_CTR_H_
5 #ifndef INCLUDE_NN_NLIB_CONFIG_H_
6 # error do not include directly
7 #endif
8 
9 #ifdef NN_PLATFORM_CTR
10 
11 #include "nn/assert.h" // NOLINT for NN_ASSERT
12 
13 extern bool nlib_init_ctrsample(bool useFs);
14 extern void nlib_terminate_ctrsample();
15 
16 #ifdef NLIB_CTR_SAMPLE_USEFILE
17 # define NLIB_CTR_SAMPLE_INIT_ARG true
18 #else
19 # define NLIB_CTR_SAMPLE_INIT_ARG false
20 #endif
21 
22 #define NLIB_PATHMAPPER_FORSAMPLE \
23  nlib_ns::NativePathMapper g_PathMapper; \
24  inline void InitPathMapperForSample() { \
25  g_PathMapper.AddMap("rom:/", "nlibpath:
26  g_PathMapper.AddMap("sdmc:/", "nlibpath:
27  }
28 
29 #define NLIB_MAINFUNC \
30 extern "C" void nnMain() { \
31  if (!nlib_init_ctrsample(NLIB_CTR_SAMPLE_INIT_ARG)) return; \
32  bool result = SampleMain(0, NULL); \
33  nlib_printf(result ? "OK\n" : "NG\n"); \
34  nlib_terminate_ctrsample(); \
35 }
36 
37 #define NLIB_ASSERT NN_ASSERT
38 #define NLIB_ASSERT_NOERR(e) NN_ASSERTMSG(((e) == 0), "%s", nlib_error_string(e))
39 
40 #define NLIB_ALIGNAS(x) __align(x)
41 #define NLIB_ALIGNOF(tp) __alignof__(tp)
42 
43 template<class T> inline void nlib_unused_(const T&) {}
44 #define NLIB_UNUSED(x) ::nlib_unused_(x)
45 
46 #define NLIB_HAS_VIRTUALMEMORY
47 #define NLIB_HAS_STDHEADER_TIME
48 
49 #endif
50 #endif // INCLUDE_NN_NLIB_CONFIG_CTR_H_