1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: hio_Api.h 4 5 Copyright (C)2009 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: 25970 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NN_HIO_CTR_HIO_API_H_ 17 #define NN_HIO_CTR_HIO_API_H_ 18 #ifdef NN_SWITCH_ENABLE_HOST_IO 19 20 /*! @file 21 @brief HIO ライブラリの初期化、終了、バージョン取得、ファイル操作を行う API です。 22 23 */ 24 25 #include <nn/types.h> 26 #include <nn/Result.h> 27 28 namespace nn { 29 namespace hio { 30 namespace CTR { 31 32 //! チャンネルオープンに必要なワークメモリのサイズ 33 const size_t WORKMEMORY_SIZE = (80 * 1024 + 32); 34 35 //! 最大チャンネル数 36 const size_t MAX_CHANNEL_NUM = 12; 37 38 /*! 39 @name Initialize/Finalize 40 41 @{ 42 */ 43 44 /*! 45 @brief HIO ライブラリの初期化処理を行います。ライブラリ利用前に一度呼び出す必要があります。 46 @param[in] pDeviceMemory ライブラリが使用するワークメモリを指定します。ワークメモリは デバイス用のメモリ である必要があり、サイズは @ref WORKMEMORY_SIZE です。 47 @return 処理の結果が返ってきます。 48 49 デバイス用のメモリ領域は、@ref nn::os::GetDeviceMemoryAddress で取得できます。 50 51 */ 52 Result Initialize(void* pDeviceMemory); 53 54 55 /*! 56 @brief HIO ライブラリの終了処理を行います。ライブラリ利用後に一度呼び出す必要があります。 57 @return 処理の結果が返ってきます。 58 */ 59 Result Finalize(); 60 61 /*! 62 @} 63 */ 64 65 /*! 66 @brief ホスト側での HostIO デーモンの起動状態を取得します。 67 @param[out] pIsRunning HostIO デーモンが起動している場合は true が格納されます。 68 @return 処理の結果が返ってきます。 69 */ 70 Result GetHioDaemonStatus(bool* pIsRunning); 71 72 /*! 73 @brief HIO ライブラリのバージョンを取得します。 74 @return HIO ライブラリのバージョン。 75 */ 76 s32 GetVersion(); 77 78 /*! 79 :overload nounicode 80 81 @brief ファイルを削除します。 82 83 @param[in] path ファイル名のパス。 84 85 @return 処理の結果を返します。 86 */ 87 Result DeleteFile(const char* path); 88 89 /*! 90 :overload unicode 91 92 @brief ファイルを削除します。 93 94 @param[in] path ファイル名のパス。 95 96 @return 処理の結果を返します。 97 98 */ 99 Result DeleteFile(const wchar_t* path); 100 101 /*! 102 :overload unicode 103 104 @brief ディレクトリを削除します。 105 ディレクトリが空でない場合失敗します。 106 107 @param[in] path ディレクトリのパス。 108 109 @return 処理の結果を返します。 110 111 */ 112 Result DeleteDirectory(const wchar_t* path); 113 114 /*! 115 :overload nounicode 116 117 @brief ディレクトリを削除します。 118 ディレクトリが空でない場合失敗します。 119 120 @param[in] path ディレクトリのパス。 121 122 @return 処理の結果を返します。 123 124 */ 125 Result DeleteDirectory(const char* path); 126 127 /*! 128 :overload nounicode 129 130 @brief ディレクトリを作成します。 131 132 @param[in] path ディレクトリのパス。 133 134 @return 処理の結果を返します。 135 136 */ 137 Result CreateDirectory(const char* path); 138 139 /*! 140 :overload unicode 141 142 @brief ディレクトリを作成します。 143 144 @param[in] path ディレクトリのパス。 145 146 @return 処理の結果を返します。 147 148 */ 149 Result CreateDirectory(const wchar_t* path); 150 151 152 /*! 153 :overload nounicode 154 155 @brief ファイル名、ディレクトリ名を変更します。 156 157 @param[in] newName 新しい名前。 158 @param[in] oldName 対象のファイル、ディレクトリのパス名。 159 160 @return 処理の結果を返します。 161 162 */ 163 Result Rename(const char* newName, const char* oldName); 164 165 166 /*! 167 :overload unicode 168 169 @brief ファイル名、ディレクトリ名を変更します。 170 171 @param[in] newName 新しい名前。 172 @param[in] oldName 対象のファイル、ディレクトリのパス名。 173 174 @return 処理の結果を返します。 175 176 */ 177 Result Rename(const wchar_t* newName, const wchar_t* oldName); 178 179 /*! 180 :overload nounicode 181 182 @brief カレントディレクトリを取得します。 183 184 @param[out] pLength 実際にコピーしたサイズの格納先。 185 @param[out] buf カレントディレクトリのパスを書き込むバッファ。 186 @param[in] length バッファサイズ。 187 188 @return 処理の結果を返します。 189 190 */ 191 Result GetCurrentDirectory(s32* pLength, char* buf, s32 length); 192 193 194 /*! 195 :overload unicode 196 197 @brief カレントディレクトリを取得します。 198 199 @param[out] pLength 実際にコピーしたサイズの格納先。 200 @param[out] buf カレントディレクトリのパスを書き込むバッファ。 201 @param[in] length バッファサイズ。 202 203 @return 処理の結果を返します。 204 205 */ 206 Result GetCurrentDirectory(s32* pLength, wchar_t* buf, s32 length); 207 208 /*! 209 :overload nounicode 210 211 @brief カレントディレクトリを取得します。 212 213 @param[out] buf カレントディレクトリのパスを書き込むバッファ。 214 @param[in] length バッファサイズ。 215 216 @return 実際にコピーしたサイズを返します。エラーが発生した場合は -1 を返します。 217 218 */ 219 s32 GetCurrentDirectory(char* buf, s32 length); 220 221 /*! 222 :overload unicode 223 224 @brief カレントディレクトリを取得します。 225 226 @param[out] buf カレントディレクトリのパスを書き込むバッファ。 227 @param[in] length バッファサイズ。 228 229 @return 実際にコピーしたサイズを返します。エラーが発生した場合は -1 を返します。 230 231 */ 232 s32 GetCurrentDirectory(wchar_t* buf, s32 length); 233 234 /*! 235 :overload nounicode 236 237 @brief カレントディレクトリを設定します。 238 239 @param[in] path カレントディレクトリとして設定するパスが格納されているバッファ。 240 241 @return 処理の結果を返します。 242 243 */ 244 Result SetCurrentDirectory(const char* path); 245 246 /*! 247 :overload unicode 248 249 @brief カレントディレクトリを設定します。 250 251 @param[in] path カレントディレクトリとして設定するパスが格納されているバッファ。 252 253 @return 処理の結果を返します。 254 255 */ 256 Result SetCurrentDirectory(const wchar_t* path); 257 258 /*! 259 :overload nounicode_withresult 260 261 @brief 環境変数を取得します。 262 263 @param[out] pLength 実際にコピーしたサイズの格納先。 264 @param[out] buf 環境変数の値を格納するバッファ。 265 @param[in] length バッファサイズ。 266 @param[in] name 環境変数名。 267 268 @return 処理の結果を返します。 269 270 */ 271 Result GetEnvironmentVariable(s32* pLength, char* buf, s32 length, const char* name); 272 273 /*! 274 :overload nounicode_noresult 275 276 @brief 環境変数を取得します。 277 278 @param[out] buf 環境変数の値を格納するバッファ。 279 @param[in] length バッファサイズ。 280 @param[in] name 環境変数名。 281 282 @return 実際にコピーしたサイズを返します。エラーが発生した場合は -1 を返します。 283 284 */ 285 s32 GetEnvironmentVariable(char* buf, size_t length, const char* name); 286 287 288 289 290 /*! 291 :overload unicode_withresult 292 293 @brief 環境変数を取得します。 294 295 @param[out] buf 環境変数の値を格納するバッファ。 296 @param[in] length バッファサイズ。 297 @param[in] name 環境変数名。 298 299 @return 実際にコピーしたサイズを返します。エラーが発生した場合は -1 を返します。 300 301 */ 302 Result GetEnvironmentVariable(s32* pLength, wchar_t* buf, s32 length, const wchar_t* name); 303 304 305 /*! 306 :overload unicode_noresult 307 308 @brief 環境変数を取得します。 309 310 @param[out] buf 環境変数の値を格納するバッファ。 311 @param[in] length バッファサイズ。 312 @param[in] name 環境変数名。 313 314 @return 実際にコピーしたサイズを返します。エラーが発生した場合は -1 を返します。 315 316 */ 317 s32 GetEnvironmentVariable(wchar_t* buf, s32 length, const wchar_t* name); 318 319 320 321 322 } 323 } 324 } 325 326 327 #endif // ifdef NN_SWITCH_ENABLE_HOST_IO 328 #endif // ifndef NN_HIO_CTR_HIO_API_H_ 329