mirror of
https://github.com/rvtr/ctr_Repair.git
synced 2025-10-31 13:51:08 -04:00
git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_Repair@548 385bec56-5757-e545-9c3a-d8741f4650f1
79 lines
3.3 KiB
C++
79 lines
3.3 KiB
C++
/*---------------------------------------------------------------------------*
|
|
Project: Horizon
|
|
File: SdReaderWriter.h
|
|
|
|
Copyright 2009 Nintendo. All rights reserved.
|
|
|
|
These coded instructions, statements, and computer programs contain
|
|
proprietary information of Nintendo of America Inc. and/or Nintendo
|
|
Company Ltd., and are protected by Federal copyright law. They may
|
|
not be disclosed to third parties or copied or duplicated in any form,
|
|
in whole or in part, without the prior written consent of Nintendo.
|
|
|
|
$Rev$
|
|
*---------------------------------------------------------------------------*/
|
|
|
|
#ifndef SDWRITER_H_
|
|
#define SDWRITER_H_
|
|
|
|
#include <nn.h>
|
|
|
|
namespace common
|
|
{
|
|
|
|
//! @brief SDカードに書き込むためのクラスです。
|
|
class SdReaderWriter
|
|
{
|
|
public :
|
|
SdReaderWriter() : m_IsInitialized(false) {};
|
|
~SdReaderWriter() {};
|
|
|
|
//! @brief 渡されたバッファからsizeバイト指定されたパス名で書きこみます。CMACが付加されます。
|
|
//! @param[in] path sdmc:で始まる出力パス名。予めディレクトリを作っておく必要があります。
|
|
//! @param[in] buf 入力データへのポインタ
|
|
//! @param[in] size 入力データのサイズ
|
|
nn::Result WriteBufWithCmac(const wchar_t* path, void* buf, size_t size);
|
|
|
|
//! @brief 渡されたバッファへ(size - CMAC)バイト指定されたパス名から読み込みます
|
|
//! @param[in] path sdmc:で始まるCMAC付きの入力パス名
|
|
//! @param[in] buf 出力バッファへのポインタ
|
|
//! @param[in] size バッファサイズ
|
|
//! @param[out] totalSize 読み込んだデータ - CMAC のサイズ
|
|
nn::Result ReadBufWithCmac(const wchar_t* path, void* buf, size_t size, size_t* totalSize);
|
|
|
|
//! @brief 渡されたディレクトリ名のディレクトリを作成します
|
|
nn::Result CreateDirectory(const wchar_t* path);
|
|
|
|
private:
|
|
//! @brief 渡されたバッファからサイズ分指定されたパス名で書きこみます
|
|
//! @param[in] path sdmc:で始まる出力パス名。予めディレクトリを作っておく必要があります。
|
|
//! @param[in] buf 入力データへのポインタ
|
|
//! @param[in] size 入力データのサイズ
|
|
nn::Result WriteBuf(nn::fs::FileStream& file, const wchar_t* path, void* buf, size_t size);
|
|
|
|
nn::Result WriteBufCore(nn::fs::FileStream& file, const wchar_t*path, void* buf, size_t size);
|
|
|
|
//! @brief 渡されたバッファへサイズ分指定されたパス名から読み込みます
|
|
//! @param[in] path sdmc:で始まる入力パス名
|
|
//! @param[in] buf 出力バッファへのポインタ
|
|
//! @param[in] size バッファサイズ
|
|
//! @param[out] totalSize 読み込んだデータのサイズ
|
|
nn::Result ReadBuf(nn::fs::FileStream& file, const wchar_t* path, void* buf, size_t size, size_t* totalSize);
|
|
|
|
nn::Result ReadBufCore(nn::fs::FileStream& file, const wchar_t* path, void* buf, size_t size, size_t* totalSize);
|
|
|
|
//! @brief 初期化します。
|
|
nn::Result Initialize();
|
|
|
|
//! @brief 終了します。
|
|
nn::Result Finalize();
|
|
|
|
NN_PADDING3;
|
|
bool m_IsInitialized;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif /* SDWRITER_H_ */
|