From 3cbcba2bde110a2eb5ba03110512c9ef63a1a367 Mon Sep 17 00:00:00 2001 From: jakcron Date: Tue, 1 May 2018 13:17:25 +0800 Subject: [PATCH] [nx] Add hasRightsId() to NcaHeader --- lib/libnx/include/nx/NcaHeader.h | 1 + lib/libnx/source/NcaHeader.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/lib/libnx/include/nx/NcaHeader.h b/lib/libnx/include/nx/NcaHeader.h index e40f813..3b417d4 100644 --- a/lib/libnx/include/nx/NcaHeader.h +++ b/lib/libnx/include/nx/NcaHeader.h @@ -83,6 +83,7 @@ namespace nx void setContentIndex(uint32_t index); uint32_t getSdkAddonVersion() const; void setSdkAddonVersion(uint32_t version); + bool hasRightsId() const; const byte_t* getRightsId() const; void setRightsId(const byte_t* rights_id); const fnd::List& getPartitions() const; diff --git a/lib/libnx/source/NcaHeader.cpp b/lib/libnx/source/NcaHeader.cpp index 9ceadb0..34e5d88 100644 --- a/lib/libnx/source/NcaHeader.cpp +++ b/lib/libnx/source/NcaHeader.cpp @@ -219,6 +219,19 @@ void nx::NcaHeader::setSdkAddonVersion(uint32_t version) mSdkAddonVersion = version; } +bool nx::NcaHeader::hasRightsId() const +{ + bool rightsIdIsSet = false; + + for (size_t i = 0; i < nca::kRightsIdLen; i++) + { + if (mRightsId[i] != 0) + rightsIdIsSet = true; + } + + return rightsIdIsSet; +} + const byte_t* nx::NcaHeader::getRightsId() const { return mRightsId;