1 /*---------------------------------------------------------------------------* 2 3 Copyright (C) Nintendo. All rights reserved. 4 5 These coded instructions, statements, and computer programs contain 6 proprietary information of Nintendo of America Inc. and/or Nintendo 7 Company Ltd., and are protected by Federal copyright law. They may 8 not be disclosed to third parties or copied or duplicated in any form, 9 in whole or in part, without the prior written consent of Nintendo. 10 11 *---------------------------------------------------------------------------*/ 12 13 #ifndef NN_EC_TYPES_H_ 14 #define NN_EC_TYPES_H_ 15 16 #include <types.h> 17 #include <nn/ec/ec_Result.h> 18 #include <nn/ec/ec_RootObject.h> 19 #include <nn/ec/ec_NonCopyable.h> 20 21 // EC library version. 22 #define NN_EC_VERSION 0x0104 23 24 namespace nn { namespace ec { 25 26 //! @addtogroup nn_ec_constant 27 //! @{ 28 29 /*! 30 @brief Specifies the width of an icon. 31 */ 32 static const size_t ICON_IMAGE_WIDTH = 160; 33 /*! 34 @brief Specifies the height of an icon. 35 */ 36 static const size_t ICON_IMAGE_HEIGHT = 160; 37 /*! 38 @brief Specifies the size of an icon. 39 */ 40 static const size_t ICON_IMAGE_SIZE = ICON_IMAGE_WIDTH * ICON_IMAGE_HEIGHT; 41 42 /*! 43 @brief Specifies the length of a download code. 44 */ 45 static const size_t DOWNLOAD_CODE_LENGTH = 16; 46 /*! 47 @brief Specifies the size of a download code. 48 */ 49 static const size_t DOWNLOAD_CODE_SIZE = DOWNLOAD_CODE_LENGTH + 1; 50 51 /*! 52 @brief Specifies the maximum number of variations. 53 */ 54 static const u32 VARIATION_NUM_MAX = 256; 55 56 /*! 57 @brief Specifies the maximum length of a server error title. 58 */ 59 static const size_t SERVER_ERROR_TITLE_LENGTH_MAX = 8; 60 /*! 61 @brief Specifies the size of a server error title. 62 */ 63 static const size_t SERVER_ERROR_TITLE_SIZE = SERVER_ERROR_TITLE_LENGTH_MAX + 1; 64 /*! 65 @brief Specifies the maximum length of a server error message. 66 */ 67 static const size_t SERVER_ERROR_MESSAGE_LENGTH_MAX = 512; 68 /*! 69 @brief Specifies the size of a server error message. 70 */ 71 static const size_t SERVER_ERROR_MESSAGE_SIZE = SERVER_ERROR_MESSAGE_LENGTH_MAX + 1; 72 73 /*! 74 @brief Enumerates sale statuses. 75 */ 76 enum SalesStatus 77 { 78 SALES_STATUS_UNKNOWN = 0, //!< Unknown. 79 SALES_STATUS_UNRELEASED = 1, //!< Not released. 80 SALES_STATUS_ONSALE = 2, //!< On sale. 81 SALES_STATUS_SALES_TERMINATION = 3, //!< No longer on sale. 82 83 SALES_STATUS_MAX, 84 SALES_STATUS_FORCE_S32 = 0x7FFFFFFF 85 }; 86 87 /*! 88 @brief Enumerates the sales status filters. 89 */ 90 enum SalesStatusFilter 91 { 92 SALES_STATUS_FILTER_ALL = 0, //!< Specifies that all items are included in the search. 93 SALES_STATUS_FILTER_ONSALE = 2, //!< Specifies that only items currently on sale are included in the search. 94 95 SALES_STATUS_FILTER_MAX, 96 SALES_STATUS_FILTER_FORCE_S32 = 0x7FFFFFFF 97 }; 98 99 /*! 100 @brief Enumerates download types. 101 */ 102 enum DownloadType 103 { 104 DOWNLOAD_TYPE_ICON = 100, //!< Icon. 105 106 DOWNLOAD_TYPE_PROMOTION_IMAGE_BASE = 200, //!< Base value for the promotional image index. 107 DOWNLOAD_TYPE_PROMOTION_IMAGE_1 = DOWNLOAD_TYPE_PROMOTION_IMAGE_BASE + 1, //!< Promotional image 1. 108 DOWNLOAD_TYPE_PROMOTION_IMAGE_2 = DOWNLOAD_TYPE_PROMOTION_IMAGE_BASE + 2, //!< Promotional image 2. 109 DOWNLOAD_TYPE_PROMOTION_IMAGE_3 = DOWNLOAD_TYPE_PROMOTION_IMAGE_BASE + 3, //!< Promotional image 3. 110 DOWNLOAD_TYPE_PROMOTION_IMAGE_4 = DOWNLOAD_TYPE_PROMOTION_IMAGE_BASE + 4, //!< Promotional image 4. 111 DOWNLOAD_TYPE_PROMOTION_IMAGE_5 = DOWNLOAD_TYPE_PROMOTION_IMAGE_BASE + 5, //!< Promotional image 5. 112 DOWNLOAD_TYPE_PROMOTION_IMAGE_6 = DOWNLOAD_TYPE_PROMOTION_IMAGE_BASE + 6, //!< Promotional image 6. 113 DOWNLOAD_TYPE_PROMOTION_IMAGE_7 = DOWNLOAD_TYPE_PROMOTION_IMAGE_BASE + 7, //!< Promotional image 7. 114 DOWNLOAD_TYPE_PROMOTION_IMAGE_8 = DOWNLOAD_TYPE_PROMOTION_IMAGE_BASE + 8, //!< Promotional image 8. 115 DOWNLOAD_TYPE_PROMOTION_IMAGE_MAX = DOWNLOAD_TYPE_PROMOTION_IMAGE_BASE + 9, 116 117 // DOWNLOAD_TYPE_PROMOTION_DATA_BASE = 300, 118 // DOWNLOAD_TYPE_PROMOTION_DATA_1 = DOWNLOAD_TYPE_PROMOTION_DATA_BASE + 1, 119 // DOWNLOAD_TYPE_PROMOTION_DATA_2 = DOWNLOAD_TYPE_PROMOTION_DATA_BASE + 2, 120 // DOWNLOAD_TYPE_PROMOTION_DATA_MAX = DOWNLOAD_TYPE_PROMOTION_DATA_BASE + 3, 121 122 DOWNLOAD_TYPE_FORCE_S32 = 0x7FFFFFFF 123 }; 124 125 /*! 126 @brief Enumerates download statuses. 127 */ 128 enum DownloadStatus 129 { 130 DOWNLOAD_STATUS_NONE = 0, //!< Download is not requested. 131 DOWNLOAD_STATUS_WAITING = 1, //!< Waiting for download. 132 DOWNLOAD_STATUS_DOWNLOADING = 2, //!< Downloading. 133 DOWNLOAD_STATUS_COMPLETED = 3, //!< Download complete. 134 DOWNLOAD_STATUS_FAILED = 4, //!< Download failed. 135 136 DOWNLOAD_STATUS_MAX, 137 DOWNLOAD_STATUS_FORCE_S32 = 0x7FFFFFFF 138 }; 139 140 /*! 141 @brief Enumerates positions of the download queue. 142 */ 143 enum QueuePosition 144 { 145 QUEUE_POSITION_HEAD = 0, //!< Front of the queue. 146 QUEUE_POSITION_TAIL = 1, //!< End of the queue. 147 148 QUEUE_POSITION_MAX, 149 QUEUE_POSITION_FORCE_S32 = 0x7FFFFFFF 150 }; 151 152 /*! 153 @private 154 @brief Enumerates platform types. 155 */ 156 enum PlatformType 157 { 158 PLATFORM_TYPE_WII_U = 1, //!< Wii U. 159 PLATFORM_TYPE_3DS = 2, //!< Nintendo 3DS. 160 161 PLATFORM_TYPE_MAX, 162 PLATFORM_TYPE_FORCE_S32 = 0x7FFFFFFF 163 }; 164 165 /*! 166 @brief Defines a Nintendo Shop Unique ID (NS-UID). 167 */ 168 typedef s64 NsUniqueId; 169 170 /*! 171 @brief Defines a function that allocates memory. 172 */ 173 typedef void* (*AllocateFunction)(size_t size, s32 alignment); 174 175 /*! 176 @brief Defines a function that releases memory. 177 */ 178 typedef void (*FreeFunction)(void* pMemory); 179 180 /*! 181 @brief Defines a download callback. 182 183 The type of <tt>pObject</tt> depends on the download type. 184 185 @li <tt>DOWNLOAD_TYPE_ICON</tt>@n 186 The type is <tt>const Item*</tt>. 187 @li <tt>DOWNLOAD_TYPE_PROMOTION_IMAGE_1</tt> to <tt>DOWNLOAD_TYPE_PROMOTION_IMAGE_N</tt>@n 188 The type is <tt>const Item*</tt>. 189 */ 190 typedef void (*DownloadCallback)(DownloadType downloadType, nn::Result result, const void* pObject, void* pContext); 191 192 //! @} 193 194 //! @addtogroup nn_ec_class 195 //! @{ 196 197 /*! 198 @brief Structure for handling an icon. 199 */ 200 struct Icon 201 { 202 u32 data[ICON_IMAGE_SIZE]; //!< R8G8B8A8 data array. 203 }; 204 205 //! @} 206 207 }} // namespace nn::ec 208 209 // internal: 210 #define NN_EC_DECLARE_ACCESSOR friend class InternalAccessor 211 // internal: 212 #define NN_EC_DECLARE_IMPL class Impl 213 // internal: 214 #define NN_EC_IMPL mutable Impl* m_pImpl 215 216 #endif // NN_EC_TYPES_H_ 217