CTR-Pia  5.4.3
Game Communication Engine
 全て クラス ネームスペース 関数 変数 型定義 列挙型 列挙型の値 ページ
pia_BasicMacrosNin.h
1 /*--------------------------------------------------------------------------------*
2  Copyright (C)Nintendo All rights reserved.
3 
4  These coded instructions, statements, and computer programs contain proprietary
5  information of Nintendo and/or its licensed developers and are protected by
6  national and international copyright laws. They may not be disclosed to third
7  parties or copied or duplicated in any form, in whole or in part, without the
8  prior written consent of Nintendo.
9 
10  The content herein is highly confidential and should be handled accordingly.
11  *--------------------------------------------------------------------------------*/
12 
13 
14 // 基本マクロです。
15 
16 #pragma once
17 
18 #include <nn/pia/pia_Settings.h>
19 
20 #if NN_PIA_NINTENDOSDK
21 
22 #include <stdio.h>
23 #include <nn/nn_Log.h>
24 #include <nn/util/util_FormatString.h>
25 
26 #define PIA_DIRECT_PRINT_ALWAYS(...) NN_LOG(__VA_ARGS__)
27 #define PIA_DIRECT_VPRINT_ALWAYS NN_VLOG
28 
29 #if NN_PIA_UNDER_DEVELOP
30 #define PIA_DIRECT_PRINT(...) PIA_DIRECT_PRINT_ALWAYS(__VA_ARGS__)
31 #define PIA_DIRECT_VPRINT(...) PIA_DIRECT_VPRINT_ALWAYS(__VA_ARGS__)
32 #else
33 #define PIA_DIRECT_PRINT(...) (void)0
34 #define PIA_DIRECT_VPRINT(...) (void)0
35 #endif
36 
37 #if NN_PIA_UNDER_DEVELOP
38 namespace nn
39 {
40 namespace pia
41 {
42 namespace common
43 {
44 void VPrintf(const char* cpFormat, va_list varg);
45 void Printf(const char* cpFormat, ...);
46 }
47 }
48 }
49 #define PIA_HOOK_PRINT(...) ::nn::pia::common::Printf(__VA_ARGS__)
50 #define PIA_HOOK_VPRINT(...) ::nn::pia::common::VPrintf(__VA_ARGS__)
51 
52 #else
53 #define PIA_HOOK_PRINT(...) (void)0
54 #define PIA_HOOK_VPRINT(...) (void)0
55 #endif
56 
57 #define PIA_BASIC_HALT(...) \
58  PIA_DIRECT_PRINT_ALWAYS(__VA_ARGS__); \
59  { \
60  int* a = NULL; \
61  *a = 0; \
62  }
63 
64 #define PIA_IS_VALID_POINTER(ptr) ((ptr) != NULL)
65 
66 #define PIA_ATTRIBUTE_ALIGN(N) NN_ALIGNAS(N)
67 
68 #define PIA_CODE_POSITION_FILE (strrchr(__FILE__, '/') ? (strrchr(__FILE__, '/') + 1) : strrchr(__FILE__, '\\') ? (strrchr(__FILE__, '\\') + 1) : __FILE__)
69 #define PIA_CODE_POSITION_FUNC __FUNCTION__
70 #define PIA_CODE_POSITION_LINE __LINE__
71 
72 #define PIA_SNPRINTF(...) nn::util::SNPrintf(__VA_ARGS__)
73 
74 #endif //PLATFORM