2018-04-24 05:24:20 +00:00
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <fnd/types.h>
|
2018-04-24 07:51:29 +00:00
|
|
|
#include <fnd/IFile.h>
|
2018-09-23 03:29:22 +00:00
|
|
|
#include <fnd/SharedPtr.h>
|
2018-10-27 05:43:57 +00:00
|
|
|
#include <nn/hac/PartitionFsHeader.h>
|
2018-04-24 05:24:20 +00:00
|
|
|
|
2018-09-13 11:06:48 +00:00
|
|
|
#include "common.h"
|
2018-04-24 05:24:20 +00:00
|
|
|
|
|
|
|
class PfsProcess
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PfsProcess();
|
|
|
|
|
|
|
|
void process();
|
|
|
|
|
|
|
|
// generic
|
2018-09-23 03:29:22 +00:00
|
|
|
void setInputFile(const fnd::SharedPtr<fnd::IFile>& 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);
|
|
|
|
void setExtractPath(const std::string& path);
|
|
|
|
void setListFs(bool list_fs);
|
|
|
|
|
2018-10-27 05:43:57 +00:00
|
|
|
const nn::hac::PartitionFsHeader& getPfsHeader() const;
|
2018-04-24 05:24:20 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
const std::string kModuleName = "PfsProcess";
|
2018-05-27 10:17:34 +00:00
|
|
|
static const size_t kCacheSize = 0x10000;
|
2018-04-24 05:24:20 +00:00
|
|
|
|
2018-09-23 03:29:22 +00:00
|
|
|
fnd::SharedPtr<fnd::IFile> mFile;
|
2018-06-18 15:30:19 +00:00
|
|
|
CliOutputMode mCliOutputMode;
|
2018-04-24 05:24:20 +00:00
|
|
|
bool mVerify;
|
|
|
|
|
|
|
|
std::string mExtractPath;
|
|
|
|
bool mExtract;
|
|
|
|
std::string mMountName;
|
|
|
|
bool mListFs;
|
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
fnd::Vec<byte_t> mCache;
|
2018-05-26 13:13:21 +00:00
|
|
|
|
2018-10-27 05:43:57 +00:00
|
|
|
nn::hac::PartitionFsHeader mPfs;
|
2018-04-24 05:24:20 +00:00
|
|
|
|
2018-08-13 17:14:21 +00:00
|
|
|
void importHeader();
|
2018-04-24 05:24:20 +00:00
|
|
|
void displayHeader();
|
|
|
|
void displayFs();
|
2018-08-07 07:17:51 +00:00
|
|
|
size_t determineHeaderSize(const nn::hac::sPfsHeader* hdr);
|
|
|
|
bool validateHeaderMagic(const nn::hac::sPfsHeader* hdr);
|
2018-04-24 05:24:20 +00:00
|
|
|
void validateHfs();
|
|
|
|
void extractFs();
|
|
|
|
};
|