2018-04-24 05:24:20 +00:00
|
|
|
#pragma once
|
2021-09-28 11:15:54 +00:00
|
|
|
#include "types.h"
|
2021-10-02 14:57:35 +00:00
|
|
|
#include "FsProcess.h"
|
2021-09-28 11:15:54 +00:00
|
|
|
|
2018-10-27 05:43:57 +00:00
|
|
|
#include <nn/hac/PartitionFsHeader.h>
|
2018-04-24 05:24:20 +00:00
|
|
|
|
2021-09-28 11:15:54 +00:00
|
|
|
namespace nstool {
|
2018-04-24 05:24:20 +00:00
|
|
|
|
|
|
|
class PfsProcess
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PfsProcess();
|
|
|
|
|
|
|
|
// generic
|
2021-09-28 11:15:54 +00:00
|
|
|
void setInputFile(const std::shared_ptr<tc::io::IStream>& file);
|
2018-06-18 15:30:19 +00:00
|
|
|
void setCliOutputMode(CliOutputMode type);
|
2018-04-24 05:24:20 +00:00
|
|
|
void setVerifyMode(bool verify);
|
|
|
|
|
2021-10-08 10:05:51 +00:00
|
|
|
// fs specific
|
|
|
|
void setShowFsTree(bool show_fs_tree);
|
|
|
|
void setFsRootLabel(const std::string& root_label);
|
|
|
|
void setExtractJobs(const std::vector<nstool::ExtractJob>& extract_jobs);
|
2018-04-24 05:24:20 +00:00
|
|
|
|
2021-10-08 10:05:51 +00:00
|
|
|
void process();
|
|
|
|
|
|
|
|
// post process() get PFS/FS out
|
2018-10-27 05:43:57 +00:00
|
|
|
const nn::hac::PartitionFsHeader& getPfsHeader() const;
|
2021-10-02 14:57:35 +00:00
|
|
|
const std::shared_ptr<tc::io::IStorage>& getFileSystem() const;
|
2018-04-24 05:24:20 +00:00
|
|
|
|
|
|
|
private:
|
2018-05-27 10:17:34 +00:00
|
|
|
static const size_t kCacheSize = 0x10000;
|
2018-04-24 05:24:20 +00:00
|
|
|
|
2021-10-02 14:53:21 +00:00
|
|
|
std::string mModuleName;
|
|
|
|
|
2021-09-28 11:15:54 +00:00
|
|
|
std::shared_ptr<tc::io::IStream> mFile;
|
2018-06-18 15:30:19 +00:00
|
|
|
CliOutputMode mCliOutputMode;
|
2018-04-24 05:24:20 +00:00
|
|
|
bool mVerify;
|
|
|
|
|
2018-10-27 05:43:57 +00:00
|
|
|
nn::hac::PartitionFsHeader mPfs;
|
2018-04-24 05:24:20 +00:00
|
|
|
|
2021-10-02 14:57:35 +00:00
|
|
|
std::shared_ptr<tc::io::IStorage> mFileSystem;
|
|
|
|
FsProcess mFsProcess;
|
2021-10-08 10:05:51 +00:00
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
size_t determineHeaderSize(const nn::hac::sPfsHeader* hdr);
|
|
|
|
bool validateHeaderMagic(const nn::hac::sPfsHeader* hdr);
|
2021-09-28 11:15:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|