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
#ifdef NLIB_UNUSED
44
#undef NLIB_UNUSED
45
#endif
46
template
<
class
T>
inline
void
nlib_unused_(
const
T&) {}
47
#define NLIB_UNUSED(x) ::nlib_unused_(x)
48
49
#define NLIB_HAS_VIRTUALMEMORY
50
51
#define NLIB_OVERRIDE_NEW \
52
static void* operator new(size_t size) throw(std::bad_alloc); \
53
static void operator delete(void* ptr) throw(); \
54
static void* operator new(size_t size, void* ptr) throw(); \
55
static void* operator new(size_t size, const std::nothrow_t& nt) throw()
56
57
#define NLIB_OVERRIDE_NEW_LIBNEW_CPP(type) \
58
void* type::operator new(size_t size) throw(std::bad_alloc) { return ::operator new(size); } \
59
void type::operator delete(void* ptr) throw() { ::operator delete(ptr); } \
60
void* type::operator new(size_t size, void* ptr) throw() { \
61
return ::operator new(size, ptr); \
62
} \
63
void* type::operator new(size_t size, const std::nothrow_t& nt) throw() { \
64
return ::operator new(size, nt); \
65
}
66
67
#endif
68
#endif // INCLUDE_NN_NLIB_CONFIG_CTR_H_
© 2012-2016 Nintendo Co., Ltd. All rights reserved.