2018-04-24 13:24:20 +08:00
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <fnd/types.h>
|
2018-04-24 15:51:29 +08:00
|
|
|
#include <fnd/IFile.h>
|
2018-04-24 13:24:20 +08:00
|
|
|
#include <nx/PfsHeader.h>
|
|
|
|
|
|
|
|
#include "nstool.h"
|
|
|
|
|
|
|
|
class PfsProcess
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PfsProcess();
|
2018-05-12 23:02:53 +08:00
|
|
|
~PfsProcess();
|
2018-04-24 13:24:20 +08:00
|
|
|
|
|
|
|
void process();
|
|
|
|
|
|
|
|
// generic
|
2018-05-12 23:02:53 +08:00
|
|
|
void setInputFile(fnd::IFile* file, size_t offset, size_t size);
|
2018-04-24 13:24:20 +08:00
|
|
|
void setCliOutputMode(CliOutputType type);
|
|
|
|
void setVerifyMode(bool verify);
|
|
|
|
|
|
|
|
// pfs specific
|
|
|
|
void setMountPointName(const std::string& mount_name);
|
|
|
|
void setExtractPath(const std::string& path);
|
|
|
|
void setListFs(bool list_fs);
|
|
|
|
|
|
|
|
const nx::PfsHeader& getPfsHeader() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
const std::string kModuleName = "PfsProcess";
|
|
|
|
static const size_t kFileExportBlockSize = 0x1000000;
|
|
|
|
|
|
|
|
fnd::IFile* mReader;
|
|
|
|
CliOutputType mCliOutputType;
|
|
|
|
bool mVerify;
|
|
|
|
|
|
|
|
std::string mExtractPath;
|
|
|
|
bool mExtract;
|
|
|
|
std::string mMountName;
|
|
|
|
bool mListFs;
|
|
|
|
|
|
|
|
nx::PfsHeader mPfs;
|
|
|
|
|
|
|
|
void displayHeader();
|
|
|
|
void displayFs();
|
|
|
|
size_t determineHeaderSize(const nx::sPfsHeader* hdr);
|
2018-05-11 23:47:31 +08:00
|
|
|
bool validateHeaderMagic(const nx::sPfsHeader* hdr);
|
2018-04-24 13:24:20 +08:00
|
|
|
void validateHfs();
|
|
|
|
void extractFs();
|
|
|
|
};
|