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();
|
|
|
|
|
|
|
|
void process();
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
|
|
|
// pfs specific
|
|
|
|
void setMountPointName(const std::string& mount_name);
|
2021-10-01 09:39:34 +00:00
|
|
|
void setExtractPath(const tc::io::Path& path);
|
2018-04-24 05:24:20 +00:00
|
|
|
void setListFs(bool list_fs);
|
|
|
|
|
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;
|
|
|
|
|
2018-08-13 17:14:21 +00:00
|
|
|
void importHeader();
|
2018-04-24 05:24:20 +00:00
|
|
|
void displayHeader();
|
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
|
|
|
};
|
|
|
|
|
|
|
|
}
|