1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: dbg_Argument.h 4 5 Copyright (C)2009-2012 Nintendo Co., Ltd. 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 $Rev:$ 14 *---------------------------------------------------------------------------*/ 15 /* Please see man pages for details 16 17 18 19 20 */ 21 22 #ifndef DBG_ARGUMENT_H_ 23 #define DBG_ARGUMENT_H_ 24 25 #ifdef NN_BUILD_VERBOSE 26 #define NN_CTR_ARG_AVAILABLE 27 #else 28 #ifdef NN_CTR_ARG_AVAILABLE 29 #undef NN_CTR_ARG_AVAILABLE 30 #endif 31 #endif 32 33 // Magic number 34 #define NN_DBG_ARG_MAGIC_NUM (0x597dfbd9UL) // For confirming buffer existence 35 #define NN_DBG_ARG_MAGIC_NUM_ARG (0xfddb597dUL) // For argument 36 37 #ifdef __cplusplus 38 namespace nn { 39 namespace dbg { 40 namespace CTR { 41 42 /* Please see man pages for details 43 44 */ 45 const size_t ArgBufferSize = 0x1000; 46 47 /* Please see man pages for details 48 49 */ 50 const char Argv0String[] = "application"; 51 52 53 // Start argument buffer information (placed at 0x00100ff0, 16 bytes) 54 struct ArgArea 55 { 56 bit32 magic1; // Magic number 57 const void* pArgArea; // Pointer to the buffer region 58 size_t areaSize; // Buffer region size 59 bit32 magic2; // Magic number 60 }; 61 62 // Header for the start argument buffer 63 struct ArgInfoHeader 64 { 65 bit32 magic; // Magic number 66 bit16 argStart; // Position where argument starts 67 bit16 argNum; // Number of arguments 68 bit16 binaryStart; // Position where binary starts 69 bit16 binarySize; // binary size 70 bit32 reserved; 71 }; 72 73 // The argument format is size (2 bytes) and string (including \0) 74 struct ArgvFormat 75 { 76 bit16 size; 77 char string[2]; // The size of 2 is provisional 78 }; 79 80 /* Please see man pages for details 81 82 83 */ 84 //---------------- Acquisition with binary 85 /* Please see man pages for details 86 87 */ 88 const void* GetArgBinary( void ); 89 /* Please see man pages for details 90 91 */ 92 size_t GetArgBinarySize( void ); 93 94 //---------------- Argument acquisition 95 /* Please see man pages for details 96 97 */ 98 int GetArgc( void ); 99 /* Please see man pages for details 100 101 102 */ 103 const char* GetArgv( int n ); 104 105 //---------------- Option string 106 /* Please see man pages for details 107 108 109 */ 110 int GetOpt( const char* optstring ); 111 /* Please see man pages for details 112 113 */ 114 int GetOptInd( void ); 115 /* Please see man pages for details 116 117 */ 118 const char* GetOptArg( void ); 119 /* Please see man pages for details 120 121 */ 122 int GetOptOpt( void ); 123 /* 124 125 */ 126 } 127 } 128 } 129 130 #define NN_DBG_ARG_BUFFER_SIZE (nn::dbg::CTR::ArgBufferSize) 131 #define NN_DBG_ARG_ARGV0_STRING (nn::dbg::CTR::Argv0String) 132 133 #endif // ifdef __cplusplus 134 135 136 #endif // DBG_ARGUMENT_H_ 137 138