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-04-24 05:24:20 +00:00
|
|
|
#include <nx/XciHeader.h>
|
|
|
|
|
|
|
|
#include "nstool.h"
|
|
|
|
|
|
|
|
#include "PfsProcess.h"
|
|
|
|
|
|
|
|
|
|
|
|
class XciProcess
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
XciProcess();
|
2018-05-12 15:02:53 +00:00
|
|
|
~XciProcess();
|
2018-04-24 05:24:20 +00:00
|
|
|
|
|
|
|
void process();
|
|
|
|
|
|
|
|
// generic
|
2018-06-03 08:48:12 +00:00
|
|
|
void setInputFile(fnd::IFile* file, bool ownIFile);
|
2018-04-24 05:24:20 +00:00
|
|
|
void setKeyset(const sKeyset* keyset);
|
2018-06-18 15:30:19 +00:00
|
|
|
void setCliOutputMode(CliOutputMode type);
|
2018-04-24 05:24:20 +00:00
|
|
|
void setVerifyMode(bool verify);
|
|
|
|
|
|
|
|
// xci specific
|
2018-06-03 07:10:47 +00:00
|
|
|
void setPartitionForExtract(const std::string& partition_name, const std::string& extract_path);
|
2018-04-24 05:24:20 +00:00
|
|
|
void setListFs(bool list_fs);
|
|
|
|
|
|
|
|
private:
|
|
|
|
const std::string kModuleName = "XciProcess";
|
|
|
|
const std::string kXciMountPointName = "gamecard:/";
|
|
|
|
|
2018-06-03 08:48:12 +00:00
|
|
|
fnd::IFile* mFile;
|
|
|
|
bool mOwnIFile;
|
2018-04-24 05:24:20 +00:00
|
|
|
const sKeyset* mKeyset;
|
2018-06-18 15:30:19 +00:00
|
|
|
CliOutputMode mCliOutputMode;
|
2018-04-24 05:24:20 +00:00
|
|
|
bool mVerify;
|
|
|
|
|
2018-06-03 07:10:47 +00:00
|
|
|
struct sExtractInfo
|
2018-04-24 05:24:20 +00:00
|
|
|
{
|
2018-06-03 07:10:47 +00:00
|
|
|
std::string partition_name;
|
|
|
|
std::string extract_path;
|
|
|
|
};
|
2018-04-24 05:24:20 +00:00
|
|
|
|
|
|
|
bool mListFs;
|
|
|
|
|
|
|
|
nx::sXciHeaderPage mHdrPage;
|
|
|
|
nx::XciHeader mHdr;
|
2018-06-03 07:10:47 +00:00
|
|
|
PfsProcess mRootPfs;
|
|
|
|
std::vector<sExtractInfo> mExtractInfo;
|
2018-04-24 05:24:20 +00:00
|
|
|
|
|
|
|
void displayHeader();
|
|
|
|
bool validateRegionOfFile(size_t offset, size_t len, const byte_t* test_hash);
|
|
|
|
void validateXciSignature();
|
|
|
|
void processRootPfs();
|
|
|
|
void processPartitionPfs();
|
|
|
|
};
|