mirror of
https://github.com/jakcron/nstool.git
synced 2024-12-22 10:45:28 +00:00
[fac|nstool] Correct name of Npdm to Meta.
This commit is contained in:
parent
803a671ed0
commit
c10e4b85b9
|
@ -2,7 +2,7 @@
|
|||
#include <string>
|
||||
#include <fnd/List.h>
|
||||
#include <fnd/ISerialisable.h>
|
||||
#include <nn/hac/npdm.h>
|
||||
#include <nn/hac/meta.h>
|
||||
#include <nn/hac/AccessControlInfoBinary.h>
|
||||
#include <nn/hac/AccessControlInfoDescBinary.h>
|
||||
|
||||
|
@ -10,16 +10,16 @@ namespace nn
|
|||
{
|
||||
namespace hac
|
||||
{
|
||||
class NpdmBinary :
|
||||
class MetaBinary :
|
||||
public fnd::ISerialisable
|
||||
{
|
||||
public:
|
||||
NpdmBinary();
|
||||
NpdmBinary(const NpdmBinary& other);
|
||||
MetaBinary();
|
||||
MetaBinary(const MetaBinary& other);
|
||||
|
||||
void operator=(const NpdmBinary& other);
|
||||
bool operator==(const NpdmBinary& other) const;
|
||||
bool operator!=(const NpdmBinary& other) const;
|
||||
void operator=(const MetaBinary& other);
|
||||
bool operator==(const MetaBinary& other) const;
|
||||
bool operator!=(const MetaBinary& other) const;
|
||||
|
||||
// export/import binary
|
||||
void toBytes();
|
||||
|
@ -29,11 +29,11 @@ namespace hac
|
|||
// variables
|
||||
void clear();
|
||||
|
||||
npdm::InstructionType getInstructionType() const;
|
||||
void setInstructionType(npdm::InstructionType type);
|
||||
meta::InstructionType getInstructionType() const;
|
||||
void setInstructionType(meta::InstructionType type);
|
||||
|
||||
npdm::ProcAddrSpaceType getProcAddressSpaceType() const;
|
||||
void setProcAddressSpaceType(npdm::ProcAddrSpaceType type);
|
||||
meta::ProcAddrSpaceType getProcAddressSpaceType() const;
|
||||
void setProcAddressSpaceType(meta::ProcAddrSpaceType type);
|
||||
|
||||
byte_t getMainThreadPriority() const;
|
||||
void setMainThreadPriority(byte_t priority);
|
||||
|
@ -59,14 +59,14 @@ namespace hac
|
|||
const AccessControlInfoDescBinary& getAcid() const;
|
||||
void setAcid(const AccessControlInfoDescBinary& acid);
|
||||
private:
|
||||
const std::string kModuleName = "NPDM_BINARY";
|
||||
const std::string kModuleName = "META_BINARY";
|
||||
|
||||
// raw binary
|
||||
fnd::Vec<byte_t> mRawBinary;
|
||||
|
||||
// variables
|
||||
npdm::InstructionType mInstructionType;
|
||||
npdm::ProcAddrSpaceType mProcAddressSpaceType;
|
||||
meta::InstructionType mInstructionType;
|
||||
meta::ProcAddrSpaceType mProcAddressSpaceType;
|
||||
byte_t mMainThreadPriority;
|
||||
byte_t mMainThreadCpuId;
|
||||
uint32_t mVersion;
|
|
@ -6,9 +6,9 @@ namespace nn
|
|||
{
|
||||
namespace hac
|
||||
{
|
||||
namespace npdm
|
||||
namespace meta
|
||||
{
|
||||
static const uint32_t kNpdmStructMagic = _MAKE_STRUCT_MAGIC_U32("META");
|
||||
static const uint32_t kMetaStructMagic = _MAKE_STRUCT_MAGIC_U32("META");
|
||||
static const size_t kNameMaxLen = 0x10;
|
||||
static const size_t kProductCodeMaxLen = 0x10;
|
||||
static const uint32_t kMaxPriority = BIT(6) - 1;
|
||||
|
@ -29,8 +29,13 @@ namespace hac
|
|||
};
|
||||
}
|
||||
#pragma pack(push,1)
|
||||
struct sMetaSection
|
||||
{
|
||||
le_uint32_t offset;
|
||||
le_uint32_t size;
|
||||
};
|
||||
|
||||
struct sNpdmHeader
|
||||
struct sMetaHeader
|
||||
{
|
||||
le_uint32_t st_magic;
|
||||
byte_t reserved_0[8];
|
||||
|
@ -41,15 +46,11 @@ namespace hac
|
|||
byte_t reserved_2[8];
|
||||
le_uint32_t version;
|
||||
le_uint32_t main_thread_stack_size;
|
||||
char name[npdm::kNameMaxLen]; // important
|
||||
char product_code[npdm::kProductCodeMaxLen]; // can be empty
|
||||
char name[meta::kNameMaxLen]; // important
|
||||
char product_code[meta::kProductCodeMaxLen]; // can be empty
|
||||
byte_t reserved_3[48];
|
||||
// Access Control Info
|
||||
struct sNpdmSection
|
||||
{
|
||||
le_uint32_t offset;
|
||||
le_uint32_t size;
|
||||
} aci, acid;
|
||||
sMetaSection aci;
|
||||
sMetaSection acid;
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
|
@ -51,6 +51,8 @@
|
|||
<ClInclude Include="include\nn\hac\macro.h" />
|
||||
<ClInclude Include="include\nn\hac\MemoryMappingHandler.h" />
|
||||
<ClInclude Include="include\nn\hac\MemoryPageEntry.h" />
|
||||
<ClInclude Include="include\nn\hac\meta.h" />
|
||||
<ClInclude Include="include\nn\hac\MetaBinary.h" />
|
||||
<ClInclude Include="include\nn\hac\MiscFlagsEntry.h" />
|
||||
<ClInclude Include="include\nn\hac\MiscFlagsHandler.h" />
|
||||
<ClInclude Include="include\nn\hac\MiscParamsEntry.h" />
|
||||
|
@ -59,8 +61,6 @@
|
|||
<ClInclude Include="include\nn\hac\nca.h" />
|
||||
<ClInclude Include="include\nn\hac\NcaHeader.h" />
|
||||
<ClInclude Include="include\nn\hac\NcaUtils.h" />
|
||||
<ClInclude Include="include\nn\hac\npdm.h" />
|
||||
<ClInclude Include="include\nn\hac\NpdmBinary.h" />
|
||||
<ClInclude Include="include\nn\hac\nro.h" />
|
||||
<ClInclude Include="include\nn\hac\NroHeader.h" />
|
||||
<ClInclude Include="include\nn\hac\nrr.h" />
|
||||
|
@ -101,13 +101,13 @@
|
|||
<ClCompile Include="source\KernelVersionHandler.cpp" />
|
||||
<ClCompile Include="source\MemoryMappingHandler.cpp" />
|
||||
<ClCompile Include="source\MemoryPageEntry.cpp" />
|
||||
<ClCompile Include="source\MetaBinary.cpp" />
|
||||
<ClCompile Include="source\MiscFlagsEntry.cpp" />
|
||||
<ClCompile Include="source\MiscFlagsHandler.cpp" />
|
||||
<ClCompile Include="source\MiscParamsEntry.cpp" />
|
||||
<ClCompile Include="source\MiscParamsHandler.cpp" />
|
||||
<ClCompile Include="source\NcaHeader.cpp" />
|
||||
<ClCompile Include="source\NcaUtils.cpp" />
|
||||
<ClCompile Include="source\NpdmBinary.cpp" />
|
||||
<ClCompile Include="source\NroHeader.cpp" />
|
||||
<ClCompile Include="source\NsoHeader.cpp" />
|
||||
<ClCompile Include="source\PfsHeader.cpp" />
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
<ClInclude Include="include\nn\hac\npdm.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\NpdmBinary.h">
|
||||
<ClInclude Include="include\nn\hac\MetaBinary.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\nn\hac\nro.h">
|
||||
|
@ -266,7 +266,7 @@
|
|||
<ClCompile Include="source\NcaUtils.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\NpdmBinary.cpp">
|
||||
<ClCompile Include="source\MetaBinary.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\NroHeader.cpp">
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
#include <nn/hac/NpdmBinary.h>
|
||||
#include <nn/hac/MetaBinary.h>
|
||||
|
||||
#include <fnd/SimpleTextOutput.h>
|
||||
|
||||
nn::hac::NpdmBinary::NpdmBinary()
|
||||
nn::hac::MetaBinary::MetaBinary()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
nn::hac::NpdmBinary::NpdmBinary(const NpdmBinary & other) :
|
||||
NpdmBinary()
|
||||
nn::hac::MetaBinary::MetaBinary(const MetaBinary & other) :
|
||||
MetaBinary()
|
||||
{
|
||||
*this = other;
|
||||
}
|
||||
|
||||
void nn::hac::NpdmBinary::operator=(const NpdmBinary & other)
|
||||
void nn::hac::MetaBinary::operator=(const MetaBinary & other)
|
||||
{
|
||||
mRawBinary = other.mRawBinary;
|
||||
mInstructionType = other.mInstructionType;
|
||||
|
@ -28,7 +28,7 @@ void nn::hac::NpdmBinary::operator=(const NpdmBinary & other)
|
|||
mAcid = other.mAcid;
|
||||
}
|
||||
|
||||
bool nn::hac::NpdmBinary::operator==(const NpdmBinary & other) const
|
||||
bool nn::hac::MetaBinary::operator==(const MetaBinary & other) const
|
||||
{
|
||||
return (mInstructionType == other.mInstructionType) \
|
||||
&& (mProcAddressSpaceType == other.mProcAddressSpaceType) \
|
||||
|
@ -42,12 +42,12 @@ bool nn::hac::NpdmBinary::operator==(const NpdmBinary & other) const
|
|||
&& (mAcid == other.mAcid);
|
||||
}
|
||||
|
||||
bool nn::hac::NpdmBinary::operator!=(const NpdmBinary & other) const
|
||||
bool nn::hac::MetaBinary::operator!=(const MetaBinary & other) const
|
||||
{
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
void nn::hac::NpdmBinary::toBytes()
|
||||
void nn::hac::MetaBinary::toBytes()
|
||||
{
|
||||
if (mAcid.getBytes().size() == 0)
|
||||
mAcid.toBytes();
|
||||
|
@ -61,20 +61,20 @@ void nn::hac::NpdmBinary::toBytes()
|
|||
uint32_t offset, size;
|
||||
} acid, aci;
|
||||
|
||||
acid.offset = (uint32_t)align(sizeof(sNpdmHeader), npdm::kSectionAlignSize);
|
||||
acid.offset = (uint32_t)align(sizeof(sMetaHeader), meta::kSectionAlignSize);
|
||||
acid.size = (uint32_t)mAcid.getBytes().size();
|
||||
aci.offset = (uint32_t)(acid.offset + align(acid.size, npdm::kSectionAlignSize));
|
||||
aci.offset = (uint32_t)(acid.offset + align(acid.size, meta::kSectionAlignSize));
|
||||
aci.size = (uint32_t)mAci.getBytes().size();
|
||||
|
||||
|
||||
// get total size
|
||||
size_t total_size = _MAX(_MAX(acid.offset + acid.size, aci.offset + aci.size), align(sizeof(sNpdmHeader), npdm::kSectionAlignSize));
|
||||
size_t total_size = _MAX(_MAX(acid.offset + acid.size, aci.offset + aci.size), align(sizeof(sMetaHeader), meta::kSectionAlignSize));
|
||||
|
||||
mRawBinary.alloc(total_size);
|
||||
sNpdmHeader* hdr = (sNpdmHeader*)mRawBinary.data();
|
||||
sMetaHeader* hdr = (sMetaHeader*)mRawBinary.data();
|
||||
|
||||
// set type
|
||||
hdr->st_magic = npdm::kNpdmStructMagic;
|
||||
hdr->st_magic = meta::kMetaStructMagic;
|
||||
|
||||
// set variables
|
||||
byte_t flag = ((byte_t)(mInstructionType & 1) | (byte_t)((mProcAddressSpaceType & 3) << 1)) & 0xf;
|
||||
|
@ -83,8 +83,8 @@ void nn::hac::NpdmBinary::toBytes()
|
|||
hdr->main_thread_cpu_id = mMainThreadCpuId;
|
||||
hdr->version = mVersion;
|
||||
hdr->main_thread_stack_size = mMainThreadStackSize;
|
||||
strncpy(hdr->name, mName.c_str(), npdm::kNameMaxLen);
|
||||
strncpy(hdr->product_code, mProductCode.c_str(), npdm::kProductCodeMaxLen);
|
||||
strncpy(hdr->name, mName.c_str(), meta::kNameMaxLen);
|
||||
strncpy(hdr->product_code, mProductCode.c_str(), meta::kProductCodeMaxLen);
|
||||
|
||||
// set offset/size
|
||||
hdr->aci.offset = aci.offset;
|
||||
|
@ -103,45 +103,45 @@ void nn::hac::NpdmBinary::toBytes()
|
|||
}
|
||||
}
|
||||
|
||||
void nn::hac::NpdmBinary::fromBytes(const byte_t* data, size_t len)
|
||||
void nn::hac::MetaBinary::fromBytes(const byte_t* data, size_t len)
|
||||
{
|
||||
// check size
|
||||
if (len < sizeof(sNpdmHeader))
|
||||
if (len < sizeof(sMetaHeader))
|
||||
{
|
||||
throw fnd::Exception(kModuleName, "NPDM binary is too small");
|
||||
throw fnd::Exception(kModuleName, "META binary is too small");
|
||||
}
|
||||
|
||||
// clear variables
|
||||
clear();
|
||||
|
||||
// save a copy of the header
|
||||
sNpdmHeader hdr;
|
||||
memcpy((void*)&hdr, data, sizeof(sNpdmHeader));
|
||||
sMetaHeader hdr;
|
||||
memcpy((void*)&hdr, data, sizeof(sMetaHeader));
|
||||
|
||||
// check magic
|
||||
if (hdr.st_magic.get() != npdm::kNpdmStructMagic)
|
||||
if (hdr.st_magic.get() != meta::kMetaStructMagic)
|
||||
{
|
||||
throw fnd::Exception(kModuleName, "NPDM header corrupt");
|
||||
throw fnd::Exception(kModuleName, "META header corrupt (unrecognised struct signature)");
|
||||
}
|
||||
|
||||
// save variables
|
||||
byte_t flag = hdr.flags & 0xf;
|
||||
mInstructionType = (npdm::InstructionType)(flag & 1);
|
||||
mProcAddressSpaceType = (npdm::ProcAddrSpaceType)((flag >> 1) & 3);
|
||||
mInstructionType = (meta::InstructionType)(flag & 1);
|
||||
mProcAddressSpaceType = (meta::ProcAddrSpaceType)((flag >> 1) & 3);
|
||||
mMainThreadPriority = hdr.main_thread_priority;
|
||||
mMainThreadCpuId = hdr.main_thread_cpu_id;
|
||||
mVersion = hdr.version.get();
|
||||
mMainThreadStackSize = hdr.main_thread_stack_size.get();
|
||||
mName = std::string(hdr.name, _MIN(strlen(hdr.name), npdm::kNameMaxLen));
|
||||
mProductCode = std::string(hdr.product_code, _MIN(strlen(hdr.product_code), npdm::kProductCodeMaxLen));
|
||||
mName = std::string(hdr.name, _MIN(strlen(hdr.name), meta::kNameMaxLen));
|
||||
mProductCode = std::string(hdr.product_code, _MIN(strlen(hdr.product_code), meta::kProductCodeMaxLen));
|
||||
|
||||
// total size
|
||||
size_t total_size = _MAX(_MAX(hdr.acid.offset.get() + hdr.acid.size.get(), hdr.aci.offset.get() + hdr.aci.size.get()), sizeof(sNpdmHeader));
|
||||
size_t total_size = _MAX(_MAX(hdr.acid.offset.get() + hdr.acid.size.get(), hdr.aci.offset.get() + hdr.aci.size.get()), sizeof(sMetaHeader));
|
||||
|
||||
// check size
|
||||
if (total_size > len)
|
||||
{
|
||||
throw fnd::Exception(kModuleName, "NPDM binary too small");
|
||||
throw fnd::Exception(kModuleName, "META binary too small");
|
||||
}
|
||||
|
||||
// save local copy
|
||||
|
@ -159,16 +159,16 @@ void nn::hac::NpdmBinary::fromBytes(const byte_t* data, size_t len)
|
|||
}
|
||||
}
|
||||
|
||||
const fnd::Vec<byte_t>& nn::hac::NpdmBinary::getBytes() const
|
||||
const fnd::Vec<byte_t>& nn::hac::MetaBinary::getBytes() const
|
||||
{
|
||||
return mRawBinary;
|
||||
}
|
||||
|
||||
void nn::hac::NpdmBinary::clear()
|
||||
void nn::hac::MetaBinary::clear()
|
||||
{
|
||||
mRawBinary.clear();
|
||||
mInstructionType = npdm::INSTR_64BIT;
|
||||
mProcAddressSpaceType = npdm::ADDR_SPACE_64BIT;
|
||||
mInstructionType = meta::INSTR_64BIT;
|
||||
mProcAddressSpaceType = meta::ADDR_SPACE_64BIT;
|
||||
mMainThreadPriority = 0;
|
||||
mMainThreadCpuId = 0;
|
||||
mVersion = 0;
|
||||
|
@ -179,34 +179,34 @@ void nn::hac::NpdmBinary::clear()
|
|||
mAcid.clear();
|
||||
}
|
||||
|
||||
nn::hac::npdm::InstructionType nn::hac::NpdmBinary::getInstructionType() const
|
||||
nn::hac::meta::InstructionType nn::hac::MetaBinary::getInstructionType() const
|
||||
{
|
||||
return mInstructionType;
|
||||
}
|
||||
|
||||
void nn::hac::NpdmBinary::setInstructionType(npdm::InstructionType type)
|
||||
void nn::hac::MetaBinary::setInstructionType(meta::InstructionType type)
|
||||
{
|
||||
mInstructionType = type;
|
||||
}
|
||||
|
||||
nn::hac::npdm::ProcAddrSpaceType nn::hac::NpdmBinary::getProcAddressSpaceType() const
|
||||
nn::hac::meta::ProcAddrSpaceType nn::hac::MetaBinary::getProcAddressSpaceType() const
|
||||
{
|
||||
return mProcAddressSpaceType;
|
||||
}
|
||||
|
||||
void nn::hac::NpdmBinary::setProcAddressSpaceType(npdm::ProcAddrSpaceType type)
|
||||
void nn::hac::MetaBinary::setProcAddressSpaceType(meta::ProcAddrSpaceType type)
|
||||
{
|
||||
mProcAddressSpaceType = type;
|
||||
}
|
||||
|
||||
byte_t nn::hac::NpdmBinary::getMainThreadPriority() const
|
||||
byte_t nn::hac::MetaBinary::getMainThreadPriority() const
|
||||
{
|
||||
return mMainThreadPriority;
|
||||
}
|
||||
|
||||
void nn::hac::NpdmBinary::setMainThreadPriority(byte_t priority)
|
||||
void nn::hac::MetaBinary::setMainThreadPriority(byte_t priority)
|
||||
{
|
||||
if (priority > npdm::kMaxPriority)
|
||||
if (priority > meta::kMaxPriority)
|
||||
{
|
||||
throw fnd::Exception(kModuleName, "Illegal main thread priority (range 0-63)");
|
||||
}
|
||||
|
@ -214,44 +214,44 @@ void nn::hac::NpdmBinary::setMainThreadPriority(byte_t priority)
|
|||
mMainThreadPriority = priority;
|
||||
}
|
||||
|
||||
byte_t nn::hac::NpdmBinary::getMainThreadCpuId() const
|
||||
byte_t nn::hac::MetaBinary::getMainThreadCpuId() const
|
||||
{
|
||||
return mMainThreadCpuId;
|
||||
}
|
||||
|
||||
void nn::hac::NpdmBinary::setMainThreadCpuId(byte_t core_num)
|
||||
void nn::hac::MetaBinary::setMainThreadCpuId(byte_t core_num)
|
||||
{
|
||||
mMainThreadCpuId = core_num;
|
||||
}
|
||||
|
||||
uint32_t nn::hac::NpdmBinary::getVersion() const
|
||||
uint32_t nn::hac::MetaBinary::getVersion() const
|
||||
{
|
||||
return mVersion;
|
||||
}
|
||||
|
||||
void nn::hac::NpdmBinary::setVersion(uint32_t version)
|
||||
void nn::hac::MetaBinary::setVersion(uint32_t version)
|
||||
{
|
||||
mVersion = version;
|
||||
}
|
||||
|
||||
uint32_t nn::hac::NpdmBinary::getMainThreadStackSize() const
|
||||
uint32_t nn::hac::MetaBinary::getMainThreadStackSize() const
|
||||
{
|
||||
return mMainThreadStackSize;
|
||||
}
|
||||
|
||||
void nn::hac::NpdmBinary::setMainThreadStackSize(uint32_t size)
|
||||
void nn::hac::MetaBinary::setMainThreadStackSize(uint32_t size)
|
||||
{
|
||||
mMainThreadStackSize = size;
|
||||
}
|
||||
|
||||
const std::string & nn::hac::NpdmBinary::getName() const
|
||||
const std::string & nn::hac::MetaBinary::getName() const
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
void nn::hac::NpdmBinary::setName(const std::string & name)
|
||||
void nn::hac::MetaBinary::setName(const std::string & name)
|
||||
{
|
||||
if (name.length() > npdm::kNameMaxLen)
|
||||
if (name.length() > meta::kNameMaxLen)
|
||||
{
|
||||
throw fnd::Exception(kModuleName, "Name is too long");
|
||||
}
|
||||
|
@ -259,14 +259,14 @@ void nn::hac::NpdmBinary::setName(const std::string & name)
|
|||
mName = name;
|
||||
}
|
||||
|
||||
const std::string & nn::hac::NpdmBinary::getProductCode() const
|
||||
const std::string & nn::hac::MetaBinary::getProductCode() const
|
||||
{
|
||||
return mProductCode;
|
||||
}
|
||||
|
||||
void nn::hac::NpdmBinary::setProductCode(const std::string & product_code)
|
||||
void nn::hac::MetaBinary::setProductCode(const std::string & product_code)
|
||||
{
|
||||
if (product_code.length() > npdm::kProductCodeMaxLen)
|
||||
if (product_code.length() > meta::kProductCodeMaxLen)
|
||||
{
|
||||
throw fnd::Exception(kModuleName, "Product Code is too long");
|
||||
}
|
||||
|
@ -274,22 +274,22 @@ void nn::hac::NpdmBinary::setProductCode(const std::string & product_code)
|
|||
mProductCode = product_code;
|
||||
}
|
||||
|
||||
const nn::hac::AccessControlInfoBinary & nn::hac::NpdmBinary::getAci() const
|
||||
const nn::hac::AccessControlInfoBinary & nn::hac::MetaBinary::getAci() const
|
||||
{
|
||||
return mAci;
|
||||
}
|
||||
|
||||
void nn::hac::NpdmBinary::setAci(const AccessControlInfoBinary & aci)
|
||||
void nn::hac::MetaBinary::setAci(const AccessControlInfoBinary & aci)
|
||||
{
|
||||
mAci = aci;
|
||||
}
|
||||
|
||||
const nn::hac::AccessControlInfoDescBinary & nn::hac::NpdmBinary::getAcid() const
|
||||
const nn::hac::AccessControlInfoDescBinary & nn::hac::MetaBinary::getAcid() const
|
||||
{
|
||||
return mAcid;
|
||||
}
|
||||
|
||||
void nn::hac::NpdmBinary::setAcid(const AccessControlInfoDescBinary & acid)
|
||||
void nn::hac::MetaBinary::setAcid(const AccessControlInfoDescBinary & acid)
|
||||
{
|
||||
mAcid = acid;
|
||||
}
|
|
@ -184,9 +184,9 @@
|
|||
<ClInclude Include="source\ElfSymbolParser.h" />
|
||||
<ClInclude Include="source\EsTikProcess.h" />
|
||||
<ClInclude Include="source\KeyConfiguration.h" />
|
||||
<ClInclude Include="source\MetaProcess.h" />
|
||||
<ClInclude Include="source\NacpProcess.h" />
|
||||
<ClInclude Include="source\NcaProcess.h" />
|
||||
<ClInclude Include="source\NpdmProcess.h" />
|
||||
<ClInclude Include="source\NroProcess.h" />
|
||||
<ClInclude Include="source\NsoProcess.h" />
|
||||
<ClInclude Include="source\PfsProcess.h" />
|
||||
|
@ -206,9 +206,9 @@
|
|||
<ClCompile Include="source\EsTikProcess.cpp" />
|
||||
<ClCompile Include="source\KeyConfiguration.cpp" />
|
||||
<ClCompile Include="source\main.cpp" />
|
||||
<ClCompile Include="source\MetaProcess.cpp" />
|
||||
<ClCompile Include="source\NacpProcess.cpp" />
|
||||
<ClCompile Include="source\NcaProcess.cpp" />
|
||||
<ClCompile Include="source\NpdmProcess.cpp" />
|
||||
<ClCompile Include="source\NroProcess.cpp" />
|
||||
<ClCompile Include="source\NsoProcess.cpp" />
|
||||
<ClCompile Include="source\PfsProcess.cpp" />
|
||||
|
|
|
@ -37,15 +37,15 @@
|
|||
<ClInclude Include="source\KeyConfiguration.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="source\MetaProcess.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="source\NacpProcess.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="source\NcaProcess.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="source\NpdmProcess.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="source\NroProcess.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -99,15 +99,15 @@
|
|||
<ClCompile Include="source\main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\MetaProcess.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\NacpProcess.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\NcaProcess.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\NpdmProcess.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\NroProcess.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
|
|
@ -1,72 +1,72 @@
|
|||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include "NpdmProcess.h"
|
||||
#include "MetaProcess.h"
|
||||
|
||||
NpdmProcess::NpdmProcess() :
|
||||
MetaProcess::MetaProcess() :
|
||||
mFile(),
|
||||
mCliOutputMode(_BIT(OUTPUT_BASIC)),
|
||||
mVerify(false)
|
||||
{
|
||||
}
|
||||
|
||||
void NpdmProcess::process()
|
||||
void MetaProcess::process()
|
||||
{
|
||||
importNpdm();
|
||||
importMeta();
|
||||
|
||||
if (mVerify)
|
||||
{
|
||||
validateAcidSignature(mNpdm.getAcid());
|
||||
validateAciFromAcid(mNpdm.getAci(), mNpdm.getAcid());
|
||||
validateAcidSignature(mMeta.getAcid());
|
||||
validateAciFromAcid(mMeta.getAci(), mMeta.getAcid());
|
||||
}
|
||||
|
||||
if (_HAS_BIT(mCliOutputMode, OUTPUT_BASIC))
|
||||
{
|
||||
// npdm binary
|
||||
displayNpdmHeader(mNpdm);
|
||||
displayMetaHeader(mMeta);
|
||||
|
||||
// aci binary
|
||||
displayAciHdr(mNpdm.getAci());
|
||||
displayFac(mNpdm.getAci().getFileSystemAccessControl());
|
||||
displaySac(mNpdm.getAci().getServiceAccessControl());
|
||||
displayKernelCap(mNpdm.getAci().getKernelCapabilities());
|
||||
displayAciHdr(mMeta.getAci());
|
||||
displayFac(mMeta.getAci().getFileSystemAccessControl());
|
||||
displaySac(mMeta.getAci().getServiceAccessControl());
|
||||
displayKernelCap(mMeta.getAci().getKernelCapabilities());
|
||||
|
||||
// acid binary
|
||||
if (_HAS_BIT(mCliOutputMode, OUTPUT_EXTENDED))
|
||||
{
|
||||
displayAciDescHdr(mNpdm.getAcid());
|
||||
displayFac(mNpdm.getAcid().getFileSystemAccessControl());
|
||||
displaySac(mNpdm.getAcid().getServiceAccessControl());
|
||||
displayKernelCap(mNpdm.getAcid().getKernelCapabilities());
|
||||
displayAciDescHdr(mMeta.getAcid());
|
||||
displayFac(mMeta.getAcid().getFileSystemAccessControl());
|
||||
displaySac(mMeta.getAcid().getServiceAccessControl());
|
||||
displayKernelCap(mMeta.getAcid().getKernelCapabilities());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NpdmProcess::setInputFile(const fnd::SharedPtr<fnd::IFile>& file)
|
||||
void MetaProcess::setInputFile(const fnd::SharedPtr<fnd::IFile>& file)
|
||||
{
|
||||
mFile = file;
|
||||
}
|
||||
|
||||
void NpdmProcess::setKeyCfg(const KeyConfiguration& keycfg)
|
||||
void MetaProcess::setKeyCfg(const KeyConfiguration& keycfg)
|
||||
{
|
||||
mKeyCfg = keycfg;
|
||||
}
|
||||
|
||||
void NpdmProcess::setCliOutputMode(CliOutputMode type)
|
||||
void MetaProcess::setCliOutputMode(CliOutputMode type)
|
||||
{
|
||||
mCliOutputMode = type;
|
||||
}
|
||||
|
||||
void NpdmProcess::setVerifyMode(bool verify)
|
||||
void MetaProcess::setVerifyMode(bool verify)
|
||||
{
|
||||
mVerify = verify;
|
||||
}
|
||||
|
||||
const nn::hac::NpdmBinary& NpdmProcess::getNpdmBinary() const
|
||||
const nn::hac::MetaBinary& MetaProcess::getMetaBinary() const
|
||||
{
|
||||
return mNpdm;
|
||||
return mMeta;
|
||||
}
|
||||
|
||||
void NpdmProcess::importNpdm()
|
||||
void MetaProcess::importMeta()
|
||||
{
|
||||
fnd::Vec<byte_t> scratch;
|
||||
|
||||
|
@ -78,10 +78,10 @@ void NpdmProcess::importNpdm()
|
|||
scratch.alloc((*mFile)->size());
|
||||
(*mFile)->read(scratch.data(), 0, scratch.size());
|
||||
|
||||
mNpdm.fromBytes(scratch.data(), scratch.size());
|
||||
mMeta.fromBytes(scratch.data(), scratch.size());
|
||||
}
|
||||
|
||||
void NpdmProcess::validateAcidSignature(const nn::hac::AccessControlInfoDescBinary& acid)
|
||||
void MetaProcess::validateAcidSignature(const nn::hac::AccessControlInfoDescBinary& acid)
|
||||
{
|
||||
try {
|
||||
fnd::rsa::sRsa2048Key acid_sign_key;
|
||||
|
@ -96,7 +96,7 @@ void NpdmProcess::validateAcidSignature(const nn::hac::AccessControlInfoDescBina
|
|||
|
||||
}
|
||||
|
||||
void NpdmProcess::validateAciFromAcid(const nn::hac::AccessControlInfoBinary& aci, const nn::hac::AccessControlInfoDescBinary& acid)
|
||||
void MetaProcess::validateAciFromAcid(const nn::hac::AccessControlInfoBinary& aci, const nn::hac::AccessControlInfoDescBinary& acid)
|
||||
{
|
||||
// check Program ID
|
||||
if (acid.getProgramIdRestrict().min > 0 && aci.getProgramId() < acid.getProgramIdRestrict().min)
|
||||
|
@ -287,9 +287,9 @@ void NpdmProcess::validateAciFromAcid(const nn::hac::AccessControlInfoBinary& ac
|
|||
}
|
||||
}
|
||||
|
||||
void NpdmProcess::displayNpdmHeader(const nn::hac::NpdmBinary& hdr)
|
||||
void MetaProcess::displayMetaHeader(const nn::hac::MetaBinary& hdr)
|
||||
{
|
||||
std::cout << "[NPDM HEADER]" << std::endl;
|
||||
std::cout << "[Meta Header]" << std::endl;
|
||||
std::cout << " Process Architecture Params:" << std::endl;
|
||||
std::cout << " Ins. Type: " << getInstructionTypeStr(hdr.getInstructionType()) << std::endl;
|
||||
std::cout << " Addr Space: " << getProcAddressSpaceTypeStr(hdr.getProcAddressSpaceType()) << std::endl;
|
||||
|
@ -306,13 +306,13 @@ void NpdmProcess::displayNpdmHeader(const nn::hac::NpdmBinary& hdr)
|
|||
}
|
||||
}
|
||||
|
||||
void NpdmProcess::displayAciHdr(const nn::hac::AccessControlInfoBinary& aci)
|
||||
void MetaProcess::displayAciHdr(const nn::hac::AccessControlInfoBinary& aci)
|
||||
{
|
||||
std::cout << "[Access Control Info]" << std::endl;
|
||||
std::cout << " ProgramID: 0x" << std::hex << std::setw(16) << std::setfill('0') << aci.getProgramId() << std::endl;
|
||||
}
|
||||
|
||||
void NpdmProcess::displayAciDescHdr(const nn::hac::AccessControlInfoDescBinary& acid)
|
||||
void MetaProcess::displayAciDescHdr(const nn::hac::AccessControlInfoDescBinary& acid)
|
||||
{
|
||||
std::cout << "[Access Control Info Desc]" << std::endl;
|
||||
if (acid.getFlagList().size() > 0 || _HAS_BIT(mCliOutputMode, OUTPUT_EXTENDED))
|
||||
|
@ -328,7 +328,7 @@ void NpdmProcess::displayAciDescHdr(const nn::hac::AccessControlInfoDescBinary&
|
|||
std::cout << " Max: 0x" << std::hex << std::setw(16) << std::setfill('0') << acid.getProgramIdRestrict().max << std::endl;
|
||||
}
|
||||
|
||||
void NpdmProcess::displayFac(const nn::hac::FileSystemAccessControlBinary& fac)
|
||||
void MetaProcess::displayFac(const nn::hac::FileSystemAccessControlBinary& fac)
|
||||
{
|
||||
std::cout << "[FS Access Control]" << std::endl;
|
||||
std::cout << " Format Version: " << std::dec << (uint32_t)fac.getFormatVersion() << std::endl;
|
||||
|
@ -373,7 +373,7 @@ void NpdmProcess::displayFac(const nn::hac::FileSystemAccessControlBinary& fac)
|
|||
|
||||
}
|
||||
|
||||
void NpdmProcess::displaySac(const nn::hac::ServiceAccessControlBinary& sac)
|
||||
void MetaProcess::displaySac(const nn::hac::ServiceAccessControlBinary& sac)
|
||||
{
|
||||
std::cout << "[Service Access Control]" << std::endl;
|
||||
std::cout << " Service List:" << std::endl;
|
||||
|
@ -394,7 +394,7 @@ void NpdmProcess::displaySac(const nn::hac::ServiceAccessControlBinary& sac)
|
|||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
void NpdmProcess::displayKernelCap(const nn::hac::KernelCapabilityBinary& kern)
|
||||
void MetaProcess::displayKernelCap(const nn::hac::KernelCapabilityBinary& kern)
|
||||
{
|
||||
std::cout << "[Kernel Capabilities]" << std::endl;
|
||||
if (kern.getThreadInfo().isSet())
|
||||
|
@ -496,16 +496,16 @@ void NpdmProcess::displayKernelCap(const nn::hac::KernelCapabilityBinary& kern)
|
|||
}
|
||||
}
|
||||
|
||||
const char* NpdmProcess::getInstructionTypeStr(nn::hac::npdm::InstructionType type) const
|
||||
const char* MetaProcess::getInstructionTypeStr(nn::hac::meta::InstructionType type) const
|
||||
{
|
||||
const char* str = nullptr;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case (nn::hac::npdm::INSTR_32BIT):
|
||||
case (nn::hac::meta::INSTR_32BIT):
|
||||
str = "32Bit";
|
||||
break;
|
||||
case (nn::hac::npdm::INSTR_64BIT):
|
||||
case (nn::hac::meta::INSTR_64BIT):
|
||||
str = "64Bit";
|
||||
break;
|
||||
default:
|
||||
|
@ -516,19 +516,19 @@ const char* NpdmProcess::getInstructionTypeStr(nn::hac::npdm::InstructionType ty
|
|||
return str;
|
||||
}
|
||||
|
||||
const char* NpdmProcess::getProcAddressSpaceTypeStr(nn::hac::npdm::ProcAddrSpaceType type) const
|
||||
const char* MetaProcess::getProcAddressSpaceTypeStr(nn::hac::meta::ProcAddrSpaceType type) const
|
||||
{
|
||||
const char* str = nullptr;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case (nn::hac::npdm::ADDR_SPACE_64BIT):
|
||||
case (nn::hac::meta::ADDR_SPACE_64BIT):
|
||||
str = "64Bit";
|
||||
break;
|
||||
case (nn::hac::npdm::ADDR_SPACE_32BIT):
|
||||
case (nn::hac::meta::ADDR_SPACE_32BIT):
|
||||
str = "32Bit";
|
||||
break;
|
||||
case (nn::hac::npdm::ADDR_SPACE_32BIT_NO_RESERVED):
|
||||
case (nn::hac::meta::ADDR_SPACE_32BIT_NO_RESERVED):
|
||||
str = "32Bit no reserved";
|
||||
break;
|
||||
default:
|
||||
|
@ -539,7 +539,7 @@ const char* NpdmProcess::getProcAddressSpaceTypeStr(nn::hac::npdm::ProcAddrSpace
|
|||
return str;
|
||||
}
|
||||
|
||||
const char* NpdmProcess::getAcidFlagStr(nn::hac::aci::Flag flag) const
|
||||
const char* MetaProcess::getAcidFlagStr(nn::hac::aci::Flag flag) const
|
||||
{
|
||||
const char* str = nullptr;
|
||||
|
||||
|
@ -559,7 +559,7 @@ const char* NpdmProcess::getAcidFlagStr(nn::hac::aci::Flag flag) const
|
|||
return str;
|
||||
}
|
||||
|
||||
const char* NpdmProcess::getMiscFlagStr(nn::hac::MiscFlagsHandler::Flags flag) const
|
||||
const char* MetaProcess::getMiscFlagStr(nn::hac::MiscFlagsHandler::Flags flag) const
|
||||
{
|
||||
const char* str = nullptr;
|
||||
|
||||
|
@ -579,7 +579,7 @@ const char* NpdmProcess::getMiscFlagStr(nn::hac::MiscFlagsHandler::Flags flag) c
|
|||
return str;
|
||||
}
|
||||
|
||||
const char* NpdmProcess::getFsaRightStr(nn::hac::fac::FsAccessFlag flag) const
|
||||
const char* MetaProcess::getFsaRightStr(nn::hac::fac::FsAccessFlag flag) const
|
||||
{
|
||||
const char* str = nullptr;
|
||||
|
||||
|
@ -659,7 +659,7 @@ const char* NpdmProcess::getFsaRightStr(nn::hac::fac::FsAccessFlag flag) const
|
|||
return str;
|
||||
}
|
||||
|
||||
const char* NpdmProcess::getSaveDataOwnerAccessModeStr(nn::hac::fac::SaveDataOwnerIdAccessType type) const
|
||||
const char* MetaProcess::getSaveDataOwnerAccessModeStr(nn::hac::fac::SaveDataOwnerIdAccessType type) const
|
||||
{
|
||||
const char* str = nullptr;
|
||||
|
||||
|
@ -682,7 +682,7 @@ const char* NpdmProcess::getSaveDataOwnerAccessModeStr(nn::hac::fac::SaveDataOwn
|
|||
return str;
|
||||
}
|
||||
|
||||
const char* NpdmProcess::getSystemCallStr(byte_t syscall_id) const
|
||||
const char* MetaProcess::getSystemCallStr(byte_t syscall_id) const
|
||||
{
|
||||
const char* str = nullptr;
|
||||
|
||||
|
@ -1077,7 +1077,7 @@ const char* NpdmProcess::getSystemCallStr(byte_t syscall_id) const
|
|||
return str;
|
||||
}
|
||||
|
||||
const char* NpdmProcess::getMemMapPermStr(nn::hac::MemoryMappingHandler::MemoryPerm type) const
|
||||
const char* MetaProcess::getMemMapPermStr(nn::hac::MemoryMappingHandler::MemoryPerm type) const
|
||||
{
|
||||
const char* str = nullptr;
|
||||
|
||||
|
@ -1097,7 +1097,7 @@ const char* NpdmProcess::getMemMapPermStr(nn::hac::MemoryMappingHandler::MemoryP
|
|||
return str;
|
||||
}
|
||||
|
||||
const char* NpdmProcess::getMemMapTypeStr(nn::hac::MemoryMappingHandler::MappingType type) const
|
||||
const char* MetaProcess::getMemMapTypeStr(nn::hac::MemoryMappingHandler::MappingType type) const
|
||||
{
|
||||
const char* str = nullptr;
|
||||
|
|
@ -3,15 +3,15 @@
|
|||
#include <fnd/types.h>
|
||||
#include <fnd/IFile.h>
|
||||
#include <fnd/SharedPtr.h>
|
||||
#include <nn/hac/NpdmBinary.h>
|
||||
#include <nn/hac/MetaBinary.h>
|
||||
#include "KeyConfiguration.h"
|
||||
|
||||
#include "common.h"
|
||||
|
||||
class NpdmProcess
|
||||
class MetaProcess
|
||||
{
|
||||
public:
|
||||
NpdmProcess();
|
||||
MetaProcess();
|
||||
|
||||
void process();
|
||||
|
||||
|
@ -20,32 +20,32 @@ public:
|
|||
void setCliOutputMode(CliOutputMode type);
|
||||
void setVerifyMode(bool verify);
|
||||
|
||||
const nn::hac::NpdmBinary& getNpdmBinary() const;
|
||||
const nn::hac::MetaBinary& getMetaBinary() const;
|
||||
|
||||
private:
|
||||
const std::string kModuleName = "NpdmProcess";
|
||||
const std::string kModuleName = "MetaProcess";
|
||||
|
||||
fnd::SharedPtr<fnd::IFile> mFile;
|
||||
KeyConfiguration mKeyCfg;
|
||||
CliOutputMode mCliOutputMode;
|
||||
bool mVerify;
|
||||
|
||||
nn::hac::NpdmBinary mNpdm;
|
||||
nn::hac::MetaBinary mMeta;
|
||||
|
||||
void importNpdm();
|
||||
void importMeta();
|
||||
|
||||
void validateAcidSignature(const nn::hac::AccessControlInfoDescBinary& acid);
|
||||
void validateAciFromAcid(const nn::hac::AccessControlInfoBinary& aci, const nn::hac::AccessControlInfoDescBinary& acid);
|
||||
|
||||
void displayNpdmHeader(const nn::hac::NpdmBinary& hdr);
|
||||
void displayMetaHeader(const nn::hac::MetaBinary& hdr);
|
||||
void displayAciHdr(const nn::hac::AccessControlInfoBinary& aci);
|
||||
void displayAciDescHdr(const nn::hac::AccessControlInfoDescBinary& aci);
|
||||
void displayFac(const nn::hac::FileSystemAccessControlBinary& fac);
|
||||
void displaySac(const nn::hac::ServiceAccessControlBinary& sac);
|
||||
void displayKernelCap(const nn::hac::KernelCapabilityBinary& kern);
|
||||
|
||||
const char* getInstructionTypeStr(nn::hac::npdm::InstructionType type) const;
|
||||
const char* getProcAddressSpaceTypeStr(nn::hac::npdm::ProcAddrSpaceType type) const;
|
||||
const char* getInstructionTypeStr(nn::hac::meta::InstructionType type) const;
|
||||
const char* getProcAddressSpaceTypeStr(nn::hac::meta::ProcAddrSpaceType type) const;
|
||||
const char* getAcidFlagStr(nn::hac::aci::Flag flag) const;
|
||||
const char* getMiscFlagStr(nn::hac::MiscFlagsHandler::Flags flag) const;
|
||||
const char* getFsaRightStr(nn::hac::fac::FsAccessFlag flag) const;
|
|
@ -12,7 +12,7 @@
|
|||
#include "NcaProcess.h"
|
||||
#include "PfsProcess.h"
|
||||
#include "RomfsProcess.h"
|
||||
#include "NpdmProcess.h"
|
||||
#include "MetaProcess.h"
|
||||
|
||||
|
||||
NcaProcess::NcaProcess() :
|
||||
|
@ -410,12 +410,12 @@ void NcaProcess::validateNcaSignatures()
|
|||
{
|
||||
const nn::hac::PfsHeader::sFile& file = exefs.getPfsHeader().getFileList().getElement(kNpdmExefsPath);
|
||||
|
||||
NpdmProcess npdm;
|
||||
MetaProcess npdm;
|
||||
npdm.setInputFile(new fnd::OffsetAdjustedIFile(mPartitions[nn::hac::nca::PARTITION_CODE].reader, file.offset, file.size));
|
||||
npdm.setCliOutputMode(0);
|
||||
npdm.process();
|
||||
|
||||
if (fnd::rsa::pss::rsaVerify(npdm.getNpdmBinary().getAcid().getNcaHeaderSignature2Key(), fnd::sha::HASH_SHA256, mHdrHash.bytes, mHdrBlock.signature_acid) != 0)
|
||||
if (fnd::rsa::pss::rsaVerify(npdm.getMetaBinary().getAcid().getNcaHeaderSignature2Key(), fnd::sha::HASH_SHA256, mHdrHash.bytes, mHdrBlock.signature_acid) != 0)
|
||||
{
|
||||
std::cout << "[WARNING] NCA Header ACID Signature: FAIL" << std::endl;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ void NroProcess::setVerifyMode(bool verify)
|
|||
mVerify = verify;
|
||||
}
|
||||
|
||||
void NroProcess::setInstructionType(nn::hac::npdm::InstructionType type)
|
||||
void NroProcess::setInstructionType(nn::hac::meta::InstructionType type)
|
||||
{
|
||||
mRoMeta.setInstructionType(type);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <fnd/types.h>
|
||||
#include <fnd/IFile.h>
|
||||
#include <fnd/SharedPtr.h>
|
||||
#include <nn/hac/npdm.h>
|
||||
#include <nn/hac/meta.h>
|
||||
#include <nn/hac/NroHeader.h>
|
||||
#include "AssetProcess.h"
|
||||
|
||||
|
@ -22,7 +22,7 @@ public:
|
|||
void setCliOutputMode(CliOutputMode type);
|
||||
void setVerifyMode(bool verify);
|
||||
|
||||
void setInstructionType(nn::hac::npdm::InstructionType type);
|
||||
void setInstructionType(nn::hac::meta::InstructionType type);
|
||||
void setListApi(bool listApi);
|
||||
void setListSymbols(bool listSymbols);
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ void NsoProcess::setVerifyMode(bool verify)
|
|||
mVerify = verify;
|
||||
}
|
||||
|
||||
void NsoProcess::setInstructionType(nn::hac::npdm::InstructionType type)
|
||||
void NsoProcess::setInstructionType(nn::hac::meta::InstructionType type)
|
||||
{
|
||||
mRoMeta.setInstructionType(type);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <fnd/types.h>
|
||||
#include <fnd/IFile.h>
|
||||
#include <fnd/SharedPtr.h>
|
||||
#include <nn/hac/npdm.h>
|
||||
#include <nn/hac/meta.h>
|
||||
#include <nn/hac/NsoHeader.h>
|
||||
|
||||
#include "common.h"
|
||||
|
@ -21,7 +21,7 @@ public:
|
|||
void setCliOutputMode(CliOutputMode type);
|
||||
void setVerifyMode(bool verify);
|
||||
|
||||
void setInstructionType(nn::hac::npdm::InstructionType type);
|
||||
void setInstructionType(nn::hac::meta::InstructionType type);
|
||||
void setListApi(bool listApi);
|
||||
void setListSymbols(bool listSymbols);
|
||||
|
||||
|
@ -32,7 +32,7 @@ private:
|
|||
fnd::SharedPtr<fnd::IFile> mFile;
|
||||
CliOutputMode mCliOutputMode;
|
||||
bool mVerify;
|
||||
nn::hac::npdm::InstructionType mInstructionType;
|
||||
nn::hac::meta::InstructionType mInstructionType;
|
||||
bool mListApi;
|
||||
bool mListSymbols;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
RoMetadataProcess::RoMetadataProcess() :
|
||||
mCliOutputMode(_BIT(OUTPUT_BASIC)),
|
||||
mInstructionType(nn::hac::npdm::INSTR_64BIT),
|
||||
mInstructionType(nn::hac::meta::INSTR_64BIT),
|
||||
mListApi(false),
|
||||
mListSymbols(false),
|
||||
mApiInfo(),
|
||||
|
@ -57,7 +57,7 @@ void RoMetadataProcess::setCliOutputMode(CliOutputMode type)
|
|||
mCliOutputMode = type;
|
||||
}
|
||||
|
||||
void RoMetadataProcess::setInstructionType(nn::hac::npdm::InstructionType type)
|
||||
void RoMetadataProcess::setInstructionType(nn::hac::meta::InstructionType type)
|
||||
{
|
||||
mInstructionType = type;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ void RoMetadataProcess::importApiList()
|
|||
|
||||
if (mDynSym.size > 0)
|
||||
{
|
||||
mSymbolList.parseData(mRoBlob.data() + mDynSym.offset, mDynSym.size, mRoBlob.data() + mDynStr.offset, mDynStr.size, mInstructionType == nn::hac::npdm::INSTR_64BIT);
|
||||
mSymbolList.parseData(mRoBlob.data() + mDynSym.offset, mDynSym.size, mRoBlob.data() + mDynStr.offset, mDynStr.size, mInstructionType == nn::hac::meta::INSTR_64BIT);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <fnd/types.h>
|
||||
#include <fnd/Vec.h>
|
||||
|
||||
#include <nn/hac/npdm.h>
|
||||
#include <nn/hac/meta.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "SdkApiString.h"
|
||||
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
void setCliOutputMode(CliOutputMode type);
|
||||
|
||||
void setInstructionType(nn::hac::npdm::InstructionType type);
|
||||
void setInstructionType(nn::hac::meta::InstructionType type);
|
||||
void setListApi(bool listApi);
|
||||
void setListSymbols(bool listSymbols);
|
||||
|
||||
|
@ -37,7 +37,7 @@ private:
|
|||
const std::string kModuleName = "RoMetadataProcess";
|
||||
|
||||
CliOutputMode mCliOutputMode;
|
||||
nn::hac::npdm::InstructionType mInstructionType;
|
||||
nn::hac::meta::InstructionType mInstructionType;
|
||||
bool mListApi;
|
||||
bool mListSymbols;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <nn/hac/xci.h>
|
||||
#include <nn/hac/pfs.h>
|
||||
#include <nn/hac/nca.h>
|
||||
#include <nn/hac/npdm.h>
|
||||
#include <nn/hac/meta.h>
|
||||
#include <nn/hac/romfs.h>
|
||||
#include <nn/hac/cnmt.h>
|
||||
#include <nn/hac/nacp.h>
|
||||
|
@ -52,7 +52,7 @@ void UserSettings::showHelp()
|
|||
printf("\n General Options:\n");
|
||||
printf(" -d, --dev Use devkit keyset.\n");
|
||||
printf(" -k, --keyset Specify keyset file.\n");
|
||||
printf(" -t, --type Specify input file type. [xci, pfs, romfs, nca, npdm, cnmt, nso, nro, nacp, aset, cert, tik]\n");
|
||||
printf(" -t, --type Specify input file type. [xci, pfs, romfs, nca, meta, cnmt, nso, nro, nacp, aset, cert, tik]\n");
|
||||
printf(" -y, --verify Verify file.\n");
|
||||
printf("\n Output Options:\n");
|
||||
printf(" --showkeys Show keys generated.\n");
|
||||
|
@ -133,7 +133,7 @@ bool UserSettings::isListSymbols() const
|
|||
return mListSymbols;
|
||||
}
|
||||
|
||||
nn::hac::npdm::InstructionType UserSettings::getInstType() const
|
||||
nn::hac::meta::InstructionType UserSettings::getInstType() const
|
||||
{
|
||||
return mInstructionType;
|
||||
}
|
||||
|
@ -548,7 +548,7 @@ void UserSettings::populateUserSettings(sCmdArgs& args)
|
|||
if (args.inst_type.isSet)
|
||||
mInstructionType = getInstructionTypeFromString(*args.inst_type);
|
||||
else
|
||||
mInstructionType = nn::hac::npdm::INSTR_64BIT; // default 64bit
|
||||
mInstructionType = nn::hac::meta::INSTR_64BIT; // default 64bit
|
||||
|
||||
mListApi = args.list_api.isSet;
|
||||
mListSymbols = args.list_sym.isSet;
|
||||
|
@ -602,8 +602,8 @@ FileType UserSettings::getFileTypeFromString(const std::string& type_str)
|
|||
type = FILE_ROMFS;
|
||||
else if (str == "nca")
|
||||
type = FILE_NCA;
|
||||
else if (str == "npdm")
|
||||
type = FILE_NPDM;
|
||||
else if (str == "meta")
|
||||
type = FILE_META;
|
||||
else if (str == "cnmt")
|
||||
type = FILE_CNMT;
|
||||
else if (str == "nso")
|
||||
|
@ -657,8 +657,8 @@ FileType UserSettings::determineFileTypeFromFile(const std::string& path)
|
|||
else if (_ASSERT_SIZE(sizeof(nn::hac::sRomfsHeader)) && _TYPE_PTR(nn::hac::sRomfsHeader)->header_size.get() == sizeof(nn::hac::sRomfsHeader) && _TYPE_PTR(nn::hac::sRomfsHeader)->sections[1].offset.get() == (_TYPE_PTR(nn::hac::sRomfsHeader)->sections[0].offset.get() + _TYPE_PTR(nn::hac::sRomfsHeader)->sections[0].size.get()))
|
||||
file_type = FILE_ROMFS;
|
||||
// test npdm
|
||||
else if (_ASSERT_SIZE(sizeof(nn::hac::sNpdmHeader)) && _TYPE_PTR(nn::hac::sNpdmHeader)->st_magic.get() == nn::hac::npdm::kNpdmStructMagic)
|
||||
file_type = FILE_NPDM;
|
||||
else if (_ASSERT_SIZE(sizeof(nn::hac::sMetaHeader)) && _TYPE_PTR(nn::hac::sMetaHeader)->st_magic.get() == nn::hac::meta::kMetaStructMagic)
|
||||
file_type = FILE_META;
|
||||
// test nca
|
||||
else if (determineValidNcaFromSample(scratch))
|
||||
file_type = FILE_NCA;
|
||||
|
@ -832,16 +832,16 @@ bool UserSettings::determineValidEsTikFromSample(const fnd::Vec<byte_t>& sample)
|
|||
return true;
|
||||
}
|
||||
|
||||
nn::hac::npdm::InstructionType UserSettings::getInstructionTypeFromString(const std::string & type_str)
|
||||
nn::hac::meta::InstructionType UserSettings::getInstructionTypeFromString(const std::string & type_str)
|
||||
{
|
||||
std::string str = type_str;
|
||||
std::transform(str.begin(), str.end(), str.begin(), ::tolower);
|
||||
|
||||
nn::hac::npdm::InstructionType type;
|
||||
nn::hac::meta::InstructionType type;
|
||||
if (str == "32bit")
|
||||
type = nn::hac::npdm::INSTR_32BIT;
|
||||
type = nn::hac::meta::INSTR_32BIT;
|
||||
else if (str == "64bit")
|
||||
type = nn::hac::npdm::INSTR_64BIT;
|
||||
type = nn::hac::meta::INSTR_64BIT;
|
||||
else
|
||||
throw fnd::Exception(kModuleName, "Unsupported instruction type: " + str);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
#include <fnd/List.h>
|
||||
#include <nn/pki/SignedData.h>
|
||||
#include <nn/pki/CertificateBody.h>
|
||||
#include <nn/hac/npdm.h>
|
||||
#include <nn/hac/meta.h>
|
||||
#include "common.h"
|
||||
#include "KeyConfiguration.h"
|
||||
|
||||
|
@ -29,7 +29,7 @@ public:
|
|||
bool isListFs() const;
|
||||
bool isListApi() const;
|
||||
bool isListSymbols() const;
|
||||
nn::hac::npdm::InstructionType getInstType() const;
|
||||
nn::hac::meta::InstructionType getInstType() const;
|
||||
|
||||
// specialised paths
|
||||
const sOptional<std::string>& getXciUpdatePath() const;
|
||||
|
@ -110,7 +110,7 @@ private:
|
|||
|
||||
bool mListApi;
|
||||
bool mListSymbols;
|
||||
nn::hac::npdm::InstructionType mInstructionType;
|
||||
nn::hac::meta::InstructionType mInstructionType;
|
||||
|
||||
void populateCmdArgs(const std::vector<std::string>& arg_list, sCmdArgs& cmd_args);
|
||||
void populateKeyset(sCmdArgs& args);
|
||||
|
@ -122,7 +122,7 @@ private:
|
|||
bool determineValidNacpFromSample(const fnd::Vec<byte_t>& sample) const;
|
||||
bool determineValidEsCertFromSample(const fnd::Vec<byte_t>& sample) const;
|
||||
bool determineValidEsTikFromSample(const fnd::Vec<byte_t>& sample) const;
|
||||
nn::hac::npdm::InstructionType getInstructionTypeFromString(const std::string& type_str);
|
||||
nn::hac::meta::InstructionType getInstructionTypeFromString(const std::string& type_str);
|
||||
void getHomePath(std::string& path) const;
|
||||
void getSwitchPath(std::string& path) const;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ enum FileType
|
|||
FILE_PARTITIONFS,
|
||||
FILE_ROMFS,
|
||||
FILE_NCA,
|
||||
FILE_NPDM,
|
||||
FILE_META,
|
||||
FILE_CNMT,
|
||||
FILE_NSO,
|
||||
FILE_NRO,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "PfsProcess.h"
|
||||
#include "RomfsProcess.h"
|
||||
#include "NcaProcess.h"
|
||||
#include "NpdmProcess.h"
|
||||
#include "MetaProcess.h"
|
||||
#include "CnmtProcess.h"
|
||||
#include "NsoProcess.h"
|
||||
#include "NroProcess.h"
|
||||
|
@ -110,9 +110,9 @@ int main(int argc, char** argv)
|
|||
|
||||
nca.process();
|
||||
}
|
||||
else if (user_set.getFileType() == FILE_NPDM)
|
||||
else if (user_set.getFileType() == FILE_META)
|
||||
{
|
||||
NpdmProcess npdm;
|
||||
MetaProcess npdm;
|
||||
|
||||
npdm.setInputFile(inputFile);
|
||||
npdm.setKeyCfg(user_set.getKeyCfg());
|
||||
|
|
Loading…
Reference in a new issue