nlib
Config_ctr.h
1
2
/*--------------------------------------------------------------------------------*
3
Project: CrossRoad
4
Copyright (C)Nintendo All rights reserved.
5
6
These coded instructions, statements, and computer programs contain proprietary
7
information of Nintendo and/or its licensed developers and are protected by
8
national and international copyright laws. They may not be disclosed to third
9
parties or copied or duplicated in any form, in whole or in part, without the
10
prior written consent of Nintendo.
11
12
The content herein is highly confidential and should be handled accordingly.
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
nlib_ns::NativePathMapper& g_PathMapper = g_pathmapper; \
38
inline void InitPathMapperForSample() { \
39
g_pathmapper.AddMap("rom:/", "nlibpath:
40
g_pathmapper.AddMap("sdmc:/", "nlibpath:
41
}
42
43
#define NLIB_MAINFUNC \
44
extern "C" void nnMain() { \
45
if (!nlib_init_ctrsample(NLIB_CTR_SAMPLE_INIT_ARG)) return; \
46
bool result = SampleMain(0, NULL); \
47
nlib_printf(result ? "OK\n" : "NG\n"); \
48
nlib_terminate_ctrsample(); \
49
}
50
51
#define NLIB_ASSERT NN_ASSERT
52
#define NLIB_ASSERT_NOERR(e) NN_ASSERTMSG(((e) == 0), "%s", nlib_error_string(e))
53
54
#define NLIB_ALIGNAS(x) __align(x)
55
#define NLIB_ALIGNOF(tp) __alignof__(tp)
56
57
#ifdef NLIB_UNUSED
58
#undef NLIB_UNUSED
59
#endif
60
template
<
class
T>
inline
void
nlib_unused_(
const
T&) {}
61
#define NLIB_UNUSED(x) ::nlib_unused_(x)
62
63
#define NLIB_HAS_VIRTUALMEMORY
64
65
#define NLIB_OVERRIDE_NEW \
66
static void* operator new(size_t size) throw(std::bad_alloc); \
67
static void operator delete(void* ptr) throw(); \
68
static void* operator new(size_t size, void* ptr) throw(); \
69
static void* operator new(size_t size, const std::nothrow_t& nt) throw()
70
71
#define NLIB_OVERRIDE_NEW_LIBNEW_CPP(type) \
72
void* type::operator new(size_t size) throw(std::bad_alloc) { return ::operator new(size); } \
73
void type::operator delete(void* ptr) throw() { ::operator delete(ptr); } \
74
void* type::operator new(size_t size, void* ptr) throw() { \
75
return ::operator new(size, ptr); \
76
} \
77
void* type::operator new(size_t size, const std::nothrow_t& nt) throw() { \
78
return ::operator new(size, nt); \
79
}
80
81
#endif
82
#endif // INCLUDE_NN_NLIB_CONFIG_CTR_H_
© 2012-2017 Nintendo Co., Ltd. All rights reserved.