2019-01-31 09:10:19 +00:00
|
|
|
#pragma once
|
2021-09-28 11:15:54 +00:00
|
|
|
#include "types.h"
|
|
|
|
#include "RoMetadataProcess.h"
|
|
|
|
|
2019-01-31 09:10:19 +00:00
|
|
|
#include <nn/hac/define/meta.h>
|
|
|
|
#include <nn/hac/NsoHeader.h>
|
|
|
|
|
2021-09-28 11:15:54 +00:00
|
|
|
namespace nstool {
|
2019-01-31 09:10:19 +00:00
|
|
|
|
|
|
|
class NsoProcess
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NsoProcess();
|
|
|
|
|
|
|
|
void process();
|
|
|
|
|
2021-09-28 11:15:54 +00:00
|
|
|
void setInputFile(const std::shared_ptr<tc::io::IStream>& file);
|
2019-01-31 09:10:19 +00:00
|
|
|
void setCliOutputMode(CliOutputMode type);
|
|
|
|
void setVerifyMode(bool verify);
|
|
|
|
|
2020-03-10 10:50:52 +00:00
|
|
|
void setIs64BitInstruction(bool flag);
|
2019-01-31 09:10:19 +00:00
|
|
|
void setListApi(bool listApi);
|
|
|
|
void setListSymbols(bool listSymbols);
|
|
|
|
|
2021-10-11 12:18:43 +00:00
|
|
|
const nstool::RoMetadataProcess& getRoMetadataProcess() const;
|
2019-01-31 09:10:19 +00:00
|
|
|
private:
|
2021-10-11 12:18:43 +00:00
|
|
|
std::string mModuleName;
|
2019-01-31 09:10:19 +00:00
|
|
|
|
2021-09-28 11:15:54 +00:00
|
|
|
std::shared_ptr<tc::io::IStream> mFile;
|
2019-01-31 09:10:19 +00:00
|
|
|
CliOutputMode mCliOutputMode;
|
|
|
|
bool mVerify;
|
2020-03-10 10:50:52 +00:00
|
|
|
bool mIs64BitInstruction;
|
2019-01-31 09:10:19 +00:00
|
|
|
bool mListApi;
|
|
|
|
bool mListSymbols;
|
|
|
|
|
|
|
|
nn::hac::NsoHeader mHdr;
|
2021-09-28 11:15:54 +00:00
|
|
|
tc::ByteData mTextBlob, mRoBlob, mDataBlob;
|
2021-10-11 12:18:43 +00:00
|
|
|
nstool::RoMetadataProcess mRoMeta;
|
2019-01-31 09:10:19 +00:00
|
|
|
|
|
|
|
void importHeader();
|
|
|
|
void importCodeSegments();
|
|
|
|
void displayNsoHeader();
|
|
|
|
void processRoMeta();
|
2021-10-11 12:18:43 +00:00
|
|
|
|
|
|
|
size_t decompressData(const byte_t* src, size_t src_len, byte_t* dst, size_t dst_capacity);
|
|
|
|
|
2021-09-28 11:15:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|