2018-11-05 13:11:08 +00:00
|
|
|
#pragma once
|
2021-09-28 11:15:54 +00:00
|
|
|
#include "types.h"
|
|
|
|
|
2018-11-05 13:11:08 +00:00
|
|
|
#include <nn/hac/IniHeader.h>
|
|
|
|
#include <nn/hac/KernelInitialProcessHeader.h>
|
|
|
|
|
2021-09-28 11:15:54 +00:00
|
|
|
namespace nstool {
|
2018-11-05 13:11:08 +00:00
|
|
|
|
|
|
|
class IniProcess
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
IniProcess();
|
|
|
|
|
|
|
|
void process();
|
|
|
|
|
2021-09-28 11:15:54 +00:00
|
|
|
void setInputFile(const std::shared_ptr<tc::io::IStream>& file);
|
2018-11-05 13:11:08 +00:00
|
|
|
void setCliOutputMode(CliOutputMode type);
|
|
|
|
void setVerifyMode(bool verify);
|
|
|
|
|
2021-10-01 09:39:34 +00:00
|
|
|
void setKipExtractPath(const tc::io::Path& path);
|
2018-11-05 13:11:08 +00:00
|
|
|
private:
|
|
|
|
const std::string kKipExtention = ".kip";
|
|
|
|
const size_t kCacheSize = 0x10000;
|
|
|
|
|
2021-10-12 06:26:19 +00:00
|
|
|
std::string mModuleName;
|
|
|
|
|
2021-09-28 11:15:54 +00:00
|
|
|
std::shared_ptr<tc::io::IStream> mFile;
|
2018-11-05 13:11:08 +00:00
|
|
|
CliOutputMode mCliOutputMode;
|
|
|
|
bool mVerify;
|
|
|
|
|
2021-10-01 09:39:34 +00:00
|
|
|
tc::Optional<tc::io::Path> mKipExtractPath;
|
2018-11-05 13:11:08 +00:00
|
|
|
|
|
|
|
nn::hac::IniHeader mHdr;
|
2021-10-13 05:39:45 +00:00
|
|
|
struct InnerKipInfo
|
|
|
|
{
|
|
|
|
nn::hac::KernelInitialProcessHeader hdr;
|
|
|
|
std::shared_ptr<tc::io::IStream> stream;
|
|
|
|
};
|
|
|
|
std::vector<InnerKipInfo> mKipList;
|
2018-11-05 13:11:08 +00:00
|
|
|
|
|
|
|
void importHeader();
|
|
|
|
void importKipList();
|
|
|
|
void displayHeader();
|
|
|
|
void displayKipList();
|
|
|
|
void extractKipList();
|
|
|
|
|
2021-10-13 05:39:45 +00:00
|
|
|
int64_t getKipSizeFromHeader(const nn::hac::KernelInitialProcessHeader& hdr) const;
|
2021-09-28 11:15:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|