nlib
Config_ctr.h
1
2
/*---------------------------------------------------------------------------*
3
4
Project: CrossRoad
5
Copyright (C)2012-2016 Nintendo. All rights reserved.
6
7
These coded instructions, statements, and computer programs contain
8
proprietary information of Nintendo of America Inc. and/or Nintendo
9
Company Ltd., and are protected by Federal copyright law. They may
10
not be disclosed to third parties or copied or duplicated in any form,
11
in whole or in part, without the prior written consent of Nintendo.
12
13
*---------------------------------------------------------------------------*/
14
15
#pragma once
16
#ifndef INCLUDE_NN_NLIB_CONFIG_CTR_H_
17
#define INCLUDE_NN_NLIB_CONFIG_CTR_H_
18
#ifndef INCLUDE_NN_NLIB_CONFIG_H_
19
# error do not include directly
20
#endif
21
22
#ifdef NN_PLATFORM_CTR
23
24
#include "nn/assert.h"
// NOLINT for NN_ASSERT
25
26
extern
bool
nlib_init_ctrsample(
bool
useFs);
27
extern
void
nlib_terminate_ctrsample();
28
29
#ifdef NLIB_CTR_SAMPLE_USEFILE
30
# define NLIB_CTR_SAMPLE_INIT_ARG true
31
#else
32
# define NLIB_CTR_SAMPLE_INIT_ARG false
33
#endif
34
35
#define NLIB_PATHMAPPER_FORSAMPLE \
36
nlib_ns::NativePathMapper g_PathMapper; \
37
inline void InitPathMapperForSample() { \
38
g_PathMapper.AddMap("rom:/", "nlibpath:
39
g_PathMapper.AddMap("sdmc:/", "nlibpath:
40
}
41
42
#define NLIB_MAINFUNC \
43
extern "C" void nnMain() { \
44
if (!nlib_init_ctrsample(NLIB_CTR_SAMPLE_INIT_ARG)) return; \
45
bool result = SampleMain(0, NULL); \
46
nlib_printf(result ? "OK\n" : "NG\n"); \
47
nlib_terminate_ctrsample(); \
48
}
49
50
#define NLIB_ASSERT NN_ASSERT
51
#define NLIB_ASSERT_NOERR(e) NN_ASSERTMSG(((e) == 0), "%s", nlib_error_string(e))
52
53
#define NLIB_ALIGNAS(x) __align(x)
54
#define NLIB_ALIGNOF(tp) __alignof__(tp)
55
56
#ifdef NLIB_UNUSED
57
#undef NLIB_UNUSED
58
#endif
59
template
<
class
T>
inline
void
nlib_unused_(
const
T&) {}
60
#define NLIB_UNUSED(x) ::nlib_unused_(x)
61
62
#define NLIB_HAS_VIRTUALMEMORY
63
64
#define NLIB_OVERRIDE_NEW \
65
static void* operator new(size_t size) throw(std::bad_alloc); \
66
static void operator delete(void* ptr) throw(); \
67
static void* operator new(size_t size, void* ptr) throw(); \
68
static void* operator new(size_t size, const std::nothrow_t& nt) throw()
69
70
#define NLIB_OVERRIDE_NEW_LIBNEW_CPP(type) \
71
void* type::operator new(size_t size) throw(std::bad_alloc) { return ::operator new(size); } \
72
void type::operator delete(void* ptr) throw() { ::operator delete(ptr); } \
73
void* type::operator new(size_t size, void* ptr) throw() { \
74
return ::operator new(size, ptr); \
75
} \
76
void* type::operator new(size_t size, const std::nothrow_t& nt) throw() { \
77
return ::operator new(size, nt); \
78
}
79
80
#endif
81
#endif // INCLUDE_NN_NLIB_CONFIG_CTR_H_
© 2012-2016 Nintendo Co., Ltd. All rights reserved.