2018-04-24 05:24:20 +00:00
|
|
|
#pragma once
|
2021-09-28 11:15:54 +00:00
|
|
|
#include "types.h"
|
|
|
|
#include "KeyBag.h"
|
2018-04-24 05:24:20 +00:00
|
|
|
#include "PfsProcess.h"
|
|
|
|
|
2021-09-28 11:15:54 +00:00
|
|
|
#include <nn/hac/GameCardHeader.h>
|
|
|
|
|
|
|
|
namespace nstool {
|
2018-04-24 05:24:20 +00:00
|
|
|
|
2018-10-27 06:13:53 +00:00
|
|
|
class GameCardProcess
|
2018-04-24 05:24:20 +00:00
|
|
|
{
|
|
|
|
public:
|
2018-10-27 06:13:53 +00:00
|
|
|
GameCardProcess();
|
2018-04-24 05:24:20 +00:00
|
|
|
|
|
|
|
// generic
|
2021-09-28 11:15:54 +00:00
|
|
|
void setInputFile(const std::shared_ptr<tc::io::IStream>& file);
|
|
|
|
void setKeyCfg(const KeyBag& keycfg);
|
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 setExtractJobs(const std::vector<nstool::ExtractJob> extract_jobs);
|
|
|
|
|
|
|
|
void process();
|
2018-04-24 05:24:20 +00:00
|
|
|
|
|
|
|
private:
|
2021-10-08 10:05:51 +00:00
|
|
|
const std::string kXciMountPointName = "gamecard";
|
|
|
|
|
|
|
|
std::string mModuleName;
|
2018-04-24 05:24:20 +00:00
|
|
|
|
2021-09-28 11:15:54 +00:00
|
|
|
std::shared_ptr<tc::io::IStream> mFile;
|
|
|
|
KeyBag mKeyCfg;
|
2018-06-18 15:30:19 +00:00
|
|
|
CliOutputMode mCliOutputMode;
|
2018-04-24 05:24:20 +00:00
|
|
|
bool mVerify;
|
2019-11-17 06:26:23 +00:00
|
|
|
bool mListFs;
|
|
|
|
|
|
|
|
bool mIsTrueSdkXci;
|
|
|
|
bool mIsSdkXciEncrypted;
|
|
|
|
size_t mGcHeaderOffset;
|
|
|
|
bool mProccessExtendedHeader;
|
2021-10-01 09:39:34 +00:00
|
|
|
nn::hac::detail::rsa2048_signature_t mHdrSignature;
|
2021-10-08 10:05:51 +00:00
|
|
|
nn::hac::detail::sha256_hash_t mHdrHash;
|
2018-10-27 06:13:53 +00:00
|
|
|
nn::hac::GameCardHeader mHdr;
|
2019-11-17 06:26:23 +00:00
|
|
|
|
2018-06-03 07:10:47 +00:00
|
|
|
PfsProcess mRootPfs;
|
2021-10-08 10:05:51 +00:00
|
|
|
std::vector<nstool::ExtractJob> mExtractJobs;
|
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();
|
2021-10-08 10:05:51 +00:00
|
|
|
bool validateRegionOfFile(int64_t offset, int64_t len, const byte_t* test_hash, bool use_salt, byte_t salt);
|
|
|
|
bool validateRegionOfFile(int64_t offset, int64_t len, const byte_t* test_hash);
|
2018-04-24 05:24:20 +00:00
|
|
|
void validateXciSignature();
|
|
|
|
void processRootPfs();
|
2021-09-28 11:15:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|