[hac|nstool] Take out the ExtendedHeader classes from ContentMeta.

This commit is contained in:
jakcron 2018-10-22 21:07:17 +08:00
parent a3fea3f0b3
commit 7937055bd6
16 changed files with 628 additions and 147 deletions

View file

@ -0,0 +1,46 @@
#pragma once
#include <string>
#include <cstring>
#include <fnd/IByteModel.h>
#include <nn/hac/cnmt.h>
namespace nn
{
namespace hac
{
class AddOnContentMetaExtendedHeader :
public fnd::IByteModel
{
public:
AddOnContentMetaExtendedHeader();
AddOnContentMetaExtendedHeader(const AddOnContentMetaExtendedHeader& other);
void operator=(const AddOnContentMetaExtendedHeader& other);
bool operator==(const AddOnContentMetaExtendedHeader& other) const;
bool operator!=(const AddOnContentMetaExtendedHeader& other) const;
// IByteModel
void toBytes();
void fromBytes(const byte_t* bytes, size_t len);
const fnd::Vec<byte_t>& getBytes() const;
// variables
void clear();
uint64_t getApplicationId() const;
void setApplicationId(uint64_t application_id);
uint32_t getRequiredApplicationVersion() const;
void setRequiredApplicationVersion(uint32_t app_ver);
private:
const std::string kModuleName = "ADD_ON_CONTENT_META_EXTENDED_HEADER";
// binary blob
fnd::Vec<byte_t> mRawBinary;
// variables
uint64_t mApplicationId;
uint32_t mRequiredApplicationVersion;
};
}
}

View file

@ -0,0 +1,46 @@
#pragma once
#include <string>
#include <cstring>
#include <fnd/IByteModel.h>
#include <nn/hac/cnmt.h>
namespace nn
{
namespace hac
{
class ApplicationMetaExtendedHeader :
public fnd::IByteModel
{
public:
ApplicationMetaExtendedHeader();
ApplicationMetaExtendedHeader(const ApplicationMetaExtendedHeader& other);
void operator=(const ApplicationMetaExtendedHeader& other);
bool operator==(const ApplicationMetaExtendedHeader& other) const;
bool operator!=(const ApplicationMetaExtendedHeader& other) const;
// IByteModel
void toBytes();
void fromBytes(const byte_t* bytes, size_t len);
const fnd::Vec<byte_t>& getBytes() const;
// variables
void clear();
uint64_t getPatchId() const;
void setPatchId(uint64_t patch_id);
uint32_t getRequiredSystemVersion() const;
void setRequiredSystemVersion(uint32_t sys_ver);
private:
const std::string kModuleName = "APPLICATION_META_EXTENDED_HEADER";
// binary blob
fnd::Vec<byte_t> mRawBinary;
// variables
uint64_t mPatchId;
uint32_t mRequiredSystemVersion;
};
}
}

View file

@ -2,7 +2,6 @@
#include <string> #include <string>
#include <cstring> #include <cstring>
#include <fnd/IByteModel.h> #include <fnd/IByteModel.h>
#include <fnd/List.h>
#include <nn/hac/cnmt.h> #include <nn/hac/cnmt.h>
namespace nn namespace nn

View file

@ -6,6 +6,10 @@
#include <nn/hac/cnmt.h> #include <nn/hac/cnmt.h>
#include <nn/hac/ContentInfo.h> #include <nn/hac/ContentInfo.h>
#include <nn/hac/ContentMetaInfo.h> #include <nn/hac/ContentMetaInfo.h>
#include <nn/hac/ApplicationMetaExtendedHeader.h>
#include <nn/hac/PatchMetaExtendedHeader.h>
#include <nn/hac/AddOnContentMetaExtendedHeader.h>
#include <nn/hac/DeltaMetaExtendedHeader.h>
namespace nn namespace nn
{ {
@ -15,95 +19,6 @@ namespace hac
public fnd::IByteModel public fnd::IByteModel
{ {
public: public:
struct ApplicationMetaExtendedHeader
{
uint64_t patch_id;
uint32_t required_system_version;
void operator=(const ApplicationMetaExtendedHeader& other)
{
patch_id = other.patch_id;
required_system_version = other.required_system_version;
}
bool operator==(const ApplicationMetaExtendedHeader& other) const
{
return (patch_id == other.patch_id) \
&& (required_system_version == other.required_system_version);
}
bool operator!=(const ApplicationMetaExtendedHeader& other) const
{
return !operator==(other);
}
};
struct PatchMetaExtendedHeader
{
uint64_t application_id;
uint32_t required_system_version;
void operator=(const PatchMetaExtendedHeader& other)
{
application_id = other.application_id;
required_system_version = other.required_system_version;
}
bool operator==(const PatchMetaExtendedHeader& other) const
{
return (application_id == other.application_id) \
&& (required_system_version == other.required_system_version);
}
bool operator!=(const PatchMetaExtendedHeader& other) const
{
return !operator==(other);
}
};
struct AddOnContentMetaExtendedHeader
{
uint64_t application_id;
uint32_t required_application_version;
void operator=(const AddOnContentMetaExtendedHeader& other)
{
application_id = other.application_id;
required_application_version = other.required_application_version;
}
bool operator==(const AddOnContentMetaExtendedHeader& other) const
{
return (application_id == other.application_id) \
&& (required_application_version == other.required_application_version);
}
bool operator!=(const AddOnContentMetaExtendedHeader& other) const
{
return !operator==(other);
}
};
struct DeltaMetaExtendedHeader
{
uint64_t application_id;
void operator=(const DeltaMetaExtendedHeader& other)
{
application_id = other.application_id;
}
bool operator==(const DeltaMetaExtendedHeader& other) const
{
return (application_id == other.application_id);
}
bool operator!=(const DeltaMetaExtendedHeader& other) const
{
return !operator==(other);
}
};
ContentMeta(); ContentMeta();
ContentMeta(const ContentMeta& other); ContentMeta(const ContentMeta& other);
@ -125,8 +40,8 @@ namespace hac
uint32_t getTitleVersion() const; uint32_t getTitleVersion() const;
void setTitleVersion(uint32_t version); void setTitleVersion(uint32_t version);
cnmt::ContentMetaType getType() const; cnmt::ContentMetaType getContentMetaType() const;
void setType(cnmt::ContentMetaType type); void setContentMetaType(cnmt::ContentMetaType type);
byte_t getAttributes() const; byte_t getAttributes() const;
void setAttributes(byte_t attributes); void setAttributes(byte_t attributes);
@ -155,8 +70,8 @@ namespace hac
const fnd::Vec<byte_t>& getExtendedData() const; const fnd::Vec<byte_t>& getExtendedData() const;
void setExtendedData(const fnd::Vec<byte_t>& data); void setExtendedData(const fnd::Vec<byte_t>& data);
const nn::hac::cnmt::sDigest& getDigest() const; const cnmt::sDigest& getDigest() const;
void setDigest(const nn::hac::cnmt::sDigest& digest); void setDigest(const cnmt::sDigest& digest);
private: private:
@ -178,10 +93,10 @@ namespace hac
AddOnContentMetaExtendedHeader mAddOnContentMetaExtendedHeader; AddOnContentMetaExtendedHeader mAddOnContentMetaExtendedHeader;
DeltaMetaExtendedHeader mDeltaMetaExtendedHeader; DeltaMetaExtendedHeader mDeltaMetaExtendedHeader;
fnd::List<nn::hac::ContentInfo> mContentInfo; fnd::List<ContentInfo> mContentInfo;
fnd::List<nn::hac::ContentMetaInfo> mContentMetaInfo; fnd::List<ContentMetaInfo> mContentMetaInfo;
fnd::Vec<byte_t> mExtendedData; fnd::Vec<byte_t> mExtendedData;
nn::hac::cnmt::sDigest mDigest; cnmt::sDigest mDigest;
inline size_t getExtendedHeaderOffset() const { return sizeof(sContentMetaHeader); } inline size_t getExtendedHeaderOffset() const { return sizeof(sContentMetaHeader); }
inline size_t getContentInfoOffset(size_t exhdrSize) const { return getExtendedHeaderOffset() + exhdrSize; } inline size_t getContentInfoOffset(size_t exhdrSize) const { return getExtendedHeaderOffset() + exhdrSize; }

View file

@ -2,7 +2,6 @@
#include <string> #include <string>
#include <cstring> #include <cstring>
#include <fnd/IByteModel.h> #include <fnd/IByteModel.h>
#include <fnd/List.h>
#include <nn/hac/cnmt.h> #include <nn/hac/cnmt.h>
namespace nn namespace nn
@ -31,8 +30,8 @@ namespace hac
uint64_t getTitleId() const; uint64_t getTitleId() const;
void setTitleId(uint64_t title_id); void setTitleId(uint64_t title_id);
uint32_t getVersion() const; uint32_t getTitleVersion() const;
void setVersion(uint32_t ver); void setTitleVersion(uint32_t ver);
cnmt::ContentMetaType getContentMetaType() const; cnmt::ContentMetaType getContentMetaType() const;
void setContentMetaType(cnmt::ContentMetaType type); void setContentMetaType(cnmt::ContentMetaType type);
@ -48,7 +47,7 @@ namespace hac
// variables // variables
uint64_t mTitleId; uint64_t mTitleId;
uint32_t mVersion; uint32_t mTitleVersion;
cnmt::ContentMetaType mType; cnmt::ContentMetaType mType;
byte_t mAttributes; byte_t mAttributes;
}; };

View file

@ -0,0 +1,47 @@
#pragma once
#include <string>
#include <cstring>
#include <fnd/IByteModel.h>
#include <nn/hac/cnmt.h>
namespace nn
{
namespace hac
{
class DeltaMetaExtendedHeader :
public fnd::IByteModel
{
public:
DeltaMetaExtendedHeader();
DeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& other);
void operator=(const DeltaMetaExtendedHeader& other);
bool operator==(const DeltaMetaExtendedHeader& other) const;
bool operator!=(const DeltaMetaExtendedHeader& other) const;
// IByteModel
void toBytes();
void fromBytes(const byte_t* bytes, size_t len);
const fnd::Vec<byte_t>& getBytes() const;
// variables
void clear();
uint64_t getApplicationId() const;
void setApplicationId(uint64_t application_id);
uint32_t getExtendedDataSize() const;
void setExtendedDataSize(uint32_t size);
private:
const std::string kModuleName = "DELTA_META_EXTENDED_HEADER";
// binary blob
fnd::Vec<byte_t> mRawBinary;
// variables
uint64_t mApplicationId;
uint32_t mExtendedDataSize;
};
}
}

View file

@ -0,0 +1,51 @@
#pragma once
#include <string>
#include <cstring>
#include <fnd/IByteModel.h>
#include <nn/hac/cnmt.h>
namespace nn
{
namespace hac
{
class PatchMetaExtendedHeader :
public fnd::IByteModel
{
public:
PatchMetaExtendedHeader();
PatchMetaExtendedHeader(const PatchMetaExtendedHeader& other);
void operator=(const PatchMetaExtendedHeader& other);
bool operator==(const PatchMetaExtendedHeader& other) const;
bool operator!=(const PatchMetaExtendedHeader& other) const;
// IByteModel
void toBytes();
void fromBytes(const byte_t* bytes, size_t len);
const fnd::Vec<byte_t>& getBytes() const;
// variables
void clear();
uint64_t getApplicationId() const;
void setApplicationId(uint64_t application_id);
uint32_t getRequiredSystemVersion() const;
void setRequiredSystemVersion(uint32_t sys_ver);
uint32_t getExtendedDataSize() const;
void setExtendedDataSize(uint32_t size);
private:
const std::string kModuleName = "PATCH_META_EXTENDED_HEADER";
// binary blob
fnd::Vec<byte_t> mRawBinary;
// variables
uint64_t mApplicationId;
uint32_t mRequiredSystemVersion;
uint32_t mExtendedDataSize;
};
}
}

View file

@ -25,14 +25,17 @@
<ClInclude Include="include\nn\hac\AccessControlInfo.h" /> <ClInclude Include="include\nn\hac\AccessControlInfo.h" />
<ClInclude Include="include\nn\hac\AccessControlInfoDesc.h" /> <ClInclude Include="include\nn\hac\AccessControlInfoDesc.h" />
<ClInclude Include="include\nn\hac\aci.h" /> <ClInclude Include="include\nn\hac\aci.h" />
<ClInclude Include="include\nn\hac\AddOnContentMetaExtendedHeader.h" />
<ClInclude Include="include\nn\hac\AesKeygen.h" /> <ClInclude Include="include\nn\hac\AesKeygen.h" />
<ClInclude Include="include\nn\hac\ApplicationControlProperty.h" /> <ClInclude Include="include\nn\hac\ApplicationControlProperty.h" />
<ClInclude Include="include\nn\hac\ApplicationControlPropertyUtils.h" /> <ClInclude Include="include\nn\hac\ApplicationControlPropertyUtils.h" />
<ClInclude Include="include\nn\hac\ApplicationMetaExtendedHeader.h" />
<ClInclude Include="include\nn\hac\cnmt.h" /> <ClInclude Include="include\nn\hac\cnmt.h" />
<ClInclude Include="include\nn\hac\ContentInfo.h" /> <ClInclude Include="include\nn\hac\ContentInfo.h" />
<ClInclude Include="include\nn\hac\ContentMeta.h" /> <ClInclude Include="include\nn\hac\ContentMeta.h" />
<ClInclude Include="include\nn\hac\ContentMetaInfo.h" /> <ClInclude Include="include\nn\hac\ContentMetaInfo.h" />
<ClInclude Include="include\nn\hac\delta.h" /> <ClInclude Include="include\nn\hac\delta.h" />
<ClInclude Include="include\nn\hac\DeltaMetaExtendedHeader.h" />
<ClInclude Include="include\nn\hac\fac.h" /> <ClInclude Include="include\nn\hac\fac.h" />
<ClInclude Include="include\nn\hac\FileSystemAccessControlBinary.h" /> <ClInclude Include="include\nn\hac\FileSystemAccessControlBinary.h" />
<ClInclude Include="include\nn\hac\HandleTableSizeEntry.h" /> <ClInclude Include="include\nn\hac\HandleTableSizeEntry.h" />
@ -68,6 +71,7 @@
<ClInclude Include="include\nn\hac\nrr.h" /> <ClInclude Include="include\nn\hac\nrr.h" />
<ClInclude Include="include\nn\hac\nso.h" /> <ClInclude Include="include\nn\hac\nso.h" />
<ClInclude Include="include\nn\hac\NsoHeader.h" /> <ClInclude Include="include\nn\hac\NsoHeader.h" />
<ClInclude Include="include\nn\hac\PatchMetaExtendedHeader.h" />
<ClInclude Include="include\nn\hac\pfs.h" /> <ClInclude Include="include\nn\hac\pfs.h" />
<ClInclude Include="include\nn\hac\PfsHeader.h" /> <ClInclude Include="include\nn\hac\PfsHeader.h" />
<ClInclude Include="include\nn\hac\Result.h" /> <ClInclude Include="include\nn\hac\Result.h" />
@ -85,12 +89,15 @@
<ItemGroup> <ItemGroup>
<ClCompile Include="source\AccessControlInfo.cpp" /> <ClCompile Include="source\AccessControlInfo.cpp" />
<ClCompile Include="source\AccessControlInfoDesc.cpp" /> <ClCompile Include="source\AccessControlInfoDesc.cpp" />
<ClCompile Include="source\AddOnContentMetaExtendedHeader.cpp" />
<ClCompile Include="source\AesKeygen.cpp" /> <ClCompile Include="source\AesKeygen.cpp" />
<ClCompile Include="source\ApplicationControlProperty.cpp" /> <ClCompile Include="source\ApplicationControlProperty.cpp" />
<ClCompile Include="source\ApplicationControlPropertyUtils.cpp" /> <ClCompile Include="source\ApplicationControlPropertyUtils.cpp" />
<ClCompile Include="source\ApplicationMetaExtendedHeader.cpp" />
<ClCompile Include="source\ContentInfo.cpp" /> <ClCompile Include="source\ContentInfo.cpp" />
<ClCompile Include="source\ContentMeta.cpp" /> <ClCompile Include="source\ContentMeta.cpp" />
<ClCompile Include="source\ContentMetaInfo.cpp" /> <ClCompile Include="source\ContentMetaInfo.cpp" />
<ClCompile Include="source\DeltaMetaExtendedHeader.cpp" />
<ClCompile Include="source\FileSystemAccessControlBinary.cpp" /> <ClCompile Include="source\FileSystemAccessControlBinary.cpp" />
<ClCompile Include="source\HandleTableSizeEntry.cpp" /> <ClCompile Include="source\HandleTableSizeEntry.cpp" />
<ClCompile Include="source\HandleTableSizeHandler.cpp" /> <ClCompile Include="source\HandleTableSizeHandler.cpp" />
@ -114,6 +121,7 @@
<ClCompile Include="source\NcaUtils.cpp" /> <ClCompile Include="source\NcaUtils.cpp" />
<ClCompile Include="source\NroHeader.cpp" /> <ClCompile Include="source\NroHeader.cpp" />
<ClCompile Include="source\NsoHeader.cpp" /> <ClCompile Include="source\NsoHeader.cpp" />
<ClCompile Include="source\PatchMetaExtendedHeader.cpp" />
<ClCompile Include="source\PfsHeader.cpp" /> <ClCompile Include="source\PfsHeader.cpp" />
<ClCompile Include="source\Result.cpp" /> <ClCompile Include="source\Result.cpp" />
<ClCompile Include="source\ServiceAccessControlBinary.cpp" /> <ClCompile Include="source\ServiceAccessControlBinary.cpp" />

View file

@ -27,6 +27,9 @@
<ClInclude Include="include\nn\hac\aci.h"> <ClInclude Include="include\nn\hac\aci.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="include\nn\hac\AddOnContentMetaExtendedHeader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\nn\hac\AesKeygen.h"> <ClInclude Include="include\nn\hac\AesKeygen.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
@ -36,6 +39,9 @@
<ClInclude Include="include\nn\hac\ApplicationControlPropertyUtils.h"> <ClInclude Include="include\nn\hac\ApplicationControlPropertyUtils.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="include\nn\hac\ApplicationMetaExtendedHeader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\nn\hac\cnmt.h"> <ClInclude Include="include\nn\hac\cnmt.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
@ -51,6 +57,9 @@
<ClInclude Include="include\nn\hac\delta.h"> <ClInclude Include="include\nn\hac\delta.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="include\nn\hac\DeltaMetaExtendedHeader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\nn\hac\fac.h"> <ClInclude Include="include\nn\hac\fac.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
@ -156,6 +165,9 @@
<ClInclude Include="include\nn\hac\NsoHeader.h"> <ClInclude Include="include\nn\hac\NsoHeader.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="include\nn\hac\PatchMetaExtendedHeader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\nn\hac\pfs.h"> <ClInclude Include="include\nn\hac\pfs.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
@ -203,6 +215,9 @@
<ClCompile Include="source\AccessControlInfoDesc.cpp"> <ClCompile Include="source\AccessControlInfoDesc.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="source\AddOnContentMetaExtendedHeader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\AesKeygen.cpp"> <ClCompile Include="source\AesKeygen.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@ -212,6 +227,9 @@
<ClCompile Include="source\ApplicationControlPropertyUtils.cpp"> <ClCompile Include="source\ApplicationControlPropertyUtils.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="source\ApplicationMetaExtendedHeader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\ContentInfo.cpp"> <ClCompile Include="source\ContentInfo.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@ -221,6 +239,9 @@
<ClCompile Include="source\ContentMetaInfo.cpp"> <ClCompile Include="source\ContentMetaInfo.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="source\DeltaMetaExtendedHeader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\FileSystemAccessControlBinary.cpp"> <ClCompile Include="source\FileSystemAccessControlBinary.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@ -287,6 +308,9 @@
<ClCompile Include="source\NsoHeader.cpp"> <ClCompile Include="source\NsoHeader.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="source\PatchMetaExtendedHeader.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="source\PfsHeader.cpp"> <ClCompile Include="source\PfsHeader.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>

View file

@ -0,0 +1,84 @@
#include <nn/hac/AddOnContentMetaExtendedHeader.h>
nn::hac::AddOnContentMetaExtendedHeader::AddOnContentMetaExtendedHeader()
{
clear();
}
nn::hac::AddOnContentMetaExtendedHeader::AddOnContentMetaExtendedHeader(const AddOnContentMetaExtendedHeader& other)
{
*this = other;
}
void nn::hac::AddOnContentMetaExtendedHeader::operator=(const AddOnContentMetaExtendedHeader& other)
{
clear();
mRawBinary = other.mRawBinary;
mApplicationId = other.mApplicationId;
mRequiredApplicationVersion = other.mRequiredApplicationVersion;
}
bool nn::hac::AddOnContentMetaExtendedHeader::operator==(const AddOnContentMetaExtendedHeader& other) const
{
return (mApplicationId == other.mApplicationId) \
&& (mRequiredApplicationVersion == other.mRequiredApplicationVersion);
}
bool nn::hac::AddOnContentMetaExtendedHeader::operator!=(const AddOnContentMetaExtendedHeader& other) const
{
return !(*this == other);
}
void nn::hac::AddOnContentMetaExtendedHeader::toBytes()
{
mRawBinary.alloc(sizeof(sAddOnContentMetaExtendedHeader));
sAddOnContentMetaExtendedHeader* info = (sAddOnContentMetaExtendedHeader*)mRawBinary.data();
info->application_id = mApplicationId;
info->required_application_version = mRequiredApplicationVersion;
}
void nn::hac::AddOnContentMetaExtendedHeader::fromBytes(const byte_t* bytes, size_t len)
{
if (len < sizeof(sAddOnContentMetaExtendedHeader))
{
throw fnd::Exception(kModuleName, "AddOnContentMetaExtendedHeader too small");
}
const sAddOnContentMetaExtendedHeader* info = (const sAddOnContentMetaExtendedHeader*)bytes;
mApplicationId = info->application_id.get();
mRequiredApplicationVersion = info->required_application_version.get();
}
const fnd::Vec<byte_t>& nn::hac::AddOnContentMetaExtendedHeader::getBytes() const
{
return mRawBinary;
}
void nn::hac::AddOnContentMetaExtendedHeader::clear()
{
mRawBinary.clear();
mApplicationId = 0;
mRequiredApplicationVersion = 0;
}
uint64_t nn::hac::AddOnContentMetaExtendedHeader::getApplicationId() const
{
return mApplicationId;
}
void nn::hac::AddOnContentMetaExtendedHeader::setApplicationId(uint64_t application_id)
{
mApplicationId = application_id;
}
uint32_t nn::hac::AddOnContentMetaExtendedHeader::getRequiredApplicationVersion() const
{
return mRequiredApplicationVersion;
}
void nn::hac::AddOnContentMetaExtendedHeader::setRequiredApplicationVersion(uint32_t sys_ver)
{
mRequiredApplicationVersion = sys_ver;
}

View file

@ -0,0 +1,84 @@
#include <nn/hac/ApplicationMetaExtendedHeader.h>
nn::hac::ApplicationMetaExtendedHeader::ApplicationMetaExtendedHeader()
{
clear();
}
nn::hac::ApplicationMetaExtendedHeader::ApplicationMetaExtendedHeader(const ApplicationMetaExtendedHeader& other)
{
*this = other;
}
void nn::hac::ApplicationMetaExtendedHeader::operator=(const ApplicationMetaExtendedHeader& other)
{
clear();
mRawBinary = other.mRawBinary;
mPatchId = other.mPatchId;
mRequiredSystemVersion = other.mRequiredSystemVersion;
}
bool nn::hac::ApplicationMetaExtendedHeader::operator==(const ApplicationMetaExtendedHeader& other) const
{
return (mPatchId == other.mPatchId) \
&& (mRequiredSystemVersion == other.mRequiredSystemVersion);
}
bool nn::hac::ApplicationMetaExtendedHeader::operator!=(const ApplicationMetaExtendedHeader& other) const
{
return !(*this == other);
}
void nn::hac::ApplicationMetaExtendedHeader::toBytes()
{
mRawBinary.alloc(sizeof(sApplicationMetaExtendedHeader));
sApplicationMetaExtendedHeader* info = (sApplicationMetaExtendedHeader*)mRawBinary.data();
info->patch_id = mPatchId;
info->required_system_version = mRequiredSystemVersion;
}
void nn::hac::ApplicationMetaExtendedHeader::fromBytes(const byte_t* bytes, size_t len)
{
if (len < sizeof(sApplicationMetaExtendedHeader))
{
throw fnd::Exception(kModuleName, "ApplicationMetaExtendedHeader too small");
}
const sApplicationMetaExtendedHeader* info = (const sApplicationMetaExtendedHeader*)bytes;
mPatchId = info->patch_id.get();
mRequiredSystemVersion = info->required_system_version.get();
}
const fnd::Vec<byte_t>& nn::hac::ApplicationMetaExtendedHeader::getBytes() const
{
return mRawBinary;
}
void nn::hac::ApplicationMetaExtendedHeader::clear()
{
mRawBinary.clear();
mPatchId = 0;
mRequiredSystemVersion = 0;
}
uint64_t nn::hac::ApplicationMetaExtendedHeader::getPatchId() const
{
return mPatchId;
}
void nn::hac::ApplicationMetaExtendedHeader::setPatchId(uint64_t application_id)
{
mPatchId = application_id;
}
uint32_t nn::hac::ApplicationMetaExtendedHeader::getRequiredSystemVersion() const
{
return mRequiredSystemVersion;
}
void nn::hac::ApplicationMetaExtendedHeader::setRequiredSystemVersion(uint32_t sys_ver)
{
mRequiredSystemVersion = sys_ver;
}

View file

@ -24,7 +24,6 @@ void nn::hac::ContentMeta::operator=(const ContentMeta& other)
mType = other.mType; mType = other.mType;
mAttributes = other.mAttributes; mAttributes = other.mAttributes;
mRequiredDownloadSystemVersion = other.mRequiredDownloadSystemVersion; mRequiredDownloadSystemVersion = other.mRequiredDownloadSystemVersion;
mExtendedHeader = other.mExtendedHeader;
mApplicationMetaExtendedHeader = other.mApplicationMetaExtendedHeader; mApplicationMetaExtendedHeader = other.mApplicationMetaExtendedHeader;
mPatchMetaExtendedHeader = other.mPatchMetaExtendedHeader; mPatchMetaExtendedHeader = other.mPatchMetaExtendedHeader;
mAddOnContentMetaExtendedHeader = other.mAddOnContentMetaExtendedHeader; mAddOnContentMetaExtendedHeader = other.mAddOnContentMetaExtendedHeader;
@ -43,7 +42,6 @@ bool nn::hac::ContentMeta::operator==(const ContentMeta& other) const
&& (mType == other.mType) \ && (mType == other.mType) \
&& (mAttributes == other.mAttributes) \ && (mAttributes == other.mAttributes) \
&& (mRequiredDownloadSystemVersion == other.mRequiredDownloadSystemVersion) \ && (mRequiredDownloadSystemVersion == other.mRequiredDownloadSystemVersion) \
&& (mExtendedHeader == other.mExtendedHeader) \
&& (mApplicationMetaExtendedHeader == other.mApplicationMetaExtendedHeader) \ && (mApplicationMetaExtendedHeader == other.mApplicationMetaExtendedHeader) \
&& (mPatchMetaExtendedHeader == other.mPatchMetaExtendedHeader) \ && (mPatchMetaExtendedHeader == other.mPatchMetaExtendedHeader) \
&& (mAddOnContentMetaExtendedHeader == other.mAddOnContentMetaExtendedHeader) \ && (mAddOnContentMetaExtendedHeader == other.mAddOnContentMetaExtendedHeader) \
@ -61,7 +59,7 @@ bool nn::hac::ContentMeta::operator!=(const ContentMeta& other) const
void nn::hac::ContentMeta::toBytes() void nn::hac::ContentMeta::toBytes()
{ {
throw fnd::Exception(kModuleName, "exportBinary() not implemented"); throw fnd::Exception(kModuleName, "toBytes() not implemented");
} }
void nn::hac::ContentMeta::fromBytes(const byte_t* data, size_t len) void nn::hac::ContentMeta::fromBytes(const byte_t* data, size_t len)
@ -85,31 +83,29 @@ void nn::hac::ContentMeta::fromBytes(const byte_t* data, size_t len)
// save exheader // save exheader
if (hdr->exhdr_size.get() > 0) if (hdr->exhdr_size.get() > 0)
{ {
mExtendedHeader.alloc(hdr->exhdr_size.get());
memcpy(mExtendedHeader.data(), data + getExtendedHeaderOffset(), hdr->exhdr_size.get());
switch (mType) switch (mType)
{ {
case (cnmt::METATYPE_APPLICATION): case (cnmt::METATYPE_APPLICATION):
mApplicationMetaExtendedHeader.patch_id = ((sApplicationMetaExtendedHeader*)mExtendedHeader.data())->patch_id.get(); mApplicationMetaExtendedHeader.fromBytes(data + getExtendedHeaderOffset(), hdr->exhdr_size.get());
mApplicationMetaExtendedHeader.required_system_version = ((sApplicationMetaExtendedHeader*)mExtendedHeader.data())->required_system_version.get(); exdata_size = 0;
break; break;
case (cnmt::METATYPE_PATCH): case (cnmt::METATYPE_PATCH):
mPatchMetaExtendedHeader.application_id = ((sPatchMetaExtendedHeader*)mExtendedHeader.data())->application_id.get(); mPatchMetaExtendedHeader.fromBytes(data + getExtendedHeaderOffset(), hdr->exhdr_size.get());
mPatchMetaExtendedHeader.required_system_version = ((sPatchMetaExtendedHeader*)mExtendedHeader.data())->required_system_version.get(); exdata_size = mPatchMetaExtendedHeader.getExtendedDataSize();
break; break;
case (cnmt::METATYPE_ADD_ON_CONTENT): case (cnmt::METATYPE_ADD_ON_CONTENT):
mAddOnContentMetaExtendedHeader.application_id = ((sAddOnContentMetaExtendedHeader*)mExtendedHeader.data())->application_id.get(); mAddOnContentMetaExtendedHeader.fromBytes(data + getExtendedHeaderOffset(), hdr->exhdr_size.get());
mAddOnContentMetaExtendedHeader.required_application_version = ((sAddOnContentMetaExtendedHeader*)mExtendedHeader.data())->required_application_version.get(); exdata_size = 0;
break; break;
case (cnmt::METATYPE_DELTA): case (cnmt::METATYPE_DELTA):
mDeltaMetaExtendedHeader.application_id = ((sDeltaMetaExtendedHeader*)mExtendedHeader.data())->application_id.get(); mDeltaMetaExtendedHeader.fromBytes(data + getExtendedHeaderOffset(), hdr->exhdr_size.get());
exdata_size = mDeltaMetaExtendedHeader.getExtendedDataSize();
break; break;
default: default:
break; throw fnd::Exception(kModuleName, "Unhandled extended header for ContentMeta");
//exdata_size = 0;
//break;
} }
exdata_size = getExtendedDataSize(mType, mExtendedHeader.data());
} }
// save content info // save content info
@ -160,11 +156,10 @@ void nn::hac::ContentMeta::clear()
mType = cnmt::METATYPE_SYSTEM_PROGRAM; mType = cnmt::METATYPE_SYSTEM_PROGRAM;
mAttributes = 0; mAttributes = 0;
mRequiredDownloadSystemVersion = 0; mRequiredDownloadSystemVersion = 0;
mExtendedHeader.clear(); mApplicationMetaExtendedHeader.clear();
memset(&mApplicationMetaExtendedHeader, 0, sizeof(mApplicationMetaExtendedHeader)); mPatchMetaExtendedHeader.clear();
memset(&mPatchMetaExtendedHeader, 0, sizeof(mPatchMetaExtendedHeader)); mAddOnContentMetaExtendedHeader.clear();
memset(&mAddOnContentMetaExtendedHeader, 0, sizeof(mAddOnContentMetaExtendedHeader)); mDeltaMetaExtendedHeader.clear();
memset(&mDeltaMetaExtendedHeader, 0, sizeof(mDeltaMetaExtendedHeader));
mContentInfo.clear(); mContentInfo.clear();
mContentMetaInfo.clear(); mContentMetaInfo.clear();
mExtendedData.clear(); mExtendedData.clear();
@ -191,12 +186,12 @@ void nn::hac::ContentMeta::setTitleVersion(uint32_t version)
mTitleVersion = version; mTitleVersion = version;
} }
nn::hac::cnmt::ContentMetaType nn::hac::ContentMeta::getType() const nn::hac::cnmt::ContentMetaType nn::hac::ContentMeta::getContentMetaType() const
{ {
return mType; return mType;
} }
void nn::hac::ContentMeta::setType(cnmt::ContentMetaType type) void nn::hac::ContentMeta::setContentMetaType(cnmt::ContentMetaType type)
{ {
mType = type; mType = type;
} }
@ -221,7 +216,7 @@ void nn::hac::ContentMeta::setRequiredDownloadSystemVersion(uint32_t version)
mRequiredDownloadSystemVersion = version; mRequiredDownloadSystemVersion = version;
} }
const nn::hac::ContentMeta::ApplicationMetaExtendedHeader& nn::hac::ContentMeta::getApplicationMetaExtendedHeader() const const nn::hac::ApplicationMetaExtendedHeader& nn::hac::ContentMeta::getApplicationMetaExtendedHeader() const
{ {
return mApplicationMetaExtendedHeader; return mApplicationMetaExtendedHeader;
} }
@ -231,7 +226,7 @@ void nn::hac::ContentMeta::setApplicationMetaExtendedHeader(const ApplicationMet
mApplicationMetaExtendedHeader = exhdr; mApplicationMetaExtendedHeader = exhdr;
} }
const nn::hac::ContentMeta::PatchMetaExtendedHeader& nn::hac::ContentMeta::getPatchMetaExtendedHeader() const const nn::hac::PatchMetaExtendedHeader& nn::hac::ContentMeta::getPatchMetaExtendedHeader() const
{ {
return mPatchMetaExtendedHeader; return mPatchMetaExtendedHeader;
} }
@ -241,7 +236,7 @@ void nn::hac::ContentMeta::setPatchMetaExtendedHeader(const PatchMetaExtendedHea
mPatchMetaExtendedHeader = exhdr; mPatchMetaExtendedHeader = exhdr;
} }
const nn::hac::ContentMeta::AddOnContentMetaExtendedHeader& nn::hac::ContentMeta::getAddOnContentMetaExtendedHeader() const const nn::hac::AddOnContentMetaExtendedHeader& nn::hac::ContentMeta::getAddOnContentMetaExtendedHeader() const
{ {
return mAddOnContentMetaExtendedHeader; return mAddOnContentMetaExtendedHeader;
} }
@ -251,7 +246,7 @@ void nn::hac::ContentMeta::setAddOnContentMetaExtendedHeader(const AddOnContentM
mAddOnContentMetaExtendedHeader = exhdr; mAddOnContentMetaExtendedHeader = exhdr;
} }
const nn::hac::ContentMeta::DeltaMetaExtendedHeader& nn::hac::ContentMeta::getDeltaMetaExtendedHeader() const const nn::hac::DeltaMetaExtendedHeader& nn::hac::ContentMeta::getDeltaMetaExtendedHeader() const
{ {
return mDeltaMetaExtendedHeader; return mDeltaMetaExtendedHeader;
} }

View file

@ -15,7 +15,7 @@ void nn::hac::ContentMetaInfo::operator=(const ContentMetaInfo& other)
clear(); clear();
mRawBinary = other.mRawBinary; mRawBinary = other.mRawBinary;
mTitleId = other.mTitleId; mTitleId = other.mTitleId;
mVersion = other.mVersion; mTitleVersion = other.mTitleVersion;
mType = other.mType; mType = other.mType;
mAttributes = other.mAttributes; mAttributes = other.mAttributes;
} }
@ -23,7 +23,7 @@ void nn::hac::ContentMetaInfo::operator=(const ContentMetaInfo& other)
bool nn::hac::ContentMetaInfo::operator==(const ContentMetaInfo& other) const bool nn::hac::ContentMetaInfo::operator==(const ContentMetaInfo& other) const
{ {
return (mTitleId == other.mTitleId) \ return (mTitleId == other.mTitleId) \
&& (mVersion == other.mVersion) \ && (mTitleVersion == other.mTitleVersion) \
&& (mType == other.mType) \ && (mType == other.mType) \
&& (mAttributes == other.mAttributes); && (mAttributes == other.mAttributes);
} }
@ -39,7 +39,7 @@ void nn::hac::ContentMetaInfo::toBytes()
sContentMetaInfo* info = (sContentMetaInfo*)mRawBinary.data(); sContentMetaInfo* info = (sContentMetaInfo*)mRawBinary.data();
info->id = mTitleId; info->id = mTitleId;
info->version = mVersion; info->version = mTitleVersion;
info->type = mType; info->type = mType;
info->attributes = mAttributes; info->attributes = mAttributes;
} }
@ -54,7 +54,7 @@ void nn::hac::ContentMetaInfo::fromBytes(const byte_t* bytes, size_t len)
const sContentMetaInfo* info = (const sContentMetaInfo*)bytes; const sContentMetaInfo* info = (const sContentMetaInfo*)bytes;
mTitleId = info->id.get(); mTitleId = info->id.get();
mVersion = info->version.get(); mTitleVersion = info->version.get();
mType = (cnmt::ContentMetaType)info->type; mType = (cnmt::ContentMetaType)info->type;
mAttributes = info->attributes; mAttributes = info->attributes;
} }
@ -68,7 +68,7 @@ void nn::hac::ContentMetaInfo::clear()
{ {
mRawBinary.clear(); mRawBinary.clear();
mTitleId = 0; mTitleId = 0;
mVersion = 0; mTitleVersion = 0;
mType = cnmt::ContentMetaType::METATYPE_APPLICATION; mType = cnmt::ContentMetaType::METATYPE_APPLICATION;
mAttributes = 0; mAttributes = 0;
} }
@ -83,14 +83,14 @@ void nn::hac::ContentMetaInfo::setTitleId(uint64_t title_id)
mTitleId = title_id; mTitleId = title_id;
} }
uint32_t nn::hac::ContentMetaInfo::getVersion() const uint32_t nn::hac::ContentMetaInfo::getTitleVersion() const
{ {
return mVersion; return mTitleVersion;
} }
void nn::hac::ContentMetaInfo::setVersion(uint32_t ver) void nn::hac::ContentMetaInfo::setTitleVersion(uint32_t ver)
{ {
mVersion = ver; mTitleVersion = ver;
} }
nn::hac::cnmt::ContentMetaType nn::hac::ContentMetaInfo::getContentMetaType() const nn::hac::cnmt::ContentMetaType nn::hac::ContentMetaInfo::getContentMetaType() const

View file

@ -0,0 +1,84 @@
#include <nn/hac/DeltaMetaExtendedHeader.h>
nn::hac::DeltaMetaExtendedHeader::DeltaMetaExtendedHeader()
{
clear();
}
nn::hac::DeltaMetaExtendedHeader::DeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& other)
{
*this = other;
}
void nn::hac::DeltaMetaExtendedHeader::operator=(const DeltaMetaExtendedHeader& other)
{
clear();
mRawBinary = other.mRawBinary;
mApplicationId = other.mApplicationId;
mExtendedDataSize = other.mExtendedDataSize;
}
bool nn::hac::DeltaMetaExtendedHeader::operator==(const DeltaMetaExtendedHeader& other) const
{
return (mApplicationId == other.mApplicationId) \
&& (mExtendedDataSize == other.mExtendedDataSize);
}
bool nn::hac::DeltaMetaExtendedHeader::operator!=(const DeltaMetaExtendedHeader& other) const
{
return !(*this == other);
}
void nn::hac::DeltaMetaExtendedHeader::toBytes()
{
mRawBinary.alloc(sizeof(sDeltaMetaExtendedHeader));
sDeltaMetaExtendedHeader* info = (sDeltaMetaExtendedHeader*)mRawBinary.data();
info->application_id = mApplicationId;
info->extended_data_size = mExtendedDataSize;
}
void nn::hac::DeltaMetaExtendedHeader::fromBytes(const byte_t* bytes, size_t len)
{
if (len < sizeof(sDeltaMetaExtendedHeader))
{
throw fnd::Exception(kModuleName, "DeltaMetaExtendedHeader too small");
}
const sDeltaMetaExtendedHeader* info = (const sDeltaMetaExtendedHeader*)bytes;
mApplicationId = info->application_id.get();
mExtendedDataSize = info->extended_data_size.get();
}
const fnd::Vec<byte_t>& nn::hac::DeltaMetaExtendedHeader::getBytes() const
{
return mRawBinary;
}
void nn::hac::DeltaMetaExtendedHeader::clear()
{
mRawBinary.clear();
mApplicationId = 0;
mExtendedDataSize = 0;
}
uint64_t nn::hac::DeltaMetaExtendedHeader::getApplicationId() const
{
return mApplicationId;
}
void nn::hac::DeltaMetaExtendedHeader::setApplicationId(uint64_t application_id)
{
mApplicationId = application_id;
}
uint32_t nn::hac::DeltaMetaExtendedHeader::getExtendedDataSize() const
{
return mExtendedDataSize;
}
void nn::hac::DeltaMetaExtendedHeader::setExtendedDataSize(uint32_t size)
{
mExtendedDataSize = size;
}

View file

@ -0,0 +1,99 @@
#include <nn/hac/PatchMetaExtendedHeader.h>
nn::hac::PatchMetaExtendedHeader::PatchMetaExtendedHeader()
{
clear();
}
nn::hac::PatchMetaExtendedHeader::PatchMetaExtendedHeader(const PatchMetaExtendedHeader& other)
{
*this = other;
}
void nn::hac::PatchMetaExtendedHeader::operator=(const PatchMetaExtendedHeader& other)
{
clear();
mRawBinary = other.mRawBinary;
mApplicationId = other.mApplicationId;
mRequiredSystemVersion = other.mRequiredSystemVersion;
mExtendedDataSize = other.mExtendedDataSize;
}
bool nn::hac::PatchMetaExtendedHeader::operator==(const PatchMetaExtendedHeader& other) const
{
return (mApplicationId == other.mApplicationId) \
&& (mRequiredSystemVersion == other.mRequiredSystemVersion) \
&& (mExtendedDataSize == other.mExtendedDataSize);
}
bool nn::hac::PatchMetaExtendedHeader::operator!=(const PatchMetaExtendedHeader& other) const
{
return !(*this == other);
}
void nn::hac::PatchMetaExtendedHeader::toBytes()
{
mRawBinary.alloc(sizeof(sPatchMetaExtendedHeader));
sPatchMetaExtendedHeader* info = (sPatchMetaExtendedHeader*)mRawBinary.data();
info->application_id = mApplicationId;
info->required_system_version = mRequiredSystemVersion;
info->extended_data_size = mExtendedDataSize;
}
void nn::hac::PatchMetaExtendedHeader::fromBytes(const byte_t* bytes, size_t len)
{
if (len < sizeof(sPatchMetaExtendedHeader))
{
throw fnd::Exception(kModuleName, "PatchMetaExtendedHeader too small");
}
const sPatchMetaExtendedHeader* info = (const sPatchMetaExtendedHeader*)bytes;
mApplicationId = info->application_id.get();
mRequiredSystemVersion = info->required_system_version.get();
mExtendedDataSize = info->extended_data_size.get();
}
const fnd::Vec<byte_t>& nn::hac::PatchMetaExtendedHeader::getBytes() const
{
return mRawBinary;
}
void nn::hac::PatchMetaExtendedHeader::clear()
{
mRawBinary.clear();
mApplicationId = 0;
mRequiredSystemVersion = 0;
mExtendedDataSize = 0;
}
uint64_t nn::hac::PatchMetaExtendedHeader::getApplicationId() const
{
return mApplicationId;
}
void nn::hac::PatchMetaExtendedHeader::setApplicationId(uint64_t application_id)
{
mApplicationId = application_id;
}
uint32_t nn::hac::PatchMetaExtendedHeader::getRequiredSystemVersion() const
{
return mRequiredSystemVersion;
}
void nn::hac::PatchMetaExtendedHeader::setRequiredSystemVersion(uint32_t sys_ver)
{
mRequiredSystemVersion = sys_ver;
}
uint32_t nn::hac::PatchMetaExtendedHeader::getExtendedDataSize() const
{
return mExtendedDataSize;
}
void nn::hac::PatchMetaExtendedHeader::setExtendedDataSize(uint32_t size)
{
mExtendedDataSize = size;
}

View file

@ -61,31 +61,31 @@ void CnmtProcess::displayCnmt()
std::cout << "[ContentMeta]" << std::endl; std::cout << "[ContentMeta]" << std::endl;
std::cout << " TitleId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getTitleId() << std::endl; std::cout << " TitleId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getTitleId() << std::endl;
std::cout << " Version: v" << std::dec << mCnmt.getTitleVersion() << " (" << _SPLIT_VER(mCnmt.getTitleVersion()) << ")"<< std::endl; std::cout << " Version: v" << std::dec << mCnmt.getTitleVersion() << " (" << _SPLIT_VER(mCnmt.getTitleVersion()) << ")"<< std::endl;
std::cout << " Type: " << getContentMetaTypeStr(mCnmt.getType()) << " (" << std::dec << mCnmt.getType() << ")" << std::endl; std::cout << " Type: " << getContentMetaTypeStr(mCnmt.getContentMetaType()) << " (" << std::dec << mCnmt.getContentMetaType() << ")" << std::endl;
std::cout << " Attributes: 0x" << std::hex << (uint32_t)mCnmt.getAttributes() << std::endl; std::cout << " Attributes: 0x" << std::hex << (uint32_t)mCnmt.getAttributes() << std::endl;
std::cout << " IncludesExFatDriver: " << getBoolStr(_HAS_BIT(mCnmt.getAttributes(), nn::hac::cnmt::ATTRIBUTE_INCLUDES_EX_FAT_DRIVER)) << std::endl; std::cout << " IncludesExFatDriver: " << getBoolStr(_HAS_BIT(mCnmt.getAttributes(), nn::hac::cnmt::ATTRIBUTE_INCLUDES_EX_FAT_DRIVER)) << std::endl;
std::cout << " Rebootless: " << getBoolStr(_HAS_BIT(mCnmt.getAttributes(), nn::hac::cnmt::ATTRIBUTE_REBOOTLESS)) << std::endl; std::cout << " Rebootless: " << getBoolStr(_HAS_BIT(mCnmt.getAttributes(), nn::hac::cnmt::ATTRIBUTE_REBOOTLESS)) << std::endl;
std::cout << " RequiredDownloadSystemVersion: v" << mCnmt.getRequiredDownloadSystemVersion() << " (" << _SPLIT_VER(mCnmt.getRequiredDownloadSystemVersion()) << ")"<< std::endl; std::cout << " RequiredDownloadSystemVersion: v" << mCnmt.getRequiredDownloadSystemVersion() << " (" << _SPLIT_VER(mCnmt.getRequiredDownloadSystemVersion()) << ")"<< std::endl;
switch(mCnmt.getType()) switch(mCnmt.getContentMetaType())
{ {
case (nn::hac::cnmt::METATYPE_APPLICATION): case (nn::hac::cnmt::METATYPE_APPLICATION):
std::cout << " ApplicationExtendedHeader:" << std::endl; std::cout << " ApplicationExtendedHeader:" << std::endl;
std::cout << " RequiredSystemVersion: v" << std::dec << mCnmt.getApplicationMetaExtendedHeader().required_system_version << " (" << _SPLIT_VER(mCnmt.getApplicationMetaExtendedHeader().required_system_version) << ")"<< std::endl; std::cout << " RequiredSystemVersion: v" << std::dec << mCnmt.getApplicationMetaExtendedHeader().getRequiredSystemVersion() << " (" << _SPLIT_VER(mCnmt.getApplicationMetaExtendedHeader().getRequiredSystemVersion()) << ")"<< std::endl;
std::cout << " PatchId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getApplicationMetaExtendedHeader().patch_id << std::endl; std::cout << " PatchId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getApplicationMetaExtendedHeader().getPatchId() << std::endl;
break; break;
case (nn::hac::cnmt::METATYPE_PATCH): case (nn::hac::cnmt::METATYPE_PATCH):
std::cout << " PatchMetaExtendedHeader:" << std::endl; std::cout << " PatchMetaExtendedHeader:" << std::endl;
std::cout << " RequiredSystemVersion: v" << std::dec << mCnmt.getPatchMetaExtendedHeader().required_system_version << " (" << _SPLIT_VER(mCnmt.getPatchMetaExtendedHeader().required_system_version) << ")"<< std::endl; std::cout << " RequiredSystemVersion: v" << std::dec << mCnmt.getPatchMetaExtendedHeader().getRequiredSystemVersion() << " (" << _SPLIT_VER(mCnmt.getPatchMetaExtendedHeader().getRequiredSystemVersion()) << ")"<< std::endl;
std::cout << " ApplicationId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getPatchMetaExtendedHeader().application_id << std::endl; std::cout << " ApplicationId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getPatchMetaExtendedHeader().getApplicationId() << std::endl;
break; break;
case (nn::hac::cnmt::METATYPE_ADD_ON_CONTENT): case (nn::hac::cnmt::METATYPE_ADD_ON_CONTENT):
std::cout << " AddOnContentMetaExtendedHeader:" << std::endl; std::cout << " AddOnContentMetaExtendedHeader:" << std::endl;
std::cout << " RequiredApplicationVersion: v" << std::dec << mCnmt.getAddOnContentMetaExtendedHeader().required_application_version << " (" << _SPLIT_VER(mCnmt.getAddOnContentMetaExtendedHeader().required_application_version) << ")" << std::endl; std::cout << " RequiredApplicationVersion: v" << std::dec << mCnmt.getAddOnContentMetaExtendedHeader().getRequiredApplicationVersion() << " (" << _SPLIT_VER(mCnmt.getAddOnContentMetaExtendedHeader().getRequiredApplicationVersion()) << ")" << std::endl;
std::cout << " ApplicationId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getAddOnContentMetaExtendedHeader().application_id << std::endl; std::cout << " ApplicationId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getAddOnContentMetaExtendedHeader().getApplicationId() << std::endl;
break; break;
case (nn::hac::cnmt::METATYPE_DELTA): case (nn::hac::cnmt::METATYPE_DELTA):
std::cout << " DeltaMetaExtendedHeader:" << std::endl; std::cout << " DeltaMetaExtendedHeader:" << std::endl;
std::cout << " ApplicationId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getDeltaMetaExtendedHeader().application_id << std::endl; std::cout << " ApplicationId: 0x" << std::hex << std::setw(16) << std::setfill('0') << mCnmt.getDeltaMetaExtendedHeader().getApplicationId() << std::endl;
break; break;
default: default:
break; break;
@ -111,7 +111,7 @@ void CnmtProcess::displayCnmt()
const nn::hac::ContentMetaInfo& info = mCnmt.getContentMetaInfo()[i]; const nn::hac::ContentMetaInfo& info = mCnmt.getContentMetaInfo()[i];
std::cout << " " << std::dec << i << std::endl; std::cout << " " << std::dec << i << std::endl;
std::cout << " Id: 0x" << std::hex << std::setw(16) << std::setfill('0') << info.getTitleId() << std::endl; std::cout << " Id: 0x" << std::hex << std::setw(16) << std::setfill('0') << info.getTitleId() << std::endl;
std::cout << " Version: v" << std::dec << info.getVersion() << " (" << _SPLIT_VER(info.getVersion()) << ")"<< std::endl; std::cout << " Version: v" << std::dec << info.getTitleVersion() << " (" << _SPLIT_VER(info.getTitleVersion()) << ")"<< std::endl;
std::cout << " Type: " << getContentMetaTypeStr(info.getContentMetaType()) << " (" << std::dec << info.getContentMetaType() << ")" << std::endl; std::cout << " Type: " << getContentMetaTypeStr(info.getContentMetaType()) << " (" << std::dec << info.getContentMetaType() << ")" << std::endl;
std::cout << " Attributes: 0x" << std::hex << (uint32_t)info.getAttributes() << std::endl; std::cout << " Attributes: 0x" << std::hex << (uint32_t)info.getAttributes() << std::endl;
std::cout << " IncludesExFatDriver: " << getBoolStr(_HAS_BIT(info.getAttributes(), nn::hac::cnmt::ATTRIBUTE_INCLUDES_EX_FAT_DRIVER)) << std::endl; std::cout << " IncludesExFatDriver: " << getBoolStr(_HAS_BIT(info.getAttributes(), nn::hac::cnmt::ATTRIBUTE_INCLUDES_EX_FAT_DRIVER)) << std::endl;