mirror of
https://github.com/jakcron/nstool
synced 2024-11-22 13:39:28 +00:00
Misc
This commit is contained in:
parent
defccc6ddf
commit
78262bc680
11 changed files with 109 additions and 113 deletions
|
@ -8,7 +8,15 @@ nstool::AssetProcess::AssetProcess() :
|
|||
mCliOutputMode(true, false, false, false),
|
||||
mVerify(false)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void nstool::AssetProcess::process()
|
||||
{
|
||||
importHeader();
|
||||
if (mCliOutputMode.show_basic_info)
|
||||
displayHeader();
|
||||
processSections();
|
||||
}
|
||||
|
||||
void nstool::AssetProcess::setInputFile(const std::shared_ptr<tc::io::IStream>& file)
|
||||
{
|
||||
|
@ -45,14 +53,6 @@ void nstool::AssetProcess::setRomfsExtractJobs(const std::vector<nstool::Extract
|
|||
mRomfs.setExtractJobs(extract_jobs);
|
||||
}
|
||||
|
||||
void nstool::AssetProcess::process()
|
||||
{
|
||||
importHeader();
|
||||
if (mCliOutputMode.show_basic_info)
|
||||
displayHeader();
|
||||
processSections();
|
||||
}
|
||||
|
||||
void nstool::AssetProcess::importHeader()
|
||||
{
|
||||
if (mFile == nullptr)
|
||||
|
|
|
@ -12,6 +12,8 @@ class AssetProcess
|
|||
public:
|
||||
AssetProcess();
|
||||
|
||||
void process();
|
||||
|
||||
void setInputFile(const std::shared_ptr<tc::io::IStream>& file);
|
||||
void setCliOutputMode(CliOutputMode type);
|
||||
void setVerifyMode(bool verify);
|
||||
|
@ -21,9 +23,6 @@ public:
|
|||
|
||||
void setRomfsShowFsTree(bool show_fs_tree);
|
||||
void setRomfsExtractJobs(const std::vector<nstool::ExtractJob>& extract_jobs);
|
||||
|
||||
void process();
|
||||
|
||||
private:
|
||||
std::string mModuleName;
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ public:
|
|||
void setVerifyMode(bool verify);
|
||||
|
||||
const nn::hac::ContentMeta& getContentMeta() const;
|
||||
|
||||
private:
|
||||
std::string mModuleName;
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ public:
|
|||
void setCertificateChain(const std::vector<nn::pki::SignedData<nn::pki::CertificateBody>>& certs);
|
||||
void setCliOutputMode(CliOutputMode mode);
|
||||
void setVerifyMode(bool verify);
|
||||
|
||||
private:
|
||||
std::string mModuleName;
|
||||
|
||||
|
|
|
@ -19,6 +19,34 @@ nstool::FsProcess::FsProcess() :
|
|||
|
||||
}
|
||||
|
||||
void nstool::FsProcess::process()
|
||||
{
|
||||
if (mInputFs == nullptr)
|
||||
{
|
||||
throw tc::InvalidOperationException(mModuleLabel, "No input filesystem");
|
||||
}
|
||||
|
||||
if (mShowFsInfo)
|
||||
{
|
||||
fmt::print("[{:s}]\n", mFsFormatName.isSet() ? mFsFormatName.get() : "FileSystem/Info");
|
||||
for (auto itr = mProperties.begin(); itr != mProperties.end(); itr++)
|
||||
{
|
||||
fmt::print(" {:s}\n", *itr);
|
||||
}
|
||||
}
|
||||
|
||||
if (mShowFsTree)
|
||||
{
|
||||
printFs();
|
||||
}
|
||||
|
||||
|
||||
if (mExtractJobs.empty() == false)
|
||||
{
|
||||
extractFs();
|
||||
}
|
||||
}
|
||||
|
||||
void nstool::FsProcess::setInputFileSystem(const std::shared_ptr<tc::io::IStorage>& input_fs)
|
||||
{
|
||||
mInputFs = input_fs;
|
||||
|
@ -54,34 +82,6 @@ void nstool::FsProcess::setExtractJobs(const std::vector<nstool::ExtractJob>& ex
|
|||
mExtractJobs = extract_jobs;
|
||||
}
|
||||
|
||||
void nstool::FsProcess::process()
|
||||
{
|
||||
if (mInputFs == nullptr)
|
||||
{
|
||||
throw tc::InvalidOperationException(mModuleLabel, "No input filesystem");
|
||||
}
|
||||
|
||||
if (mShowFsInfo)
|
||||
{
|
||||
fmt::print("[{:s}]\n", mFsFormatName.isSet() ? mFsFormatName.get() : "FileSystem/Info");
|
||||
for (auto itr = mProperties.begin(); itr != mProperties.end(); itr++)
|
||||
{
|
||||
fmt::print(" {:s}\n", *itr);
|
||||
}
|
||||
}
|
||||
|
||||
if (mShowFsTree)
|
||||
{
|
||||
printFs();
|
||||
}
|
||||
|
||||
|
||||
if (mExtractJobs.empty() == false)
|
||||
{
|
||||
extractFs();
|
||||
}
|
||||
}
|
||||
|
||||
void nstool::FsProcess::printFs()
|
||||
{
|
||||
fmt::print("[{:s}/Tree]\n", (mFsFormatName.isSet() ? mFsFormatName.get() : "FileSystem"));
|
||||
|
|
|
@ -12,6 +12,8 @@ class FsProcess
|
|||
public:
|
||||
FsProcess();
|
||||
|
||||
void process();
|
||||
|
||||
void setInputFileSystem(const std::shared_ptr<tc::io::IStorage>& input_fs);
|
||||
void setFsFormatName(const std::string& fs_format_name);
|
||||
void setFsProperties(const std::vector<std::string>& properties);
|
||||
|
@ -19,8 +21,6 @@ public:
|
|||
void setShowFsTree(bool show_fs_tree);
|
||||
void setFsRootLabel(const std::string& root_label);
|
||||
void setExtractJobs(const std::vector<nstool::ExtractJob>& extract_jobs);
|
||||
|
||||
void process();
|
||||
private:
|
||||
std::string mModuleLabel;
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@ class GameCardProcess
|
|||
public:
|
||||
GameCardProcess();
|
||||
|
||||
void process();
|
||||
|
||||
// generic
|
||||
void setInputFile(const std::shared_ptr<tc::io::IStream>& file);
|
||||
void setKeyCfg(const KeyBag& keycfg);
|
||||
|
@ -21,9 +23,6 @@ public:
|
|||
// fs specific
|
||||
void setShowFsTree(bool show_fs_tree);
|
||||
void setExtractJobs(const std::vector<nstool::ExtractJob> extract_jobs);
|
||||
|
||||
void process();
|
||||
|
||||
private:
|
||||
const std::string kXciMountPointName = "gamecard";
|
||||
|
||||
|
|
|
@ -20,37 +20,6 @@ nstool::PfsProcess::PfsProcess() :
|
|||
mFsProcess.setFsFormatName("PartitionFS");
|
||||
}
|
||||
|
||||
void nstool::PfsProcess::setInputFile(const std::shared_ptr<tc::io::IStream>& file)
|
||||
{
|
||||
mFile = file;
|
||||
}
|
||||
|
||||
void nstool::PfsProcess::setCliOutputMode(CliOutputMode type)
|
||||
{
|
||||
mCliOutputMode = type;
|
||||
mFsProcess.setShowFsInfo(mCliOutputMode.show_basic_info);
|
||||
}
|
||||
|
||||
void nstool::PfsProcess::setVerifyMode(bool verify)
|
||||
{
|
||||
mVerify = verify;
|
||||
}
|
||||
|
||||
void nstool::PfsProcess::setShowFsTree(bool show_fs_tree)
|
||||
{
|
||||
mFsProcess.setShowFsTree(show_fs_tree);
|
||||
}
|
||||
|
||||
void nstool::PfsProcess::setFsRootLabel(const std::string& root_label)
|
||||
{
|
||||
mFsProcess.setFsRootLabel(root_label);
|
||||
}
|
||||
|
||||
void nstool::PfsProcess::setExtractJobs(const std::vector<nstool::ExtractJob>& extract_jobs)
|
||||
{
|
||||
mFsProcess.setExtractJobs(extract_jobs);
|
||||
}
|
||||
|
||||
void nstool::PfsProcess::process()
|
||||
{
|
||||
if (mFile == nullptr)
|
||||
|
@ -105,6 +74,37 @@ void nstool::PfsProcess::process()
|
|||
mFsProcess.process();
|
||||
}
|
||||
|
||||
void nstool::PfsProcess::setInputFile(const std::shared_ptr<tc::io::IStream>& file)
|
||||
{
|
||||
mFile = file;
|
||||
}
|
||||
|
||||
void nstool::PfsProcess::setCliOutputMode(CliOutputMode type)
|
||||
{
|
||||
mCliOutputMode = type;
|
||||
mFsProcess.setShowFsInfo(mCliOutputMode.show_basic_info);
|
||||
}
|
||||
|
||||
void nstool::PfsProcess::setVerifyMode(bool verify)
|
||||
{
|
||||
mVerify = verify;
|
||||
}
|
||||
|
||||
void nstool::PfsProcess::setShowFsTree(bool show_fs_tree)
|
||||
{
|
||||
mFsProcess.setShowFsTree(show_fs_tree);
|
||||
}
|
||||
|
||||
void nstool::PfsProcess::setFsRootLabel(const std::string& root_label)
|
||||
{
|
||||
mFsProcess.setFsRootLabel(root_label);
|
||||
}
|
||||
|
||||
void nstool::PfsProcess::setExtractJobs(const std::vector<nstool::ExtractJob>& extract_jobs)
|
||||
{
|
||||
mFsProcess.setExtractJobs(extract_jobs);
|
||||
}
|
||||
|
||||
const nn::hac::PartitionFsHeader& nstool::PfsProcess::getPfsHeader() const
|
||||
{
|
||||
return mPfs;
|
||||
|
|
|
@ -11,6 +11,8 @@ class PfsProcess
|
|||
public:
|
||||
PfsProcess();
|
||||
|
||||
void process();
|
||||
|
||||
// generic
|
||||
void setInputFile(const std::shared_ptr<tc::io::IStream>& file);
|
||||
void setCliOutputMode(CliOutputMode type);
|
||||
|
@ -21,8 +23,6 @@ public:
|
|||
void setFsRootLabel(const std::string& root_label);
|
||||
void setExtractJobs(const std::vector<nstool::ExtractJob>& extract_jobs);
|
||||
|
||||
void process();
|
||||
|
||||
// post process() get PFS/FS out
|
||||
const nn::hac::PartitionFsHeader& getPfsHeader() const;
|
||||
const std::shared_ptr<tc::io::IStorage>& getFileSystem() const;
|
||||
|
|
|
@ -18,37 +18,6 @@ nstool::RomfsProcess::RomfsProcess() :
|
|||
mFsProcess.setFsFormatName("RomFS");
|
||||
}
|
||||
|
||||
void nstool::RomfsProcess::setInputFile(const std::shared_ptr<tc::io::IStream>& file)
|
||||
{
|
||||
mFile = file;
|
||||
}
|
||||
|
||||
void nstool::RomfsProcess::setCliOutputMode(CliOutputMode type)
|
||||
{
|
||||
mCliOutputMode = type;
|
||||
mFsProcess.setShowFsInfo(mCliOutputMode.show_basic_info);
|
||||
}
|
||||
|
||||
void nstool::RomfsProcess::setVerifyMode(bool verify)
|
||||
{
|
||||
mVerify = verify;
|
||||
}
|
||||
|
||||
void nstool::RomfsProcess::setFsRootLabel(const std::string& root_label)
|
||||
{
|
||||
mFsProcess.setFsRootLabel(root_label);
|
||||
}
|
||||
|
||||
void nstool::RomfsProcess::setExtractJobs(const std::vector<nstool::ExtractJob>& extract_jobs)
|
||||
{
|
||||
mFsProcess.setExtractJobs(extract_jobs);
|
||||
}
|
||||
|
||||
void nstool::RomfsProcess::setShowFsTree(bool list_fs)
|
||||
{
|
||||
mFsProcess.setShowFsTree(list_fs);
|
||||
}
|
||||
|
||||
void nstool::RomfsProcess::process()
|
||||
{
|
||||
if (mFile == nullptr)
|
||||
|
@ -125,4 +94,35 @@ void nstool::RomfsProcess::process()
|
|||
|
||||
// process filesystem
|
||||
mFsProcess.process();
|
||||
}
|
||||
|
||||
void nstool::RomfsProcess::setInputFile(const std::shared_ptr<tc::io::IStream>& file)
|
||||
{
|
||||
mFile = file;
|
||||
}
|
||||
|
||||
void nstool::RomfsProcess::setCliOutputMode(CliOutputMode type)
|
||||
{
|
||||
mCliOutputMode = type;
|
||||
mFsProcess.setShowFsInfo(mCliOutputMode.show_basic_info);
|
||||
}
|
||||
|
||||
void nstool::RomfsProcess::setVerifyMode(bool verify)
|
||||
{
|
||||
mVerify = verify;
|
||||
}
|
||||
|
||||
void nstool::RomfsProcess::setFsRootLabel(const std::string& root_label)
|
||||
{
|
||||
mFsProcess.setFsRootLabel(root_label);
|
||||
}
|
||||
|
||||
void nstool::RomfsProcess::setExtractJobs(const std::vector<nstool::ExtractJob>& extract_jobs)
|
||||
{
|
||||
mFsProcess.setExtractJobs(extract_jobs);
|
||||
}
|
||||
|
||||
void nstool::RomfsProcess::setShowFsTree(bool list_fs)
|
||||
{
|
||||
mFsProcess.setShowFsTree(list_fs);
|
||||
}
|
|
@ -11,6 +11,8 @@ class RomfsProcess
|
|||
public:
|
||||
RomfsProcess();
|
||||
|
||||
void process();
|
||||
|
||||
// generic
|
||||
void setInputFile(const std::shared_ptr<tc::io::IStream>& file);
|
||||
void setCliOutputMode(CliOutputMode type);
|
||||
|
@ -20,8 +22,6 @@ public:
|
|||
void setFsRootLabel(const std::string& root_label);
|
||||
void setExtractJobs(const std::vector<nstool::ExtractJob>& extract_jobs);
|
||||
void setShowFsTree(bool show_fs_tree);
|
||||
|
||||
void process();
|
||||
private:
|
||||
static const size_t kCacheSize = 0x10000;
|
||||
|
||||
|
|
Loading…
Reference in a new issue