2018-04-24 13:24:20 +08:00
|
|
|
#pragma once
|
2021-09-28 19:15:54 +08:00
|
|
|
#include "types.h"
|
|
|
|
|
2018-10-27 13:43:57 +08:00
|
|
|
#include <nn/hac/PartitionFsHeader.h>
|
2018-04-24 13:24:20 +08:00
|
|
|
|
2021-09-28 19:15:54 +08:00
|
|
|
namespace nstool {
|
2018-04-24 13:24:20 +08:00
|
|
|
|
|
|
|
class PfsProcess
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PfsProcess();
|
|
|
|
|
|
|
|
void process();
|
|
|
|
|
|
|
|
// generic
|
2021-09-28 19:15:54 +08:00
|
|
|
void setInputFile(const std::shared_ptr<tc::io::IStream>& file);
|
2018-06-18 23:30:19 +08:00
|
|
|
void setCliOutputMode(CliOutputMode type);
|
2018-04-24 13:24:20 +08:00
|
|
|
void setVerifyMode(bool verify);
|
|
|
|
|
|
|
|
// pfs specific
|
|
|
|
void setMountPointName(const std::string& mount_name);
|
|
|
|
void setExtractPath(const std::string& path);
|
|
|
|
void setListFs(bool list_fs);
|
|
|
|
|
2018-10-27 13:43:57 +08:00
|
|
|
const nn::hac::PartitionFsHeader& getPfsHeader() const;
|
2018-04-24 13:24:20 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
const std::string kModuleName = "PfsProcess";
|
2018-05-27 18:17:34 +08:00
|
|
|
static const size_t kCacheSize = 0x10000;
|
2018-04-24 13:24:20 +08:00
|
|
|
|
2021-09-28 19:15:54 +08:00
|
|
|
std::shared_ptr<tc::io::IStream> mFile;
|
2018-06-18 23:30:19 +08:00
|
|
|
CliOutputMode mCliOutputMode;
|
2018-04-24 13:24:20 +08:00
|
|
|
bool mVerify;
|
|
|
|
|
|
|
|
std::string mExtractPath;
|
|
|
|
bool mExtract;
|
|
|
|
std::string mMountName;
|
|
|
|
bool mListFs;
|
|
|
|
|
2021-09-28 19:15:54 +08:00
|
|
|
tc::ByteData mCache;
|
2018-05-26 21:13:21 +08:00
|
|
|
|
2018-10-27 13:43:57 +08:00
|
|
|
nn::hac::PartitionFsHeader mPfs;
|
2018-04-24 13:24:20 +08:00
|
|
|
|
2018-08-14 01:14:21 +08:00
|
|
|
void importHeader();
|
2018-04-24 13:24:20 +08:00
|
|
|
void displayHeader();
|
|
|
|
void displayFs();
|
2018-08-07 15:17:51 +08:00
|
|
|
size_t determineHeaderSize(const nn::hac::sPfsHeader* hdr);
|
|
|
|
bool validateHeaderMagic(const nn::hac::sPfsHeader* hdr);
|
2018-04-24 13:24:20 +08:00
|
|
|
void validateHfs();
|
|
|
|
void extractFs();
|
2021-09-28 19:15:54 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|