ctr_Repair/trunk/CardSaveData/common/savefile/sdmcwo.h

102 lines
2.8 KiB
C++

/*---------------------------------------------------------------------------*
Project: Horizon
Copyright (C)2009 Nintendo Co., Ltd. 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.
*---------------------------------------------------------------------------*/
//SDKツールのSaveFilerで読める形式でsdmcダイレクトで書き出す
//リードはしない
#ifndef sdmcwo_H_
#define sdmcwo_H_
#include <sstream>
#include <nn/types.h>
#include <nn/Result.h>
#include "../my_defs.h"
#include "savefile.h"
//SDKツールのSaveFiler用の情報ファイル
//-------ources\tools\NandFiler\nandf_Dialog.h 参照
struct FormatParameters
{
size_t m_LimitSize;
size_t m_MaxDir;
size_t m_MaxFile;
s32 m_IconSize;
bit8 *m_pIconData;
bool m_Duplicate;
FormatParameters()
: m_LimitSize(0),m_IconSize(0), m_pIconData(0) {}
//オリジナルはLimitSize不定
};
struct AdditionalInfo
{
bit64 m_Version;
bit64 m_Id;
bit64 m_Reserved[128];//オリジナルは乱数埋
AdditionalInfo()
: m_Version(0), m_Id(0) {}
};
class Sdmcwo: public SaveFileWrite
{
public:
wchar_t DirName[16];
size_t ClasterSize;//SDクラスタサイズ .. Create後有効
size_t FreeSize;//Create直後の空き..Create後有効
private:
bool DelDir(const wchar_t *dir);
std::wstring GetDateName();
std::wstring DateDirName;
wchar_t latestPath_w[MAX_PATH_LENGTH];//dev:filer/UserSaveData/YearMtDtHrMtSc
wchar_t rootPath_w[MAX_PATH_LENGTH];//dev:/filer/UserSaveData/YearMtDtHrMtSc/00000000/
bool created;
public:
bool MountCore()
{
LastNnResult = nn::fs::MountSdmcWriteOnly(devName);
return LastNnResult.IsSuccess();
}
bool GetFreeSize(s64 *size)
{
s64 sz;
LastNnResult = nn::fs::GetSdmcSize(&sz,size);
return LastNnResult.IsSuccess();
}
void Finalize(){CloseW();};
bool Create();
bool Delete();
bool DeleteAll();
bool OpenVnfW(wchar_t *path,s64 size);
bool WriteSys(tArcInfo *ifo);
Sdmcwo(){
strcpy(devName,"sdmcwo:");
ClasterSize = 0;
FreeSize = 0;
DirName[0] = 0;
};
~Sdmcwo(){Finalize();};
};
//Fat違反パス格納データのヘッダ
//直後にデータ配置
//Header+Data,、Header+Data ... と連続して追記してゆく
typedef struct{
wchar_t path[MAX_PATH_LENGTH];
s64 size;
}tVnf;
#endif