Fixed links.

This commit is contained in:
jakcron 2018-08-07 15:17:51 +08:00
parent 3a4a5b9fb2
commit 8954dc405f
150 changed files with 1690 additions and 1533 deletions

View file

@ -1,5 +1,5 @@
#include <compress/lz4.h> #include <compress/lz4.h>
#include "lz4/lz4.h" #include <lz4.h>
void compress::lz4::compressData(const uint8_t* src, uint32_t src_len, uint8_t* dst, uint32_t dst_capacity, uint32_t& compressed_size) void compress::lz4::compressData(const uint8_t* src, uint32_t src_len, uint8_t* dst, uint32_t dst_capacity, uint32_t& compressed_size)
{ {

View file

@ -1,8 +1,10 @@
#pragma once #pragma once
#include <string> #include <string>
#include <fnd/ISerialisable.h> #include <fnd/ISerialisable.h>
#include <es/ticket.h> #include <nn/es/ticket.h>
namespace nn
{
namespace es namespace es
{ {
class SectionHeader_V2 : class SectionHeader_V2 :
@ -52,5 +54,5 @@ namespace es
uint16_t mRecordNum; uint16_t mRecordNum;
ticket::SectionType mSectionType; ticket::SectionType mSectionType;
}; };
}
} }

View file

@ -2,8 +2,10 @@
#include <string> #include <string>
#include <fnd/ISerialisable.h> #include <fnd/ISerialisable.h>
#include <fnd/List.h> #include <fnd/List.h>
#include <es/ticket.h> #include <nn/es/ticket.h>
namespace nn
{
namespace es namespace es
{ {
class TicketBody_V2 : class TicketBody_V2 :
@ -98,5 +100,4 @@ namespace es
uint16_t mSectEntrySize; uint16_t mSectEntrySize;
}; };
} }
}

View file

@ -3,6 +3,8 @@
#include <fnd/types.h> #include <fnd/types.h>
#include <crypto/rsa.h> #include <crypto/rsa.h>
namespace nn
{
namespace es namespace es
{ {
namespace ticket namespace ticket
@ -106,3 +108,4 @@ namespace es
}; };
#pragma pack(pop) #pragma pack(pop)
} }
}

View file

@ -1,16 +1,14 @@
#include <es/SectionHeader_V2.h> #include <nn/es/SectionHeader_V2.h>
nn::es::SectionHeader_V2::SectionHeader_V2()
es::SectionHeader_V2::SectionHeader_V2()
{} {}
es::SectionHeader_V2::SectionHeader_V2(const SectionHeader_V2 & other) nn::es::SectionHeader_V2::SectionHeader_V2(const SectionHeader_V2 & other)
{ {
*this = other; *this = other;
} }
void es::SectionHeader_V2::operator=(const SectionHeader_V2 & other) void nn::es::SectionHeader_V2::operator=(const SectionHeader_V2 & other)
{ {
if (other.getBytes().size()) if (other.getBytes().size())
{ {
@ -27,7 +25,7 @@ void es::SectionHeader_V2::operator=(const SectionHeader_V2 & other)
} }
} }
bool es::SectionHeader_V2::operator==(const SectionHeader_V2 & other) const bool nn::es::SectionHeader_V2::operator==(const SectionHeader_V2 & other) const
{ {
return (mSectionOffset == other.mSectionOffset) \ return (mSectionOffset == other.mSectionOffset) \
&& (mRecordSize == other.mRecordSize) \ && (mRecordSize == other.mRecordSize) \
@ -36,12 +34,12 @@ bool es::SectionHeader_V2::operator==(const SectionHeader_V2 & other) const
&& (mSectionType == other.mSectionType); && (mSectionType == other.mSectionType);
} }
bool es::SectionHeader_V2::operator!=(const SectionHeader_V2 & other) const bool nn::es::SectionHeader_V2::operator!=(const SectionHeader_V2 & other) const
{ {
return !(*this ==other); return !(*this ==other);
} }
void es::SectionHeader_V2::toBytes() void nn::es::SectionHeader_V2::toBytes()
{ {
mRawBinary.alloc(sizeof(sSectionHeader_v2)); mRawBinary.alloc(sizeof(sSectionHeader_v2));
sSectionHeader_v2* hdr = (sSectionHeader_v2*)mRawBinary.data(); sSectionHeader_v2* hdr = (sSectionHeader_v2*)mRawBinary.data();
@ -53,7 +51,7 @@ void es::SectionHeader_V2::toBytes()
hdr->section_type = (mSectionType); hdr->section_type = (mSectionType);
} }
void es::SectionHeader_V2::fromBytes(const byte_t * bytes, size_t len) void nn::es::SectionHeader_V2::fromBytes(const byte_t * bytes, size_t len)
{ {
if (len < sizeof(sSectionHeader_v2)) if (len < sizeof(sSectionHeader_v2))
{ {
@ -73,12 +71,12 @@ void es::SectionHeader_V2::fromBytes(const byte_t * bytes, size_t len)
mSectionType = (ticket::SectionType)hdr->section_type.get(); mSectionType = (ticket::SectionType)hdr->section_type.get();
} }
const fnd::Vec<byte_t>& es::SectionHeader_V2::getBytes() const const fnd::Vec<byte_t>& nn::es::SectionHeader_V2::getBytes() const
{ {
return mRawBinary; return mRawBinary;
} }
void es::SectionHeader_V2::clear() void nn::es::SectionHeader_V2::clear()
{ {
mRawBinary.clear(); mRawBinary.clear();
mSectionOffset = 0; mSectionOffset = 0;
@ -88,52 +86,52 @@ void es::SectionHeader_V2::clear()
mSectionType = ticket::SECTION_PERMANENT; mSectionType = ticket::SECTION_PERMANENT;
} }
uint32_t es::SectionHeader_V2::getSectionOffset() const uint32_t nn::es::SectionHeader_V2::getSectionOffset() const
{ {
return mSectionOffset; return mSectionOffset;
} }
void es::SectionHeader_V2::setSectionOffset(uint32_t offset) void nn::es::SectionHeader_V2::setSectionOffset(uint32_t offset)
{ {
mSectionOffset = offset; mSectionOffset = offset;
} }
uint32_t es::SectionHeader_V2::getRecordSize() const uint32_t nn::es::SectionHeader_V2::getRecordSize() const
{ {
return mRecordSize; return mRecordSize;
} }
void es::SectionHeader_V2::setRecordSize(uint32_t size) void nn::es::SectionHeader_V2::setRecordSize(uint32_t size)
{ {
mRecordSize = size; mRecordSize = size;
} }
uint32_t es::SectionHeader_V2::getSectionSize() const uint32_t nn::es::SectionHeader_V2::getSectionSize() const
{ {
return mSectionSize; return mSectionSize;
} }
void es::SectionHeader_V2::getSectionSize(uint32_t size) void nn::es::SectionHeader_V2::getSectionSize(uint32_t size)
{ {
mSectionSize = size; mSectionSize = size;
} }
uint16_t es::SectionHeader_V2::getRecordNum() const uint16_t nn::es::SectionHeader_V2::getRecordNum() const
{ {
return mRecordNum; return mRecordNum;
} }
void es::SectionHeader_V2::setRecordNum(uint16_t record_num) void nn::es::SectionHeader_V2::setRecordNum(uint16_t record_num)
{ {
mRecordNum = record_num; mRecordNum = record_num;
} }
es::ticket::SectionType es::SectionHeader_V2::getSectionType() const nn::es::ticket::SectionType nn::es::SectionHeader_V2::getSectionType() const
{ {
return mSectionType; return mSectionType;
} }
void es::SectionHeader_V2::setSectionType(ticket::SectionType type) void nn::es::SectionHeader_V2::setSectionType(ticket::SectionType type)
{ {
mSectionType = type; mSectionType = type;
} }

View file

@ -1,18 +1,16 @@
#include <es/TicketBody_V2.h> #include <nn/es/TicketBody_V2.h>
nn::es::TicketBody_V2::TicketBody_V2()
es::TicketBody_V2::TicketBody_V2()
{ {
clear(); clear();
} }
es::TicketBody_V2::TicketBody_V2(const TicketBody_V2 & other) nn::es::TicketBody_V2::TicketBody_V2(const TicketBody_V2 & other)
{ {
*this = other; *this = other;
} }
void es::TicketBody_V2::operator=(const TicketBody_V2 & other) void nn::es::TicketBody_V2::operator=(const TicketBody_V2 & other)
{ {
if (other.getBytes().size()) if (other.getBytes().size())
{ {
@ -40,7 +38,7 @@ void es::TicketBody_V2::operator=(const TicketBody_V2 & other)
} }
} }
bool es::TicketBody_V2::operator==(const TicketBody_V2 & other) const bool nn::es::TicketBody_V2::operator==(const TicketBody_V2 & other) const
{ {
return (mIssuer == other.mIssuer) \ return (mIssuer == other.mIssuer) \
&& (memcmp(mEncTitleKey, other.mEncTitleKey, ticket::kEncTitleKeySize) == 0) \ && (memcmp(mEncTitleKey, other.mEncTitleKey, ticket::kEncTitleKeySize) == 0) \
@ -59,12 +57,12 @@ bool es::TicketBody_V2::operator==(const TicketBody_V2 & other) const
&& (mSectEntrySize == other.mSectEntrySize); && (mSectEntrySize == other.mSectEntrySize);
} }
bool es::TicketBody_V2::operator!=(const TicketBody_V2 & other) const bool nn::es::TicketBody_V2::operator!=(const TicketBody_V2 & other) const
{ {
return !(*this == other); return !(*this == other);
} }
void es::TicketBody_V2::toBytes() void nn::es::TicketBody_V2::toBytes()
{ {
mRawBinary.alloc(sizeof(sTicketBody_v2)); mRawBinary.alloc(sizeof(sTicketBody_v2));
sTicketBody_v2* body = (sTicketBody_v2*)mRawBinary.data(); sTicketBody_v2* body = (sTicketBody_v2*)mRawBinary.data();
@ -94,7 +92,7 @@ void es::TicketBody_V2::toBytes()
body->sect_entry_size = (mSectEntrySize); body->sect_entry_size = (mSectEntrySize);
} }
void es::TicketBody_V2::fromBytes(const byte_t * bytes, size_t len) void nn::es::TicketBody_V2::fromBytes(const byte_t * bytes, size_t len)
{ {
if (len < sizeof(sTicketBody_v2)) if (len < sizeof(sTicketBody_v2))
{ {
@ -134,12 +132,12 @@ void es::TicketBody_V2::fromBytes(const byte_t * bytes, size_t len)
mSectEntrySize = body->sect_entry_size.get(); mSectEntrySize = body->sect_entry_size.get();
} }
const fnd::Vec<byte_t>& es::TicketBody_V2::getBytes() const const fnd::Vec<byte_t>& nn::es::TicketBody_V2::getBytes() const
{ {
return mRawBinary; return mRawBinary;
} }
void es::TicketBody_V2::clear() void nn::es::TicketBody_V2::clear()
{ {
mRawBinary.clear(); mRawBinary.clear();
mIssuer.clear(); mIssuer.clear();
@ -160,12 +158,12 @@ void es::TicketBody_V2::clear()
mSectEntrySize = 0; mSectEntrySize = 0;
} }
const std::string & es::TicketBody_V2::getIssuer() const const std::string & nn::es::TicketBody_V2::getIssuer() const
{ {
return mIssuer; return mIssuer;
} }
void es::TicketBody_V2::setIssuer(const std::string & issuer) void nn::es::TicketBody_V2::setIssuer(const std::string & issuer)
{ {
if (issuer.length() > ticket::kIssuerSize) if (issuer.length() > ticket::kIssuerSize)
{ {
@ -175,154 +173,154 @@ void es::TicketBody_V2::setIssuer(const std::string & issuer)
mIssuer = issuer; mIssuer = issuer;
} }
const byte_t * es::TicketBody_V2::getEncTitleKey() const const byte_t * nn::es::TicketBody_V2::getEncTitleKey() const
{ {
return mEncTitleKey; return mEncTitleKey;
} }
void es::TicketBody_V2::setEncTitleKey(const byte_t * data, size_t len) void nn::es::TicketBody_V2::setEncTitleKey(const byte_t * data, size_t len)
{ {
memset(mEncTitleKey, 0, ticket::kEncTitleKeySize); memset(mEncTitleKey, 0, ticket::kEncTitleKeySize);
memcpy(mEncTitleKey, data, _MIN(len, ticket::kEncTitleKeySize)); memcpy(mEncTitleKey, data, _MIN(len, ticket::kEncTitleKeySize));
} }
es::ticket::TitleKeyEncType es::TicketBody_V2::getTitleKeyEncType() const nn::es::ticket::TitleKeyEncType nn::es::TicketBody_V2::getTitleKeyEncType() const
{ {
return mEncType; return mEncType;
} }
void es::TicketBody_V2::setTitleKeyEncType(ticket::TitleKeyEncType type) void nn::es::TicketBody_V2::setTitleKeyEncType(ticket::TitleKeyEncType type)
{ {
mEncType = type; mEncType = type;
} }
uint16_t es::TicketBody_V2::getTicketVersion() const uint16_t nn::es::TicketBody_V2::getTicketVersion() const
{ {
return mTicketVersion; return mTicketVersion;
} }
void es::TicketBody_V2::setTicketVersion(uint16_t version) void nn::es::TicketBody_V2::setTicketVersion(uint16_t version)
{ {
mTicketVersion = version; mTicketVersion = version;
} }
es::ticket::LicenseType es::TicketBody_V2::getLicenseType() const nn::es::ticket::LicenseType nn::es::TicketBody_V2::getLicenseType() const
{ {
return mLicenseType; return mLicenseType;
} }
void es::TicketBody_V2::setLicenseType(ticket::LicenseType type) void nn::es::TicketBody_V2::setLicenseType(ticket::LicenseType type)
{ {
mLicenseType = type; mLicenseType = type;
} }
byte_t es::TicketBody_V2::getCommonKeyId() const byte_t nn::es::TicketBody_V2::getCommonKeyId() const
{ {
return mCommonKeyId; return mCommonKeyId;
} }
void es::TicketBody_V2::setCommonKeyId(byte_t id) void nn::es::TicketBody_V2::setCommonKeyId(byte_t id)
{ {
mCommonKeyId = id; mCommonKeyId = id;
} }
const fnd::List<es::ticket::PropertyMaskFlags>& es::TicketBody_V2::getPropertyFlags() const const fnd::List<nn::es::ticket::PropertyMaskFlags>& nn::es::TicketBody_V2::getPropertyFlags() const
{ {
return mPropertyFlags; return mPropertyFlags;
} }
void es::TicketBody_V2::setPropertyFlags(const fnd::List<es::ticket::PropertyMaskFlags>& flags) void nn::es::TicketBody_V2::setPropertyFlags(const fnd::List<nn::es::ticket::PropertyMaskFlags>& flags)
{ {
mPropertyFlags = flags; mPropertyFlags = flags;
} }
const byte_t * es::TicketBody_V2::getReservedRegion() const const byte_t * nn::es::TicketBody_V2::getReservedRegion() const
{ {
return mReservedRegion; return mReservedRegion;
} }
void es::TicketBody_V2::setReservedRegion(const byte_t * data, size_t len) void nn::es::TicketBody_V2::setReservedRegion(const byte_t * data, size_t len)
{ {
memset(mReservedRegion, 0, ticket::kReservedRegionSize); memset(mReservedRegion, 0, ticket::kReservedRegionSize);
memcpy(mReservedRegion, data, _MIN(len, ticket::kReservedRegionSize)); memcpy(mReservedRegion, data, _MIN(len, ticket::kReservedRegionSize));
} }
uint64_t es::TicketBody_V2::getTicketId() const uint64_t nn::es::TicketBody_V2::getTicketId() const
{ {
return mTicketId; return mTicketId;
} }
void es::TicketBody_V2::setTicketId(uint64_t id) void nn::es::TicketBody_V2::setTicketId(uint64_t id)
{ {
mTicketId = id; mTicketId = id;
} }
uint64_t es::TicketBody_V2::getDeviceId() const uint64_t nn::es::TicketBody_V2::getDeviceId() const
{ {
return mDeviceId; return mDeviceId;
} }
void es::TicketBody_V2::setDeviceId(uint64_t id) void nn::es::TicketBody_V2::setDeviceId(uint64_t id)
{ {
mDeviceId = id; mDeviceId = id;
} }
const byte_t * es::TicketBody_V2::getRightsId() const const byte_t * nn::es::TicketBody_V2::getRightsId() const
{ {
return mRightsId; return mRightsId;
} }
void es::TicketBody_V2::setRightsId(const byte_t * id) void nn::es::TicketBody_V2::setRightsId(const byte_t * id)
{ {
memcpy(mRightsId, id, ticket::kRightsIdSize); memcpy(mRightsId, id, ticket::kRightsIdSize);
} }
uint32_t es::TicketBody_V2::getAccountId() const uint32_t nn::es::TicketBody_V2::getAccountId() const
{ {
return mAccountId; return mAccountId;
} }
void es::TicketBody_V2::setAccountId(uint32_t id) void nn::es::TicketBody_V2::setAccountId(uint32_t id)
{ {
mAccountId = id; mAccountId = id;
} }
uint32_t es::TicketBody_V2::getSectionTotalSize() const uint32_t nn::es::TicketBody_V2::getSectionTotalSize() const
{ {
return mSectTotalSize; return mSectTotalSize;
} }
void es::TicketBody_V2::setSectionTotalSize(uint32_t size) void nn::es::TicketBody_V2::setSectionTotalSize(uint32_t size)
{ {
mSectTotalSize = size; mSectTotalSize = size;
} }
uint32_t es::TicketBody_V2::getSectionHeaderOffset() const uint32_t nn::es::TicketBody_V2::getSectionHeaderOffset() const
{ {
return mSectHeaderOffset; return mSectHeaderOffset;
} }
void es::TicketBody_V2::setSectionHeaderOffset(uint32_t offset) void nn::es::TicketBody_V2::setSectionHeaderOffset(uint32_t offset)
{ {
mSectHeaderOffset = offset; mSectHeaderOffset = offset;
} }
uint16_t es::TicketBody_V2::getSectionNum() const uint16_t nn::es::TicketBody_V2::getSectionNum() const
{ {
return mSectNum; return mSectNum;
} }
void es::TicketBody_V2::setSectionNum(uint16_t num) void nn::es::TicketBody_V2::setSectionNum(uint16_t num)
{ {
mSectNum = num; mSectNum = num;
} }
uint16_t es::TicketBody_V2::getSectionEntrySize() const uint16_t nn::es::TicketBody_V2::getSectionEntrySize() const
{ {
return mSectEntrySize; return mSectEntrySize;
} }
void es::TicketBody_V2::setSectionEntrySize(uint16_t size) void nn::es::TicketBody_V2::setSectionEntrySize(uint16_t size)
{ {
mSectEntrySize = size; mSectEntrySize = size;
} }

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#include <nx/aset.h> #include <nn/hac/aset.h>
#include <fnd/List.h> #include <fnd/List.h>
#include <fnd/ISerialisable.h> #include <fnd/ISerialisable.h>
namespace nx namespace nn
{
namespace hac
{ {
class AssetHeader : class AssetHeader :
public fnd::ISerialisable public fnd::ISerialisable
@ -66,5 +68,5 @@ namespace nx
sSection mNacpInfo; sSection mNacpInfo;
sSection mRomfsInfo; sSection mRomfsInfo;
}; };
}
} }

View file

@ -1,8 +1,10 @@
#pragma once #pragma once
#include <fnd/types.h> #include <fnd/types.h>
#include <nx/macro.h> #include <nn/hac/macro.h>
namespace nx
namespace nn
{
namespace hac
{ {
namespace aset namespace aset
{ {
@ -28,3 +30,4 @@ namespace nx
}; };
#pragma pack(pop) #pragma pack(pop)
} }
}

View file

@ -1,11 +1,14 @@
#pragma once #pragma once
#include <nn/hac/nro.h>
#include <nn/hac/macro.h>
#include <nx/nro.h> namespace nn
#include <nx/macro.h> {
namespace nx namespace hac
{ {
namespace nro namespace nro
{ {
static const uint64_t kNroHomebrewStructMagic = _MAKE_STRUCT_MAGIC_U64("HOMEBREW"); static const uint64_t kNroHomebrewStructMagic = _MAKE_STRUCT_MAGIC_U64("HOMEBREW");
} }
} }
}

View file

@ -3,7 +3,7 @@ SRC_DIR = source
OBJS = $(foreach dir,$(SRC_DIR),$(subst .cpp,.o,$(wildcard $(dir)/*.cpp))) $(foreach dir,$(SRC_DIR),$(subst .c,.o,$(wildcard $(dir)/*.c))) OBJS = $(foreach dir,$(SRC_DIR),$(subst .cpp,.o,$(wildcard $(dir)/*.cpp))) $(foreach dir,$(SRC_DIR),$(subst .c,.o,$(wildcard $(dir)/*.c)))
# External dependencies # External dependencies
DEPENDS = fnd crypto nx DEPENDS = fnd crypto hac
LIB_DIR = .. LIB_DIR = ..
INCS = -I"include" $(foreach dep,$(DEPENDS), -I"$(LIB_DIR)/lib$(dep)/include") INCS = -I"include" $(foreach dep,$(DEPENDS), -I"$(LIB_DIR)/lib$(dep)/include")

View file

@ -1,16 +1,16 @@
#include <nx/AssetHeader.h> #include <nn/hac/AssetHeader.h>
nx::AssetHeader::AssetHeader() nn::hac::AssetHeader::AssetHeader()
{ {
clear(); clear();
} }
nx::AssetHeader::AssetHeader(const AssetHeader& other) nn::hac::AssetHeader::AssetHeader(const AssetHeader& other)
{ {
*this = other; *this = other;
} }
void nx::AssetHeader::operator=(const AssetHeader& other) void nn::hac::AssetHeader::operator=(const AssetHeader& other)
{ {
mRawBinary = other.mRawBinary; mRawBinary = other.mRawBinary;
mIconInfo = other.mIconInfo; mIconInfo = other.mIconInfo;
@ -18,22 +18,22 @@ void nx::AssetHeader::operator=(const AssetHeader& other)
mRomfsInfo = other.mRomfsInfo; mRomfsInfo = other.mRomfsInfo;
} }
bool nx::AssetHeader::operator==(const AssetHeader& other) const bool nn::hac::AssetHeader::operator==(const AssetHeader& other) const
{ {
return (mIconInfo == other.mIconInfo) \ return (mIconInfo == other.mIconInfo) \
&& (mNacpInfo == other.mNacpInfo) \ && (mNacpInfo == other.mNacpInfo) \
&& (mRomfsInfo == other.mRomfsInfo); && (mRomfsInfo == other.mRomfsInfo);
} }
bool nx::AssetHeader::operator!=(const AssetHeader& other) const bool nn::hac::AssetHeader::operator!=(const AssetHeader& other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::AssetHeader::toBytes() void nn::hac::AssetHeader::toBytes()
{ {
mRawBinary.alloc(sizeof(sAssetHeader)); mRawBinary.alloc(sizeof(sAssetHeader));
nx::sAssetHeader* hdr = (nx::sAssetHeader*)mRawBinary.data(); nn::hac::sAssetHeader* hdr = (nn::hac::sAssetHeader*)mRawBinary.data();
// set header identifers // set header identifers
hdr->st_magic = aset::kAssetStructMagic; hdr->st_magic = aset::kAssetStructMagic;
@ -52,7 +52,7 @@ void nx::AssetHeader::toBytes()
hdr->romfs.size = mRomfsInfo.size; hdr->romfs.size = mRomfsInfo.size;
} }
void nx::AssetHeader::fromBytes(const byte_t* bytes, size_t len) void nn::hac::AssetHeader::fromBytes(const byte_t* bytes, size_t len)
{ {
// check input data size // check input data size
if (len < sizeof(sAssetHeader)) if (len < sizeof(sAssetHeader))
@ -68,7 +68,7 @@ void nx::AssetHeader::fromBytes(const byte_t* bytes, size_t len)
memcpy(mRawBinary.data(), bytes, mRawBinary.size()); memcpy(mRawBinary.data(), bytes, mRawBinary.size());
// get sAssetHeader ptr // get sAssetHeader ptr
const nx::sAssetHeader* hdr = (const nx::sAssetHeader*)mRawBinary.data(); const nn::hac::sAssetHeader* hdr = (const nn::hac::sAssetHeader*)mRawBinary.data();
// check NRO signature // check NRO signature
if (hdr->st_magic.get() != aset::kAssetStructMagic) if (hdr->st_magic.get() != aset::kAssetStructMagic)
@ -90,12 +90,12 @@ void nx::AssetHeader::fromBytes(const byte_t* bytes, size_t len)
mRomfsInfo.size = hdr->romfs.size.get(); mRomfsInfo.size = hdr->romfs.size.get();
} }
const fnd::Vec<byte_t>& nx::AssetHeader::getBytes() const const fnd::Vec<byte_t>& nn::hac::AssetHeader::getBytes() const
{ {
return mRawBinary; return mRawBinary;
} }
void nx::AssetHeader::clear() void nn::hac::AssetHeader::clear()
{ {
mRawBinary.clear(); mRawBinary.clear();
memset(&mIconInfo, 0, sizeof(mIconInfo)); memset(&mIconInfo, 0, sizeof(mIconInfo));
@ -103,32 +103,32 @@ void nx::AssetHeader::clear()
memset(&mRomfsInfo, 0, sizeof(mRomfsInfo)); memset(&mRomfsInfo, 0, sizeof(mRomfsInfo));
} }
const nx::AssetHeader::sSection& nx::AssetHeader::getIconInfo() const const nn::hac::AssetHeader::sSection& nn::hac::AssetHeader::getIconInfo() const
{ {
return mIconInfo; return mIconInfo;
} }
void nx::AssetHeader::setIconInfo(const nx::AssetHeader::sSection& info) void nn::hac::AssetHeader::setIconInfo(const nn::hac::AssetHeader::sSection& info)
{ {
mIconInfo = info; mIconInfo = info;
} }
const nx::AssetHeader::sSection& nx::AssetHeader::getNacpInfo() const const nn::hac::AssetHeader::sSection& nn::hac::AssetHeader::getNacpInfo() const
{ {
return mNacpInfo; return mNacpInfo;
} }
void nx::AssetHeader::setNacpInfo(const sSection& info) void nn::hac::AssetHeader::setNacpInfo(const sSection& info)
{ {
mNacpInfo = info; mNacpInfo = info;
} }
const nx::AssetHeader::sSection& nx::AssetHeader::getRomfsInfo() const const nn::hac::AssetHeader::sSection& nn::hac::AssetHeader::getRomfsInfo() const
{ {
return mRomfsInfo; return mRomfsInfo;
} }
void nx::AssetHeader::setRomfsInfo(const sSection& info) void nn::hac::AssetHeader::setRomfsInfo(const sSection& info)
{ {
mRomfsInfo = info; mRomfsInfo = info;
} }

View file

@ -2,12 +2,14 @@
#include <string> #include <string>
#include <fnd/types.h> #include <fnd/types.h>
#include <fnd/ISerialisable.h> #include <fnd/ISerialisable.h>
#include <nx/aci.h> #include <nn/hac/aci.h>
#include <nx/FileSystemAccessControlBinary.h> #include <nn/hac/FileSystemAccessControlBinary.h>
#include <nx/ServiceAccessControlBinary.h> #include <nn/hac/ServiceAccessControlBinary.h>
#include <nx/KernelCapabilityBinary.h> #include <nn/hac/KernelCapabilityBinary.h>
namespace nx namespace nn
{
namespace hac
{ {
class AccessControlInfoBinary : public fnd::ISerialisable class AccessControlInfoBinary : public fnd::ISerialisable
{ {
@ -30,13 +32,13 @@ namespace nx
uint64_t getProgramId() const; uint64_t getProgramId() const;
void setProgramId(uint64_t program_id); void setProgramId(uint64_t program_id);
const nx::FileSystemAccessControlBinary& getFileSystemAccessControl() const; const nn::hac::FileSystemAccessControlBinary& getFileSystemAccessControl() const;
void setFileSystemAccessControl(const FileSystemAccessControlBinary& fac); void setFileSystemAccessControl(const FileSystemAccessControlBinary& fac);
const nx::ServiceAccessControlBinary& getServiceAccessControl() const; const nn::hac::ServiceAccessControlBinary& getServiceAccessControl() const;
void setServiceAccessControl(const ServiceAccessControlBinary& sac); void setServiceAccessControl(const ServiceAccessControlBinary& sac);
const nx::KernelCapabilityBinary& getKernelCapabilities() const; const nn::hac::KernelCapabilityBinary& getKernelCapabilities() const;
void setKernelCapabilities(const KernelCapabilityBinary& kc); void setKernelCapabilities(const KernelCapabilityBinary& kc);
private: private:
const std::string kModuleName = "ACCESS_CONTROL_INFO_BINARY"; const std::string kModuleName = "ACCESS_CONTROL_INFO_BINARY";
@ -46,8 +48,9 @@ namespace nx
// variables // variables
uint64_t mProgramId; uint64_t mProgramId;
nx::FileSystemAccessControlBinary mFileSystemAccessControl; nn::hac::FileSystemAccessControlBinary mFileSystemAccessControl;
nx::ServiceAccessControlBinary mServiceAccessControl; nn::hac::ServiceAccessControlBinary mServiceAccessControl;
nx::KernelCapabilityBinary mKernelCapabilities; nn::hac::KernelCapabilityBinary mKernelCapabilities;
}; };
} }
}

View file

@ -3,12 +3,14 @@
#include <fnd/types.h> #include <fnd/types.h>
#include <fnd/List.h> #include <fnd/List.h>
#include <fnd/ISerialisable.h> #include <fnd/ISerialisable.h>
#include <nx/aci.h> #include <nn/hac/aci.h>
#include <nx/FileSystemAccessControlBinary.h> #include <nn/hac/FileSystemAccessControlBinary.h>
#include <nx/ServiceAccessControlBinary.h> #include <nn/hac/ServiceAccessControlBinary.h>
#include <nx/KernelCapabilityBinary.h> #include <nn/hac/KernelCapabilityBinary.h>
namespace nx namespace nn
{
namespace hac
{ {
class AccessControlInfoDescBinary : public fnd::ISerialisable class AccessControlInfoDescBinary : public fnd::ISerialisable
{ {
@ -63,13 +65,13 @@ namespace nx
const sProgramIdRestrict& getProgramIdRestrict() const; const sProgramIdRestrict& getProgramIdRestrict() const;
void setProgramIdRestrict(const sProgramIdRestrict& pid_restrict); void setProgramIdRestrict(const sProgramIdRestrict& pid_restrict);
const nx::FileSystemAccessControlBinary& getFileSystemAccessControl() const; const nn::hac::FileSystemAccessControlBinary& getFileSystemAccessControl() const;
void setFileSystemAccessControl(const FileSystemAccessControlBinary& fac); void setFileSystemAccessControl(const FileSystemAccessControlBinary& fac);
const nx::ServiceAccessControlBinary& getServiceAccessControl() const; const nn::hac::ServiceAccessControlBinary& getServiceAccessControl() const;
void setServiceAccessControl(const ServiceAccessControlBinary& sac); void setServiceAccessControl(const ServiceAccessControlBinary& sac);
const nx::KernelCapabilityBinary& getKernelCapabilities() const; const nn::hac::KernelCapabilityBinary& getKernelCapabilities() const;
void setKernelCapabilities(const KernelCapabilityBinary& kc); void setKernelCapabilities(const KernelCapabilityBinary& kc);
private: private:
const std::string kModuleName = "ACCESS_CONTROL_INFO_DESC_BINARY"; const std::string kModuleName = "ACCESS_CONTROL_INFO_DESC_BINARY";
@ -81,8 +83,9 @@ namespace nx
crypto::rsa::sRsa2048Key mNcaHeaderSignature2Key; crypto::rsa::sRsa2048Key mNcaHeaderSignature2Key;
fnd::List<aci::Flag> mFlags; fnd::List<aci::Flag> mFlags;
sProgramIdRestrict mProgramIdRestrict; sProgramIdRestrict mProgramIdRestrict;
nx::FileSystemAccessControlBinary mFileSystemAccessControl; nn::hac::FileSystemAccessControlBinary mFileSystemAccessControl;
nx::ServiceAccessControlBinary mServiceAccessControl; nn::hac::ServiceAccessControlBinary mServiceAccessControl;
nx::KernelCapabilityBinary mKernelCapabilities; nn::hac::KernelCapabilityBinary mKernelCapabilities;
}; };
} }
}

View file

@ -3,7 +3,9 @@
#include <fnd/types.h> #include <fnd/types.h>
#include <crypto/aes.h> #include <crypto/aes.h>
namespace nx namespace nn
{
namespace hac
{ {
class AesKeygen class AesKeygen
{ {
@ -17,3 +19,4 @@ namespace nx
static void generateKey(byte_t* dst, const byte_t* src1, const byte_t* src2, const byte_t* src3, const byte_t* src1_key); static void generateKey(byte_t* dst, const byte_t* src1, const byte_t* src2, const byte_t* src3, const byte_t* src1_key);
}; };
} }
}

View file

@ -3,9 +3,11 @@
#include <fnd/types.h> #include <fnd/types.h>
#include <fnd/ISerialisable.h> #include <fnd/ISerialisable.h>
#include <fnd/List.h> #include <fnd/List.h>
#include <nx/nacp.h> #include <nn/hac/nacp.h>
namespace nx namespace nn
{
namespace hac
{ {
class ApplicationControlPropertyBinary : class ApplicationControlPropertyBinary :
public fnd::ISerialisable public fnd::ISerialisable
@ -229,7 +231,7 @@ namespace nx
nacp::TouchScreenUsageMode mTouchScreenUsageMode; nacp::TouchScreenUsageMode mTouchScreenUsageMode;
nacp::AocRegistrationType mAocRegistrationType; nacp::AocRegistrationType mAocRegistrationType;
nacp::AttributeFlag mAttributeFlag; nacp::AttributeFlag mAttributeFlag;
fnd::List<nx::nacp::Language> mSupportedLanguages; fnd::List<nn::hac::nacp::Language> mSupportedLanguages;
nacp::ParentalControlFlag mParentalControlFlag; nacp::ParentalControlFlag mParentalControlFlag;
nacp::ScreenshotMode mScreenshotMode; nacp::ScreenshotMode mScreenshotMode;
nacp::VideoCaptureMode mVideoCaptureMode; nacp::VideoCaptureMode mVideoCaptureMode;
@ -264,3 +266,4 @@ namespace nx
byte_t mProgramIndex; byte_t mProgramIndex;
}; };
} }
}

View file

@ -1,7 +1,9 @@
#pragma once #pragma once
#include <nx/nacp.h> #include <nn/hac/nacp.h>
namespace nx namespace nn
{
namespace hac
{ {
class ApplicationControlPropertyUtils class ApplicationControlPropertyUtils
{ {
@ -10,3 +12,4 @@ namespace nx
static bool validateSaveDataSize(int64_t size); static bool validateSaveDataSize(int64_t size);
}; };
} }
}

View file

@ -2,10 +2,11 @@
#include <string> #include <string>
#include <fnd/ISerialisable.h> #include <fnd/ISerialisable.h>
#include <fnd/List.h> #include <fnd/List.h>
#include <nx/cnmt.h> #include <nn/hac/cnmt.h>
namespace nn
namespace nx {
namespace hac
{ {
class ContentMetaBinary : class ContentMetaBinary :
public fnd::ISerialisable public fnd::ISerialisable
@ -200,17 +201,17 @@ namespace nx
const DeltaMetaExtendedHeader& getDeltaMetaExtendedHeader() const; const DeltaMetaExtendedHeader& getDeltaMetaExtendedHeader() const;
void setDeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& exhdr); void setDeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& exhdr);
const fnd::List<nx::ContentMetaBinary::ContentInfo>& getContentInfo() const; const fnd::List<nn::hac::ContentMetaBinary::ContentInfo>& getContentInfo() const;
void setContentInfo(const fnd::List<nx::ContentMetaBinary::ContentInfo>& info); void setContentInfo(const fnd::List<nn::hac::ContentMetaBinary::ContentInfo>& info);
const fnd::List<nx::ContentMetaBinary::ContentMetaInfo>& getContentMetaInfo() const; const fnd::List<nn::hac::ContentMetaBinary::ContentMetaInfo>& getContentMetaInfo() const;
void setContentMetaInfo(const fnd::List<nx::ContentMetaBinary::ContentMetaInfo>& info); void setContentMetaInfo(const fnd::List<nn::hac::ContentMetaBinary::ContentMetaInfo>& info);
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 nx::sDigest& getDigest() const; const nn::hac::sDigest& getDigest() const;
void setDigest(const nx::sDigest& digest); void setDigest(const nn::hac::sDigest& digest);
private: private:
@ -232,10 +233,10 @@ namespace nx
AddOnContentMetaExtendedHeader mAddOnContentMetaExtendedHeader; AddOnContentMetaExtendedHeader mAddOnContentMetaExtendedHeader;
DeltaMetaExtendedHeader mDeltaMetaExtendedHeader; DeltaMetaExtendedHeader mDeltaMetaExtendedHeader;
fnd::List<nx::ContentMetaBinary::ContentInfo> mContentInfo; fnd::List<nn::hac::ContentMetaBinary::ContentInfo> mContentInfo;
fnd::List<nx::ContentMetaBinary::ContentMetaInfo> mContentMetaInfo; fnd::List<nn::hac::ContentMetaBinary::ContentMetaInfo> mContentMetaInfo;
fnd::Vec<byte_t> mExtendedData; fnd::Vec<byte_t> mExtendedData;
nx::sDigest mDigest; nn::hac::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; }
@ -249,3 +250,4 @@ namespace nx
void validateBinary(const byte_t* bytes, size_t len) const; void validateBinary(const byte_t* bytes, size_t len) const;
}; };
} }
}

View file

@ -3,17 +3,18 @@
#include <fnd/types.h> #include <fnd/types.h>
#include <fnd/ISerialisable.h> #include <fnd/ISerialisable.h>
#include <fnd/List.h> #include <fnd/List.h>
#include <nx/fac.h> #include <nn/hac/fac.h>
namespace nn
namespace nx {
namespace hac
{ {
class FileSystemAccessControlBinary : public fnd::ISerialisable class FileSystemAccessControlBinary : public fnd::ISerialisable
{ {
public: public:
struct sSaveDataOwnerId struct sSaveDataOwnerId
{ {
nx::fac::SaveDataOwnerIdAccessType access_type; nn::hac::fac::SaveDataOwnerIdAccessType access_type;
uint64_t id; uint64_t id;
void operator=(const sSaveDataOwnerId& other) void operator=(const sSaveDataOwnerId& other)
@ -73,3 +74,4 @@ namespace nx
fnd::List<sSaveDataOwnerId> mSaveDataOwnerIdList; fnd::List<sSaveDataOwnerId> mSaveDataOwnerIdList;
}; };
} }
}

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#include <string> #include <string>
#include <fnd/types.h> #include <fnd/types.h>
#include <nx/KernelCapabilityEntry.h> #include <nn/hac/KernelCapabilityEntry.h>
namespace nx namespace nn
{
namespace hac
{ {
class HandleTableSizeEntry class HandleTableSizeEntry
{ {
@ -45,3 +47,4 @@ namespace nx
} }
}; };
} }
}

View file

@ -1,8 +1,10 @@
#pragma once #pragma once
#include <nx/IKernelCapabilityHandler.h> #include <nn/hac/IKernelCapabilityHandler.h>
#include <nx/HandleTableSizeEntry.h> #include <nn/hac/HandleTableSizeEntry.h>
namespace nx namespace nn
{
namespace hac
{ {
class HandleTableSizeHandler : class HandleTableSizeHandler :
public IKernelCapabilityHandler public IKernelCapabilityHandler
@ -32,4 +34,4 @@ namespace nx
HandleTableSizeEntry mEntry; HandleTableSizeEntry mEntry;
}; };
} }
}

View file

@ -1,10 +1,12 @@
#pragma once #pragma once
#include <nx/hierarchicalintegrity.h> #include <nn/hac/hierarchicalintegrity.h>
#include <fnd/ISerialisable.h> #include <fnd/ISerialisable.h>
#include <fnd/List.h> #include <fnd/List.h>
#include <crypto/sha.h> #include <crypto/sha.h>
namespace nx namespace nn
{
namespace hac
{ {
class HierarchicalIntegrityHeader : class HierarchicalIntegrityHeader :
public fnd::ISerialisable public fnd::ISerialisable
@ -64,5 +66,5 @@ namespace nx
fnd::List<sLayer> mLayerInfo; fnd::List<sLayer> mLayerInfo;
fnd::List<crypto::sha::sSha256Hash> mMasterHashList; fnd::List<crypto::sha::sSha256Hash> mMasterHashList;
}; };
}
} }

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#include <nx/hierarchicalsha256.h> #include <nn/hac/hierarchicalsha256.h>
#include <fnd/ISerialisable.h> #include <fnd/ISerialisable.h>
#include <fnd/List.h> #include <fnd/List.h>
namespace nx namespace nn
{
namespace hac
{ {
class HierarchicalSha256Header : class HierarchicalSha256Header :
public fnd::ISerialisable public fnd::ISerialisable
@ -65,5 +67,5 @@ namespace nx
size_t mHashBlockSize; size_t mHashBlockSize;
fnd::List<sLayer> mLayerInfo; fnd::List<sLayer> mLayerInfo;
}; };
}
} }

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#include <fnd/types.h> #include <fnd/types.h>
#include <fnd/List.h> #include <fnd/List.h>
#include <nx/KernelCapabilityEntry.h> #include <nn/hac/KernelCapabilityEntry.h>
namespace nx namespace nn
{
namespace hac
{ {
class IKernelCapabilityHandler class IKernelCapabilityHandler
{ {
@ -14,4 +16,4 @@ namespace nx
virtual bool isSet() const = 0; virtual bool isSet() const = 0;
}; };
} }
}

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#include <string> #include <string>
#include <fnd/types.h> #include <fnd/types.h>
#include <nx/KernelCapabilityEntry.h> #include <nn/hac/KernelCapabilityEntry.h>
namespace nx namespace nn
{
namespace hac
{ {
class InteruptEntry class InteruptEntry
{ {
@ -52,5 +54,5 @@ namespace nx
mInterupt[1] = (field >> kInteruptBits) & kInteruptMax; mInterupt[1] = (field >> kInteruptBits) & kInteruptMax;
} }
}; };
}
} }

View file

@ -1,8 +1,10 @@
#pragma once #pragma once
#include <nx/IKernelCapabilityHandler.h> #include <nn/hac/IKernelCapabilityHandler.h>
#include <nx/InteruptEntry.h> #include <nn/hac/InteruptEntry.h>
namespace nx namespace nn
{
namespace hac
{ {
class InteruptHandler : class InteruptHandler :
public IKernelCapabilityHandler public IKernelCapabilityHandler
@ -31,4 +33,4 @@ namespace nx
fnd::List<uint16_t> mInterupts; fnd::List<uint16_t> mInterupts;
}; };
} }
}

View file

@ -3,16 +3,18 @@
#include <vector> #include <vector>
#include <fnd/ISerialisable.h> #include <fnd/ISerialisable.h>
#include <fnd/List.h> #include <fnd/List.h>
#include <nx/ThreadInfoHandler.h> #include <nn/hac/ThreadInfoHandler.h>
#include <nx/SystemCallHandler.h> #include <nn/hac/SystemCallHandler.h>
#include <nx/MemoryMappingHandler.h> #include <nn/hac/MemoryMappingHandler.h>
#include <nx/InteruptHandler.h> #include <nn/hac/InteruptHandler.h>
#include <nx/MiscParamsHandler.h> #include <nn/hac/MiscParamsHandler.h>
#include <nx/KernelVersionHandler.h> #include <nn/hac/KernelVersionHandler.h>
#include <nx/HandleTableSizeHandler.h> #include <nn/hac/HandleTableSizeHandler.h>
#include <nx/MiscFlagsHandler.h> #include <nn/hac/MiscFlagsHandler.h>
namespace nx namespace nn
{
namespace hac
{ {
class KernelCapabilityBinary : class KernelCapabilityBinary :
public fnd::ISerialisable public fnd::ISerialisable
@ -73,4 +75,4 @@ namespace nx
MiscFlagsHandler mMiscFlags; MiscFlagsHandler mMiscFlags;
}; };
} }
}

View file

@ -1,8 +1,10 @@
#pragma once #pragma once
#include <fnd/types.h> #include <fnd/types.h>
#include <nx/kc.h> #include <nn/hac/kc.h>
namespace nx namespace nn
{
namespace hac
{ {
class KernelCapabilityEntry class KernelCapabilityEntry
{ {
@ -47,4 +49,4 @@ namespace nx
} }
}; };
} }
}

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#include <string> #include <string>
#include <fnd/types.h> #include <fnd/types.h>
#include <nx/KernelCapabilityEntry.h> #include <nn/hac/KernelCapabilityEntry.h>
namespace nx namespace nn
{
namespace hac
{ {
class KernelVersionEntry class KernelVersionEntry
{ {
@ -53,4 +55,4 @@ namespace nx
} }
}; };
} }
}

View file

@ -1,8 +1,10 @@
#pragma once #pragma once
#include <nx/IKernelCapabilityHandler.h> #include <nn/hac/IKernelCapabilityHandler.h>
#include <nx/KernelVersionEntry.h> #include <nn/hac/KernelVersionEntry.h>
namespace nx namespace nn
{
namespace hac
{ {
class KernelVersionHandler : class KernelVersionHandler :
public IKernelCapabilityHandler public IKernelCapabilityHandler
@ -34,4 +36,4 @@ namespace nx
KernelVersionEntry mEntry; KernelVersionEntry mEntry;
}; };
} }
}

View file

@ -1,7 +1,9 @@
#pragma once #pragma once
#include <nx/IKernelCapabilityHandler.h> #include <nn/hac/IKernelCapabilityHandler.h>
namespace nx namespace nn
{
namespace hac
{ {
class MemoryMappingHandler : class MemoryMappingHandler :
public IKernelCapabilityHandler public IKernelCapabilityHandler
@ -75,4 +77,4 @@ namespace nx
fnd::List<sMemoryMapping> mMemPage; fnd::List<sMemoryMapping> mMemPage;
}; };
} }
}

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#include <string> #include <string>
#include <fnd/types.h> #include <fnd/types.h>
#include <nx/KernelCapabilityEntry.h> #include <nn/hac/KernelCapabilityEntry.h>
namespace nx namespace nn
{
namespace hac
{ {
class MemoryPageEntry class MemoryPageEntry
{ {
@ -56,5 +58,5 @@ namespace nx
mUseFlag = mCap.getType() == kc::KC_MEMORY_MAP; mUseFlag = mCap.getType() == kc::KC_MEMORY_MAP;
} }
}; };
}
} }

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#include <string> #include <string>
#include <fnd/types.h> #include <fnd/types.h>
#include <nx/KernelCapabilityEntry.h> #include <nn/hac/KernelCapabilityEntry.h>
namespace nx namespace nn
{
namespace hac
{ {
class MiscFlagsEntry class MiscFlagsEntry
{ {
@ -44,5 +46,5 @@ namespace nx
mFlags = field & kMaxVal; mFlags = field & kMaxVal;
} }
}; };
}
} }

View file

@ -1,8 +1,10 @@
#pragma once #pragma once
#include <nx/IKernelCapabilityHandler.h> #include <nn/hac/IKernelCapabilityHandler.h>
#include <nx/MiscFlagsEntry.h> #include <nn/hac/MiscFlagsEntry.h>
namespace nx namespace nn
{
namespace hac
{ {
class MiscFlagsHandler : class MiscFlagsHandler :
public IKernelCapabilityHandler public IKernelCapabilityHandler
@ -51,5 +53,5 @@ namespace nx
bool mIsSet; bool mIsSet;
fnd::List<Flags> mFlags; fnd::List<Flags> mFlags;
}; };
}
} }

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#include <string> #include <string>
#include <fnd/types.h> #include <fnd/types.h>
#include <nx/KernelCapabilityEntry.h> #include <nn/hac/KernelCapabilityEntry.h>
namespace nx namespace nn
{
namespace hac
{ {
class MiscParamsEntry class MiscParamsEntry
{ {
@ -44,6 +46,5 @@ namespace nx
mProgramType = field & kMaxProgramType; mProgramType = field & kMaxProgramType;
} }
}; };
}
} }

View file

@ -1,8 +1,10 @@
#pragma once #pragma once
#include <nx/IKernelCapabilityHandler.h> #include <nn/hac/IKernelCapabilityHandler.h>
#include <nx/MiscParamsEntry.h> #include <nn/hac/MiscParamsEntry.h>
namespace nx namespace nn
{
namespace hac
{ {
class MiscParamsHandler : class MiscParamsHandler :
public IKernelCapabilityHandler public IKernelCapabilityHandler
@ -32,4 +34,4 @@ namespace nx
MiscParamsEntry mEntry; MiscParamsEntry mEntry;
}; };
} }
}

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#include <nx/nca.h> #include <nn/hac/nca.h>
#include <fnd/ISerialisable.h> #include <fnd/ISerialisable.h>
#include <fnd/List.h> #include <fnd/List.h>
namespace nx namespace nn
{
namespace hac
{ {
class NcaHeader : class NcaHeader :
public fnd::ISerialisable public fnd::ISerialisable
@ -112,5 +114,5 @@ namespace nx
uint64_t blockNumToSize(uint32_t block_num) const; uint64_t blockNumToSize(uint32_t block_num) const;
uint32_t sizeToBlockNum(uint64_t real_size) const; uint32_t sizeToBlockNum(uint64_t real_size) const;
}; };
}
} }

View file

@ -1,14 +1,17 @@
#pragma once #pragma once
#include <nx/nca.h> #include <nn/hac/nca.h>
namespace nx namespace nn
{
namespace hac
{ {
class NcaUtils class NcaUtils
{ {
public: public:
static inline size_t sectorToOffset(size_t sector_index) { return sector_index * nx::nca::kSectorSize; } static inline size_t sectorToOffset(size_t sector_index) { return sector_index * nn::hac::nca::kSectorSize; }
static void decryptNcaHeader(const byte_t* src, byte_t* dst, const crypto::aes::sAesXts128Key& key); static void decryptNcaHeader(const byte_t* src, byte_t* dst, const crypto::aes::sAesXts128Key& key);
static byte_t getMasterKeyRevisionFromKeyGeneration(byte_t key_generation); static byte_t getMasterKeyRevisionFromKeyGeneration(byte_t key_generation);
static void getNcaPartitionAesCtr(const nx::sNcaFsHeader* hdr, byte_t* ctr); static void getNcaPartitionAesCtr(const nn::hac::sNcaFsHeader* hdr, byte_t* ctr);
}; };
} }
}

View file

@ -2,12 +2,13 @@
#include <string> #include <string>
#include <fnd/List.h> #include <fnd/List.h>
#include <fnd/ISerialisable.h> #include <fnd/ISerialisable.h>
#include <nx/npdm.h> #include <nn/hac/npdm.h>
#include <nx/AccessControlInfoBinary.h> #include <nn/hac/AccessControlInfoBinary.h>
#include <nx/AccessControlInfoDescBinary.h> #include <nn/hac/AccessControlInfoDescBinary.h>
namespace nn
namespace nx {
namespace hac
{ {
class NpdmBinary : class NpdmBinary :
public fnd::ISerialisable public fnd::ISerialisable
@ -75,5 +76,5 @@ namespace nx
AccessControlInfoBinary mAci; AccessControlInfoBinary mAci;
AccessControlInfoDescBinary mAcid; AccessControlInfoDescBinary mAcid;
}; };
}
} }

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#include <nx/nro.h> #include <nn/hac/nro.h>
#include <fnd/ISerialisable.h> #include <fnd/ISerialisable.h>
#include <fnd/List.h> #include <fnd/List.h>
namespace nx namespace nn
{
namespace hac
{ {
class NroHeader : class NroHeader :
public fnd::ISerialisable public fnd::ISerialisable
@ -134,5 +136,5 @@ namespace nx
sSection mRoDynStrInfo; sSection mRoDynStrInfo;
sSection mRoDynSymInfo; sSection mRoDynSymInfo;
}; };
}
} }

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#include <nx/nso.h> #include <nn/hac/nso.h>
#include <fnd/ISerialisable.h> #include <fnd/ISerialisable.h>
#include <fnd/List.h> #include <fnd/List.h>
namespace nx namespace nn
{
namespace hac
{ {
class NsoHeader : class NsoHeader :
public fnd::ISerialisable public fnd::ISerialisable
@ -142,5 +144,5 @@ namespace nx
sLayout mRoDynStrInfo; sLayout mRoDynStrInfo;
sLayout mRoDynSymInfo; sLayout mRoDynSymInfo;
}; };
}
} }

View file

@ -3,10 +3,11 @@
#include <fnd/types.h> #include <fnd/types.h>
#include <fnd/ISerialisable.h> #include <fnd/ISerialisable.h>
#include <fnd/List.h> #include <fnd/List.h>
#include <nx/pfs.h> #include <nn/hac/pfs.h>
namespace nn
namespace nx {
namespace hac
{ {
class PfsHeader : class PfsHeader :
public fnd::ISerialisable public fnd::ISerialisable
@ -99,4 +100,4 @@ namespace nx
void calculateOffsets(size_t data_offset); void calculateOffsets(size_t data_offset);
}; };
} }
}

View file

@ -3,9 +3,11 @@
#include <vector> #include <vector>
#include <fnd/ISerialisable.h> #include <fnd/ISerialisable.h>
#include <fnd/List.h> #include <fnd/List.h>
#include <nx/ServiceAccessControlEntry.h> #include <nn/hac/ServiceAccessControlEntry.h>
namespace nx namespace nn
{
namespace hac
{ {
class ServiceAccessControlBinary : class ServiceAccessControlBinary :
public fnd::ISerialisable public fnd::ISerialisable
@ -36,5 +38,5 @@ namespace nx
// variables // variables
fnd::List<ServiceAccessControlEntry> mServices; fnd::List<ServiceAccessControlEntry> mServices;
}; };
}
} }

View file

@ -3,7 +3,9 @@
#include <fnd/types.h> #include <fnd/types.h>
#include <fnd/ISerialisable.h> #include <fnd/ISerialisable.h>
namespace nx namespace nn
{
namespace hac
{ {
class ServiceAccessControlEntry : class ServiceAccessControlEntry :
public fnd::ISerialisable public fnd::ISerialisable
@ -49,3 +51,4 @@ namespace nx
void copyFrom(const ServiceAccessControlEntry& other); void copyFrom(const ServiceAccessControlEntry& other);
}; };
} }
}

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#include <string> #include <string>
#include <fnd/types.h> #include <fnd/types.h>
#include <nx/KernelCapabilityEntry.h> #include <nn/hac/KernelCapabilityEntry.h>
namespace nx namespace nn
{
namespace hac
{ {
class SystemCallEntry class SystemCallEntry
{ {
@ -54,4 +56,4 @@ namespace nx
} }
}; };
} }
}

View file

@ -1,7 +1,9 @@
#pragma once #pragma once
#include <nx/IKernelCapabilityHandler.h> #include <nn/hac/IKernelCapabilityHandler.h>
namespace nx namespace nn
{
namespace hac
{ {
class SystemCallHandler : class SystemCallHandler :
public IKernelCapabilityHandler public IKernelCapabilityHandler
@ -32,5 +34,5 @@ namespace nx
bool mIsSet; bool mIsSet;
fnd::List<uint8_t> mSystemCalls; fnd::List<uint8_t> mSystemCalls;
}; };
}
} }

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#include <string> #include <string>
#include <fnd/types.h> #include <fnd/types.h>
#include <nx/KernelCapabilityEntry.h> #include <nn/hac/KernelCapabilityEntry.h>
namespace nx namespace nn
{
namespace hac
{ {
class ThreadInfoEntry class ThreadInfoEntry
{ {
@ -64,3 +66,4 @@ namespace nx
} }
}; };
} }
}

View file

@ -1,8 +1,10 @@
#pragma once #pragma once
#include <nx/IKernelCapabilityHandler.h> #include <nn/hac/IKernelCapabilityHandler.h>
#include <nx/ThreadInfoEntry.h> #include <nn/hac/ThreadInfoEntry.h>
namespace nx namespace nn
{
namespace hac
{ {
class ThreadInfoHandler : class ThreadInfoHandler :
public IKernelCapabilityHandler public IKernelCapabilityHandler
@ -38,4 +40,4 @@ namespace nx
ThreadInfoEntry mEntry; ThreadInfoEntry mEntry;
}; };
} }
}

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#include <nx/xci.h> #include <nn/hac/xci.h>
#include <fnd/ISerialisable.h> #include <fnd/ISerialisable.h>
#include <fnd/List.h> #include <fnd/List.h>
namespace nx namespace nn
{
namespace hac
{ {
class XciHeader : class XciHeader :
public fnd::ISerialisable public fnd::ISerialisable
@ -121,5 +123,5 @@ namespace nx
byte_t mUppHash[8]; byte_t mUppHash[8];
uint64_t mUppId; uint64_t mUppId;
}; };
}
} }

View file

@ -1,13 +1,16 @@
#pragma once #pragma once
#include <nx/xci.h> #include <nn/hac/xci.h>
namespace nx namespace nn
{
namespace hac
{ {
class XciUtils class XciUtils
{ {
public: public:
static inline uint64_t blockToAddr(uint32_t block) { return ((uint64_t)block) << 9; } static inline uint64_t blockToAddr(uint32_t block) { return ((uint64_t)block) << 9; }
static void getXciHeaderAesIv(const nx::sXciHeader* hdr, byte_t* iv); static void getXciHeaderAesIv(const nn::hac::sXciHeader* hdr, byte_t* iv);
static void decryptXciHeader(const byte_t* src, byte_t* dst, const byte_t* key); static void decryptXciHeader(const byte_t* src, byte_t* dst, const byte_t* key);
}; };
} }
}

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#include <fnd/types.h> #include <fnd/types.h>
#include <crypto/rsa.h> #include <crypto/rsa.h>
#include <nx/macro.h> #include <nn/hac/macro.h>
namespace nx namespace nn
{
namespace hac
{ {
namespace aci namespace aci
{ {
@ -51,3 +53,4 @@ namespace nx
}; };
#pragma pack(pop) #pragma pack(pop)
} }
}

View file

@ -2,7 +2,9 @@
#include <fnd/types.h> #include <fnd/types.h>
#include <crypto/sha.h> #include <crypto/sha.h>
namespace nx namespace nn
{
namespace hac
{ {
namespace cnmt namespace cnmt
{ {
@ -133,3 +135,4 @@ namespace nx
}; };
#pragma pack(pop) #pragma pack(pop)
} }
}

View file

@ -1,7 +1,9 @@
#pragma once #pragma once
#include <fnd/types.h> #include <fnd/types.h>
namespace nx namespace nn
{
namespace hac
{ {
namespace elf namespace elf
{ {
@ -65,3 +67,4 @@ namespace nx
}; };
#pragma pack(pop) #pragma pack(pop)
} }
}

View file

@ -1,7 +1,9 @@
#pragma once #pragma once
#include <fnd/types.h> #include <fnd/types.h>
namespace nx namespace nn
{
namespace hac
{ {
namespace fac namespace fac
{ {
@ -55,3 +57,4 @@ namespace nx
}; };
#pragma pack(pop) #pragma pack(pop)
} }
}

View file

@ -1,8 +1,10 @@
#pragma once #pragma once
#include <fnd/types.h> #include <fnd/types.h>
#include <nx/macro.h> #include <nn/hac/macro.h>
namespace nx namespace nn
{
namespace hac
{ {
namespace hierarchicalintegrity namespace hierarchicalintegrity
{ {
@ -30,3 +32,4 @@ namespace nx
}; };
#pragma pack(pop) #pragma pack(pop)
} }
}

View file

@ -2,7 +2,9 @@
#include <fnd/types.h> #include <fnd/types.h>
#include <crypto/sha.h> #include <crypto/sha.h>
namespace nx namespace nn
{
namespace hac
{ {
namespace hierarchicalsha256 namespace hierarchicalsha256
{ {
@ -24,3 +26,4 @@ namespace nx
}; };
#pragma pack(pop) #pragma pack(pop)
} }
}

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#include <fnd/types.h> #include <fnd/types.h>
#include <crypto/rsa.h> #include <crypto/rsa.h>
#include <nx/macro.h> #include <nn/hac/macro.h>
namespace nx namespace nn
{
namespace hac
{ {
namespace kc namespace kc
{ {
@ -22,3 +24,4 @@ namespace nx
}; };
} }
} }
}

View file

@ -1,7 +1,9 @@
#pragma once #pragma once
#include <fnd/types.h> #include <fnd/types.h>
namespace nx namespace nn
{
namespace hac
{ {
namespace nacp namespace nacp
{ {
@ -218,3 +220,4 @@ namespace nx
}; };
#pragma pack(pop) #pragma pack(pop)
} }
}

View file

@ -3,9 +3,11 @@
#include <crypto/aes.h> #include <crypto/aes.h>
#include <crypto/sha.h> #include <crypto/sha.h>
#include <crypto/rsa.h> #include <crypto/rsa.h>
#include <nx/macro.h> #include <nn/hac/macro.h>
namespace nx namespace nn
{
namespace hac
{ {
namespace nca namespace nca
{ {
@ -127,8 +129,9 @@ namespace nx
byte_t signature_main[crypto::rsa::kRsa2048Size]; byte_t signature_main[crypto::rsa::kRsa2048Size];
byte_t signature_acid[crypto::rsa::kRsa2048Size]; byte_t signature_acid[crypto::rsa::kRsa2048Size];
sNcaHeader header; sNcaHeader header;
sNcaFsHeader fs_header[nx::nca::kPartitionNum]; sNcaFsHeader fs_header[nn::hac::nca::kPartitionNum];
}; };
#pragma pack(pop) #pragma pack(pop)
} }
}

View file

@ -1,8 +1,10 @@
#pragma once #pragma once
#include <fnd/types.h> #include <fnd/types.h>
#include <nx/macro.h> #include <nn/hac/macro.h>
namespace nx namespace nn
{
namespace hac
{ {
namespace npdm namespace npdm
{ {
@ -52,3 +54,4 @@ namespace nx
#pragma pack(pop) #pragma pack(pop)
} }
}

View file

@ -1,8 +1,10 @@
#pragma once #pragma once
#include <fnd/types.h> #include <fnd/types.h>
#include <nx/macro.h> #include <nn/hac/macro.h>
namespace nx namespace nn
{
namespace hac
{ {
namespace nro namespace nro
{ {
@ -40,3 +42,4 @@ namespace nx
}; };
#pragma pack(pop) #pragma pack(pop)
} }
}

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#include <fnd/types.h> #include <fnd/types.h>
#include <crypto/rsa.h> #include <crypto/rsa.h>
#include <nx/macro.h> #include <nn/hac/macro.h>
namespace nx namespace nn
{
namespace hac
{ {
namespace nrr namespace nrr
{ {
@ -34,3 +36,4 @@ namespace nx
}; };
#pragma pack(pop) #pragma pack(pop)
} }
}

View file

@ -1,9 +1,11 @@
#pragma once #pragma once
#include <fnd/types.h> #include <fnd/types.h>
#include <crypto/sha.h> #include <crypto/sha.h>
#include <nx/macro.h> #include <nn/hac/macro.h>
namespace nx namespace nn
{
namespace hac
{ {
namespace nso namespace nso
{ {
@ -63,3 +65,4 @@ namespace nx
#pragma pack(pop) #pragma pack(pop)
} }
}

View file

@ -1,8 +1,10 @@
#include <fnd/types.h> #include <fnd/types.h>
#include <crypto/sha.h> #include <crypto/sha.h>
#include <nx/macro.h> #include <nn/hac/macro.h>
namespace nx namespace nn
{
namespace hac
{ {
namespace pfs namespace pfs
{ {
@ -39,3 +41,4 @@ namespace nx
}; // sizeof(0x40) }; // sizeof(0x40)
#pragma pack(pop) #pragma pack(pop)
} }
}

View file

@ -1,7 +1,9 @@
#pragma once #pragma once
#include <fnd/types.h> #include <fnd/types.h>
namespace nx namespace nn
{
namespace hac
{ {
namespace romfs namespace romfs
{ {
@ -55,3 +57,4 @@ namespace nx
}; };
#pragma pack(pop) #pragma pack(pop)
} }
}

View file

@ -4,9 +4,11 @@
#include <crypto/aes.h> #include <crypto/aes.h>
#include <crypto/sha.h> #include <crypto/sha.h>
#include <crypto/rsa.h> #include <crypto/rsa.h>
#include <nx/macro.h> #include <nn/hac/macro.h>
namespace nx namespace nn
{
namespace hac
{ {
namespace xci namespace xci
{ {
@ -128,3 +130,4 @@ namespace nx
#pragma pack(pop) #pragma pack(pop)
} }
}

View file

@ -1,16 +1,16 @@
#include <nx/AccessControlInfoBinary.h> #include <nn/hac/AccessControlInfoBinary.h>
nx::AccessControlInfoBinary::AccessControlInfoBinary() nn::hac::AccessControlInfoBinary::AccessControlInfoBinary()
{ {
clear(); clear();
} }
nx::AccessControlInfoBinary::AccessControlInfoBinary(const AccessControlInfoBinary & other) nn::hac::AccessControlInfoBinary::AccessControlInfoBinary(const AccessControlInfoBinary & other)
{ {
*this = other; *this = other;
} }
void nx::AccessControlInfoBinary::operator=(const AccessControlInfoBinary & other) void nn::hac::AccessControlInfoBinary::operator=(const AccessControlInfoBinary & other)
{ {
mRawBinary = other.mRawBinary; mRawBinary = other.mRawBinary;
mProgramId = other.mProgramId; mProgramId = other.mProgramId;
@ -19,7 +19,7 @@ void nx::AccessControlInfoBinary::operator=(const AccessControlInfoBinary & othe
mKernelCapabilities = other.mKernelCapabilities; mKernelCapabilities = other.mKernelCapabilities;
} }
bool nx::AccessControlInfoBinary::operator==(const AccessControlInfoBinary & other) const bool nn::hac::AccessControlInfoBinary::operator==(const AccessControlInfoBinary & other) const
{ {
return (mProgramId == other.mProgramId) \ return (mProgramId == other.mProgramId) \
&& (mFileSystemAccessControl == other.mFileSystemAccessControl) \ && (mFileSystemAccessControl == other.mFileSystemAccessControl) \
@ -27,12 +27,12 @@ bool nx::AccessControlInfoBinary::operator==(const AccessControlInfoBinary & oth
&& (mKernelCapabilities == other.mKernelCapabilities); && (mKernelCapabilities == other.mKernelCapabilities);
} }
bool nx::AccessControlInfoBinary::operator!=(const AccessControlInfoBinary & other) const bool nn::hac::AccessControlInfoBinary::operator!=(const AccessControlInfoBinary & other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::AccessControlInfoBinary::toBytes() void nn::hac::AccessControlInfoBinary::toBytes()
{ {
if (mFileSystemAccessControl.getBytes().size() == 0) if (mFileSystemAccessControl.getBytes().size() == 0)
mFileSystemAccessControl.toBytes(); mFileSystemAccessControl.toBytes();
@ -76,7 +76,7 @@ void nx::AccessControlInfoBinary::toBytes()
hdr->kc.size = kc.size; hdr->kc.size = kc.size;
} }
void nx::AccessControlInfoBinary::fromBytes(const byte_t* data, size_t len) void nn::hac::AccessControlInfoBinary::fromBytes(const byte_t* data, size_t len)
{ {
// check size // check size
if (len < sizeof(sAciHeader)) if (len < sizeof(sAciHeader))
@ -117,12 +117,12 @@ void nx::AccessControlInfoBinary::fromBytes(const byte_t* data, size_t len)
mKernelCapabilities.fromBytes(mRawBinary.data() + hdr.kc.offset.get(), hdr.kc.size.get()); mKernelCapabilities.fromBytes(mRawBinary.data() + hdr.kc.offset.get(), hdr.kc.size.get());
} }
const fnd::Vec<byte_t>& nx::AccessControlInfoBinary::getBytes() const const fnd::Vec<byte_t>& nn::hac::AccessControlInfoBinary::getBytes() const
{ {
return mRawBinary; return mRawBinary;
} }
void nx::AccessControlInfoBinary::clear() void nn::hac::AccessControlInfoBinary::clear()
{ {
mRawBinary.clear(); mRawBinary.clear();
mProgramId = 0; mProgramId = 0;
@ -131,42 +131,42 @@ void nx::AccessControlInfoBinary::clear()
mKernelCapabilities.clear(); mKernelCapabilities.clear();
} }
uint64_t nx::AccessControlInfoBinary::getProgramId() const uint64_t nn::hac::AccessControlInfoBinary::getProgramId() const
{ {
return mProgramId; return mProgramId;
} }
void nx::AccessControlInfoBinary::setProgramId(uint64_t program_id) void nn::hac::AccessControlInfoBinary::setProgramId(uint64_t program_id)
{ {
mProgramId = program_id; mProgramId = program_id;
} }
const nx::FileSystemAccessControlBinary& nx::AccessControlInfoBinary::getFileSystemAccessControl() const const nn::hac::FileSystemAccessControlBinary& nn::hac::AccessControlInfoBinary::getFileSystemAccessControl() const
{ {
return mFileSystemAccessControl; return mFileSystemAccessControl;
} }
void nx::AccessControlInfoBinary::setFileSystemAccessControl(const nx::FileSystemAccessControlBinary& fac) void nn::hac::AccessControlInfoBinary::setFileSystemAccessControl(const nn::hac::FileSystemAccessControlBinary& fac)
{ {
mFileSystemAccessControl = fac; mFileSystemAccessControl = fac;
} }
const nx::ServiceAccessControlBinary& nx::AccessControlInfoBinary::getServiceAccessControl() const const nn::hac::ServiceAccessControlBinary& nn::hac::AccessControlInfoBinary::getServiceAccessControl() const
{ {
return mServiceAccessControl; return mServiceAccessControl;
} }
void nx::AccessControlInfoBinary::setServiceAccessControl(const nx::ServiceAccessControlBinary& sac) void nn::hac::AccessControlInfoBinary::setServiceAccessControl(const nn::hac::ServiceAccessControlBinary& sac)
{ {
mServiceAccessControl = sac; mServiceAccessControl = sac;
} }
const nx::KernelCapabilityBinary& nx::AccessControlInfoBinary::getKernelCapabilities() const const nn::hac::KernelCapabilityBinary& nn::hac::AccessControlInfoBinary::getKernelCapabilities() const
{ {
return mKernelCapabilities; return mKernelCapabilities;
} }
void nx::AccessControlInfoBinary::setKernelCapabilities(const nx::KernelCapabilityBinary& kc) void nn::hac::AccessControlInfoBinary::setKernelCapabilities(const nn::hac::KernelCapabilityBinary& kc)
{ {
mKernelCapabilities = kc; mKernelCapabilities = kc;
} }

View file

@ -1,16 +1,16 @@
#include <nx/AccessControlInfoDescBinary.h> #include <nn/hac/AccessControlInfoDescBinary.h>
nx::AccessControlInfoDescBinary::AccessControlInfoDescBinary() nn::hac::AccessControlInfoDescBinary::AccessControlInfoDescBinary()
{ {
clear(); clear();
} }
nx::AccessControlInfoDescBinary::AccessControlInfoDescBinary(const AccessControlInfoDescBinary & other) nn::hac::AccessControlInfoDescBinary::AccessControlInfoDescBinary(const AccessControlInfoDescBinary & other)
{ {
*this = other; *this = other;
} }
void nx::AccessControlInfoDescBinary::operator=(const AccessControlInfoDescBinary & other) void nn::hac::AccessControlInfoDescBinary::operator=(const AccessControlInfoDescBinary & other)
{ {
mRawBinary = other.mRawBinary; mRawBinary = other.mRawBinary;
mNcaHeaderSignature2Key = other.mNcaHeaderSignature2Key; mNcaHeaderSignature2Key = other.mNcaHeaderSignature2Key;
@ -21,7 +21,7 @@ void nx::AccessControlInfoDescBinary::operator=(const AccessControlInfoDescBinar
mKernelCapabilities = other.mKernelCapabilities; mKernelCapabilities = other.mKernelCapabilities;
} }
bool nx::AccessControlInfoDescBinary::operator==(const AccessControlInfoDescBinary & other) const bool nn::hac::AccessControlInfoDescBinary::operator==(const AccessControlInfoDescBinary & other) const
{ {
return (mNcaHeaderSignature2Key == other.mNcaHeaderSignature2Key) \ return (mNcaHeaderSignature2Key == other.mNcaHeaderSignature2Key) \
&& (mFlags == other.mFlags) \ && (mFlags == other.mFlags) \
@ -31,12 +31,12 @@ bool nx::AccessControlInfoDescBinary::operator==(const AccessControlInfoDescBina
&& (mKernelCapabilities == other.mKernelCapabilities); && (mKernelCapabilities == other.mKernelCapabilities);
} }
bool nx::AccessControlInfoDescBinary::operator!=(const AccessControlInfoDescBinary & other) const bool nn::hac::AccessControlInfoDescBinary::operator!=(const AccessControlInfoDescBinary & other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::AccessControlInfoDescBinary::toBytes() void nn::hac::AccessControlInfoDescBinary::toBytes()
{ {
if (mFileSystemAccessControl.getBytes().size() == 0) if (mFileSystemAccessControl.getBytes().size() == 0)
mFileSystemAccessControl.toBytes(); mFileSystemAccessControl.toBytes();
@ -93,7 +93,7 @@ void nx::AccessControlInfoDescBinary::toBytes()
hdr->kc.size = kc.size; hdr->kc.size = kc.size;
} }
void nx::AccessControlInfoDescBinary::fromBytes(const byte_t* data, size_t len) void nn::hac::AccessControlInfoDescBinary::fromBytes(const byte_t* data, size_t len)
{ {
// check size // check size
if (len < sizeof(sAciDescHeader)) if (len < sizeof(sAciDescHeader))
@ -144,12 +144,12 @@ void nx::AccessControlInfoDescBinary::fromBytes(const byte_t* data, size_t len)
mKernelCapabilities.fromBytes(mRawBinary.data() + hdr.kc.offset.get(), hdr.kc.size.get()); mKernelCapabilities.fromBytes(mRawBinary.data() + hdr.kc.offset.get(), hdr.kc.size.get());
} }
const fnd::Vec<byte_t>& nx::AccessControlInfoDescBinary::getBytes() const const fnd::Vec<byte_t>& nn::hac::AccessControlInfoDescBinary::getBytes() const
{ {
return mRawBinary; return mRawBinary;
} }
void nx::AccessControlInfoDescBinary::generateSignature(const crypto::rsa::sRsa2048Key& key) void nn::hac::AccessControlInfoDescBinary::generateSignature(const crypto::rsa::sRsa2048Key& key)
{ {
if (mRawBinary.size() == 0) if (mRawBinary.size() == 0)
toBytes(); toBytes();
@ -163,7 +163,7 @@ void nx::AccessControlInfoDescBinary::generateSignature(const crypto::rsa::sRsa2
} }
} }
void nx::AccessControlInfoDescBinary::validateSignature(const crypto::rsa::sRsa2048Key& key) const void nn::hac::AccessControlInfoDescBinary::validateSignature(const crypto::rsa::sRsa2048Key& key) const
{ {
if (mRawBinary.size() == 0) if (mRawBinary.size() == 0)
throw fnd::Exception(kModuleName, "No Access Control Info Desc binary exists to verify"); throw fnd::Exception(kModuleName, "No Access Control Info Desc binary exists to verify");
@ -177,7 +177,7 @@ void nx::AccessControlInfoDescBinary::validateSignature(const crypto::rsa::sRsa2
} }
} }
void nx::AccessControlInfoDescBinary::clear() void nn::hac::AccessControlInfoDescBinary::clear()
{ {
mRawBinary.clear(); mRawBinary.clear();
memset((void*)&mNcaHeaderSignature2Key, 0, sizeof(mNcaHeaderSignature2Key)); memset((void*)&mNcaHeaderSignature2Key, 0, sizeof(mNcaHeaderSignature2Key));
@ -189,62 +189,62 @@ void nx::AccessControlInfoDescBinary::clear()
mKernelCapabilities.clear(); mKernelCapabilities.clear();
} }
const crypto::rsa::sRsa2048Key& nx::AccessControlInfoDescBinary::getNcaHeaderSignature2Key() const const crypto::rsa::sRsa2048Key& nn::hac::AccessControlInfoDescBinary::getNcaHeaderSignature2Key() const
{ {
return mNcaHeaderSignature2Key; return mNcaHeaderSignature2Key;
} }
void nx::AccessControlInfoDescBinary::setNcaHeaderSignature2Key(const crypto::rsa::sRsa2048Key& key) void nn::hac::AccessControlInfoDescBinary::setNcaHeaderSignature2Key(const crypto::rsa::sRsa2048Key& key)
{ {
mNcaHeaderSignature2Key = key; mNcaHeaderSignature2Key = key;
} }
const fnd::List<nx::aci::Flag>& nx::AccessControlInfoDescBinary::getFlagList() const const fnd::List<nn::hac::aci::Flag>& nn::hac::AccessControlInfoDescBinary::getFlagList() const
{ {
return mFlags; return mFlags;
} }
void nx::AccessControlInfoDescBinary::setFlagList(const fnd::List<nx::aci::Flag>& flags) void nn::hac::AccessControlInfoDescBinary::setFlagList(const fnd::List<nn::hac::aci::Flag>& flags)
{ {
mFlags = flags; mFlags = flags;
} }
const nx::AccessControlInfoDescBinary::sProgramIdRestrict& nx::AccessControlInfoDescBinary::getProgramIdRestrict() const const nn::hac::AccessControlInfoDescBinary::sProgramIdRestrict& nn::hac::AccessControlInfoDescBinary::getProgramIdRestrict() const
{ {
return mProgramIdRestrict; return mProgramIdRestrict;
} }
void nx::AccessControlInfoDescBinary::setProgramIdRestrict(const sProgramIdRestrict& pid_restrict) void nn::hac::AccessControlInfoDescBinary::setProgramIdRestrict(const sProgramIdRestrict& pid_restrict)
{ {
mProgramIdRestrict = pid_restrict; mProgramIdRestrict = pid_restrict;
} }
const nx::FileSystemAccessControlBinary& nx::AccessControlInfoDescBinary::getFileSystemAccessControl() const const nn::hac::FileSystemAccessControlBinary& nn::hac::AccessControlInfoDescBinary::getFileSystemAccessControl() const
{ {
return mFileSystemAccessControl; return mFileSystemAccessControl;
} }
void nx::AccessControlInfoDescBinary::setFileSystemAccessControl(const nx::FileSystemAccessControlBinary& fac) void nn::hac::AccessControlInfoDescBinary::setFileSystemAccessControl(const nn::hac::FileSystemAccessControlBinary& fac)
{ {
mFileSystemAccessControl = fac; mFileSystemAccessControl = fac;
} }
const nx::ServiceAccessControlBinary& nx::AccessControlInfoDescBinary::getServiceAccessControl() const const nn::hac::ServiceAccessControlBinary& nn::hac::AccessControlInfoDescBinary::getServiceAccessControl() const
{ {
return mServiceAccessControl; return mServiceAccessControl;
} }
void nx::AccessControlInfoDescBinary::setServiceAccessControl(const nx::ServiceAccessControlBinary& sac) void nn::hac::AccessControlInfoDescBinary::setServiceAccessControl(const nn::hac::ServiceAccessControlBinary& sac)
{ {
mServiceAccessControl = sac; mServiceAccessControl = sac;
} }
const nx::KernelCapabilityBinary& nx::AccessControlInfoDescBinary::getKernelCapabilities() const const nn::hac::KernelCapabilityBinary& nn::hac::AccessControlInfoDescBinary::getKernelCapabilities() const
{ {
return mKernelCapabilities; return mKernelCapabilities;
} }
void nx::AccessControlInfoDescBinary::setKernelCapabilities(const nx::KernelCapabilityBinary& kc) void nn::hac::AccessControlInfoDescBinary::setKernelCapabilities(const nn::hac::KernelCapabilityBinary& kc)
{ {
mKernelCapabilities = kc; mKernelCapabilities = kc;
} }

View file

@ -1,17 +1,17 @@
#include <nx/AesKeygen.h> #include <nn/hac/AesKeygen.h>
void nx::AesKeygen::generateKey(byte_t* dst, const byte_t* src, const byte_t* src_key) void nn::hac::AesKeygen::generateKey(byte_t* dst, const byte_t* src, const byte_t* src_key)
{ {
crypto::aes::AesEcbDecrypt(src, sizeof(crypto::aes::sAes128Key), src_key, dst); crypto::aes::AesEcbDecrypt(src, sizeof(crypto::aes::sAes128Key), src_key, dst);
} }
void nx::AesKeygen::generateKey(byte_t* dst, const byte_t* src1, const byte_t* src2, const byte_t* src1_key) void nn::hac::AesKeygen::generateKey(byte_t* dst, const byte_t* src1, const byte_t* src2, const byte_t* src1_key)
{ {
crypto::aes::sAes128Key src2_key; crypto::aes::sAes128Key src2_key;
generateKey(src2_key.key, src1, src1_key); generateKey(src2_key.key, src1, src1_key);
generateKey(dst, src2, src2_key.key); generateKey(dst, src2, src2_key.key);
} }
void nx::AesKeygen::generateKey(byte_t* dst, const byte_t* src1, const byte_t* src2, const byte_t* src3, const byte_t* src1_key) void nn::hac::AesKeygen::generateKey(byte_t* dst, const byte_t* src1, const byte_t* src2, const byte_t* src3, const byte_t* src1_key)
{ {
crypto::aes::sAes128Key src3_key; crypto::aes::sAes128Key src3_key;
generateKey(src3_key.key, src1, src2, src1_key); generateKey(src3_key.key, src1, src2, src1_key);

View file

@ -1,16 +1,16 @@
#include <nx/ApplicationControlPropertyBinary.h> #include <nn/hac/ApplicationControlPropertyBinary.h>
nx::ApplicationControlPropertyBinary::ApplicationControlPropertyBinary() nn::hac::ApplicationControlPropertyBinary::ApplicationControlPropertyBinary()
{ {
clear(); clear();
} }
nx::ApplicationControlPropertyBinary::ApplicationControlPropertyBinary(const ApplicationControlPropertyBinary& other) nn::hac::ApplicationControlPropertyBinary::ApplicationControlPropertyBinary(const ApplicationControlPropertyBinary& other)
{ {
*this = other; *this = other;
} }
void nx::ApplicationControlPropertyBinary::operator=(const ApplicationControlPropertyBinary& other) void nn::hac::ApplicationControlPropertyBinary::operator=(const ApplicationControlPropertyBinary& other)
{ {
clear(); clear();
mTitle = other.mTitle; mTitle = other.mTitle;
@ -54,7 +54,7 @@ void nx::ApplicationControlPropertyBinary::operator=(const ApplicationControlPro
mProgramIndex = other.mProgramIndex; mProgramIndex = other.mProgramIndex;
} }
bool nx::ApplicationControlPropertyBinary::operator==(const ApplicationControlPropertyBinary& other) const bool nn::hac::ApplicationControlPropertyBinary::operator==(const ApplicationControlPropertyBinary& other) const
{ {
return (mTitle == other.mTitle) \ return (mTitle == other.mTitle) \
&& (mIsbn == other.mIsbn) \ && (mIsbn == other.mIsbn) \
@ -97,14 +97,14 @@ bool nx::ApplicationControlPropertyBinary::operator==(const ApplicationControlPr
&& (mProgramIndex == other.mProgramIndex); && (mProgramIndex == other.mProgramIndex);
} }
bool nx::ApplicationControlPropertyBinary::operator!=(const ApplicationControlPropertyBinary& other) const bool nn::hac::ApplicationControlPropertyBinary::operator!=(const ApplicationControlPropertyBinary& other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::ApplicationControlPropertyBinary::toBytes() void nn::hac::ApplicationControlPropertyBinary::toBytes()
{ {
mRawBinary.alloc(sizeof(nx::sApplicationControlProperty)); mRawBinary.alloc(sizeof(nn::hac::sApplicationControlProperty));
sApplicationControlProperty* data = (sApplicationControlProperty*)mRawBinary.data(); sApplicationControlProperty* data = (sApplicationControlProperty*)mRawBinary.data();
@ -182,16 +182,16 @@ void nx::ApplicationControlPropertyBinary::toBytes()
data->cache_storage_data_and_journal_size_max = mCacheStorageDataAndJournalSizeMax; data->cache_storage_data_and_journal_size_max = mCacheStorageDataAndJournalSizeMax;
} }
void nx::ApplicationControlPropertyBinary::fromBytes(const byte_t* bytes, size_t len) void nn::hac::ApplicationControlPropertyBinary::fromBytes(const byte_t* bytes, size_t len)
{ {
if (len < sizeof(nx::sApplicationControlProperty)) if (len < sizeof(nn::hac::sApplicationControlProperty))
{ {
throw fnd::Exception(kModuleName, "NACP too small"); throw fnd::Exception(kModuleName, "NACP too small");
} }
clear(); clear();
mRawBinary.alloc(sizeof(nx::sApplicationControlProperty)); mRawBinary.alloc(sizeof(nn::hac::sApplicationControlProperty));
memcpy(mRawBinary.data(), bytes, mRawBinary.size()); memcpy(mRawBinary.data(), bytes, mRawBinary.size());
const sApplicationControlProperty* data = (const sApplicationControlProperty*)mRawBinary.data(); const sApplicationControlProperty* data = (const sApplicationControlProperty*)mRawBinary.data();
@ -275,12 +275,12 @@ void nx::ApplicationControlPropertyBinary::fromBytes(const byte_t* bytes, size_t
mCacheStorageDataAndJournalSizeMax = (int64_t)data->cache_storage_data_and_journal_size_max.get(); mCacheStorageDataAndJournalSizeMax = (int64_t)data->cache_storage_data_and_journal_size_max.get();
} }
const fnd::Vec<byte_t>& nx::ApplicationControlPropertyBinary::getBytes() const const fnd::Vec<byte_t>& nn::hac::ApplicationControlPropertyBinary::getBytes() const
{ {
return mRawBinary; return mRawBinary;
} }
void nx::ApplicationControlPropertyBinary::clear() void nn::hac::ApplicationControlPropertyBinary::clear()
{ {
mRawBinary.clear(); mRawBinary.clear();
mTitle.clear(); mTitle.clear();
@ -324,392 +324,392 @@ void nx::ApplicationControlPropertyBinary::clear()
mProgramIndex = 0; mProgramIndex = 0;
} }
const fnd::List<nx::ApplicationControlPropertyBinary::sTitle>& nx::ApplicationControlPropertyBinary::getTitle() const const fnd::List<nn::hac::ApplicationControlPropertyBinary::sTitle>& nn::hac::ApplicationControlPropertyBinary::getTitle() const
{ {
return mTitle; return mTitle;
} }
void nx::ApplicationControlPropertyBinary::setTitle(const fnd::List<sTitle>& title) void nn::hac::ApplicationControlPropertyBinary::setTitle(const fnd::List<sTitle>& title)
{ {
mTitle = title; mTitle = title;
} }
const std::string& nx::ApplicationControlPropertyBinary::getIsbn() const const std::string& nn::hac::ApplicationControlPropertyBinary::getIsbn() const
{ {
return mIsbn; return mIsbn;
} }
void nx::ApplicationControlPropertyBinary::setIsbn(const std::string& isbn) void nn::hac::ApplicationControlPropertyBinary::setIsbn(const std::string& isbn)
{ {
mIsbn = isbn; mIsbn = isbn;
} }
nx::nacp::StartupUserAccount nx::ApplicationControlPropertyBinary::getStartupUserAccount() const nn::hac::nacp::StartupUserAccount nn::hac::ApplicationControlPropertyBinary::getStartupUserAccount() const
{ {
return mStartupUserAccount; return mStartupUserAccount;
} }
void nx::ApplicationControlPropertyBinary::setStartupUserAccount(nacp::StartupUserAccount var) void nn::hac::ApplicationControlPropertyBinary::setStartupUserAccount(nacp::StartupUserAccount var)
{ {
mStartupUserAccount = var; mStartupUserAccount = var;
} }
nx::nacp::TouchScreenUsageMode nx::ApplicationControlPropertyBinary::getTouchScreenUsageMode() const nn::hac::nacp::TouchScreenUsageMode nn::hac::ApplicationControlPropertyBinary::getTouchScreenUsageMode() const
{ {
return mTouchScreenUsageMode; return mTouchScreenUsageMode;
} }
void nx::ApplicationControlPropertyBinary::setTouchScreenUsageMode(nacp::TouchScreenUsageMode var) void nn::hac::ApplicationControlPropertyBinary::setTouchScreenUsageMode(nacp::TouchScreenUsageMode var)
{ {
mTouchScreenUsageMode = var; mTouchScreenUsageMode = var;
} }
nx::nacp::AocRegistrationType nx::ApplicationControlPropertyBinary::getAocRegistrationType() const nn::hac::nacp::AocRegistrationType nn::hac::ApplicationControlPropertyBinary::getAocRegistrationType() const
{ {
return mAocRegistrationType; return mAocRegistrationType;
} }
void nx::ApplicationControlPropertyBinary::setAocRegistrationType(nacp::AocRegistrationType var) void nn::hac::ApplicationControlPropertyBinary::setAocRegistrationType(nacp::AocRegistrationType var)
{ {
mAocRegistrationType = var; mAocRegistrationType = var;
} }
nx::nacp::AttributeFlag nx::ApplicationControlPropertyBinary::getAttributeFlag() const nn::hac::nacp::AttributeFlag nn::hac::ApplicationControlPropertyBinary::getAttributeFlag() const
{ {
return mAttributeFlag; return mAttributeFlag;
} }
void nx::ApplicationControlPropertyBinary::setAttributeFlag(nacp::AttributeFlag var) void nn::hac::ApplicationControlPropertyBinary::setAttributeFlag(nacp::AttributeFlag var)
{ {
mAttributeFlag = var; mAttributeFlag = var;
} }
const fnd::List<nx::nacp::Language>& nx::ApplicationControlPropertyBinary::getSupportedLanguages() const const fnd::List<nn::hac::nacp::Language>& nn::hac::ApplicationControlPropertyBinary::getSupportedLanguages() const
{ {
return mSupportedLanguages; return mSupportedLanguages;
} }
void nx::ApplicationControlPropertyBinary::setSupportedLanguages(const fnd::List<nacp::Language>& var) void nn::hac::ApplicationControlPropertyBinary::setSupportedLanguages(const fnd::List<nacp::Language>& var)
{ {
mSupportedLanguages = var; mSupportedLanguages = var;
} }
nx::nacp::ParentalControlFlag nx::ApplicationControlPropertyBinary::getParentalControlFlag() const nn::hac::nacp::ParentalControlFlag nn::hac::ApplicationControlPropertyBinary::getParentalControlFlag() const
{ {
return mParentalControlFlag; return mParentalControlFlag;
} }
void nx::ApplicationControlPropertyBinary::setParentalControlFlag(nacp::ParentalControlFlag var) void nn::hac::ApplicationControlPropertyBinary::setParentalControlFlag(nacp::ParentalControlFlag var)
{ {
mParentalControlFlag = var; mParentalControlFlag = var;
} }
nx::nacp::ScreenshotMode nx::ApplicationControlPropertyBinary::getScreenshotMode() const nn::hac::nacp::ScreenshotMode nn::hac::ApplicationControlPropertyBinary::getScreenshotMode() const
{ {
return mScreenshotMode; return mScreenshotMode;
} }
void nx::ApplicationControlPropertyBinary::setScreenshotMode(nacp::ScreenshotMode var) void nn::hac::ApplicationControlPropertyBinary::setScreenshotMode(nacp::ScreenshotMode var)
{ {
mScreenshotMode = var; mScreenshotMode = var;
} }
nx::nacp::VideoCaptureMode nx::ApplicationControlPropertyBinary::getVideoCaptureMode() const nn::hac::nacp::VideoCaptureMode nn::hac::ApplicationControlPropertyBinary::getVideoCaptureMode() const
{ {
return mVideoCaptureMode; return mVideoCaptureMode;
} }
void nx::ApplicationControlPropertyBinary::setVideoCaptureMode(nacp::VideoCaptureMode var) void nn::hac::ApplicationControlPropertyBinary::setVideoCaptureMode(nacp::VideoCaptureMode var)
{ {
mVideoCaptureMode = var; mVideoCaptureMode = var;
} }
nx::nacp::DataLossConfirmation nx::ApplicationControlPropertyBinary::getDataLossConfirmation() const nn::hac::nacp::DataLossConfirmation nn::hac::ApplicationControlPropertyBinary::getDataLossConfirmation() const
{ {
return mDataLossConfirmation; return mDataLossConfirmation;
} }
void nx::ApplicationControlPropertyBinary::setDataLossConfirmation(nacp::DataLossConfirmation var) void nn::hac::ApplicationControlPropertyBinary::setDataLossConfirmation(nacp::DataLossConfirmation var)
{ {
mDataLossConfirmation = var; mDataLossConfirmation = var;
} }
nx::nacp::PlayLogPolicy nx::ApplicationControlPropertyBinary::getPlayLogPolicy() const nn::hac::nacp::PlayLogPolicy nn::hac::ApplicationControlPropertyBinary::getPlayLogPolicy() const
{ {
return mPlayLogPolicy; return mPlayLogPolicy;
} }
void nx::ApplicationControlPropertyBinary::setPlayLogPolicy(nacp::PlayLogPolicy var) void nn::hac::ApplicationControlPropertyBinary::setPlayLogPolicy(nacp::PlayLogPolicy var)
{ {
mPlayLogPolicy = var; mPlayLogPolicy = var;
} }
uint64_t nx::ApplicationControlPropertyBinary::getPresenceGroupId() const uint64_t nn::hac::ApplicationControlPropertyBinary::getPresenceGroupId() const
{ {
return mPresenceGroupId; return mPresenceGroupId;
} }
void nx::ApplicationControlPropertyBinary::setPresenceGroupId(uint64_t var) void nn::hac::ApplicationControlPropertyBinary::setPresenceGroupId(uint64_t var)
{ {
mPresenceGroupId = var; mPresenceGroupId = var;
} }
const fnd::List<nx::ApplicationControlPropertyBinary::sRating>& nx::ApplicationControlPropertyBinary::getRatingAge() const const fnd::List<nn::hac::ApplicationControlPropertyBinary::sRating>& nn::hac::ApplicationControlPropertyBinary::getRatingAge() const
{ {
return mRatingAge; return mRatingAge;
} }
void nx::ApplicationControlPropertyBinary::setRatingAge(const fnd::List<sRating>& var) void nn::hac::ApplicationControlPropertyBinary::setRatingAge(const fnd::List<sRating>& var)
{ {
mRatingAge = var; mRatingAge = var;
} }
const std::string& nx::ApplicationControlPropertyBinary::getDisplayVersion() const const std::string& nn::hac::ApplicationControlPropertyBinary::getDisplayVersion() const
{ {
return mDisplayVersion; return mDisplayVersion;
} }
void nx::ApplicationControlPropertyBinary::setDisplayVersion(const std::string& var) void nn::hac::ApplicationControlPropertyBinary::setDisplayVersion(const std::string& var)
{ {
mDisplayVersion = var; mDisplayVersion = var;
} }
uint64_t nx::ApplicationControlPropertyBinary::getAocBaseId() const uint64_t nn::hac::ApplicationControlPropertyBinary::getAocBaseId() const
{ {
return mAocBaseId; return mAocBaseId;
} }
void nx::ApplicationControlPropertyBinary::setAocBaseId(uint64_t var) void nn::hac::ApplicationControlPropertyBinary::setAocBaseId(uint64_t var)
{ {
mAocBaseId = var; mAocBaseId = var;
} }
uint64_t nx::ApplicationControlPropertyBinary::getSaveDatawOwnerId() const uint64_t nn::hac::ApplicationControlPropertyBinary::getSaveDatawOwnerId() const
{ {
return mSaveDatawOwnerId; return mSaveDatawOwnerId;
} }
void nx::ApplicationControlPropertyBinary::setSaveDatawOwnerId(uint64_t var) void nn::hac::ApplicationControlPropertyBinary::setSaveDatawOwnerId(uint64_t var)
{ {
mSaveDatawOwnerId = var; mSaveDatawOwnerId = var;
} }
const nx::ApplicationControlPropertyBinary::sStorageSize& nx::ApplicationControlPropertyBinary::getUserAccountSaveDataSize() const const nn::hac::ApplicationControlPropertyBinary::sStorageSize& nn::hac::ApplicationControlPropertyBinary::getUserAccountSaveDataSize() const
{ {
return mUserAccountSaveDataSize; return mUserAccountSaveDataSize;
} }
void nx::ApplicationControlPropertyBinary::setUserAccountSaveDataSize(const sStorageSize& var) void nn::hac::ApplicationControlPropertyBinary::setUserAccountSaveDataSize(const sStorageSize& var)
{ {
mUserAccountSaveDataSize = var; mUserAccountSaveDataSize = var;
} }
const nx::ApplicationControlPropertyBinary::sStorageSize& nx::ApplicationControlPropertyBinary::getDeviceSaveDataSize() const const nn::hac::ApplicationControlPropertyBinary::sStorageSize& nn::hac::ApplicationControlPropertyBinary::getDeviceSaveDataSize() const
{ {
return mDeviceSaveDataSize; return mDeviceSaveDataSize;
} }
void nx::ApplicationControlPropertyBinary::setDeviceSaveDataSize(const sStorageSize& var) void nn::hac::ApplicationControlPropertyBinary::setDeviceSaveDataSize(const sStorageSize& var)
{ {
mDeviceSaveDataSize = var; mDeviceSaveDataSize = var;
} }
int64_t nx::ApplicationControlPropertyBinary::getBcatDeliveryCacheStorageSize() const int64_t nn::hac::ApplicationControlPropertyBinary::getBcatDeliveryCacheStorageSize() const
{ {
return mBcatDeliveryCacheStorageSize; return mBcatDeliveryCacheStorageSize;
} }
void nx::ApplicationControlPropertyBinary::setBcatDeliveryCacheStorageSize(int64_t var) void nn::hac::ApplicationControlPropertyBinary::setBcatDeliveryCacheStorageSize(int64_t var)
{ {
mBcatDeliveryCacheStorageSize = var; mBcatDeliveryCacheStorageSize = var;
} }
const std::string& nx::ApplicationControlPropertyBinary::getApplicationErrorCodeCategory() const const std::string& nn::hac::ApplicationControlPropertyBinary::getApplicationErrorCodeCategory() const
{ {
return mApplicationErrorCodeCategory; return mApplicationErrorCodeCategory;
} }
void nx::ApplicationControlPropertyBinary::setApplicationErrorCodeCategory(const std::string& var) void nn::hac::ApplicationControlPropertyBinary::setApplicationErrorCodeCategory(const std::string& var)
{ {
mApplicationErrorCodeCategory = var; mApplicationErrorCodeCategory = var;
} }
const fnd::List<uint64_t>& nx::ApplicationControlPropertyBinary::getLocalCommunicationId() const const fnd::List<uint64_t>& nn::hac::ApplicationControlPropertyBinary::getLocalCommunicationId() const
{ {
return mLocalCommunicationId; return mLocalCommunicationId;
} }
void nx::ApplicationControlPropertyBinary::setLocalCommunicationId(const fnd::List<uint64_t>& var) void nn::hac::ApplicationControlPropertyBinary::setLocalCommunicationId(const fnd::List<uint64_t>& var)
{ {
mLocalCommunicationId = var; mLocalCommunicationId = var;
} }
nx::nacp::LogoType nx::ApplicationControlPropertyBinary::getLogoType() const nn::hac::nacp::LogoType nn::hac::ApplicationControlPropertyBinary::getLogoType() const
{ {
return mLogoType; return mLogoType;
} }
void nx::ApplicationControlPropertyBinary::setLogoType(nacp::LogoType var) void nn::hac::ApplicationControlPropertyBinary::setLogoType(nacp::LogoType var)
{ {
mLogoType = var; mLogoType = var;
} }
nx::nacp::LogoHandling nx::ApplicationControlPropertyBinary::getLogoHandling() const nn::hac::nacp::LogoHandling nn::hac::ApplicationControlPropertyBinary::getLogoHandling() const
{ {
return mLogoHandling; return mLogoHandling;
} }
void nx::ApplicationControlPropertyBinary::setLogoHandling(nacp::LogoHandling var) void nn::hac::ApplicationControlPropertyBinary::setLogoHandling(nacp::LogoHandling var)
{ {
mLogoHandling = var; mLogoHandling = var;
} }
nx::nacp::RuntimeAocInstallMode nx::ApplicationControlPropertyBinary::getRuntimeAocInstallMode() const nn::hac::nacp::RuntimeAocInstallMode nn::hac::ApplicationControlPropertyBinary::getRuntimeAocInstallMode() const
{ {
return mRuntimeAocInstallMode; return mRuntimeAocInstallMode;
} }
void nx::ApplicationControlPropertyBinary::setRuntimeAocInstallMode(nacp::RuntimeAocInstallMode var) void nn::hac::ApplicationControlPropertyBinary::setRuntimeAocInstallMode(nacp::RuntimeAocInstallMode var)
{ {
mRuntimeAocInstallMode = var; mRuntimeAocInstallMode = var;
} }
nx::nacp::CrashReportMode nx::ApplicationControlPropertyBinary::getCrashReportMode() const nn::hac::nacp::CrashReportMode nn::hac::ApplicationControlPropertyBinary::getCrashReportMode() const
{ {
return mCrashReportMode; return mCrashReportMode;
} }
void nx::ApplicationControlPropertyBinary::setCrashReportMode(nacp::CrashReportMode var) void nn::hac::ApplicationControlPropertyBinary::setCrashReportMode(nacp::CrashReportMode var)
{ {
mCrashReportMode = var; mCrashReportMode = var;
} }
nx::nacp::Hdcp nx::ApplicationControlPropertyBinary::getHdcp() const nn::hac::nacp::Hdcp nn::hac::ApplicationControlPropertyBinary::getHdcp() const
{ {
return mHdcp; return mHdcp;
} }
void nx::ApplicationControlPropertyBinary::setHdcp(nacp::Hdcp var) void nn::hac::ApplicationControlPropertyBinary::setHdcp(nacp::Hdcp var)
{ {
mHdcp = var; mHdcp = var;
} }
uint64_t nx::ApplicationControlPropertyBinary::getSeedForPsuedoDeviceId() const uint64_t nn::hac::ApplicationControlPropertyBinary::getSeedForPsuedoDeviceId() const
{ {
return mSeedForPsuedoDeviceId; return mSeedForPsuedoDeviceId;
} }
void nx::ApplicationControlPropertyBinary::setSeedForPsuedoDeviceId(uint64_t var) void nn::hac::ApplicationControlPropertyBinary::setSeedForPsuedoDeviceId(uint64_t var)
{ {
mSeedForPsuedoDeviceId = var; mSeedForPsuedoDeviceId = var;
} }
const std::string& nx::ApplicationControlPropertyBinary::getBcatPassphase() const const std::string& nn::hac::ApplicationControlPropertyBinary::getBcatPassphase() const
{ {
return mBcatPassphase; return mBcatPassphase;
} }
void nx::ApplicationControlPropertyBinary::setBcatPassphase(const std::string& var) void nn::hac::ApplicationControlPropertyBinary::setBcatPassphase(const std::string& var)
{ {
mBcatPassphase = var; mBcatPassphase = var;
} }
const nx::ApplicationControlPropertyBinary::sStorageSize& nx::ApplicationControlPropertyBinary::getUserAccountSaveDataMax() const const nn::hac::ApplicationControlPropertyBinary::sStorageSize& nn::hac::ApplicationControlPropertyBinary::getUserAccountSaveDataMax() const
{ {
return mUserAccountSaveDataMax; return mUserAccountSaveDataMax;
} }
void nx::ApplicationControlPropertyBinary::setUserAccountSaveDataMax(const sStorageSize& var) void nn::hac::ApplicationControlPropertyBinary::setUserAccountSaveDataMax(const sStorageSize& var)
{ {
mUserAccountSaveDataMax = var; mUserAccountSaveDataMax = var;
} }
const nx::ApplicationControlPropertyBinary::sStorageSize& nx::ApplicationControlPropertyBinary::getDeviceSaveDataMax() const const nn::hac::ApplicationControlPropertyBinary::sStorageSize& nn::hac::ApplicationControlPropertyBinary::getDeviceSaveDataMax() const
{ {
return mDeviceSaveDataMax; return mDeviceSaveDataMax;
} }
void nx::ApplicationControlPropertyBinary::setDeviceSaveDataMax(const sStorageSize& var) void nn::hac::ApplicationControlPropertyBinary::setDeviceSaveDataMax(const sStorageSize& var)
{ {
mDeviceSaveDataMax = var; mDeviceSaveDataMax = var;
} }
int64_t nx::ApplicationControlPropertyBinary::getTemporaryStorageSize() const int64_t nn::hac::ApplicationControlPropertyBinary::getTemporaryStorageSize() const
{ {
return mTemporaryStorageSize; return mTemporaryStorageSize;
} }
void nx::ApplicationControlPropertyBinary::setTemporaryStorageSize(int64_t var) void nn::hac::ApplicationControlPropertyBinary::setTemporaryStorageSize(int64_t var)
{ {
mTemporaryStorageSize = var; mTemporaryStorageSize = var;
} }
const nx::ApplicationControlPropertyBinary::sStorageSize& nx::ApplicationControlPropertyBinary::getCacheStorageSize() const const nn::hac::ApplicationControlPropertyBinary::sStorageSize& nn::hac::ApplicationControlPropertyBinary::getCacheStorageSize() const
{ {
return mCacheStorageSize; return mCacheStorageSize;
} }
void nx::ApplicationControlPropertyBinary::setCacheStorageSize(const sStorageSize& var) void nn::hac::ApplicationControlPropertyBinary::setCacheStorageSize(const sStorageSize& var)
{ {
mCacheStorageSize = var; mCacheStorageSize = var;
} }
int64_t nx::ApplicationControlPropertyBinary::getCacheStorageDataAndJournalSizeMax() const int64_t nn::hac::ApplicationControlPropertyBinary::getCacheStorageDataAndJournalSizeMax() const
{ {
return mCacheStorageDataAndJournalSizeMax; return mCacheStorageDataAndJournalSizeMax;
} }
void nx::ApplicationControlPropertyBinary::setCacheStorageDataAndJournalSizeMax(int64_t var) void nn::hac::ApplicationControlPropertyBinary::setCacheStorageDataAndJournalSizeMax(int64_t var)
{ {
mCacheStorageDataAndJournalSizeMax = var; mCacheStorageDataAndJournalSizeMax = var;
} }
uint16_t nx::ApplicationControlPropertyBinary::getCacheStorageIndexMax() const uint16_t nn::hac::ApplicationControlPropertyBinary::getCacheStorageIndexMax() const
{ {
return mCacheStorageIndexMax; return mCacheStorageIndexMax;
} }
void nx::ApplicationControlPropertyBinary::setCacheStorageIndexMax(uint16_t var) void nn::hac::ApplicationControlPropertyBinary::setCacheStorageIndexMax(uint16_t var)
{ {
mCacheStorageIndexMax = var; mCacheStorageIndexMax = var;
} }
const fnd::List<uint64_t>& nx::ApplicationControlPropertyBinary::getPlayLogQueryableApplicationId() const const fnd::List<uint64_t>& nn::hac::ApplicationControlPropertyBinary::getPlayLogQueryableApplicationId() const
{ {
return mPlayLogQueryableApplicationId; return mPlayLogQueryableApplicationId;
} }
void nx::ApplicationControlPropertyBinary::setPlayLogQueryableApplicationId(const fnd::List<uint64_t>& var) void nn::hac::ApplicationControlPropertyBinary::setPlayLogQueryableApplicationId(const fnd::List<uint64_t>& var)
{ {
mPlayLogQueryableApplicationId = var; mPlayLogQueryableApplicationId = var;
} }
nx::nacp::PlayLogQueryCapability nx::ApplicationControlPropertyBinary::getPlayLogQueryCapability() const nn::hac::nacp::PlayLogQueryCapability nn::hac::ApplicationControlPropertyBinary::getPlayLogQueryCapability() const
{ {
return mPlayLogQueryCapability; return mPlayLogQueryCapability;
} }
void nx::ApplicationControlPropertyBinary::setPlayLogQueryCapability(nacp::PlayLogQueryCapability var) void nn::hac::ApplicationControlPropertyBinary::setPlayLogQueryCapability(nacp::PlayLogQueryCapability var)
{ {
mPlayLogQueryCapability = var; mPlayLogQueryCapability = var;
} }
nx::nacp::RepairFlag nx::ApplicationControlPropertyBinary::getRepairFlag() const nn::hac::nacp::RepairFlag nn::hac::ApplicationControlPropertyBinary::getRepairFlag() const
{ {
return mRepairFlag; return mRepairFlag;
} }
void nx::ApplicationControlPropertyBinary::setRepairFlag(nacp::RepairFlag var) void nn::hac::ApplicationControlPropertyBinary::setRepairFlag(nacp::RepairFlag var)
{ {
mRepairFlag = var; mRepairFlag = var;
} }
byte_t nx::ApplicationControlPropertyBinary::getProgramIndex() const byte_t nn::hac::ApplicationControlPropertyBinary::getProgramIndex() const
{ {
return mProgramIndex; return mProgramIndex;
} }
void nx::ApplicationControlPropertyBinary::setProgramIndex(byte_t var) void nn::hac::ApplicationControlPropertyBinary::setProgramIndex(byte_t var)
{ {
mProgramIndex = var; mProgramIndex = var;
} }

View file

@ -1,11 +1,11 @@
#include <nx/ApplicationControlPropertyUtils.h> #include <nn/hac/ApplicationControlPropertyUtils.h>
bool nx::ApplicationControlPropertyUtils::validateSaveDataSizeMax(int64_t size, int64_t alignment) bool nn::hac::ApplicationControlPropertyUtils::validateSaveDataSizeMax(int64_t size, int64_t alignment)
{ {
return (alignment != 0 && (size & (alignment - 1)) != 0) == false; return (alignment != 0 && (size & (alignment - 1)) != 0) == false;
} }
bool nx::ApplicationControlPropertyUtils::validateSaveDataSize(int64_t size) bool nn::hac::ApplicationControlPropertyUtils::validateSaveDataSize(int64_t size)
{ {
return (size & 0x3fff) == 0; return (size & 0x3fff) == 0;
} }

View file

@ -1,16 +1,16 @@
#include <nx/ContentMetaBinary.h> #include <nn/hac/ContentMetaBinary.h>
nx::ContentMetaBinary::ContentMetaBinary() nn::hac::ContentMetaBinary::ContentMetaBinary()
{ {
clear(); clear();
} }
nx::ContentMetaBinary::ContentMetaBinary(const ContentMetaBinary & other) nn::hac::ContentMetaBinary::ContentMetaBinary(const ContentMetaBinary & other)
{ {
*this = other; *this = other;
} }
void nx::ContentMetaBinary::operator=(const ContentMetaBinary& other) void nn::hac::ContentMetaBinary::operator=(const ContentMetaBinary& other)
{ {
if (other.getBytes().size() > 0) if (other.getBytes().size() > 0)
{ {
@ -36,7 +36,7 @@ void nx::ContentMetaBinary::operator=(const ContentMetaBinary& other)
} }
} }
bool nx::ContentMetaBinary::operator==(const ContentMetaBinary& other) const bool nn::hac::ContentMetaBinary::operator==(const ContentMetaBinary& other) const
{ {
return (mTitleId == other.mTitleId) \ return (mTitleId == other.mTitleId) \
&& (mTitleVersion == other.mTitleVersion) \ && (mTitleVersion == other.mTitleVersion) \
@ -54,17 +54,17 @@ bool nx::ContentMetaBinary::operator==(const ContentMetaBinary& other) const
&& (memcmp(mDigest.data, other.mDigest.data, cnmt::kDigestLen) == 0); && (memcmp(mDigest.data, other.mDigest.data, cnmt::kDigestLen) == 0);
} }
bool nx::ContentMetaBinary::operator!=(const ContentMetaBinary& other) const bool nn::hac::ContentMetaBinary::operator!=(const ContentMetaBinary& other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::ContentMetaBinary::toBytes() void nn::hac::ContentMetaBinary::toBytes()
{ {
throw fnd::Exception(kModuleName, "exportBinary() not implemented"); throw fnd::Exception(kModuleName, "exportBinary() not implemented");
} }
void nx::ContentMetaBinary::fromBytes(const byte_t* data, size_t len) void nn::hac::ContentMetaBinary::fromBytes(const byte_t* data, size_t len)
{ {
// clear member variables // clear member variables
clear(); clear();
@ -153,12 +153,12 @@ void nx::ContentMetaBinary::fromBytes(const byte_t* data, size_t len)
memcpy(mDigest.data, data + getDigestOffset(hdr->exhdr_size.get(), hdr->content_count.get(), hdr->content_meta_count.get(), exdata_size), cnmt::kDigestLen); memcpy(mDigest.data, data + getDigestOffset(hdr->exhdr_size.get(), hdr->content_count.get(), hdr->content_meta_count.get(), exdata_size), cnmt::kDigestLen);
} }
const fnd::Vec<byte_t>& nx::ContentMetaBinary::getBytes() const const fnd::Vec<byte_t>& nn::hac::ContentMetaBinary::getBytes() const
{ {
return mRawBinary; return mRawBinary;
} }
void nx::ContentMetaBinary::clear() void nn::hac::ContentMetaBinary::clear()
{ {
mRawBinary.clear(); mRawBinary.clear();
mTitleId = 0; mTitleId = 0;
@ -177,138 +177,138 @@ void nx::ContentMetaBinary::clear()
memset(mDigest.data, 0, cnmt::kDigestLen); memset(mDigest.data, 0, cnmt::kDigestLen);
} }
uint64_t nx::ContentMetaBinary::getTitleId() const uint64_t nn::hac::ContentMetaBinary::getTitleId() const
{ {
return mTitleId; return mTitleId;
} }
void nx::ContentMetaBinary::setTitleId(uint64_t title_id) void nn::hac::ContentMetaBinary::setTitleId(uint64_t title_id)
{ {
mTitleId = title_id; mTitleId = title_id;
} }
uint32_t nx::ContentMetaBinary::getTitleVersion() const uint32_t nn::hac::ContentMetaBinary::getTitleVersion() const
{ {
return mTitleVersion; return mTitleVersion;
} }
void nx::ContentMetaBinary::setTitleVersion(uint32_t version) void nn::hac::ContentMetaBinary::setTitleVersion(uint32_t version)
{ {
mTitleVersion = version; mTitleVersion = version;
} }
nx::cnmt::ContentMetaType nx::ContentMetaBinary::getType() const nn::hac::cnmt::ContentMetaType nn::hac::ContentMetaBinary::getType() const
{ {
return mType; return mType;
} }
void nx::ContentMetaBinary::setType(cnmt::ContentMetaType type) void nn::hac::ContentMetaBinary::setType(cnmt::ContentMetaType type)
{ {
mType = type; mType = type;
} }
byte_t nx::ContentMetaBinary::getAttributes() const byte_t nn::hac::ContentMetaBinary::getAttributes() const
{ {
return mAttributes; return mAttributes;
} }
void nx::ContentMetaBinary::setAttributes(byte_t attributes) void nn::hac::ContentMetaBinary::setAttributes(byte_t attributes)
{ {
mAttributes = attributes; mAttributes = attributes;
} }
uint32_t nx::ContentMetaBinary::getRequiredDownloadSystemVersion() const uint32_t nn::hac::ContentMetaBinary::getRequiredDownloadSystemVersion() const
{ {
return mRequiredDownloadSystemVersion; return mRequiredDownloadSystemVersion;
} }
void nx::ContentMetaBinary::setRequiredDownloadSystemVersion(uint32_t version) void nn::hac::ContentMetaBinary::setRequiredDownloadSystemVersion(uint32_t version)
{ {
mRequiredDownloadSystemVersion = version; mRequiredDownloadSystemVersion = version;
} }
const nx::ContentMetaBinary::ApplicationMetaExtendedHeader& nx::ContentMetaBinary::getApplicationMetaExtendedHeader() const const nn::hac::ContentMetaBinary::ApplicationMetaExtendedHeader& nn::hac::ContentMetaBinary::getApplicationMetaExtendedHeader() const
{ {
return mApplicationMetaExtendedHeader; return mApplicationMetaExtendedHeader;
} }
void nx::ContentMetaBinary::setApplicationMetaExtendedHeader(const ApplicationMetaExtendedHeader& exhdr) void nn::hac::ContentMetaBinary::setApplicationMetaExtendedHeader(const ApplicationMetaExtendedHeader& exhdr)
{ {
mApplicationMetaExtendedHeader = exhdr; mApplicationMetaExtendedHeader = exhdr;
} }
const nx::ContentMetaBinary::PatchMetaExtendedHeader& nx::ContentMetaBinary::getPatchMetaExtendedHeader() const const nn::hac::ContentMetaBinary::PatchMetaExtendedHeader& nn::hac::ContentMetaBinary::getPatchMetaExtendedHeader() const
{ {
return mPatchMetaExtendedHeader; return mPatchMetaExtendedHeader;
} }
void nx::ContentMetaBinary::setPatchMetaExtendedHeader(const PatchMetaExtendedHeader& exhdr) void nn::hac::ContentMetaBinary::setPatchMetaExtendedHeader(const PatchMetaExtendedHeader& exhdr)
{ {
mPatchMetaExtendedHeader = exhdr; mPatchMetaExtendedHeader = exhdr;
} }
const nx::ContentMetaBinary::AddOnContentMetaExtendedHeader& nx::ContentMetaBinary::getAddOnContentMetaExtendedHeader() const const nn::hac::ContentMetaBinary::AddOnContentMetaExtendedHeader& nn::hac::ContentMetaBinary::getAddOnContentMetaExtendedHeader() const
{ {
return mAddOnContentMetaExtendedHeader; return mAddOnContentMetaExtendedHeader;
} }
void nx::ContentMetaBinary::setAddOnContentMetaExtendedHeader(const AddOnContentMetaExtendedHeader& exhdr) void nn::hac::ContentMetaBinary::setAddOnContentMetaExtendedHeader(const AddOnContentMetaExtendedHeader& exhdr)
{ {
mAddOnContentMetaExtendedHeader = exhdr; mAddOnContentMetaExtendedHeader = exhdr;
} }
const nx::ContentMetaBinary::DeltaMetaExtendedHeader& nx::ContentMetaBinary::getDeltaMetaExtendedHeader() const const nn::hac::ContentMetaBinary::DeltaMetaExtendedHeader& nn::hac::ContentMetaBinary::getDeltaMetaExtendedHeader() const
{ {
return mDeltaMetaExtendedHeader; return mDeltaMetaExtendedHeader;
} }
void nx::ContentMetaBinary::setDeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& exhdr) void nn::hac::ContentMetaBinary::setDeltaMetaExtendedHeader(const DeltaMetaExtendedHeader& exhdr)
{ {
mDeltaMetaExtendedHeader = exhdr; mDeltaMetaExtendedHeader = exhdr;
} }
const fnd::List<nx::ContentMetaBinary::ContentInfo>& nx::ContentMetaBinary::getContentInfo() const const fnd::List<nn::hac::ContentMetaBinary::ContentInfo>& nn::hac::ContentMetaBinary::getContentInfo() const
{ {
return mContentInfo; return mContentInfo;
} }
void nx::ContentMetaBinary::setContentInfo(const fnd::List<nx::ContentMetaBinary::ContentInfo>& info) void nn::hac::ContentMetaBinary::setContentInfo(const fnd::List<nn::hac::ContentMetaBinary::ContentInfo>& info)
{ {
mContentInfo = info; mContentInfo = info;
} }
const fnd::List<nx::ContentMetaBinary::ContentMetaInfo>& nx::ContentMetaBinary::getContentMetaInfo() const const fnd::List<nn::hac::ContentMetaBinary::ContentMetaInfo>& nn::hac::ContentMetaBinary::getContentMetaInfo() const
{ {
return mContentMetaInfo; return mContentMetaInfo;
} }
void nx::ContentMetaBinary::setContentMetaInfo(const fnd::List<nx::ContentMetaBinary::ContentMetaInfo>& info) void nn::hac::ContentMetaBinary::setContentMetaInfo(const fnd::List<nn::hac::ContentMetaBinary::ContentMetaInfo>& info)
{ {
mContentMetaInfo = info; mContentMetaInfo = info;
} }
const fnd::Vec<byte_t> & nx::ContentMetaBinary::getExtendedData() const const fnd::Vec<byte_t> & nn::hac::ContentMetaBinary::getExtendedData() const
{ {
return mExtendedData; return mExtendedData;
} }
void nx::ContentMetaBinary::setExtendedData(const fnd::Vec<byte_t> & data) void nn::hac::ContentMetaBinary::setExtendedData(const fnd::Vec<byte_t> & data)
{ {
mExtendedData = data; mExtendedData = data;
} }
const nx::sDigest & nx::ContentMetaBinary::getDigest() const const nn::hac::sDigest & nn::hac::ContentMetaBinary::getDigest() const
{ {
return mDigest; return mDigest;
} }
void nx::ContentMetaBinary::setDigest(const nx::sDigest & digest) void nn::hac::ContentMetaBinary::setDigest(const nn::hac::sDigest & digest)
{ {
memcpy(mDigest.data, digest.data, cnmt::kDigestLen); memcpy(mDigest.data, digest.data, cnmt::kDigestLen);
} }
bool nx::ContentMetaBinary::validateExtendedHeaderSize(cnmt::ContentMetaType type, size_t exhdrSize) const bool nn::hac::ContentMetaBinary::validateExtendedHeaderSize(cnmt::ContentMetaType type, size_t exhdrSize) const
{ {
bool validSize = false; bool validSize = false;
@ -333,7 +333,7 @@ bool nx::ContentMetaBinary::validateExtendedHeaderSize(cnmt::ContentMetaType typ
return validSize; return validSize;
} }
size_t nx::ContentMetaBinary::getExtendedDataSize(cnmt::ContentMetaType type, const byte_t * data) const size_t nn::hac::ContentMetaBinary::getExtendedDataSize(cnmt::ContentMetaType type, const byte_t * data) const
{ {
size_t exdata_len = 0; size_t exdata_len = 0;
if (type == cnmt::METATYPE_PATCH) if (type == cnmt::METATYPE_PATCH)
@ -349,7 +349,7 @@ size_t nx::ContentMetaBinary::getExtendedDataSize(cnmt::ContentMetaType type, co
return exdata_len; return exdata_len;
} }
void nx::ContentMetaBinary::validateBinary(const byte_t * data, size_t len) const void nn::hac::ContentMetaBinary::validateBinary(const byte_t * data, size_t len) const
{ {
// check if it is large enough to read the header // check if it is large enough to read the header
if (len < sizeof(sContentMetaHeader)) if (len < sizeof(sContentMetaHeader))

View file

@ -1,18 +1,18 @@
#include <nx/FileSystemAccessControlBinary.h> #include <nn/hac/FileSystemAccessControlBinary.h>
#include <fnd/SimpleTextOutput.h> #include <fnd/SimpleTextOutput.h>
nx::FileSystemAccessControlBinary::FileSystemAccessControlBinary() nn::hac::FileSystemAccessControlBinary::FileSystemAccessControlBinary()
{ {
clear(); clear();
} }
nx::FileSystemAccessControlBinary::FileSystemAccessControlBinary(const FileSystemAccessControlBinary & other) nn::hac::FileSystemAccessControlBinary::FileSystemAccessControlBinary(const FileSystemAccessControlBinary & other)
{ {
*this = other; *this = other;
} }
void nx::FileSystemAccessControlBinary::operator=(const FileSystemAccessControlBinary & other) void nn::hac::FileSystemAccessControlBinary::operator=(const FileSystemAccessControlBinary & other)
{ {
mRawBinary = other.mRawBinary; mRawBinary = other.mRawBinary;
mVersion = other.mVersion; mVersion = other.mVersion;
@ -21,7 +21,7 @@ void nx::FileSystemAccessControlBinary::operator=(const FileSystemAccessControlB
mSaveDataOwnerIdList = other.mSaveDataOwnerIdList; mSaveDataOwnerIdList = other.mSaveDataOwnerIdList;
} }
bool nx::FileSystemAccessControlBinary::operator==(const FileSystemAccessControlBinary & other) const bool nn::hac::FileSystemAccessControlBinary::operator==(const FileSystemAccessControlBinary & other) const
{ {
return (mVersion == other.mVersion) \ return (mVersion == other.mVersion) \
&& (mFsaRights == other.mFsaRights) \ && (mFsaRights == other.mFsaRights) \
@ -29,12 +29,12 @@ bool nx::FileSystemAccessControlBinary::operator==(const FileSystemAccessControl
&& (mSaveDataOwnerIdList == other.mSaveDataOwnerIdList); && (mSaveDataOwnerIdList == other.mSaveDataOwnerIdList);
} }
bool nx::FileSystemAccessControlBinary::operator!=(const FileSystemAccessControlBinary & other) const bool nn::hac::FileSystemAccessControlBinary::operator!=(const FileSystemAccessControlBinary & other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::FileSystemAccessControlBinary::toBytes() void nn::hac::FileSystemAccessControlBinary::toBytes()
{ {
// determine section layout // determine section layout
struct sLayout { struct sLayout {
@ -91,7 +91,7 @@ void nx::FileSystemAccessControlBinary::toBytes()
} }
} }
void nx::FileSystemAccessControlBinary::fromBytes(const byte_t* data, size_t len) void nn::hac::FileSystemAccessControlBinary::fromBytes(const byte_t* data, size_t len)
{ {
// check size // check size
if (len < sizeof(sFacHeader)) if (len < sizeof(sFacHeader))
@ -157,12 +157,12 @@ void nx::FileSystemAccessControlBinary::fromBytes(const byte_t* data, size_t len
} }
} }
const fnd::Vec<byte_t>& nx::FileSystemAccessControlBinary::getBytes() const const fnd::Vec<byte_t>& nn::hac::FileSystemAccessControlBinary::getBytes() const
{ {
return mRawBinary; return mRawBinary;
} }
void nx::FileSystemAccessControlBinary::clear() void nn::hac::FileSystemAccessControlBinary::clear()
{ {
mRawBinary.clear(); mRawBinary.clear();
mVersion = 0; mVersion = 0;
@ -171,42 +171,42 @@ void nx::FileSystemAccessControlBinary::clear()
mSaveDataOwnerIdList.clear(); mSaveDataOwnerIdList.clear();
} }
uint32_t nx::FileSystemAccessControlBinary::getFormatVersion() const uint32_t nn::hac::FileSystemAccessControlBinary::getFormatVersion() const
{ {
return mVersion; return mVersion;
} }
void nx::FileSystemAccessControlBinary::setFormatVersion(uint32_t format_version) void nn::hac::FileSystemAccessControlBinary::setFormatVersion(uint32_t format_version)
{ {
mVersion = format_version; mVersion = format_version;
} }
const fnd::List<nx::fac::FsAccessFlag>& nx::FileSystemAccessControlBinary::getFsaRightsList() const const fnd::List<nn::hac::fac::FsAccessFlag>& nn::hac::FileSystemAccessControlBinary::getFsaRightsList() const
{ {
return mFsaRights; return mFsaRights;
} }
void nx::FileSystemAccessControlBinary::setFsaRightsList(const fnd::List<fac::FsAccessFlag>& list) void nn::hac::FileSystemAccessControlBinary::setFsaRightsList(const fnd::List<fac::FsAccessFlag>& list)
{ {
mFsaRights = list; mFsaRights = list;
} }
const fnd::List<uint64_t>& nx::FileSystemAccessControlBinary::getContentOwnerIdList() const const fnd::List<uint64_t>& nn::hac::FileSystemAccessControlBinary::getContentOwnerIdList() const
{ {
return mContentOwnerIdList; return mContentOwnerIdList;
} }
void nx::FileSystemAccessControlBinary::setContentOwnerIdList(const fnd::List<uint64_t>& list) void nn::hac::FileSystemAccessControlBinary::setContentOwnerIdList(const fnd::List<uint64_t>& list)
{ {
mContentOwnerIdList = list; mContentOwnerIdList = list;
} }
const fnd::List<nx::FileSystemAccessControlBinary::sSaveDataOwnerId>& nx::FileSystemAccessControlBinary::getSaveDataOwnerIdList() const const fnd::List<nn::hac::FileSystemAccessControlBinary::sSaveDataOwnerId>& nn::hac::FileSystemAccessControlBinary::getSaveDataOwnerIdList() const
{ {
return mSaveDataOwnerIdList; return mSaveDataOwnerIdList;
} }
void nx::FileSystemAccessControlBinary::setSaveDataOwnerIdList(const fnd::List<sSaveDataOwnerId>& list) void nn::hac::FileSystemAccessControlBinary::setSaveDataOwnerIdList(const fnd::List<sSaveDataOwnerId>& list)
{ {
mSaveDataOwnerIdList = list; mSaveDataOwnerIdList = list;
} }

View file

@ -1,47 +1,47 @@
#include <nx/HandleTableSizeEntry.h> #include <nn/hac/HandleTableSizeEntry.h>
nx::HandleTableSizeEntry::HandleTableSizeEntry() : nn::hac::HandleTableSizeEntry::HandleTableSizeEntry() :
mCap(kCapId), mCap(kCapId),
mHandleTableSize(0) mHandleTableSize(0)
{} {}
nx::HandleTableSizeEntry::HandleTableSizeEntry(const KernelCapabilityEntry & kernel_cap) : nn::hac::HandleTableSizeEntry::HandleTableSizeEntry(const KernelCapabilityEntry & kernel_cap) :
mCap(kCapId), mCap(kCapId),
mHandleTableSize(0) mHandleTableSize(0)
{ {
setKernelCapability(kernel_cap); setKernelCapability(kernel_cap);
} }
nx::HandleTableSizeEntry::HandleTableSizeEntry(uint16_t size) : nn::hac::HandleTableSizeEntry::HandleTableSizeEntry(uint16_t size) :
mCap(kCapId), mCap(kCapId),
mHandleTableSize(0) mHandleTableSize(0)
{ {
setHandleTableSize(size); setHandleTableSize(size);
} }
void nx::HandleTableSizeEntry::operator=(const HandleTableSizeEntry& other) void nn::hac::HandleTableSizeEntry::operator=(const HandleTableSizeEntry& other)
{ {
mHandleTableSize = other.mHandleTableSize; mHandleTableSize = other.mHandleTableSize;
updateCapField(); updateCapField();
} }
bool nx::HandleTableSizeEntry::operator==(const HandleTableSizeEntry& other) const bool nn::hac::HandleTableSizeEntry::operator==(const HandleTableSizeEntry& other) const
{ {
return (mHandleTableSize == other.mHandleTableSize); return (mHandleTableSize == other.mHandleTableSize);
} }
bool nx::HandleTableSizeEntry::operator!=(const HandleTableSizeEntry& other) const bool nn::hac::HandleTableSizeEntry::operator!=(const HandleTableSizeEntry& other) const
{ {
return !(*this == other); return !(*this == other);
} }
const nx::KernelCapabilityEntry & nx::HandleTableSizeEntry::getKernelCapability() const const nn::hac::KernelCapabilityEntry & nn::hac::HandleTableSizeEntry::getKernelCapability() const
{ {
return mCap; return mCap;
} }
void nx::HandleTableSizeEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap) void nn::hac::HandleTableSizeEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap)
{ {
if (kernel_cap.getType() != kCapId) if (kernel_cap.getType() != kCapId)
{ {
@ -52,12 +52,12 @@ void nx::HandleTableSizeEntry::setKernelCapability(const KernelCapabilityEntry &
processCapField(); processCapField();
} }
uint16_t nx::HandleTableSizeEntry::getHandleTableSize() const uint16_t nn::hac::HandleTableSizeEntry::getHandleTableSize() const
{ {
return mHandleTableSize; return mHandleTableSize;
} }
void nx::HandleTableSizeEntry::setHandleTableSize(uint16_t size) void nn::hac::HandleTableSizeEntry::setHandleTableSize(uint16_t size)
{ {
if (size > kMaxHandleTableSize) if (size > kMaxHandleTableSize)
{ {

View file

@ -1,28 +1,28 @@
#include <nx/HandleTableSizeHandler.h> #include <nn/hac/HandleTableSizeHandler.h>
nx::HandleTableSizeHandler::HandleTableSizeHandler() : nn::hac::HandleTableSizeHandler::HandleTableSizeHandler() :
mIsSet(false), mIsSet(false),
mEntry(0) mEntry(0)
{} {}
void nx::HandleTableSizeHandler::operator=(const HandleTableSizeHandler & other) void nn::hac::HandleTableSizeHandler::operator=(const HandleTableSizeHandler & other)
{ {
mIsSet = other.mIsSet; mIsSet = other.mIsSet;
mEntry.setKernelCapability(other.mEntry.getKernelCapability()); mEntry.setKernelCapability(other.mEntry.getKernelCapability());
} }
bool nx::HandleTableSizeHandler::operator==(const HandleTableSizeHandler & other) const bool nn::hac::HandleTableSizeHandler::operator==(const HandleTableSizeHandler & other) const
{ {
return (mIsSet == other.mIsSet) \ return (mIsSet == other.mIsSet) \
&& (mEntry.getKernelCapability() == other.mEntry.getKernelCapability()); && (mEntry.getKernelCapability() == other.mEntry.getKernelCapability());
} }
bool nx::HandleTableSizeHandler::operator!=(const HandleTableSizeHandler & other) const bool nn::hac::HandleTableSizeHandler::operator!=(const HandleTableSizeHandler & other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::HandleTableSizeHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps) void nn::hac::HandleTableSizeHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps)
{ {
if (caps.size() > kMaxKernelCapNum) if (caps.size() > kMaxKernelCapNum)
{ {
@ -36,7 +36,7 @@ void nx::HandleTableSizeHandler::importKernelCapabilityList(const fnd::List<Kern
mIsSet = true; mIsSet = true;
} }
void nx::HandleTableSizeHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const void nn::hac::HandleTableSizeHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const
{ {
if (isSet() == false) if (isSet() == false)
return; return;
@ -44,23 +44,23 @@ void nx::HandleTableSizeHandler::exportKernelCapabilityList(fnd::List<KernelCapa
caps.addElement(mEntry.getKernelCapability()); caps.addElement(mEntry.getKernelCapability());
} }
void nx::HandleTableSizeHandler::clear() void nn::hac::HandleTableSizeHandler::clear()
{ {
mIsSet = false; mIsSet = false;
mEntry.setHandleTableSize(0); mEntry.setHandleTableSize(0);
} }
bool nx::HandleTableSizeHandler::isSet() const bool nn::hac::HandleTableSizeHandler::isSet() const
{ {
return mIsSet; return mIsSet;
} }
uint16_t nx::HandleTableSizeHandler::getHandleTableSize() const uint16_t nn::hac::HandleTableSizeHandler::getHandleTableSize() const
{ {
return mEntry.getHandleTableSize(); return mEntry.getHandleTableSize();
} }
void nx::HandleTableSizeHandler::setHandleTableSize(uint16_t size) void nn::hac::HandleTableSizeHandler::setHandleTableSize(uint16_t size)
{ {
mEntry.setHandleTableSize(size); mEntry.setHandleTableSize(size);
mIsSet = true; mIsSet = true;

View file

@ -1,17 +1,17 @@
#include <sstream> #include <sstream>
#include <nx/HierarchicalIntegrityHeader.h> #include <nn/hac/HierarchicalIntegrityHeader.h>
nx::HierarchicalIntegrityHeader::HierarchicalIntegrityHeader() nn::hac::HierarchicalIntegrityHeader::HierarchicalIntegrityHeader()
{ {
clear(); clear();
} }
nx::HierarchicalIntegrityHeader::HierarchicalIntegrityHeader(const HierarchicalIntegrityHeader & other) nn::hac::HierarchicalIntegrityHeader::HierarchicalIntegrityHeader(const HierarchicalIntegrityHeader & other)
{ {
*this = other; *this = other;
} }
void nx::HierarchicalIntegrityHeader::operator=(const HierarchicalIntegrityHeader & other) void nn::hac::HierarchicalIntegrityHeader::operator=(const HierarchicalIntegrityHeader & other)
{ {
if (other.getBytes().size() != 0) if (other.getBytes().size() != 0)
{ {
@ -25,33 +25,33 @@ void nx::HierarchicalIntegrityHeader::operator=(const HierarchicalIntegrityHeade
} }
} }
bool nx::HierarchicalIntegrityHeader::operator==(const HierarchicalIntegrityHeader & other) const bool nn::hac::HierarchicalIntegrityHeader::operator==(const HierarchicalIntegrityHeader & other) const
{ {
return (mLayerInfo == other.mLayerInfo) \ return (mLayerInfo == other.mLayerInfo) \
&& (mMasterHashList == other.mMasterHashList); && (mMasterHashList == other.mMasterHashList);
} }
bool nx::HierarchicalIntegrityHeader::operator!=(const HierarchicalIntegrityHeader & other) const bool nn::hac::HierarchicalIntegrityHeader::operator!=(const HierarchicalIntegrityHeader & other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::HierarchicalIntegrityHeader::toBytes() void nn::hac::HierarchicalIntegrityHeader::toBytes()
{ {
throw fnd::Exception(kModuleName, "exportBinary() not implemented"); throw fnd::Exception(kModuleName, "exportBinary() not implemented");
} }
void nx::HierarchicalIntegrityHeader::fromBytes(const byte_t* data, size_t len) void nn::hac::HierarchicalIntegrityHeader::fromBytes(const byte_t* data, size_t len)
{ {
std::stringstream error_str; std::stringstream error_str;
// validate size for at least header // validate size for at least header
if (len < sizeof(nx::sHierarchicalIntegrityHeader)) if (len < sizeof(nn::hac::sHierarchicalIntegrityHeader))
{ {
throw fnd::Exception(kModuleName, "Header too small"); throw fnd::Exception(kModuleName, "Header too small");
} }
const nx::sHierarchicalIntegrityHeader* hdr = (const nx::sHierarchicalIntegrityHeader*)data; const nn::hac::sHierarchicalIntegrityHeader* hdr = (const nn::hac::sHierarchicalIntegrityHeader*)data;
// Validate Header Sig "IVFC" // Validate Header Sig "IVFC"
if (hdr->st_magic.get() != hierarchicalintegrity::kStructMagic) if (hdr->st_magic.get() != hierarchicalintegrity::kStructMagic)
@ -60,7 +60,7 @@ void nx::HierarchicalIntegrityHeader::fromBytes(const byte_t* data, size_t len)
} }
// Validate TypeId // Validate TypeId
if (hdr->type_id.get() != nx::hierarchicalintegrity::kRomfsTypeId) if (hdr->type_id.get() != nn::hac::hierarchicalintegrity::kRomfsTypeId)
{ {
error_str.clear(); error_str.clear();
error_str << "Unsupported type id (" << std::hex << hdr->type_id.get() << ")"; error_str << "Unsupported type id (" << std::hex << hdr->type_id.get() << ")";
@ -72,12 +72,12 @@ void nx::HierarchicalIntegrityHeader::fromBytes(const byte_t* data, size_t len)
{ {
error_str.clear(); error_str.clear();
error_str << "Invalid layer count. "; error_str << "Invalid layer count. ";
error_str << "(actual=" << std::dec << hdr->layer_num.get() << ", expected=" << nx::hierarchicalintegrity::kDefaultLayerNum+1 << ")"; error_str << "(actual=" << std::dec << hdr->layer_num.get() << ", expected=" << nn::hac::hierarchicalintegrity::kDefaultLayerNum+1 << ")";
throw fnd::Exception(kModuleName, error_str.str()); throw fnd::Exception(kModuleName, error_str.str());
} }
// Get Sizes/Offsets // Get Sizes/Offsets
size_t master_hash_offset = align((sizeof(nx::sHierarchicalIntegrityHeader) + sizeof(nx::sHierarchicalIntegrityLayerInfo) * hdr->layer_num.get()), nx::hierarchicalintegrity::kHeaderAlignLen); size_t master_hash_offset = align((sizeof(nn::hac::sHierarchicalIntegrityHeader) + sizeof(nn::hac::sHierarchicalIntegrityLayerInfo) * hdr->layer_num.get()), nn::hac::hierarchicalintegrity::kHeaderAlignLen);
size_t total_size = master_hash_offset + hdr->master_hash_size.get(); size_t total_size = master_hash_offset + hdr->master_hash_size.get();
// Validate total size // Validate total size
@ -91,7 +91,7 @@ void nx::HierarchicalIntegrityHeader::fromBytes(const byte_t* data, size_t len)
memcpy(mRawBinary.data(), data, mRawBinary.size()); memcpy(mRawBinary.data(), data, mRawBinary.size());
// save layer info // save layer info
const nx::sHierarchicalIntegrityLayerInfo* layer_info = (const nx::sHierarchicalIntegrityLayerInfo*)(mRawBinary.data() + sizeof(nx::sHierarchicalIntegrityHeader)); const nn::hac::sHierarchicalIntegrityLayerInfo* layer_info = (const nn::hac::sHierarchicalIntegrityLayerInfo*)(mRawBinary.data() + sizeof(nn::hac::sHierarchicalIntegrityHeader));
for (size_t i = 0; i < hierarchicalintegrity::kDefaultLayerNum; i++) for (size_t i = 0; i < hierarchicalintegrity::kDefaultLayerNum; i++)
{ {
mLayerInfo.addElement({layer_info[i].offset.get(), layer_info[i].size.get(), layer_info[i].block_size.get()}); mLayerInfo.addElement({layer_info[i].offset.get(), layer_info[i].size.get(), layer_info[i].block_size.get()});
@ -105,33 +105,33 @@ void nx::HierarchicalIntegrityHeader::fromBytes(const byte_t* data, size_t len)
} }
} }
const fnd::Vec<byte_t>& nx::HierarchicalIntegrityHeader::getBytes() const const fnd::Vec<byte_t>& nn::hac::HierarchicalIntegrityHeader::getBytes() const
{ {
return mRawBinary; return mRawBinary;
} }
void nx::HierarchicalIntegrityHeader::clear() void nn::hac::HierarchicalIntegrityHeader::clear()
{ {
mLayerInfo.clear(); mLayerInfo.clear();
mMasterHashList.clear(); mMasterHashList.clear();
} }
const fnd::List<nx::HierarchicalIntegrityHeader::sLayer>& nx::HierarchicalIntegrityHeader::getLayerInfo() const const fnd::List<nn::hac::HierarchicalIntegrityHeader::sLayer>& nn::hac::HierarchicalIntegrityHeader::getLayerInfo() const
{ {
return mLayerInfo; return mLayerInfo;
} }
void nx::HierarchicalIntegrityHeader::setLayerInfo(const fnd::List<sLayer>& layer_info) void nn::hac::HierarchicalIntegrityHeader::setLayerInfo(const fnd::List<sLayer>& layer_info)
{ {
mLayerInfo = layer_info; mLayerInfo = layer_info;
} }
const fnd::List<crypto::sha::sSha256Hash>& nx::HierarchicalIntegrityHeader::getMasterHashList() const const fnd::List<crypto::sha::sSha256Hash>& nn::hac::HierarchicalIntegrityHeader::getMasterHashList() const
{ {
return mMasterHashList; return mMasterHashList;
} }
void nx::HierarchicalIntegrityHeader::setMasterHashList(const fnd::List<crypto::sha::sSha256Hash>& master_hash_list) void nn::hac::HierarchicalIntegrityHeader::setMasterHashList(const fnd::List<crypto::sha::sSha256Hash>& master_hash_list)
{ {
mMasterHashList = master_hash_list; mMasterHashList = master_hash_list;
} }

View file

@ -1,17 +1,17 @@
#include <sstream> #include <sstream>
#include <nx/HierarchicalSha256Header.h> #include <nn/hac/HierarchicalSha256Header.h>
nx::HierarchicalSha256Header::HierarchicalSha256Header() nn::hac::HierarchicalSha256Header::HierarchicalSha256Header()
{ {
clear(); clear();
} }
nx::HierarchicalSha256Header::HierarchicalSha256Header(const HierarchicalSha256Header & other) nn::hac::HierarchicalSha256Header::HierarchicalSha256Header(const HierarchicalSha256Header & other)
{ {
*this = other; *this = other;
} }
void nx::HierarchicalSha256Header::operator=(const HierarchicalSha256Header & other) void nn::hac::HierarchicalSha256Header::operator=(const HierarchicalSha256Header & other)
{ {
if (other.getBytes().size() != 0) if (other.getBytes().size() != 0)
{ {
@ -25,39 +25,39 @@ void nx::HierarchicalSha256Header::operator=(const HierarchicalSha256Header & ot
} }
} }
bool nx::HierarchicalSha256Header::operator==(const HierarchicalSha256Header & other) const bool nn::hac::HierarchicalSha256Header::operator==(const HierarchicalSha256Header & other) const
{ {
return (mMasterHash == other.mMasterHash) \ return (mMasterHash == other.mMasterHash) \
&& (mHashBlockSize == other.mHashBlockSize) \ && (mHashBlockSize == other.mHashBlockSize) \
&& (mLayerInfo == other.mLayerInfo); && (mLayerInfo == other.mLayerInfo);
} }
bool nx::HierarchicalSha256Header::operator!=(const HierarchicalSha256Header & other) const bool nn::hac::HierarchicalSha256Header::operator!=(const HierarchicalSha256Header & other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::HierarchicalSha256Header::toBytes() void nn::hac::HierarchicalSha256Header::toBytes()
{ {
throw fnd::Exception(kModuleName, "exportBinary() not implemented"); throw fnd::Exception(kModuleName, "exportBinary() not implemented");
} }
void nx::HierarchicalSha256Header::fromBytes(const byte_t* data, size_t len) void nn::hac::HierarchicalSha256Header::fromBytes(const byte_t* data, size_t len)
{ {
std::stringstream error_str; std::stringstream error_str;
if (len < sizeof(nx::sHierarchicalSha256Header)) if (len < sizeof(nn::hac::sHierarchicalSha256Header))
{ {
throw fnd::Exception(kModuleName, "Header too small"); throw fnd::Exception(kModuleName, "Header too small");
} }
const nx::sHierarchicalSha256Header* hdr = (const nx::sHierarchicalSha256Header*)data; const nn::hac::sHierarchicalSha256Header* hdr = (const nn::hac::sHierarchicalSha256Header*)data;
if (hdr->layer_num.get() != nx::hierarchicalsha256::kDefaultLayerNum) if (hdr->layer_num.get() != nn::hac::hierarchicalsha256::kDefaultLayerNum)
{ {
error_str.clear(); error_str.clear();
error_str << "Invalid layer count. "; error_str << "Invalid layer count. ";
error_str << "(actual=" << std::dec << hdr->layer_num.get() << ", expected=" << nx::hierarchicalsha256::kDefaultLayerNum << ")"; error_str << "(actual=" << std::dec << hdr->layer_num.get() << ", expected=" << nn::hac::hierarchicalsha256::kDefaultLayerNum << ")";
throw fnd::Exception(kModuleName, error_str.str()); throw fnd::Exception(kModuleName, error_str.str());
} }
@ -69,44 +69,44 @@ void nx::HierarchicalSha256Header::fromBytes(const byte_t* data, size_t len)
} }
} }
const fnd::Vec<byte_t>& nx::HierarchicalSha256Header::getBytes() const const fnd::Vec<byte_t>& nn::hac::HierarchicalSha256Header::getBytes() const
{ {
return mRawBinary; return mRawBinary;
} }
void nx::HierarchicalSha256Header::clear() void nn::hac::HierarchicalSha256Header::clear()
{ {
memset(mMasterHash.bytes, 0, sizeof(crypto::sha::sSha256Hash)); memset(mMasterHash.bytes, 0, sizeof(crypto::sha::sSha256Hash));
mHashBlockSize = 0; mHashBlockSize = 0;
mLayerInfo.clear(); mLayerInfo.clear();
} }
const crypto::sha::sSha256Hash & nx::HierarchicalSha256Header::getMasterHash() const const crypto::sha::sSha256Hash & nn::hac::HierarchicalSha256Header::getMasterHash() const
{ {
return mMasterHash; return mMasterHash;
} }
void nx::HierarchicalSha256Header::setMasterHash(const crypto::sha::sSha256Hash & master_hash) void nn::hac::HierarchicalSha256Header::setMasterHash(const crypto::sha::sSha256Hash & master_hash)
{ {
mMasterHash = master_hash; mMasterHash = master_hash;
} }
size_t nx::HierarchicalSha256Header::getHashBlockSize() const size_t nn::hac::HierarchicalSha256Header::getHashBlockSize() const
{ {
return mHashBlockSize; return mHashBlockSize;
} }
void nx::HierarchicalSha256Header::setHashBlockSize(size_t hash_block_size) void nn::hac::HierarchicalSha256Header::setHashBlockSize(size_t hash_block_size)
{ {
mHashBlockSize = hash_block_size; mHashBlockSize = hash_block_size;
} }
const fnd::List<nx::HierarchicalSha256Header::sLayer>& nx::HierarchicalSha256Header::getLayerInfo() const const fnd::List<nn::hac::HierarchicalSha256Header::sLayer>& nn::hac::HierarchicalSha256Header::getLayerInfo() const
{ {
return mLayerInfo; return mLayerInfo;
} }
void nx::HierarchicalSha256Header::setLayerInfo(const fnd::List<sLayer>& layer_info) void nn::hac::HierarchicalSha256Header::setLayerInfo(const fnd::List<sLayer>& layer_info)
{ {
mLayerInfo = layer_info; mLayerInfo = layer_info;
} }

View file

@ -1,20 +1,20 @@
#include <nx/InteruptEntry.h> #include <nn/hac/InteruptEntry.h>
nx::InteruptEntry::InteruptEntry() : nn::hac::InteruptEntry::InteruptEntry() :
mCap(kCapId), mCap(kCapId),
mInterupt{0,0} mInterupt{0,0}
{ {
} }
nx::InteruptEntry::InteruptEntry(const KernelCapabilityEntry & kernel_cap) : nn::hac::InteruptEntry::InteruptEntry(const KernelCapabilityEntry & kernel_cap) :
mCap(kCapId), mCap(kCapId),
mInterupt{ 0,0 } mInterupt{ 0,0 }
{ {
setKernelCapability(kernel_cap); setKernelCapability(kernel_cap);
} }
nx::InteruptEntry::InteruptEntry(uint32_t interupt0, uint32_t interupt1) : nn::hac::InteruptEntry::InteruptEntry(uint32_t interupt0, uint32_t interupt1) :
mCap(kCapId), mCap(kCapId),
mInterupt{ 0,0 } mInterupt{ 0,0 }
{ {
@ -22,30 +22,30 @@ nx::InteruptEntry::InteruptEntry(uint32_t interupt0, uint32_t interupt1) :
setInterupt(1, interupt1); setInterupt(1, interupt1);
} }
void nx::InteruptEntry::operator=(const InteruptEntry& other) void nn::hac::InteruptEntry::operator=(const InteruptEntry& other)
{ {
mInterupt[0] = other.mInterupt[0]; mInterupt[0] = other.mInterupt[0];
mInterupt[1] = other.mInterupt[1]; mInterupt[1] = other.mInterupt[1];
updateCapField(); updateCapField();
} }
bool nx::InteruptEntry::operator==(const InteruptEntry& other) const bool nn::hac::InteruptEntry::operator==(const InteruptEntry& other) const
{ {
return (mInterupt[0] == other.mInterupt[0]) \ return (mInterupt[0] == other.mInterupt[0]) \
&& (mInterupt[1] == other.mInterupt[1]); && (mInterupt[1] == other.mInterupt[1]);
} }
bool nx::InteruptEntry::operator!=(const InteruptEntry& other) const bool nn::hac::InteruptEntry::operator!=(const InteruptEntry& other) const
{ {
return !(*this == other); return !(*this == other);
} }
const nx::KernelCapabilityEntry & nx::InteruptEntry::getKernelCapability() const const nn::hac::KernelCapabilityEntry & nn::hac::InteruptEntry::getKernelCapability() const
{ {
return mCap; return mCap;
} }
void nx::InteruptEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap) void nn::hac::InteruptEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap)
{ {
if (kernel_cap.getType() != kCapId) if (kernel_cap.getType() != kCapId)
{ {
@ -56,17 +56,17 @@ void nx::InteruptEntry::setKernelCapability(const KernelCapabilityEntry & kernel
processCapField(); processCapField();
} }
uint32_t nx::InteruptEntry::operator[](size_t index) const uint32_t nn::hac::InteruptEntry::operator[](size_t index) const
{ {
return getInterupt(index); return getInterupt(index);
} }
uint32_t nx::InteruptEntry::getInterupt(size_t index) const uint32_t nn::hac::InteruptEntry::getInterupt(size_t index) const
{ {
return mInterupt[index % kInteruptNum]; return mInterupt[index % kInteruptNum];
} }
void nx::InteruptEntry::setInterupt(size_t index, uint32_t interupt) void nn::hac::InteruptEntry::setInterupt(size_t index, uint32_t interupt)
{ {
if (interupt > kInteruptMax) if (interupt > kInteruptMax)
{ {

View file

@ -1,28 +1,28 @@
#include <nx/InteruptHandler.h> #include <nn/hac/InteruptHandler.h>
nx::InteruptHandler::InteruptHandler() : nn::hac::InteruptHandler::InteruptHandler() :
mIsSet(false), mIsSet(false),
mInterupts() mInterupts()
{} {}
void nx::InteruptHandler::operator=(const InteruptHandler & other) void nn::hac::InteruptHandler::operator=(const InteruptHandler & other)
{ {
mIsSet = other.mIsSet; mIsSet = other.mIsSet;
mInterupts = other.mInterupts; mInterupts = other.mInterupts;
} }
bool nx::InteruptHandler::operator==(const InteruptHandler & other) const bool nn::hac::InteruptHandler::operator==(const InteruptHandler & other) const
{ {
return (mIsSet == other.mIsSet) \ return (mIsSet == other.mIsSet) \
&& (mInterupts == other.mInterupts); && (mInterupts == other.mInterupts);
} }
bool nx::InteruptHandler::operator!=(const InteruptHandler & other) const bool nn::hac::InteruptHandler::operator!=(const InteruptHandler & other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::InteruptHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps) void nn::hac::InteruptHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps)
{ {
if (caps.size() == 0) if (caps.size() == 0)
return; return;
@ -58,7 +58,7 @@ void nx::InteruptHandler::importKernelCapabilityList(const fnd::List<KernelCapab
mIsSet = true; mIsSet = true;
} }
void nx::InteruptHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const void nn::hac::InteruptHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const
{ {
if (isSet() == false) if (isSet() == false)
return; return;
@ -84,23 +84,23 @@ void nx::InteruptHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityE
} }
} }
void nx::InteruptHandler::clear() void nn::hac::InteruptHandler::clear()
{ {
mIsSet = false; mIsSet = false;
mInterupts.clear(); mInterupts.clear();
} }
bool nx::InteruptHandler::isSet() const bool nn::hac::InteruptHandler::isSet() const
{ {
return mIsSet; return mIsSet;
} }
const fnd::List<uint16_t>& nx::InteruptHandler::getInteruptList() const const fnd::List<uint16_t>& nn::hac::InteruptHandler::getInteruptList() const
{ {
return mInterupts; return mInterupts;
} }
void nx::InteruptHandler::setInteruptList(const fnd::List<uint16_t>& interupts) void nn::hac::InteruptHandler::setInteruptList(const fnd::List<uint16_t>& interupts)
{ {
mInterupts.clear(); mInterupts.clear();
for (size_t i = 0; i < interupts.size(); i++) for (size_t i = 0; i < interupts.size(); i++)

View file

@ -1,14 +1,14 @@
#include <nx/KernelCapabilityBinary.h> #include <nn/hac/KernelCapabilityBinary.h>
nx::KernelCapabilityBinary::KernelCapabilityBinary() nn::hac::KernelCapabilityBinary::KernelCapabilityBinary()
{} {}
nx::KernelCapabilityBinary::KernelCapabilityBinary(const KernelCapabilityBinary & other) nn::hac::KernelCapabilityBinary::KernelCapabilityBinary(const KernelCapabilityBinary & other)
{ {
*this = other; *this = other;
} }
void nx::KernelCapabilityBinary::operator=(const KernelCapabilityBinary & other) void nn::hac::KernelCapabilityBinary::operator=(const KernelCapabilityBinary & other)
{ {
clear(); clear();
mThreadInfo = other.mThreadInfo; mThreadInfo = other.mThreadInfo;
@ -21,7 +21,7 @@ void nx::KernelCapabilityBinary::operator=(const KernelCapabilityBinary & other)
mMiscFlags = other.mMiscFlags; mMiscFlags = other.mMiscFlags;
} }
bool nx::KernelCapabilityBinary::operator==(const KernelCapabilityBinary & other) const bool nn::hac::KernelCapabilityBinary::operator==(const KernelCapabilityBinary & other) const
{ {
return (mThreadInfo == other.mThreadInfo) \ return (mThreadInfo == other.mThreadInfo) \
&& (mSystemCalls == other.mSystemCalls) \ && (mSystemCalls == other.mSystemCalls) \
@ -33,12 +33,12 @@ bool nx::KernelCapabilityBinary::operator==(const KernelCapabilityBinary & other
&& (mMiscFlags == other.mMiscFlags); && (mMiscFlags == other.mMiscFlags);
} }
bool nx::KernelCapabilityBinary::operator!=(const KernelCapabilityBinary & other) const bool nn::hac::KernelCapabilityBinary::operator!=(const KernelCapabilityBinary & other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::KernelCapabilityBinary::toBytes() void nn::hac::KernelCapabilityBinary::toBytes()
{ {
fnd::List<KernelCapabilityEntry> caps; fnd::List<KernelCapabilityEntry> caps;
@ -63,7 +63,7 @@ void nx::KernelCapabilityBinary::toBytes()
} }
} }
void nx::KernelCapabilityBinary::fromBytes(const byte_t * data, size_t len) void nn::hac::KernelCapabilityBinary::fromBytes(const byte_t * data, size_t len)
{ {
if ((len % sizeof(uint32_t)) != 0) if ((len % sizeof(uint32_t)) != 0)
{ {
@ -131,12 +131,12 @@ void nx::KernelCapabilityBinary::fromBytes(const byte_t * data, size_t len)
mMiscFlags.importKernelCapabilityList(miscFlagsCaps); mMiscFlags.importKernelCapabilityList(miscFlagsCaps);
} }
const fnd::Vec<byte_t>& nx::KernelCapabilityBinary::getBytes() const const fnd::Vec<byte_t>& nn::hac::KernelCapabilityBinary::getBytes() const
{ {
return mRawBinary; return mRawBinary;
} }
void nx::KernelCapabilityBinary::clear() void nn::hac::KernelCapabilityBinary::clear()
{ {
mRawBinary.clear(); mRawBinary.clear();
mThreadInfo.clear(); mThreadInfo.clear();
@ -149,82 +149,82 @@ void nx::KernelCapabilityBinary::clear()
mMiscFlags.clear(); mMiscFlags.clear();
} }
const nx::ThreadInfoHandler & nx::KernelCapabilityBinary::getThreadInfo() const const nn::hac::ThreadInfoHandler & nn::hac::KernelCapabilityBinary::getThreadInfo() const
{ {
return mThreadInfo; return mThreadInfo;
} }
nx::ThreadInfoHandler & nx::KernelCapabilityBinary::getThreadInfo() nn::hac::ThreadInfoHandler & nn::hac::KernelCapabilityBinary::getThreadInfo()
{ {
return mThreadInfo; return mThreadInfo;
} }
const nx::SystemCallHandler & nx::KernelCapabilityBinary::getSystemCalls() const const nn::hac::SystemCallHandler & nn::hac::KernelCapabilityBinary::getSystemCalls() const
{ {
return mSystemCalls; return mSystemCalls;
} }
nx::SystemCallHandler & nx::KernelCapabilityBinary::getSystemCalls() nn::hac::SystemCallHandler & nn::hac::KernelCapabilityBinary::getSystemCalls()
{ {
return mSystemCalls; return mSystemCalls;
} }
const nx::MemoryMappingHandler & nx::KernelCapabilityBinary::getMemoryMaps() const const nn::hac::MemoryMappingHandler & nn::hac::KernelCapabilityBinary::getMemoryMaps() const
{ {
return mMemoryMap; return mMemoryMap;
} }
nx::MemoryMappingHandler & nx::KernelCapabilityBinary::getMemoryMaps() nn::hac::MemoryMappingHandler & nn::hac::KernelCapabilityBinary::getMemoryMaps()
{ {
return mMemoryMap; return mMemoryMap;
} }
const nx::InteruptHandler & nx::KernelCapabilityBinary::getInterupts() const const nn::hac::InteruptHandler & nn::hac::KernelCapabilityBinary::getInterupts() const
{ {
return mInterupts; return mInterupts;
} }
nx::InteruptHandler & nx::KernelCapabilityBinary::getInterupts() nn::hac::InteruptHandler & nn::hac::KernelCapabilityBinary::getInterupts()
{ {
return mInterupts; return mInterupts;
} }
const nx::MiscParamsHandler & nx::KernelCapabilityBinary::getMiscParams() const const nn::hac::MiscParamsHandler & nn::hac::KernelCapabilityBinary::getMiscParams() const
{ {
return mMiscParams; return mMiscParams;
} }
nx::MiscParamsHandler & nx::KernelCapabilityBinary::getMiscParams() nn::hac::MiscParamsHandler & nn::hac::KernelCapabilityBinary::getMiscParams()
{ {
return mMiscParams; return mMiscParams;
} }
const nx::KernelVersionHandler & nx::KernelCapabilityBinary::getKernelVersion() const const nn::hac::KernelVersionHandler & nn::hac::KernelCapabilityBinary::getKernelVersion() const
{ {
return mKernelVersion; return mKernelVersion;
} }
nx::KernelVersionHandler & nx::KernelCapabilityBinary::getKernelVersion() nn::hac::KernelVersionHandler & nn::hac::KernelCapabilityBinary::getKernelVersion()
{ {
return mKernelVersion; return mKernelVersion;
} }
const nx::HandleTableSizeHandler & nx::KernelCapabilityBinary::getHandleTableSize() const const nn::hac::HandleTableSizeHandler & nn::hac::KernelCapabilityBinary::getHandleTableSize() const
{ {
return mHandleTableSize; return mHandleTableSize;
} }
nx::HandleTableSizeHandler & nx::KernelCapabilityBinary::getHandleTableSize() nn::hac::HandleTableSizeHandler & nn::hac::KernelCapabilityBinary::getHandleTableSize()
{ {
return mHandleTableSize; return mHandleTableSize;
} }
const nx::MiscFlagsHandler & nx::KernelCapabilityBinary::getMiscFlags() const const nn::hac::MiscFlagsHandler & nn::hac::KernelCapabilityBinary::getMiscFlags() const
{ {
return mMiscFlags; return mMiscFlags;
} }
nx::MiscFlagsHandler & nx::KernelCapabilityBinary::getMiscFlags() nn::hac::MiscFlagsHandler & nn::hac::KernelCapabilityBinary::getMiscFlags()
{ {
return mMiscFlags; return mMiscFlags;
} }

View file

@ -1,63 +1,63 @@
#include <nx/KernelCapabilityEntry.h> #include <nn/hac/KernelCapabilityEntry.h>
nx::KernelCapabilityEntry::KernelCapabilityEntry() : nn::hac::KernelCapabilityEntry::KernelCapabilityEntry() :
mType(kc::KC_INVALID) mType(kc::KC_INVALID)
{} {}
nx::KernelCapabilityEntry::KernelCapabilityEntry(kc::KernelCapId type) : nn::hac::KernelCapabilityEntry::KernelCapabilityEntry(kc::KernelCapId type) :
mType(type), mType(type),
mField(0) mField(0)
{} {}
nx::KernelCapabilityEntry::KernelCapabilityEntry(kc::KernelCapId type, uint32_t field) : nn::hac::KernelCapabilityEntry::KernelCapabilityEntry(kc::KernelCapId type, uint32_t field) :
mType(type), mType(type),
mField(field) mField(field)
{} {}
void nx::KernelCapabilityEntry::operator=(const KernelCapabilityEntry & other) void nn::hac::KernelCapabilityEntry::operator=(const KernelCapabilityEntry & other)
{ {
mType = other.mType; mType = other.mType;
mField = other.mField; mField = other.mField;
} }
bool nx::KernelCapabilityEntry::operator==(const KernelCapabilityEntry & other) const bool nn::hac::KernelCapabilityEntry::operator==(const KernelCapabilityEntry & other) const
{ {
return (mType == other.mType) \ return (mType == other.mType) \
&& (mField == other.mField); && (mField == other.mField);
} }
bool nx::KernelCapabilityEntry::operator!=(const KernelCapabilityEntry & other) const bool nn::hac::KernelCapabilityEntry::operator!=(const KernelCapabilityEntry & other) const
{ {
return !operator==(other); return !operator==(other);
} }
uint32_t nx::KernelCapabilityEntry::getCap() const uint32_t nn::hac::KernelCapabilityEntry::getCap() const
{ {
return (mField & getFieldMask()) << getFieldShift() | getCapMask(); return (mField & getFieldMask()) << getFieldShift() | getCapMask();
} }
void nx::KernelCapabilityEntry::setCap(uint32_t cap) void nn::hac::KernelCapabilityEntry::setCap(uint32_t cap)
{ {
mType = getCapId(cap); mType = getCapId(cap);
mField = (cap >> getFieldShift()) & getFieldMask(); mField = (cap >> getFieldShift()) & getFieldMask();
} }
nx::kc::KernelCapId nx::KernelCapabilityEntry::getType() const nn::hac::kc::KernelCapId nn::hac::KernelCapabilityEntry::getType() const
{ {
return mType; return mType;
} }
void nx::KernelCapabilityEntry::setType(kc::KernelCapId type) void nn::hac::KernelCapabilityEntry::setType(kc::KernelCapId type)
{ {
mType = type; mType = type;
} }
uint32_t nx::KernelCapabilityEntry::getField() const uint32_t nn::hac::KernelCapabilityEntry::getField() const
{ {
return mField & getFieldMask(); return mField & getFieldMask();
} }
void nx::KernelCapabilityEntry::setField(uint32_t field) void nn::hac::KernelCapabilityEntry::setField(uint32_t field)
{ {
mField = field; mField = field;
} }

View file

@ -1,12 +1,12 @@
#include <nx/KernelVersionEntry.h> #include <nn/hac/KernelVersionEntry.h>
nx::KernelVersionEntry::KernelVersionEntry() : nn::hac::KernelVersionEntry::KernelVersionEntry() :
mCap(kCapId), mCap(kCapId),
mVerMajor(0), mVerMajor(0),
mVerMinor(0) mVerMinor(0)
{} {}
nx::KernelVersionEntry::KernelVersionEntry(const KernelCapabilityEntry & kernel_cap) : nn::hac::KernelVersionEntry::KernelVersionEntry(const KernelCapabilityEntry & kernel_cap) :
mCap(kCapId), mCap(kCapId),
mVerMajor(0), mVerMajor(0),
mVerMinor(0) mVerMinor(0)
@ -14,7 +14,7 @@ nx::KernelVersionEntry::KernelVersionEntry(const KernelCapabilityEntry & kernel_
setKernelCapability(kernel_cap); setKernelCapability(kernel_cap);
} }
nx::KernelVersionEntry::KernelVersionEntry(uint16_t major, uint8_t minor) : nn::hac::KernelVersionEntry::KernelVersionEntry(uint16_t major, uint8_t minor) :
mCap(kCapId), mCap(kCapId),
mVerMajor(0), mVerMajor(0),
mVerMinor(0) mVerMinor(0)
@ -23,30 +23,30 @@ nx::KernelVersionEntry::KernelVersionEntry(uint16_t major, uint8_t minor) :
setVerMinor(minor); setVerMinor(minor);
} }
void nx::KernelVersionEntry::operator=(const KernelVersionEntry& other) void nn::hac::KernelVersionEntry::operator=(const KernelVersionEntry& other)
{ {
mVerMajor = other.mVerMajor; mVerMajor = other.mVerMajor;
mVerMinor = other.mVerMinor; mVerMinor = other.mVerMinor;
updateCapField(); updateCapField();
} }
bool nx::KernelVersionEntry::operator==(const KernelVersionEntry& other) const bool nn::hac::KernelVersionEntry::operator==(const KernelVersionEntry& other) const
{ {
return (mVerMajor == other.mVerMajor) \ return (mVerMajor == other.mVerMajor) \
&& (mVerMinor == other.mVerMinor); && (mVerMinor == other.mVerMinor);
} }
bool nx::KernelVersionEntry::operator!=(const KernelVersionEntry& other) const bool nn::hac::KernelVersionEntry::operator!=(const KernelVersionEntry& other) const
{ {
return !(*this == other); return !(*this == other);
} }
const nx::KernelCapabilityEntry & nx::KernelVersionEntry::getKernelCapability() const const nn::hac::KernelCapabilityEntry & nn::hac::KernelVersionEntry::getKernelCapability() const
{ {
return mCap; return mCap;
} }
void nx::KernelVersionEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap) void nn::hac::KernelVersionEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap)
{ {
if (kernel_cap.getType() != kCapId) if (kernel_cap.getType() != kCapId)
{ {
@ -57,12 +57,12 @@ void nx::KernelVersionEntry::setKernelCapability(const KernelCapabilityEntry & k
processCapField(); processCapField();
} }
uint16_t nx::KernelVersionEntry::getVerMajor() const uint16_t nn::hac::KernelVersionEntry::getVerMajor() const
{ {
return mVerMajor; return mVerMajor;
} }
void nx::KernelVersionEntry::setVerMajor(uint16_t major) void nn::hac::KernelVersionEntry::setVerMajor(uint16_t major)
{ {
if (major > kVerMajorMax) if (major > kVerMajorMax)
{ {
@ -73,12 +73,12 @@ void nx::KernelVersionEntry::setVerMajor(uint16_t major)
updateCapField(); updateCapField();
} }
uint8_t nx::KernelVersionEntry::getVerMinor() const uint8_t nn::hac::KernelVersionEntry::getVerMinor() const
{ {
return mVerMinor; return mVerMinor;
} }
void nx::KernelVersionEntry::setVerMinor(uint8_t minor) void nn::hac::KernelVersionEntry::setVerMinor(uint8_t minor)
{ {
if (minor > kVerMinorMax) if (minor > kVerMinorMax)
{ {

View file

@ -1,28 +1,28 @@
#include <nx/KernelVersionHandler.h> #include <nn/hac/KernelVersionHandler.h>
nx::KernelVersionHandler::KernelVersionHandler() : nn::hac::KernelVersionHandler::KernelVersionHandler() :
mIsSet(false), mIsSet(false),
mEntry(0,0) mEntry(0,0)
{} {}
void nx::KernelVersionHandler::operator=(const KernelVersionHandler & other) void nn::hac::KernelVersionHandler::operator=(const KernelVersionHandler & other)
{ {
mIsSet = other.mIsSet; mIsSet = other.mIsSet;
mEntry.setKernelCapability(other.mEntry.getKernelCapability()); mEntry.setKernelCapability(other.mEntry.getKernelCapability());
} }
bool nx::KernelVersionHandler::operator==(const KernelVersionHandler & other) const bool nn::hac::KernelVersionHandler::operator==(const KernelVersionHandler & other) const
{ {
return (mIsSet == other.mIsSet) \ return (mIsSet == other.mIsSet) \
&& (mEntry.getKernelCapability() == other.mEntry.getKernelCapability()); && (mEntry.getKernelCapability() == other.mEntry.getKernelCapability());
} }
bool nx::KernelVersionHandler::operator!=(const KernelVersionHandler & other) const bool nn::hac::KernelVersionHandler::operator!=(const KernelVersionHandler & other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::KernelVersionHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps) void nn::hac::KernelVersionHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps)
{ {
if (caps.size() > kMaxKernelCapNum) if (caps.size() > kMaxKernelCapNum)
{ {
@ -37,7 +37,7 @@ void nx::KernelVersionHandler::importKernelCapabilityList(const fnd::List<Kernel
mIsSet = true; mIsSet = true;
} }
void nx::KernelVersionHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const void nn::hac::KernelVersionHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const
{ {
if (isSet() == false) if (isSet() == false)
return; return;
@ -45,35 +45,35 @@ void nx::KernelVersionHandler::exportKernelCapabilityList(fnd::List<KernelCapabi
caps.addElement(mEntry.getKernelCapability()); caps.addElement(mEntry.getKernelCapability());
} }
void nx::KernelVersionHandler::clear() void nn::hac::KernelVersionHandler::clear()
{ {
mIsSet = false; mIsSet = false;
mEntry.setVerMajor(0); mEntry.setVerMajor(0);
mEntry.setVerMinor(0); mEntry.setVerMinor(0);
} }
bool nx::KernelVersionHandler::isSet() const bool nn::hac::KernelVersionHandler::isSet() const
{ {
return mIsSet; return mIsSet;
} }
uint16_t nx::KernelVersionHandler::getVerMajor() const uint16_t nn::hac::KernelVersionHandler::getVerMajor() const
{ {
return mEntry.getVerMajor(); return mEntry.getVerMajor();
} }
void nx::KernelVersionHandler::setVerMajor(uint16_t major) void nn::hac::KernelVersionHandler::setVerMajor(uint16_t major)
{ {
mEntry.setVerMajor(major); mEntry.setVerMajor(major);
mIsSet = true; mIsSet = true;
} }
uint8_t nx::KernelVersionHandler::getVerMinor() const uint8_t nn::hac::KernelVersionHandler::getVerMinor() const
{ {
return mEntry.getVerMinor(); return mEntry.getVerMinor();
} }
void nx::KernelVersionHandler::setVerMinor(uint8_t minor) void nn::hac::KernelVersionHandler::setVerMinor(uint8_t minor)
{ {
mEntry.setVerMinor(minor); mEntry.setVerMinor(minor);
mIsSet = true; mIsSet = true;

View file

@ -1,30 +1,30 @@
#include <nx/MemoryMappingHandler.h> #include <nn/hac/MemoryMappingHandler.h>
#include <nx/MemoryPageEntry.h> #include <nn/hac/MemoryPageEntry.h>
nx::MemoryMappingHandler::MemoryMappingHandler() : nn::hac::MemoryMappingHandler::MemoryMappingHandler() :
mIsSet(false) mIsSet(false)
{} {}
void nx::MemoryMappingHandler::operator=(const MemoryMappingHandler & other) void nn::hac::MemoryMappingHandler::operator=(const MemoryMappingHandler & other)
{ {
mIsSet = other.mIsSet; mIsSet = other.mIsSet;
mMemRange = other.mMemRange; mMemRange = other.mMemRange;
mMemPage = other.mMemPage; mMemPage = other.mMemPage;
} }
bool nx::MemoryMappingHandler::operator==(const MemoryMappingHandler & other) const bool nn::hac::MemoryMappingHandler::operator==(const MemoryMappingHandler & other) const
{ {
return (mIsSet == other.mIsSet) \ return (mIsSet == other.mIsSet) \
&& (mMemRange == other.mMemRange) \ && (mMemRange == other.mMemRange) \
&& (mMemPage == other.mMemPage); && (mMemPage == other.mMemPage);
} }
bool nx::MemoryMappingHandler::operator!=(const MemoryMappingHandler & other) const bool nn::hac::MemoryMappingHandler::operator!=(const MemoryMappingHandler & other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::MemoryMappingHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps) void nn::hac::MemoryMappingHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps)
{ {
if (caps.size() == 0) if (caps.size() == 0)
return; return;
@ -87,7 +87,7 @@ void nx::MemoryMappingHandler::importKernelCapabilityList(const fnd::List<Kernel
mIsSet = true; mIsSet = true;
} }
void nx::MemoryMappingHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const void nn::hac::MemoryMappingHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const
{ {
if (isSet() == false) if (isSet() == false)
return; return;
@ -116,24 +116,24 @@ void nx::MemoryMappingHandler::exportKernelCapabilityList(fnd::List<KernelCapabi
} }
} }
void nx::MemoryMappingHandler::clear() void nn::hac::MemoryMappingHandler::clear()
{ {
mIsSet = false; mIsSet = false;
mMemRange.clear(); mMemRange.clear();
mMemPage.clear(); mMemPage.clear();
} }
bool nx::MemoryMappingHandler::isSet() const bool nn::hac::MemoryMappingHandler::isSet() const
{ {
return mIsSet; return mIsSet;
} }
const fnd::List<nx::MemoryMappingHandler::sMemoryMapping>& nx::MemoryMappingHandler::getMemoryMaps() const const fnd::List<nn::hac::MemoryMappingHandler::sMemoryMapping>& nn::hac::MemoryMappingHandler::getMemoryMaps() const
{ {
return mMemRange; return mMemRange;
} }
const fnd::List<nx::MemoryMappingHandler::sMemoryMapping>& nx::MemoryMappingHandler::getIoMemoryMaps() const const fnd::List<nn::hac::MemoryMappingHandler::sMemoryMapping>& nn::hac::MemoryMappingHandler::getIoMemoryMaps() const
{ {
return mMemPage; return mMemPage;
} }

View file

@ -1,13 +1,13 @@
#include <nx/MemoryPageEntry.h> #include <nn/hac/MemoryPageEntry.h>
nx::MemoryPageEntry::MemoryPageEntry() : nn::hac::MemoryPageEntry::MemoryPageEntry() :
mCap(kc::KC_INVALID), mCap(kc::KC_INVALID),
mPage(0), mPage(0),
mFlag(false), mFlag(false),
mUseFlag(false) mUseFlag(false)
{} {}
nx::MemoryPageEntry::MemoryPageEntry(const KernelCapabilityEntry & kernel_cap) : nn::hac::MemoryPageEntry::MemoryPageEntry(const KernelCapabilityEntry & kernel_cap) :
mCap(kc::KC_INVALID), mCap(kc::KC_INVALID),
mPage(0), mPage(0),
mFlag(false), mFlag(false),
@ -16,7 +16,7 @@ nx::MemoryPageEntry::MemoryPageEntry(const KernelCapabilityEntry & kernel_cap) :
setKernelCapability(kernel_cap); setKernelCapability(kernel_cap);
} }
nx::MemoryPageEntry::MemoryPageEntry(uint32_t page) : nn::hac::MemoryPageEntry::MemoryPageEntry(uint32_t page) :
mCap(kc::KC_INVALID), mCap(kc::KC_INVALID),
mPage(0), mPage(0),
mFlag(false), mFlag(false),
@ -25,7 +25,7 @@ nx::MemoryPageEntry::MemoryPageEntry(uint32_t page) :
setPage(page); setPage(page);
} }
nx::MemoryPageEntry::MemoryPageEntry(uint32_t page, bool flag) : nn::hac::MemoryPageEntry::MemoryPageEntry(uint32_t page, bool flag) :
mCap(kc::KC_INVALID), mCap(kc::KC_INVALID),
mPage(0), mPage(0),
mFlag(false), mFlag(false),
@ -35,7 +35,7 @@ nx::MemoryPageEntry::MemoryPageEntry(uint32_t page, bool flag) :
setFlag(flag); setFlag(flag);
} }
void nx::MemoryPageEntry::operator=(const MemoryPageEntry& other) void nn::hac::MemoryPageEntry::operator=(const MemoryPageEntry& other)
{ {
mPage = other.mPage; mPage = other.mPage;
mFlag = other.mFlag; mFlag = other.mFlag;
@ -43,24 +43,24 @@ void nx::MemoryPageEntry::operator=(const MemoryPageEntry& other)
updateCapField(); updateCapField();
} }
bool nx::MemoryPageEntry::operator==(const MemoryPageEntry& other) const bool nn::hac::MemoryPageEntry::operator==(const MemoryPageEntry& other) const
{ {
return (mPage == other.mPage) \ return (mPage == other.mPage) \
&& (mFlag == other.mFlag) \ && (mFlag == other.mFlag) \
&& (mUseFlag == other.mUseFlag); && (mUseFlag == other.mUseFlag);
} }
bool nx::MemoryPageEntry::operator!=(const MemoryPageEntry& other) const bool nn::hac::MemoryPageEntry::operator!=(const MemoryPageEntry& other) const
{ {
return !(*this == other); return !(*this == other);
} }
const nx::KernelCapabilityEntry & nx::MemoryPageEntry::getKernelCapability() const const nn::hac::KernelCapabilityEntry & nn::hac::MemoryPageEntry::getKernelCapability() const
{ {
return mCap; return mCap;
} }
void nx::MemoryPageEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap) void nn::hac::MemoryPageEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap)
{ {
if (kernel_cap.getType() != kc::KC_MEMORY_MAP && kernel_cap.getType() != kc::KC_IO_MEMORY_MAP) if (kernel_cap.getType() != kc::KC_MEMORY_MAP && kernel_cap.getType() != kc::KC_IO_MEMORY_MAP)
{ {
@ -71,12 +71,12 @@ void nx::MemoryPageEntry::setKernelCapability(const KernelCapabilityEntry & kern
processCapField(); processCapField();
} }
uint32_t nx::MemoryPageEntry::getPage() const uint32_t nn::hac::MemoryPageEntry::getPage() const
{ {
return mPage; return mPage;
} }
void nx::MemoryPageEntry::setPage(uint32_t page) void nn::hac::MemoryPageEntry::setPage(uint32_t page)
{ {
if (page > kMaxPage) if (page > kMaxPage)
{ {
@ -87,23 +87,23 @@ void nx::MemoryPageEntry::setPage(uint32_t page)
updateCapField(); updateCapField();
} }
bool nx::MemoryPageEntry::getFlag() const bool nn::hac::MemoryPageEntry::getFlag() const
{ {
return mFlag; return mFlag;
} }
void nx::MemoryPageEntry::setFlag(bool flag) void nn::hac::MemoryPageEntry::setFlag(bool flag)
{ {
mFlag = flag; mFlag = flag;
updateCapField(); updateCapField();
} }
bool nx::MemoryPageEntry::isMultiplePages() const bool nn::hac::MemoryPageEntry::isMultiplePages() const
{ {
return mUseFlag; return mUseFlag;
} }
void nx::MemoryPageEntry::setMapMultiplePages(bool useFlag) void nn::hac::MemoryPageEntry::setMapMultiplePages(bool useFlag)
{ {
mUseFlag = useFlag; mUseFlag = useFlag;
} }

View file

@ -1,46 +1,46 @@
#include <nx/MiscFlagsEntry.h> #include <nn/hac/MiscFlagsEntry.h>
nx::MiscFlagsEntry::MiscFlagsEntry() : nn::hac::MiscFlagsEntry::MiscFlagsEntry() :
mCap(kCapId), mCap(kCapId),
mFlags(0) mFlags(0)
{} {}
nx::MiscFlagsEntry::MiscFlagsEntry(const KernelCapabilityEntry & kernel_cap) : nn::hac::MiscFlagsEntry::MiscFlagsEntry(const KernelCapabilityEntry & kernel_cap) :
mCap(kCapId), mCap(kCapId),
mFlags(0) mFlags(0)
{ {
setKernelCapability(kernel_cap); setKernelCapability(kernel_cap);
} }
nx::MiscFlagsEntry::MiscFlagsEntry(uint32_t flags) : nn::hac::MiscFlagsEntry::MiscFlagsEntry(uint32_t flags) :
mCap(kCapId), mCap(kCapId),
mFlags(0) mFlags(0)
{ {
setFlags(flags); setFlags(flags);
} }
void nx::MiscFlagsEntry::operator=(const MiscFlagsEntry& other) void nn::hac::MiscFlagsEntry::operator=(const MiscFlagsEntry& other)
{ {
mFlags = other.mFlags; mFlags = other.mFlags;
updateCapField(); updateCapField();
} }
bool nx::MiscFlagsEntry::operator==(const MiscFlagsEntry& other) const bool nn::hac::MiscFlagsEntry::operator==(const MiscFlagsEntry& other) const
{ {
return (mFlags == other.mFlags); return (mFlags == other.mFlags);
} }
bool nx::MiscFlagsEntry::operator!=(const MiscFlagsEntry& other) const bool nn::hac::MiscFlagsEntry::operator!=(const MiscFlagsEntry& other) const
{ {
return !(*this == other); return !(*this == other);
} }
const nx::KernelCapabilityEntry & nx::MiscFlagsEntry::getKernelCapability() const const nn::hac::KernelCapabilityEntry & nn::hac::MiscFlagsEntry::getKernelCapability() const
{ {
return mCap; return mCap;
} }
void nx::MiscFlagsEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap) void nn::hac::MiscFlagsEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap)
{ {
if (kernel_cap.getType() != kCapId) if (kernel_cap.getType() != kCapId)
{ {
@ -51,12 +51,12 @@ void nx::MiscFlagsEntry::setKernelCapability(const KernelCapabilityEntry & kerne
processCapField(); processCapField();
} }
uint32_t nx::MiscFlagsEntry::getFlags() const uint32_t nn::hac::MiscFlagsEntry::getFlags() const
{ {
return mFlags; return mFlags;
} }
void nx::MiscFlagsEntry::setFlags(uint32_t flags) void nn::hac::MiscFlagsEntry::setFlags(uint32_t flags)
{ {
if ((flags & ~kMaxVal) != 0) if ((flags & ~kMaxVal) != 0)
{ {

View file

@ -1,27 +1,27 @@
#include <nx/MiscFlagsHandler.h> #include <nn/hac/MiscFlagsHandler.h>
nx::MiscFlagsHandler::MiscFlagsHandler() : nn::hac::MiscFlagsHandler::MiscFlagsHandler() :
mIsSet(false) mIsSet(false)
{} {}
void nx::MiscFlagsHandler::operator=(const MiscFlagsHandler & other) void nn::hac::MiscFlagsHandler::operator=(const MiscFlagsHandler & other)
{ {
mIsSet = other.mIsSet; mIsSet = other.mIsSet;
mFlags = other.mFlags; mFlags = other.mFlags;
} }
bool nx::MiscFlagsHandler::operator==(const MiscFlagsHandler & other) const bool nn::hac::MiscFlagsHandler::operator==(const MiscFlagsHandler & other) const
{ {
return (mIsSet == other.mIsSet) \ return (mIsSet == other.mIsSet) \
&& (mFlags == other.mFlags); && (mFlags == other.mFlags);
} }
bool nx::MiscFlagsHandler::operator!=(const MiscFlagsHandler & other) const bool nn::hac::MiscFlagsHandler::operator!=(const MiscFlagsHandler & other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::MiscFlagsHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps) void nn::hac::MiscFlagsHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps)
{ {
if (caps.size() > kMaxKernelCapNum) if (caps.size() > kMaxKernelCapNum)
{ {
@ -46,7 +46,7 @@ void nx::MiscFlagsHandler::importKernelCapabilityList(const fnd::List<KernelCapa
mIsSet = true; mIsSet = true;
} }
void nx::MiscFlagsHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const void nn::hac::MiscFlagsHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const
{ {
if (isSet() == false) if (isSet() == false)
return; return;
@ -66,23 +66,23 @@ void nx::MiscFlagsHandler::exportKernelCapabilityList(fnd::List<KernelCapability
caps.addElement(entry.getKernelCapability()); caps.addElement(entry.getKernelCapability());
} }
void nx::MiscFlagsHandler::clear() void nn::hac::MiscFlagsHandler::clear()
{ {
mIsSet = false; mIsSet = false;
mFlags.clear(); mFlags.clear();
} }
bool nx::MiscFlagsHandler::isSet() const bool nn::hac::MiscFlagsHandler::isSet() const
{ {
return mIsSet; return mIsSet;
} }
const fnd::List<nx::MiscFlagsHandler::Flags>& nx::MiscFlagsHandler::getFlagList() const const fnd::List<nn::hac::MiscFlagsHandler::Flags>& nn::hac::MiscFlagsHandler::getFlagList() const
{ {
return mFlags; return mFlags;
} }
void nx::MiscFlagsHandler::setFlagList(fnd::List<Flags> flags) void nn::hac::MiscFlagsHandler::setFlagList(fnd::List<Flags> flags)
{ {
mFlags = flags; mFlags = flags;
mIsSet = true; mIsSet = true;

View file

@ -1,46 +1,46 @@
#include <nx/MiscParamsEntry.h> #include <nn/hac/MiscParamsEntry.h>
nx::MiscParamsEntry::MiscParamsEntry() : nn::hac::MiscParamsEntry::MiscParamsEntry() :
mCap(kCapId), mCap(kCapId),
mProgramType(0) mProgramType(0)
{} {}
nx::MiscParamsEntry::MiscParamsEntry(const KernelCapabilityEntry & kernel_cap) : nn::hac::MiscParamsEntry::MiscParamsEntry(const KernelCapabilityEntry & kernel_cap) :
mCap(kCapId), mCap(kCapId),
mProgramType(0) mProgramType(0)
{ {
setKernelCapability(kernel_cap); setKernelCapability(kernel_cap);
} }
nx::MiscParamsEntry::MiscParamsEntry(uint8_t program_type) : nn::hac::MiscParamsEntry::MiscParamsEntry(uint8_t program_type) :
mCap(kCapId), mCap(kCapId),
mProgramType(0) mProgramType(0)
{ {
setProgramType(program_type); setProgramType(program_type);
} }
void nx::MiscParamsEntry::operator=(const MiscParamsEntry& other) void nn::hac::MiscParamsEntry::operator=(const MiscParamsEntry& other)
{ {
mProgramType = other.mProgramType; mProgramType = other.mProgramType;
updateCapField(); updateCapField();
} }
bool nx::MiscParamsEntry::operator==(const MiscParamsEntry& other) const bool nn::hac::MiscParamsEntry::operator==(const MiscParamsEntry& other) const
{ {
return (mProgramType == other.mProgramType); return (mProgramType == other.mProgramType);
} }
bool nx::MiscParamsEntry::operator!=(const MiscParamsEntry& other) const bool nn::hac::MiscParamsEntry::operator!=(const MiscParamsEntry& other) const
{ {
return !(*this == other); return !(*this == other);
} }
const nx::KernelCapabilityEntry & nx::MiscParamsEntry::getKernelCapability() const const nn::hac::KernelCapabilityEntry & nn::hac::MiscParamsEntry::getKernelCapability() const
{ {
return mCap; return mCap;
} }
void nx::MiscParamsEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap) void nn::hac::MiscParamsEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap)
{ {
if (kernel_cap.getType() != kCapId) if (kernel_cap.getType() != kCapId)
{ {
@ -51,12 +51,12 @@ void nx::MiscParamsEntry::setKernelCapability(const KernelCapabilityEntry & kern
processCapField(); processCapField();
} }
uint8_t nx::MiscParamsEntry::getProgramType() const uint8_t nn::hac::MiscParamsEntry::getProgramType() const
{ {
return mProgramType; return mProgramType;
} }
void nx::MiscParamsEntry::setProgramType(uint8_t type) void nn::hac::MiscParamsEntry::setProgramType(uint8_t type)
{ {
if (type > kMaxProgramType) if (type > kMaxProgramType)
{ {

View file

@ -1,28 +1,28 @@
#include <nx/MiscParamsHandler.h> #include <nn/hac/MiscParamsHandler.h>
nx::MiscParamsHandler::MiscParamsHandler() : nn::hac::MiscParamsHandler::MiscParamsHandler() :
mIsSet(false), mIsSet(false),
mEntry(0) mEntry(0)
{} {}
void nx::MiscParamsHandler::operator=(const MiscParamsHandler & other) void nn::hac::MiscParamsHandler::operator=(const MiscParamsHandler & other)
{ {
mIsSet = other.mIsSet; mIsSet = other.mIsSet;
mEntry.setKernelCapability(other.mEntry.getKernelCapability()); mEntry.setKernelCapability(other.mEntry.getKernelCapability());
} }
bool nx::MiscParamsHandler::operator==(const MiscParamsHandler & other) const bool nn::hac::MiscParamsHandler::operator==(const MiscParamsHandler & other) const
{ {
return (mIsSet == other.mIsSet) \ return (mIsSet == other.mIsSet) \
&& (mEntry.getKernelCapability() == other.mEntry.getKernelCapability()); && (mEntry.getKernelCapability() == other.mEntry.getKernelCapability());
} }
bool nx::MiscParamsHandler::operator!=(const MiscParamsHandler & other) const bool nn::hac::MiscParamsHandler::operator!=(const MiscParamsHandler & other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::MiscParamsHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps) void nn::hac::MiscParamsHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps)
{ {
if (caps.size() > kMaxKernelCapNum) if (caps.size() > kMaxKernelCapNum)
{ {
@ -37,7 +37,7 @@ void nx::MiscParamsHandler::importKernelCapabilityList(const fnd::List<KernelCap
mIsSet = true; mIsSet = true;
} }
void nx::MiscParamsHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const void nn::hac::MiscParamsHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const
{ {
if (isSet() == false) if (isSet() == false)
return; return;
@ -45,23 +45,23 @@ void nx::MiscParamsHandler::exportKernelCapabilityList(fnd::List<KernelCapabilit
caps.addElement(mEntry.getKernelCapability()); caps.addElement(mEntry.getKernelCapability());
} }
void nx::MiscParamsHandler::clear() void nn::hac::MiscParamsHandler::clear()
{ {
mIsSet = false; mIsSet = false;
mEntry.setProgramType(0); mEntry.setProgramType(0);
} }
bool nx::MiscParamsHandler::isSet() const bool nn::hac::MiscParamsHandler::isSet() const
{ {
return mIsSet; return mIsSet;
} }
uint8_t nx::MiscParamsHandler::getProgramType() const uint8_t nn::hac::MiscParamsHandler::getProgramType() const
{ {
return mEntry.getProgramType(); return mEntry.getProgramType();
} }
void nx::MiscParamsHandler::setProgramType(uint8_t type) void nn::hac::MiscParamsHandler::setProgramType(uint8_t type)
{ {
mEntry.setProgramType(type); mEntry.setProgramType(type);
mIsSet = true; mIsSet = true;

View file

@ -1,16 +1,16 @@
#include <nx/NcaHeader.h> #include <nn/hac/NcaHeader.h>
nx::NcaHeader::NcaHeader() nn::hac::NcaHeader::NcaHeader()
{ {
clear(); clear();
} }
nx::NcaHeader::NcaHeader(const NcaHeader & other) nn::hac::NcaHeader::NcaHeader(const NcaHeader & other)
{ {
*this = other; *this = other;
} }
bool nx::NcaHeader::operator==(const NcaHeader & other) const bool nn::hac::NcaHeader::operator==(const NcaHeader & other) const
{ {
return (mDistributionType == other.mDistributionType) \ return (mDistributionType == other.mDistributionType) \
&& (mContentType == other.mContentType) \ && (mContentType == other.mContentType) \
@ -24,12 +24,12 @@ bool nx::NcaHeader::operator==(const NcaHeader & other) const
&& (mEncAesKeys == other.mEncAesKeys); && (mEncAesKeys == other.mEncAesKeys);
} }
bool nx::NcaHeader::operator!=(const NcaHeader & other) const bool nn::hac::NcaHeader::operator!=(const NcaHeader & other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::NcaHeader::operator=(const NcaHeader & other) void nn::hac::NcaHeader::operator=(const NcaHeader & other)
{ {
if (other.getBytes().size()) if (other.getBytes().size())
{ {
@ -51,7 +51,7 @@ void nx::NcaHeader::operator=(const NcaHeader & other)
} }
} }
void nx::NcaHeader::toBytes() void nn::hac::NcaHeader::toBytes()
{ {
mRawBinary.alloc(sizeof(sNcaHeader)); mRawBinary.alloc(sizeof(sNcaHeader));
sNcaHeader* hdr = (sNcaHeader*)mRawBinary.data(); sNcaHeader* hdr = (sNcaHeader*)mRawBinary.data();
@ -108,7 +108,7 @@ void nx::NcaHeader::toBytes()
} }
} }
void nx::NcaHeader::fromBytes(const byte_t * data, size_t len) void nn::hac::NcaHeader::fromBytes(const byte_t * data, size_t len)
{ {
if (len < sizeof(sNcaHeader)) if (len < sizeof(sNcaHeader))
{ {
@ -158,12 +158,12 @@ void nx::NcaHeader::fromBytes(const byte_t * data, size_t len)
} }
} }
const fnd::Vec<byte_t>& nx::NcaHeader::getBytes() const const fnd::Vec<byte_t>& nn::hac::NcaHeader::getBytes() const
{ {
return mRawBinary; return mRawBinary;
} }
void nx::NcaHeader::clear() void nn::hac::NcaHeader::clear()
{ {
mFormatVersion = NCA3_FORMAT; mFormatVersion = NCA3_FORMAT;
mDistributionType = nca::DIST_DOWNLOAD; mDistributionType = nca::DIST_DOWNLOAD;
@ -179,97 +179,97 @@ void nx::NcaHeader::clear()
mEncAesKeys.clear(); mEncAesKeys.clear();
} }
nx::NcaHeader::FormatVersion nx::NcaHeader::getFormatVersion() const nn::hac::NcaHeader::FormatVersion nn::hac::NcaHeader::getFormatVersion() const
{ {
return mFormatVersion; return mFormatVersion;
} }
void nx::NcaHeader::setFormatVersion(FormatVersion version) void nn::hac::NcaHeader::setFormatVersion(FormatVersion version)
{ {
mFormatVersion = version; mFormatVersion = version;
} }
nx::nca::DistributionType nx::NcaHeader::getDistributionType() const nn::hac::nca::DistributionType nn::hac::NcaHeader::getDistributionType() const
{ {
return mDistributionType; return mDistributionType;
} }
void nx::NcaHeader::setDistributionType(nca::DistributionType type) void nn::hac::NcaHeader::setDistributionType(nca::DistributionType type)
{ {
mDistributionType = type; mDistributionType = type;
} }
nx::nca::ContentType nx::NcaHeader::getContentType() const nn::hac::nca::ContentType nn::hac::NcaHeader::getContentType() const
{ {
return mContentType; return mContentType;
} }
void nx::NcaHeader::setContentType(nca::ContentType type) void nn::hac::NcaHeader::setContentType(nca::ContentType type)
{ {
mContentType = type; mContentType = type;
} }
byte_t nx::NcaHeader::getKeyGeneration() const byte_t nn::hac::NcaHeader::getKeyGeneration() const
{ {
return mKeyGeneration; return mKeyGeneration;
} }
void nx::NcaHeader::setKeyGeneration(byte_t gen) void nn::hac::NcaHeader::setKeyGeneration(byte_t gen)
{ {
mKeyGeneration = gen; mKeyGeneration = gen;
} }
byte_t nx::NcaHeader::getKaekIndex() const byte_t nn::hac::NcaHeader::getKaekIndex() const
{ {
return mKaekIndex; return mKaekIndex;
} }
void nx::NcaHeader::setKaekIndex(byte_t index) void nn::hac::NcaHeader::setKaekIndex(byte_t index)
{ {
mKaekIndex = index; mKaekIndex = index;
} }
uint64_t nx::NcaHeader::getContentSize() const uint64_t nn::hac::NcaHeader::getContentSize() const
{ {
return mContentSize; return mContentSize;
} }
void nx::NcaHeader::setContentSize(uint64_t size) void nn::hac::NcaHeader::setContentSize(uint64_t size)
{ {
mContentSize = size; mContentSize = size;
} }
uint64_t nx::NcaHeader::getProgramId() const uint64_t nn::hac::NcaHeader::getProgramId() const
{ {
return mProgramId; return mProgramId;
} }
void nx::NcaHeader::setProgramId(uint64_t program_id) void nn::hac::NcaHeader::setProgramId(uint64_t program_id)
{ {
mProgramId = program_id; mProgramId = program_id;
} }
uint32_t nx::NcaHeader::getContentIndex() const uint32_t nn::hac::NcaHeader::getContentIndex() const
{ {
return mContentIndex; return mContentIndex;
} }
void nx::NcaHeader::setContentIndex(uint32_t index) void nn::hac::NcaHeader::setContentIndex(uint32_t index)
{ {
mContentIndex = index; mContentIndex = index;
} }
uint32_t nx::NcaHeader::getSdkAddonVersion() const uint32_t nn::hac::NcaHeader::getSdkAddonVersion() const
{ {
return mSdkAddonVersion; return mSdkAddonVersion;
} }
void nx::NcaHeader::setSdkAddonVersion(uint32_t version) void nn::hac::NcaHeader::setSdkAddonVersion(uint32_t version)
{ {
mSdkAddonVersion = version; mSdkAddonVersion = version;
} }
bool nx::NcaHeader::hasRightsId() const bool nn::hac::NcaHeader::hasRightsId() const
{ {
bool rightsIdIsSet = false; bool rightsIdIsSet = false;
@ -282,22 +282,22 @@ bool nx::NcaHeader::hasRightsId() const
return rightsIdIsSet; return rightsIdIsSet;
} }
const byte_t* nx::NcaHeader::getRightsId() const const byte_t* nn::hac::NcaHeader::getRightsId() const
{ {
return mRightsId; return mRightsId;
} }
void nx::NcaHeader::setRightsId(const byte_t* rights_id) void nn::hac::NcaHeader::setRightsId(const byte_t* rights_id)
{ {
memcpy(mRightsId, rights_id, nca::kRightsIdLen); memcpy(mRightsId, rights_id, nca::kRightsIdLen);
} }
const fnd::List<nx::NcaHeader::sPartition>& nx::NcaHeader::getPartitions() const const fnd::List<nn::hac::NcaHeader::sPartition>& nn::hac::NcaHeader::getPartitions() const
{ {
return mPartitions; return mPartitions;
} }
void nx::NcaHeader::setPartitions(const fnd::List<nx::NcaHeader::sPartition>& partitions) void nn::hac::NcaHeader::setPartitions(const fnd::List<nn::hac::NcaHeader::sPartition>& partitions)
{ {
mPartitions = partitions; mPartitions = partitions;
if (mPartitions.size() >= nca::kPartitionNum) if (mPartitions.size() >= nca::kPartitionNum)
@ -306,22 +306,22 @@ void nx::NcaHeader::setPartitions(const fnd::List<nx::NcaHeader::sPartition>& pa
} }
} }
const fnd::List<crypto::aes::sAes128Key>& nx::NcaHeader::getEncAesKeys() const const fnd::List<crypto::aes::sAes128Key>& nn::hac::NcaHeader::getEncAesKeys() const
{ {
return mEncAesKeys; return mEncAesKeys;
} }
void nx::NcaHeader::setEncAesKeys(const fnd::List<crypto::aes::sAes128Key>& keys) void nn::hac::NcaHeader::setEncAesKeys(const fnd::List<crypto::aes::sAes128Key>& keys)
{ {
mEncAesKeys = keys; mEncAesKeys = keys;
} }
uint64_t nx::NcaHeader::blockNumToSize(uint32_t block_num) const uint64_t nn::hac::NcaHeader::blockNumToSize(uint32_t block_num) const
{ {
return block_num*nca::kSectorSize; return block_num*nca::kSectorSize;
} }
uint32_t nx::NcaHeader::sizeToBlockNum(uint64_t real_size) const uint32_t nn::hac::NcaHeader::sizeToBlockNum(uint64_t real_size) const
{ {
return (uint32_t)(align(real_size, nca::kSectorSize) / nca::kSectorSize); return (uint32_t)(align(real_size, nca::kSectorSize) / nca::kSectorSize);
} }

View file

@ -1,25 +1,25 @@
#include <nx/NcaUtils.h> #include <nn/hac/NcaUtils.h>
void nx::NcaUtils::decryptNcaHeader(const byte_t* src, byte_t* dst, const crypto::aes::sAesXts128Key& key) void nn::hac::NcaUtils::decryptNcaHeader(const byte_t* src, byte_t* dst, const crypto::aes::sAesXts128Key& key)
{ {
byte_t tweak[crypto::aes::kAesBlockSize]; byte_t tweak[crypto::aes::kAesBlockSize];
// decrypt main header // decrypt main header
byte_t raw_hdr[nx::nca::kSectorSize]; byte_t raw_hdr[nn::hac::nca::kSectorSize];
crypto::aes::AesXtsMakeTweak(tweak, 1); crypto::aes::AesXtsMakeTweak(tweak, 1);
crypto::aes::AesXtsDecryptSector(src + sectorToOffset(1), nx::nca::kSectorSize, key.key[0], key.key[1], tweak, raw_hdr); crypto::aes::AesXtsDecryptSector(src + sectorToOffset(1), nn::hac::nca::kSectorSize, key.key[0], key.key[1], tweak, raw_hdr);
bool useNca2SectorIndex = ((nx::sNcaHeader*)(raw_hdr))->st_magic.get() == nx::nca::kNca2StructMagic; bool useNca2SectorIndex = ((nn::hac::sNcaHeader*)(raw_hdr))->st_magic.get() == nn::hac::nca::kNca2StructMagic;
// decrypt whole header // decrypt whole header
for (size_t i = 0; i < nx::nca::kHeaderSectorNum; i++) for (size_t i = 0; i < nn::hac::nca::kHeaderSectorNum; i++)
{ {
crypto::aes::AesXtsMakeTweak(tweak, (i > 1 && useNca2SectorIndex)? 0 : i); crypto::aes::AesXtsMakeTweak(tweak, (i > 1 && useNca2SectorIndex)? 0 : i);
crypto::aes::AesXtsDecryptSector(src + sectorToOffset(i), nx::nca::kSectorSize, key.key[0], key.key[1], tweak, dst + sectorToOffset(i)); crypto::aes::AesXtsDecryptSector(src + sectorToOffset(i), nn::hac::nca::kSectorSize, key.key[0], key.key[1], tweak, dst + sectorToOffset(i));
} }
} }
byte_t nx::NcaUtils::getMasterKeyRevisionFromKeyGeneration(byte_t key_generation) byte_t nn::hac::NcaUtils::getMasterKeyRevisionFromKeyGeneration(byte_t key_generation)
{ {
byte_t masterkey_rev; byte_t masterkey_rev;
@ -48,7 +48,7 @@ byte_t nx::NcaUtils::getMasterKeyRevisionFromKeyGeneration(byte_t key_generation
return masterkey_rev; return masterkey_rev;
} }
void nx::NcaUtils::getNcaPartitionAesCtr(const nx::sNcaFsHeader* hdr, byte_t* ctr) void nn::hac::NcaUtils::getNcaPartitionAesCtr(const nn::hac::sNcaFsHeader* hdr, byte_t* ctr)
{ {
for (size_t i = 0; i < 8; i++) for (size_t i = 0; i < 8; i++)
{ {

View file

@ -1,19 +1,19 @@
#include <nx/NpdmBinary.h> #include <nn/hac/NpdmBinary.h>
#include <fnd/SimpleTextOutput.h> #include <fnd/SimpleTextOutput.h>
nx::NpdmBinary::NpdmBinary() nn::hac::NpdmBinary::NpdmBinary()
{ {
clear(); clear();
} }
nx::NpdmBinary::NpdmBinary(const NpdmBinary & other) : nn::hac::NpdmBinary::NpdmBinary(const NpdmBinary & other) :
NpdmBinary() NpdmBinary()
{ {
*this = other; *this = other;
} }
void nx::NpdmBinary::operator=(const NpdmBinary & other) void nn::hac::NpdmBinary::operator=(const NpdmBinary & other)
{ {
mRawBinary = other.mRawBinary; mRawBinary = other.mRawBinary;
mInstructionType = other.mInstructionType; mInstructionType = other.mInstructionType;
@ -28,7 +28,7 @@ void nx::NpdmBinary::operator=(const NpdmBinary & other)
mAcid = other.mAcid; mAcid = other.mAcid;
} }
bool nx::NpdmBinary::operator==(const NpdmBinary & other) const bool nn::hac::NpdmBinary::operator==(const NpdmBinary & other) const
{ {
return (mInstructionType == other.mInstructionType) \ return (mInstructionType == other.mInstructionType) \
&& (mProcAddressSpaceType == other.mProcAddressSpaceType) \ && (mProcAddressSpaceType == other.mProcAddressSpaceType) \
@ -42,12 +42,12 @@ bool nx::NpdmBinary::operator==(const NpdmBinary & other) const
&& (mAcid == other.mAcid); && (mAcid == other.mAcid);
} }
bool nx::NpdmBinary::operator!=(const NpdmBinary & other) const bool nn::hac::NpdmBinary::operator!=(const NpdmBinary & other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::NpdmBinary::toBytes() void nn::hac::NpdmBinary::toBytes()
{ {
if (mAcid.getBytes().size() == 0) if (mAcid.getBytes().size() == 0)
mAcid.toBytes(); mAcid.toBytes();
@ -103,7 +103,7 @@ void nx::NpdmBinary::toBytes()
} }
} }
void nx::NpdmBinary::fromBytes(const byte_t* data, size_t len) void nn::hac::NpdmBinary::fromBytes(const byte_t* data, size_t len)
{ {
// check size // check size
if (len < sizeof(sNpdmHeader)) if (len < sizeof(sNpdmHeader))
@ -167,12 +167,12 @@ void nx::NpdmBinary::fromBytes(const byte_t* data, size_t len)
} }
} }
const fnd::Vec<byte_t>& nx::NpdmBinary::getBytes() const const fnd::Vec<byte_t>& nn::hac::NpdmBinary::getBytes() const
{ {
return mRawBinary; return mRawBinary;
} }
void nx::NpdmBinary::clear() void nn::hac::NpdmBinary::clear()
{ {
mRawBinary.clear(); mRawBinary.clear();
mInstructionType = npdm::INSTR_64BIT; mInstructionType = npdm::INSTR_64BIT;
@ -187,32 +187,32 @@ void nx::NpdmBinary::clear()
mAcid.clear(); mAcid.clear();
} }
nx::npdm::InstructionType nx::NpdmBinary::getInstructionType() const nn::hac::npdm::InstructionType nn::hac::NpdmBinary::getInstructionType() const
{ {
return mInstructionType; return mInstructionType;
} }
void nx::NpdmBinary::setInstructionType(npdm::InstructionType type) void nn::hac::NpdmBinary::setInstructionType(npdm::InstructionType type)
{ {
mInstructionType = type; mInstructionType = type;
} }
nx::npdm::ProcAddrSpaceType nx::NpdmBinary::getProcAddressSpaceType() const nn::hac::npdm::ProcAddrSpaceType nn::hac::NpdmBinary::getProcAddressSpaceType() const
{ {
return mProcAddressSpaceType; return mProcAddressSpaceType;
} }
void nx::NpdmBinary::setProcAddressSpaceType(npdm::ProcAddrSpaceType type) void nn::hac::NpdmBinary::setProcAddressSpaceType(npdm::ProcAddrSpaceType type)
{ {
mProcAddressSpaceType = type; mProcAddressSpaceType = type;
} }
byte_t nx::NpdmBinary::getMainThreadPriority() const byte_t nn::hac::NpdmBinary::getMainThreadPriority() const
{ {
return mMainThreadPriority; return mMainThreadPriority;
} }
void nx::NpdmBinary::setMainThreadPriority(byte_t priority) void nn::hac::NpdmBinary::setMainThreadPriority(byte_t priority)
{ {
if (priority > npdm::kMaxPriority) if (priority > npdm::kMaxPriority)
{ {
@ -222,42 +222,42 @@ void nx::NpdmBinary::setMainThreadPriority(byte_t priority)
mMainThreadPriority = priority; mMainThreadPriority = priority;
} }
byte_t nx::NpdmBinary::getMainThreadCpuId() const byte_t nn::hac::NpdmBinary::getMainThreadCpuId() const
{ {
return mMainThreadCpuId; return mMainThreadCpuId;
} }
void nx::NpdmBinary::setMainThreadCpuId(byte_t core_num) void nn::hac::NpdmBinary::setMainThreadCpuId(byte_t core_num)
{ {
mMainThreadCpuId = core_num; mMainThreadCpuId = core_num;
} }
uint32_t nx::NpdmBinary::getVersion() const uint32_t nn::hac::NpdmBinary::getVersion() const
{ {
return mVersion; return mVersion;
} }
void nx::NpdmBinary::setVersion(uint32_t version) void nn::hac::NpdmBinary::setVersion(uint32_t version)
{ {
mVersion = version; mVersion = version;
} }
uint32_t nx::NpdmBinary::getMainThreadStackSize() const uint32_t nn::hac::NpdmBinary::getMainThreadStackSize() const
{ {
return mMainThreadStackSize; return mMainThreadStackSize;
} }
void nx::NpdmBinary::setMainThreadStackSize(uint32_t size) void nn::hac::NpdmBinary::setMainThreadStackSize(uint32_t size)
{ {
mMainThreadStackSize = size; mMainThreadStackSize = size;
} }
const std::string & nx::NpdmBinary::getName() const const std::string & nn::hac::NpdmBinary::getName() const
{ {
return mName; return mName;
} }
void nx::NpdmBinary::setName(const std::string & name) void nn::hac::NpdmBinary::setName(const std::string & name)
{ {
if (name.length() > npdm::kNameMaxLen) if (name.length() > npdm::kNameMaxLen)
{ {
@ -267,12 +267,12 @@ void nx::NpdmBinary::setName(const std::string & name)
mName = name; mName = name;
} }
const std::string & nx::NpdmBinary::getProductCode() const const std::string & nn::hac::NpdmBinary::getProductCode() const
{ {
return mProductCode; return mProductCode;
} }
void nx::NpdmBinary::setProductCode(const std::string & product_code) void nn::hac::NpdmBinary::setProductCode(const std::string & product_code)
{ {
if (product_code.length() > npdm::kProductCodeMaxLen) if (product_code.length() > npdm::kProductCodeMaxLen)
{ {
@ -282,22 +282,22 @@ void nx::NpdmBinary::setProductCode(const std::string & product_code)
mProductCode = product_code; mProductCode = product_code;
} }
const nx::AccessControlInfoBinary & nx::NpdmBinary::getAci() const const nn::hac::AccessControlInfoBinary & nn::hac::NpdmBinary::getAci() const
{ {
return mAci; return mAci;
} }
void nx::NpdmBinary::setAci(const AccessControlInfoBinary & aci) void nn::hac::NpdmBinary::setAci(const AccessControlInfoBinary & aci)
{ {
mAci = aci; mAci = aci;
} }
const nx::AccessControlInfoDescBinary & nx::NpdmBinary::getAcid() const const nn::hac::AccessControlInfoDescBinary & nn::hac::NpdmBinary::getAcid() const
{ {
return mAcid; return mAcid;
} }
void nx::NpdmBinary::setAcid(const AccessControlInfoDescBinary & acid) void nn::hac::NpdmBinary::setAcid(const AccessControlInfoDescBinary & acid)
{ {
mAcid = acid; mAcid = acid;
} }

View file

@ -1,16 +1,16 @@
#include <nx/NroHeader.h> #include <nn/hac/NroHeader.h>
nx::NroHeader::NroHeader() nn::hac::NroHeader::NroHeader()
{ {
clear(); clear();
} }
nx::NroHeader::NroHeader(const NroHeader& other) nn::hac::NroHeader::NroHeader(const NroHeader& other)
{ {
*this = other; *this = other;
} }
void nx::NroHeader::operator=(const NroHeader& other) void nn::hac::NroHeader::operator=(const NroHeader& other)
{ {
clear(); clear();
mRoCrt = other.mRoCrt; mRoCrt = other.mRoCrt;
@ -26,7 +26,7 @@ void nx::NroHeader::operator=(const NroHeader& other)
mRoDynSymInfo = other.mRoDynSymInfo; mRoDynSymInfo = other.mRoDynSymInfo;
} }
bool nx::NroHeader::operator==(const NroHeader& other) const bool nn::hac::NroHeader::operator==(const NroHeader& other) const
{ {
return (mRoCrt == other.mRoCrt) \ return (mRoCrt == other.mRoCrt) \
&& (mNroSize == other.mNroSize) \ && (mNroSize == other.mNroSize) \
@ -41,15 +41,15 @@ bool nx::NroHeader::operator==(const NroHeader& other) const
&& (mRoDynSymInfo == other.mRoDynSymInfo); && (mRoDynSymInfo == other.mRoDynSymInfo);
} }
bool nx::NroHeader::operator!=(const NroHeader& other) const bool nn::hac::NroHeader::operator!=(const NroHeader& other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::NroHeader::toBytes() void nn::hac::NroHeader::toBytes()
{ {
mRawBinary.alloc(sizeof(sNroHeader)); mRawBinary.alloc(sizeof(sNroHeader));
nx::sNroHeader* hdr = (nx::sNroHeader*)mRawBinary.data(); nn::hac::sNroHeader* hdr = (nn::hac::sNroHeader*)mRawBinary.data();
// set header identifers // set header identifers
hdr->st_magic = nro::kNroStructMagic; hdr->st_magic = nro::kNroStructMagic;
@ -93,7 +93,7 @@ void nx::NroHeader::toBytes()
hdr->dyn_sym.size = mRoDynSymInfo.size; hdr->dyn_sym.size = mRoDynSymInfo.size;
} }
void nx::NroHeader::fromBytes(const byte_t* data, size_t len) void nn::hac::NroHeader::fromBytes(const byte_t* data, size_t len)
{ {
// check input data size // check input data size
if (len < sizeof(sNroHeader)) if (len < sizeof(sNroHeader))
@ -109,7 +109,7 @@ void nx::NroHeader::fromBytes(const byte_t* data, size_t len)
memcpy(mRawBinary.data(), data, mRawBinary.size()); memcpy(mRawBinary.data(), data, mRawBinary.size());
// get sNroHeader ptr // get sNroHeader ptr
const nx::sNroHeader* hdr = (const nx::sNroHeader*)mRawBinary.data(); const nn::hac::sNroHeader* hdr = (const nn::hac::sNroHeader*)mRawBinary.data();
// check NRO signature // check NRO signature
if (hdr->st_magic.get() != nro::kNroStructMagic) if (hdr->st_magic.get() != nro::kNroStructMagic)
@ -150,12 +150,12 @@ void nx::NroHeader::fromBytes(const byte_t* data, size_t len)
mRoDynSymInfo.size = hdr->dyn_sym.size.get(); mRoDynSymInfo.size = hdr->dyn_sym.size.get();
} }
const fnd::Vec<byte_t>& nx::NroHeader::getBytes() const const fnd::Vec<byte_t>& nn::hac::NroHeader::getBytes() const
{ {
return mRawBinary; return mRawBinary;
} }
void nx::NroHeader::clear() void nn::hac::NroHeader::clear()
{ {
mRawBinary.clear(); mRawBinary.clear();
memset(&mRoCrt, 0, sizeof(mRoCrt)); memset(&mRoCrt, 0, sizeof(mRoCrt));
@ -169,102 +169,102 @@ void nx::NroHeader::clear()
memset(&mRoDynSymInfo, 0, sizeof(mRoDynSymInfo)); memset(&mRoDynSymInfo, 0, sizeof(mRoDynSymInfo));
} }
const nx::NroHeader::sRoCrt& nx::NroHeader::getRoCrt() const const nn::hac::NroHeader::sRoCrt& nn::hac::NroHeader::getRoCrt() const
{ {
return mRoCrt; return mRoCrt;
} }
void nx::NroHeader::setRoCrt(const sRoCrt& ro_crt) void nn::hac::NroHeader::setRoCrt(const sRoCrt& ro_crt)
{ {
mRoCrt = ro_crt; mRoCrt = ro_crt;
} }
uint32_t nx::NroHeader::getNroSize() const uint32_t nn::hac::NroHeader::getNroSize() const
{ {
return mNroSize; return mNroSize;
} }
void nx::NroHeader::setNroSize(uint32_t size) void nn::hac::NroHeader::setNroSize(uint32_t size)
{ {
mNroSize = size; mNroSize = size;
} }
const nx::NroHeader::sSection& nx::NroHeader::getTextInfo() const const nn::hac::NroHeader::sSection& nn::hac::NroHeader::getTextInfo() const
{ {
return mTextInfo; return mTextInfo;
} }
void nx::NroHeader::setTextInfo(const sSection& info) void nn::hac::NroHeader::setTextInfo(const sSection& info)
{ {
mTextInfo = info; mTextInfo = info;
} }
const nx::NroHeader::sSection& nx::NroHeader::getRoInfo() const const nn::hac::NroHeader::sSection& nn::hac::NroHeader::getRoInfo() const
{ {
return mRoInfo; return mRoInfo;
} }
void nx::NroHeader::setRoInfo(const sSection& info) void nn::hac::NroHeader::setRoInfo(const sSection& info)
{ {
mRoInfo = info; mRoInfo = info;
} }
const nx::NroHeader::sSection& nx::NroHeader::getDataInfo() const const nn::hac::NroHeader::sSection& nn::hac::NroHeader::getDataInfo() const
{ {
return mDataInfo; return mDataInfo;
} }
void nx::NroHeader::setDataInfo(const sSection& info) void nn::hac::NroHeader::setDataInfo(const sSection& info)
{ {
mDataInfo = info; mDataInfo = info;
} }
uint32_t nx::NroHeader::getBssSize() const uint32_t nn::hac::NroHeader::getBssSize() const
{ {
return mBssSize; return mBssSize;
} }
void nx::NroHeader::setBssSize(uint32_t size) void nn::hac::NroHeader::setBssSize(uint32_t size)
{ {
mBssSize = size; mBssSize = size;
} }
const nx::NroHeader::sModuleId& nx::NroHeader::getModuleId() const const nn::hac::NroHeader::sModuleId& nn::hac::NroHeader::getModuleId() const
{ {
return mModuleId; return mModuleId;
} }
void nx::NroHeader::setModuleId(const sModuleId& id) void nn::hac::NroHeader::setModuleId(const sModuleId& id)
{ {
mModuleId = id; mModuleId = id;
} }
const nx::NroHeader::sSection& nx::NroHeader::getRoEmbeddedInfo() const const nn::hac::NroHeader::sSection& nn::hac::NroHeader::getRoEmbeddedInfo() const
{ {
return mRoEmbeddedInfo; return mRoEmbeddedInfo;
} }
void nx::NroHeader::setRoEmbeddedInfo(const sSection& info) void nn::hac::NroHeader::setRoEmbeddedInfo(const sSection& info)
{ {
mRoEmbeddedInfo = info; mRoEmbeddedInfo = info;
} }
const nx::NroHeader::sSection& nx::NroHeader::getRoDynStrInfo() const const nn::hac::NroHeader::sSection& nn::hac::NroHeader::getRoDynStrInfo() const
{ {
return mRoDynStrInfo; return mRoDynStrInfo;
} }
void nx::NroHeader::setRoDynStrInfo(const sSection& info) void nn::hac::NroHeader::setRoDynStrInfo(const sSection& info)
{ {
mRoDynStrInfo = info; mRoDynStrInfo = info;
} }
const nx::NroHeader::sSection& nx::NroHeader::getRoDynSymInfo() const const nn::hac::NroHeader::sSection& nn::hac::NroHeader::getRoDynSymInfo() const
{ {
return mRoDynSymInfo; return mRoDynSymInfo;
} }
void nx::NroHeader::setRoDynSymInfo(const sSection& info) void nn::hac::NroHeader::setRoDynSymInfo(const sSection& info)
{ {
mRoDynSymInfo = info; mRoDynSymInfo = info;
} }

View file

@ -1,16 +1,16 @@
#include <nx/NsoHeader.h> #include <nn/hac/NsoHeader.h>
nx::NsoHeader::NsoHeader() nn::hac::NsoHeader::NsoHeader()
{ {
clear(); clear();
} }
nx::NsoHeader::NsoHeader(const NsoHeader& other) nn::hac::NsoHeader::NsoHeader(const NsoHeader& other)
{ {
*this = other; *this = other;
} }
void nx::NsoHeader::operator=(const NsoHeader& other) void nn::hac::NsoHeader::operator=(const NsoHeader& other)
{ {
clear(); clear();
mModuleId = other.mModuleId; mModuleId = other.mModuleId;
@ -25,7 +25,7 @@ void nx::NsoHeader::operator=(const NsoHeader& other)
} }
bool nx::NsoHeader::operator==(const NsoHeader& other) const bool nn::hac::NsoHeader::operator==(const NsoHeader& other) const
{ {
return (mModuleId == other.mModuleId) \ return (mModuleId == other.mModuleId) \
&& (mBssSize == other.mBssSize) \ && (mBssSize == other.mBssSize) \
@ -38,15 +38,15 @@ bool nx::NsoHeader::operator==(const NsoHeader& other) const
&& (mRoDynSymInfo == other.mRoDynSymInfo); && (mRoDynSymInfo == other.mRoDynSymInfo);
} }
bool nx::NsoHeader::operator!=(const NsoHeader& other) const bool nn::hac::NsoHeader::operator!=(const NsoHeader& other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::NsoHeader::toBytes() void nn::hac::NsoHeader::toBytes()
{ {
mRawBinary.alloc(sizeof(sNsoHeader)); mRawBinary.alloc(sizeof(sNsoHeader));
nx::sNsoHeader* hdr = (nx::sNsoHeader*)mRawBinary.data(); nn::hac::sNsoHeader* hdr = (nn::hac::sNsoHeader*)mRawBinary.data();
// set header identifers // set header identifers
hdr->st_magic = nso::kNsoStructMagic; hdr->st_magic = nso::kNsoStructMagic;
@ -125,7 +125,7 @@ void nx::NsoHeader::toBytes()
hdr->flags = flags; hdr->flags = flags;
} }
void nx::NsoHeader::fromBytes(const byte_t* data, size_t len) void nn::hac::NsoHeader::fromBytes(const byte_t* data, size_t len)
{ {
// check input data size // check input data size
if (len < sizeof(sNsoHeader)) if (len < sizeof(sNsoHeader))
@ -141,7 +141,7 @@ void nx::NsoHeader::fromBytes(const byte_t* data, size_t len)
memcpy(mRawBinary.data(), data, mRawBinary.size()); memcpy(mRawBinary.data(), data, mRawBinary.size());
// get sNsoHeader ptr // get sNsoHeader ptr
const nx::sNsoHeader* hdr = (const nx::sNsoHeader*)mRawBinary.data(); const nn::hac::sNsoHeader* hdr = (const nn::hac::sNsoHeader*)mRawBinary.data();
// check NSO signature // check NSO signature
if (hdr->st_magic.get() != nso::kNsoStructMagic) if (hdr->st_magic.get() != nso::kNsoStructMagic)
@ -196,12 +196,12 @@ void nx::NsoHeader::fromBytes(const byte_t* data, size_t len)
mRoDynSymInfo.size = hdr->dyn_sym.size.get(); mRoDynSymInfo.size = hdr->dyn_sym.size.get();
} }
const fnd::Vec<byte_t>& nx::NsoHeader::getBytes() const const fnd::Vec<byte_t>& nn::hac::NsoHeader::getBytes() const
{ {
return mRawBinary; return mRawBinary;
} }
void nx::NsoHeader::clear() void nn::hac::NsoHeader::clear()
{ {
mRawBinary.clear(); mRawBinary.clear();
memset(&mModuleId, 0, sizeof(mModuleId)); memset(&mModuleId, 0, sizeof(mModuleId));
@ -215,92 +215,92 @@ void nx::NsoHeader::clear()
memset(&mRoDynSymInfo, 0, sizeof(mRoDynSymInfo)); memset(&mRoDynSymInfo, 0, sizeof(mRoDynSymInfo));
} }
const nx::NsoHeader::sModuleId& nx::NsoHeader::getModuleId() const const nn::hac::NsoHeader::sModuleId& nn::hac::NsoHeader::getModuleId() const
{ {
return mModuleId; return mModuleId;
} }
void nx::NsoHeader::setModuleId(const sModuleId& id) void nn::hac::NsoHeader::setModuleId(const sModuleId& id)
{ {
mModuleId = id; mModuleId = id;
} }
uint32_t nx::NsoHeader::getBssSize() const uint32_t nn::hac::NsoHeader::getBssSize() const
{ {
return mBssSize; return mBssSize;
} }
void nx::NsoHeader::setBssSize(uint32_t size) void nn::hac::NsoHeader::setBssSize(uint32_t size)
{ {
mBssSize = size; mBssSize = size;
} }
const nx::NsoHeader::sCodeSegment& nx::NsoHeader::getTextSegmentInfo() const const nn::hac::NsoHeader::sCodeSegment& nn::hac::NsoHeader::getTextSegmentInfo() const
{ {
return mTextSegmentInfo; return mTextSegmentInfo;
} }
void nx::NsoHeader::setTextSegmentInfo(const sCodeSegment& info) void nn::hac::NsoHeader::setTextSegmentInfo(const sCodeSegment& info)
{ {
mTextSegmentInfo = info; mTextSegmentInfo = info;
} }
const nx::NsoHeader::sCodeSegment& nx::NsoHeader::getRoSegmentInfo() const const nn::hac::NsoHeader::sCodeSegment& nn::hac::NsoHeader::getRoSegmentInfo() const
{ {
return mRoSegmentInfo; return mRoSegmentInfo;
} }
void nx::NsoHeader::setRoSegmentInfo(const sCodeSegment& info) void nn::hac::NsoHeader::setRoSegmentInfo(const sCodeSegment& info)
{ {
mRoSegmentInfo = info; mRoSegmentInfo = info;
} }
const nx::NsoHeader::sCodeSegment& nx::NsoHeader::getDataSegmentInfo() const const nn::hac::NsoHeader::sCodeSegment& nn::hac::NsoHeader::getDataSegmentInfo() const
{ {
return mDataSegmentInfo; return mDataSegmentInfo;
} }
void nx::NsoHeader::setDataSegmentInfo(const sCodeSegment& info) void nn::hac::NsoHeader::setDataSegmentInfo(const sCodeSegment& info)
{ {
mDataSegmentInfo = info; mDataSegmentInfo = info;
} }
const nx::NsoHeader::sLayout& nx::NsoHeader::getModuleNameInfo() const const nn::hac::NsoHeader::sLayout& nn::hac::NsoHeader::getModuleNameInfo() const
{ {
return mModuleNameInfo; return mModuleNameInfo;
} }
void nx::NsoHeader::setModuleNameInfo(const sLayout& info) void nn::hac::NsoHeader::setModuleNameInfo(const sLayout& info)
{ {
mModuleNameInfo = info; mModuleNameInfo = info;
} }
const nx::NsoHeader::sLayout& nx::NsoHeader::getRoEmbeddedInfo() const const nn::hac::NsoHeader::sLayout& nn::hac::NsoHeader::getRoEmbeddedInfo() const
{ {
return mRoEmbeddedInfo; return mRoEmbeddedInfo;
} }
void nx::NsoHeader::setRoEmbeddedInfo(const sLayout& info) void nn::hac::NsoHeader::setRoEmbeddedInfo(const sLayout& info)
{ {
mRoEmbeddedInfo = info; mRoEmbeddedInfo = info;
} }
const nx::NsoHeader::sLayout& nx::NsoHeader::getRoDynStrInfo() const const nn::hac::NsoHeader::sLayout& nn::hac::NsoHeader::getRoDynStrInfo() const
{ {
return mRoDynStrInfo; return mRoDynStrInfo;
} }
void nx::NsoHeader::setRoDynStrInfo(const sLayout& info) void nn::hac::NsoHeader::setRoDynStrInfo(const sLayout& info)
{ {
mRoDynStrInfo = info; mRoDynStrInfo = info;
} }
const nx::NsoHeader::sLayout& nx::NsoHeader::getRoDynSymInfo() const const nn::hac::NsoHeader::sLayout& nn::hac::NsoHeader::getRoDynSymInfo() const
{ {
return mRoDynSymInfo; return mRoDynSymInfo;
} }
void nx::NsoHeader::setRoDynSymInfo(const sLayout& info) void nn::hac::NsoHeader::setRoDynSymInfo(const sLayout& info)
{ {
mRoDynSymInfo = info; mRoDynSymInfo = info;
} }

View file

@ -1,16 +1,16 @@
#include <nx/PfsHeader.h> #include <nn/hac/PfsHeader.h>
nx::PfsHeader::PfsHeader() nn::hac::PfsHeader::PfsHeader()
{ {
clear(); clear();
} }
nx::PfsHeader::PfsHeader(const PfsHeader & other) nn::hac::PfsHeader::PfsHeader(const PfsHeader & other)
{ {
*this = other; *this = other;
} }
void nx::PfsHeader::operator=(const PfsHeader & other) void nn::hac::PfsHeader::operator=(const PfsHeader & other)
{ {
if (other.getBytes().size()) if (other.getBytes().size())
{ {
@ -24,24 +24,24 @@ void nx::PfsHeader::operator=(const PfsHeader & other)
} }
} }
bool nx::PfsHeader::operator==(const PfsHeader & other) const bool nn::hac::PfsHeader::operator==(const PfsHeader & other) const
{ {
return (mFsType == other.mFsType) \ return (mFsType == other.mFsType) \
&& (mFileList == other.mFileList); && (mFileList == other.mFileList);
} }
bool nx::PfsHeader::operator!=(const PfsHeader & other) const bool nn::hac::PfsHeader::operator!=(const PfsHeader & other) const
{ {
return !(*this == other); return !(*this == other);
} }
const fnd::Vec<byte_t>& nx::PfsHeader::getBytes() const const fnd::Vec<byte_t>& nn::hac::PfsHeader::getBytes() const
{ {
return mRawBinary; return mRawBinary;
} }
void nx::PfsHeader::toBytes() void nn::hac::PfsHeader::toBytes()
{ {
// calculate name table size // calculate name table size
size_t name_table_size = 0; size_t name_table_size = 0;
@ -113,7 +113,7 @@ void nx::PfsHeader::toBytes()
} }
void nx::PfsHeader::fromBytes(const byte_t* data, size_t len) void nn::hac::PfsHeader::fromBytes(const byte_t* data, size_t len)
{ {
// check input length meets minimum size // check input length meets minimum size
if (len < sizeof(sPfsHeader)) if (len < sizeof(sPfsHeader))
@ -195,39 +195,39 @@ void nx::PfsHeader::fromBytes(const byte_t* data, size_t len)
} }
void nx::PfsHeader::clear() void nn::hac::PfsHeader::clear()
{ {
mRawBinary.clear(); mRawBinary.clear();
mFsType = TYPE_PFS0; mFsType = TYPE_PFS0;
mFileList.clear(); mFileList.clear();
} }
nx::PfsHeader::FsType nx::PfsHeader::getFsType() const nn::hac::PfsHeader::FsType nn::hac::PfsHeader::getFsType() const
{ {
return mFsType; return mFsType;
} }
void nx::PfsHeader::setFsType(FsType type) void nn::hac::PfsHeader::setFsType(FsType type)
{ {
mFsType = type; mFsType = type;
} }
const fnd::List<nx::PfsHeader::sFile>& nx::PfsHeader::getFileList() const const fnd::List<nn::hac::PfsHeader::sFile>& nn::hac::PfsHeader::getFileList() const
{ {
return mFileList; return mFileList;
} }
void nx::PfsHeader::addFile(const std::string & name, size_t size) void nn::hac::PfsHeader::addFile(const std::string & name, size_t size)
{ {
mFileList.addElement({ name, 0, size, 0 }); mFileList.addElement({ name, 0, size, 0 });
} }
void nx::PfsHeader::addFile(const std::string & name, size_t size, size_t hash_protected_size, const crypto::sha::sSha256Hash& hash) void nn::hac::PfsHeader::addFile(const std::string & name, size_t size, size_t hash_protected_size, const crypto::sha::sSha256Hash& hash)
{ {
mFileList.addElement({ name, 0, size, hash_protected_size, hash }); mFileList.addElement({ name, 0, size, hash_protected_size, hash });
} }
size_t nx::PfsHeader::getFileEntrySize(FsType fs_type) size_t nn::hac::PfsHeader::getFileEntrySize(FsType fs_type)
{ {
size_t size = 0; size_t size = 0;
switch(fs_type) switch(fs_type)
@ -244,7 +244,7 @@ size_t nx::PfsHeader::getFileEntrySize(FsType fs_type)
return size; return size;
} }
void nx::PfsHeader::calculateOffsets(size_t data_offset) void nn::hac::PfsHeader::calculateOffsets(size_t data_offset)
{ {
for (size_t i = 0; i < mFileList.size(); i++) for (size_t i = 0; i < mFileList.size(); i++)
{ {

View file

@ -1,32 +1,32 @@
#include <nx/ServiceAccessControlBinary.h> #include <nn/hac/ServiceAccessControlBinary.h>
nx::ServiceAccessControlBinary::ServiceAccessControlBinary() nn::hac::ServiceAccessControlBinary::ServiceAccessControlBinary()
{ {
clear(); clear();
} }
nx::ServiceAccessControlBinary::ServiceAccessControlBinary(const ServiceAccessControlBinary & other) nn::hac::ServiceAccessControlBinary::ServiceAccessControlBinary(const ServiceAccessControlBinary & other)
{ {
*this = other; *this = other;
} }
void nx::ServiceAccessControlBinary::operator=(const ServiceAccessControlBinary & other) void nn::hac::ServiceAccessControlBinary::operator=(const ServiceAccessControlBinary & other)
{ {
mRawBinary = other.mRawBinary; mRawBinary = other.mRawBinary;
mServices = other.mServices; mServices = other.mServices;
} }
bool nx::ServiceAccessControlBinary::operator==(const ServiceAccessControlBinary & other) const bool nn::hac::ServiceAccessControlBinary::operator==(const ServiceAccessControlBinary & other) const
{ {
return (mServices == other.mServices); return (mServices == other.mServices);
} }
bool nx::ServiceAccessControlBinary::operator!=(const ServiceAccessControlBinary & other) const bool nn::hac::ServiceAccessControlBinary::operator!=(const ServiceAccessControlBinary & other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::ServiceAccessControlBinary::toBytes() void nn::hac::ServiceAccessControlBinary::toBytes()
{ {
size_t totalSize = 0; size_t totalSize = 0;
for (size_t i = 0; i < mServices.size(); i++) for (size_t i = 0; i < mServices.size(); i++)
@ -42,7 +42,7 @@ void nx::ServiceAccessControlBinary::toBytes()
} }
} }
void nx::ServiceAccessControlBinary::fromBytes(const byte_t* data, size_t len) void nn::hac::ServiceAccessControlBinary::fromBytes(const byte_t* data, size_t len)
{ {
clear(); clear();
mRawBinary.alloc(len); mRawBinary.alloc(len);
@ -56,23 +56,23 @@ void nx::ServiceAccessControlBinary::fromBytes(const byte_t* data, size_t len)
} }
} }
const fnd::Vec<byte_t>& nx::ServiceAccessControlBinary::getBytes() const const fnd::Vec<byte_t>& nn::hac::ServiceAccessControlBinary::getBytes() const
{ {
return mRawBinary; return mRawBinary;
} }
void nx::ServiceAccessControlBinary::clear() void nn::hac::ServiceAccessControlBinary::clear()
{ {
mRawBinary.clear(); mRawBinary.clear();
mServices.clear(); mServices.clear();
} }
const fnd::List<nx::ServiceAccessControlEntry>& nx::ServiceAccessControlBinary::getServiceList() const const fnd::List<nn::hac::ServiceAccessControlEntry>& nn::hac::ServiceAccessControlBinary::getServiceList() const
{ {
return mServices; return mServices;
} }
void nx::ServiceAccessControlBinary::addService(const ServiceAccessControlEntry& service) void nn::hac::ServiceAccessControlBinary::addService(const ServiceAccessControlEntry& service)
{ {
mServices.addElement(service); mServices.addElement(service);
} }

View file

@ -1,23 +1,23 @@
#include <nx/ServiceAccessControlEntry.h> #include <nn/hac/ServiceAccessControlEntry.h>
nx::ServiceAccessControlEntry::ServiceAccessControlEntry() nn::hac::ServiceAccessControlEntry::ServiceAccessControlEntry()
{ {
clear(); clear();
} }
nx::ServiceAccessControlEntry::ServiceAccessControlEntry(const std::string & name, bool isServer) : nn::hac::ServiceAccessControlEntry::ServiceAccessControlEntry(const std::string & name, bool isServer) :
mIsServer(isServer), mIsServer(isServer),
mName(name) mName(name)
{ {
toBytes(); toBytes();
} }
nx::ServiceAccessControlEntry::ServiceAccessControlEntry(const ServiceAccessControlEntry & other) nn::hac::ServiceAccessControlEntry::ServiceAccessControlEntry(const ServiceAccessControlEntry & other)
{ {
*this = other; *this = other;
} }
void nx::ServiceAccessControlEntry::operator=(const ServiceAccessControlEntry & other) void nn::hac::ServiceAccessControlEntry::operator=(const ServiceAccessControlEntry & other)
{ {
if (other.getBytes().size()) if (other.getBytes().size())
{ {
@ -31,19 +31,19 @@ void nx::ServiceAccessControlEntry::operator=(const ServiceAccessControlEntry &
} }
} }
bool nx::ServiceAccessControlEntry::operator==(const ServiceAccessControlEntry & other) const bool nn::hac::ServiceAccessControlEntry::operator==(const ServiceAccessControlEntry & other) const
{ {
return (mIsServer == other.mIsServer) \ return (mIsServer == other.mIsServer) \
&& (mName == other.mName); && (mName == other.mName);
} }
bool nx::ServiceAccessControlEntry::operator!=(const ServiceAccessControlEntry & other) const bool nn::hac::ServiceAccessControlEntry::operator!=(const ServiceAccessControlEntry & other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::ServiceAccessControlEntry::toBytes() void nn::hac::ServiceAccessControlEntry::toBytes()
{ {
try { try {
mRawBinary.alloc(mName.size() + 1); mRawBinary.alloc(mName.size() + 1);
@ -68,7 +68,7 @@ void nx::ServiceAccessControlEntry::toBytes()
memcpy(mRawBinary.data() + 1, mName.c_str(), mName.length()); memcpy(mRawBinary.data() + 1, mName.c_str(), mName.length());
} }
void nx::ServiceAccessControlEntry::fromBytes(const byte_t* data, size_t len) void nn::hac::ServiceAccessControlEntry::fromBytes(const byte_t* data, size_t len)
{ {
bool isServer = (data[0] & SAC_IS_SERVER) == SAC_IS_SERVER; bool isServer = (data[0] & SAC_IS_SERVER) == SAC_IS_SERVER;
size_t nameLen = (data[0] & SAC_NAME_LEN_MASK) + 1; // bug? size_t nameLen = (data[0] & SAC_NAME_LEN_MASK) + 1; // bug?
@ -94,33 +94,33 @@ void nx::ServiceAccessControlEntry::fromBytes(const byte_t* data, size_t len)
mName = std::string((const char*)(mRawBinary.data() + 1), nameLen); mName = std::string((const char*)(mRawBinary.data() + 1), nameLen);
} }
const fnd::Vec<byte_t>& nx::ServiceAccessControlEntry::getBytes() const const fnd::Vec<byte_t>& nn::hac::ServiceAccessControlEntry::getBytes() const
{ {
return mRawBinary; return mRawBinary;
} }
void nx::ServiceAccessControlEntry::clear() void nn::hac::ServiceAccessControlEntry::clear()
{ {
mIsServer = false; mIsServer = false;
mName.clear(); mName.clear();
} }
bool nx::ServiceAccessControlEntry::isServer() const bool nn::hac::ServiceAccessControlEntry::isServer() const
{ {
return mIsServer; return mIsServer;
} }
void nx::ServiceAccessControlEntry::setIsServer(bool isServer) void nn::hac::ServiceAccessControlEntry::setIsServer(bool isServer)
{ {
mIsServer = isServer; mIsServer = isServer;
} }
const std::string & nx::ServiceAccessControlEntry::getName() const const std::string & nn::hac::ServiceAccessControlEntry::getName() const
{ {
return mName; return mName;
} }
void nx::ServiceAccessControlEntry::setName(const std::string & name) void nn::hac::ServiceAccessControlEntry::setName(const std::string & name)
{ {
if (name.length() > kMaxServiceNameLen) if (name.length() > kMaxServiceNameLen)
{ {

View file

@ -1,6 +1,6 @@
#include <nx/SystemCallEntry.h> #include <nn/hac/SystemCallEntry.h>
nx::SystemCallEntry::SystemCallEntry() : nn::hac::SystemCallEntry::SystemCallEntry() :
mCap(kCapId), mCap(kCapId),
mSystemCallUpper(0), mSystemCallUpper(0),
mSystemCallLower(0) mSystemCallLower(0)
@ -8,7 +8,7 @@ nx::SystemCallEntry::SystemCallEntry() :
} }
nx::SystemCallEntry::SystemCallEntry(const KernelCapabilityEntry & kernel_cap) : nn::hac::SystemCallEntry::SystemCallEntry(const KernelCapabilityEntry & kernel_cap) :
mCap(kCapId), mCap(kCapId),
mSystemCallUpper(0), mSystemCallUpper(0),
mSystemCallLower(0) mSystemCallLower(0)
@ -16,7 +16,7 @@ nx::SystemCallEntry::SystemCallEntry(const KernelCapabilityEntry & kernel_cap) :
setKernelCapability(kernel_cap); setKernelCapability(kernel_cap);
} }
nx::SystemCallEntry::SystemCallEntry(uint32_t upper_bits, uint32_t lower_bits) : nn::hac::SystemCallEntry::SystemCallEntry(uint32_t upper_bits, uint32_t lower_bits) :
mCap(kCapId), mCap(kCapId),
mSystemCallUpper(0), mSystemCallUpper(0),
mSystemCallLower(0) mSystemCallLower(0)
@ -25,30 +25,30 @@ nx::SystemCallEntry::SystemCallEntry(uint32_t upper_bits, uint32_t lower_bits) :
setSystemCallLowerBits(lower_bits); setSystemCallLowerBits(lower_bits);
} }
void nx::SystemCallEntry::operator=(const SystemCallEntry& other) void nn::hac::SystemCallEntry::operator=(const SystemCallEntry& other)
{ {
mSystemCallUpper = other.mSystemCallUpper; mSystemCallUpper = other.mSystemCallUpper;
mSystemCallLower = other.mSystemCallLower; mSystemCallLower = other.mSystemCallLower;
updateCapField(); updateCapField();
} }
bool nx::SystemCallEntry::operator==(const SystemCallEntry& other) const bool nn::hac::SystemCallEntry::operator==(const SystemCallEntry& other) const
{ {
return (mSystemCallUpper == other.mSystemCallUpper) \ return (mSystemCallUpper == other.mSystemCallUpper) \
&& (mSystemCallLower == other.mSystemCallLower); && (mSystemCallLower == other.mSystemCallLower);
} }
bool nx::SystemCallEntry::operator!=(const SystemCallEntry& other) const bool nn::hac::SystemCallEntry::operator!=(const SystemCallEntry& other) const
{ {
return !(*this == other); return !(*this == other);
} }
const nx::KernelCapabilityEntry & nx::SystemCallEntry::getKernelCapability() const const nn::hac::KernelCapabilityEntry & nn::hac::SystemCallEntry::getKernelCapability() const
{ {
return mCap; return mCap;
} }
void nx::SystemCallEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap) void nn::hac::SystemCallEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap)
{ {
if (kernel_cap.getType() != kCapId) if (kernel_cap.getType() != kCapId)
{ {
@ -59,12 +59,12 @@ void nx::SystemCallEntry::setKernelCapability(const KernelCapabilityEntry & kern
processCapField(); processCapField();
} }
uint32_t nx::SystemCallEntry::getSystemCallUpperBits() const uint32_t nn::hac::SystemCallEntry::getSystemCallUpperBits() const
{ {
return mSystemCallUpper; return mSystemCallUpper;
} }
void nx::SystemCallEntry::setSystemCallUpperBits(uint32_t upper_bits) void nn::hac::SystemCallEntry::setSystemCallUpperBits(uint32_t upper_bits)
{ {
if (upper_bits > kSysCallUpperMax) if (upper_bits > kSysCallUpperMax)
{ {
@ -75,12 +75,12 @@ void nx::SystemCallEntry::setSystemCallUpperBits(uint32_t upper_bits)
updateCapField(); updateCapField();
} }
uint32_t nx::SystemCallEntry::getSystemCallLowerBits() const uint32_t nn::hac::SystemCallEntry::getSystemCallLowerBits() const
{ {
return mSystemCallLower; return mSystemCallLower;
} }
void nx::SystemCallEntry::setSystemCallLowerBits(uint32_t lower_bits) void nn::hac::SystemCallEntry::setSystemCallLowerBits(uint32_t lower_bits)
{ {
if (lower_bits > kSysCallLowerMax) if (lower_bits > kSysCallLowerMax)
{ {

View file

@ -1,29 +1,29 @@
#include <nx/SystemCallHandler.h> #include <nn/hac/SystemCallHandler.h>
#include <nx/SystemCallEntry.h> #include <nn/hac/SystemCallEntry.h>
nx::SystemCallHandler::SystemCallHandler() : nn::hac::SystemCallHandler::SystemCallHandler() :
mIsSet(false), mIsSet(false),
mSystemCalls() mSystemCalls()
{} {}
void nx::SystemCallHandler::operator=(const SystemCallHandler & other) void nn::hac::SystemCallHandler::operator=(const SystemCallHandler & other)
{ {
mIsSet = other.mIsSet; mIsSet = other.mIsSet;
mSystemCalls = other.mSystemCalls; mSystemCalls = other.mSystemCalls;
} }
bool nx::SystemCallHandler::operator==(const SystemCallHandler & other) const bool nn::hac::SystemCallHandler::operator==(const SystemCallHandler & other) const
{ {
return (mIsSet == other.mIsSet) \ return (mIsSet == other.mIsSet) \
&& (mSystemCalls == other.mSystemCalls); && (mSystemCalls == other.mSystemCalls);
} }
bool nx::SystemCallHandler::operator!=(const SystemCallHandler & other) const bool nn::hac::SystemCallHandler::operator!=(const SystemCallHandler & other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::SystemCallHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps) void nn::hac::SystemCallHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps)
{ {
if (caps.size() == 0) if (caps.size() == 0)
return; return;
@ -49,7 +49,7 @@ void nx::SystemCallHandler::importKernelCapabilityList(const fnd::List<KernelCap
mIsSet = true; mIsSet = true;
} }
void nx::SystemCallHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const void nn::hac::SystemCallHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const
{ {
if (isSet() == false) if (isSet() == false)
return; return;
@ -80,23 +80,23 @@ void nx::SystemCallHandler::exportKernelCapabilityList(fnd::List<KernelCapabilit
} }
} }
void nx::SystemCallHandler::clear() void nn::hac::SystemCallHandler::clear()
{ {
mIsSet = false; mIsSet = false;
mSystemCalls.clear(); mSystemCalls.clear();
} }
bool nx::SystemCallHandler::isSet() const bool nn::hac::SystemCallHandler::isSet() const
{ {
return mIsSet; return mIsSet;
} }
const fnd::List<uint8_t>& nx::SystemCallHandler::getSystemCalls() const const fnd::List<uint8_t>& nn::hac::SystemCallHandler::getSystemCalls() const
{ {
return mSystemCalls; return mSystemCalls;
} }
void nx::SystemCallHandler::setSystemCallList(const fnd::List<uint8_t>& calls) void nn::hac::SystemCallHandler::setSystemCallList(const fnd::List<uint8_t>& calls)
{ {
mSystemCalls.clear(); mSystemCalls.clear();
for (size_t i = 0; i < calls.size(); i++) for (size_t i = 0; i < calls.size(); i++)

View file

@ -1,6 +1,6 @@
#include <nx/ThreadInfoEntry.h> #include <nn/hac/ThreadInfoEntry.h>
nx::ThreadInfoEntry::ThreadInfoEntry() : nn::hac::ThreadInfoEntry::ThreadInfoEntry() :
mCap(kCapId), mCap(kCapId),
mMinPriority(kDefaultPriority), mMinPriority(kDefaultPriority),
mMaxPriority(kDefaultPriority), mMaxPriority(kDefaultPriority),
@ -8,7 +8,7 @@ nx::ThreadInfoEntry::ThreadInfoEntry() :
mMaxCpuId(kDefaultCpuId) mMaxCpuId(kDefaultCpuId)
{} {}
nx::ThreadInfoEntry::ThreadInfoEntry(const KernelCapabilityEntry & kernel_cap) : nn::hac::ThreadInfoEntry::ThreadInfoEntry(const KernelCapabilityEntry & kernel_cap) :
mCap(kCapId), mCap(kCapId),
mMinPriority(kDefaultPriority), mMinPriority(kDefaultPriority),
mMaxPriority(kDefaultPriority), mMaxPriority(kDefaultPriority),
@ -18,7 +18,7 @@ nx::ThreadInfoEntry::ThreadInfoEntry(const KernelCapabilityEntry & kernel_cap) :
setKernelCapability(kernel_cap); setKernelCapability(kernel_cap);
} }
nx::ThreadInfoEntry::ThreadInfoEntry(uint8_t min_priority, uint8_t max_priority, uint8_t min_core_number, uint8_t max_core_number) : nn::hac::ThreadInfoEntry::ThreadInfoEntry(uint8_t min_priority, uint8_t max_priority, uint8_t min_core_number, uint8_t max_core_number) :
mCap(kCapId), mCap(kCapId),
mMinPriority(kDefaultPriority), mMinPriority(kDefaultPriority),
mMaxPriority(kDefaultPriority), mMaxPriority(kDefaultPriority),
@ -31,7 +31,7 @@ nx::ThreadInfoEntry::ThreadInfoEntry(uint8_t min_priority, uint8_t max_priority,
setMaxCpuId(max_core_number); setMaxCpuId(max_core_number);
} }
void nx::ThreadInfoEntry::operator=(const ThreadInfoEntry& other) void nn::hac::ThreadInfoEntry::operator=(const ThreadInfoEntry& other)
{ {
mMinPriority = other.mMinPriority; mMinPriority = other.mMinPriority;
mMaxPriority = other.mMaxPriority; mMaxPriority = other.mMaxPriority;
@ -40,7 +40,7 @@ void nx::ThreadInfoEntry::operator=(const ThreadInfoEntry& other)
updateCapField(); updateCapField();
} }
bool nx::ThreadInfoEntry::operator==(const ThreadInfoEntry& other) const bool nn::hac::ThreadInfoEntry::operator==(const ThreadInfoEntry& other) const
{ {
return (mMinPriority == other.mMinPriority) \ return (mMinPriority == other.mMinPriority) \
&& (mMaxPriority == other.mMaxPriority) \ && (mMaxPriority == other.mMaxPriority) \
@ -48,17 +48,17 @@ bool nx::ThreadInfoEntry::operator==(const ThreadInfoEntry& other) const
&& (mMaxCpuId == other.mMaxCpuId); && (mMaxCpuId == other.mMaxCpuId);
} }
bool nx::ThreadInfoEntry::operator!=(const ThreadInfoEntry& other) const bool nn::hac::ThreadInfoEntry::operator!=(const ThreadInfoEntry& other) const
{ {
return !(*this == other); return !(*this == other);
} }
const nx::KernelCapabilityEntry & nx::ThreadInfoEntry::getKernelCapability() const const nn::hac::KernelCapabilityEntry & nn::hac::ThreadInfoEntry::getKernelCapability() const
{ {
return mCap; return mCap;
} }
void nx::ThreadInfoEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap) void nn::hac::ThreadInfoEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap)
{ {
if (kernel_cap.getType() != kCapId) if (kernel_cap.getType() != kCapId)
{ {
@ -69,12 +69,12 @@ void nx::ThreadInfoEntry::setKernelCapability(const KernelCapabilityEntry & kern
processCapField(); processCapField();
} }
uint8_t nx::ThreadInfoEntry::getMinPriority() const uint8_t nn::hac::ThreadInfoEntry::getMinPriority() const
{ {
return mMinPriority; return mMinPriority;
} }
void nx::ThreadInfoEntry::setMinPriority(uint8_t priority) void nn::hac::ThreadInfoEntry::setMinPriority(uint8_t priority)
{ {
if (priority > kMaxVal) if (priority > kMaxVal)
{ {
@ -85,12 +85,12 @@ void nx::ThreadInfoEntry::setMinPriority(uint8_t priority)
updateCapField(); updateCapField();
} }
uint8_t nx::ThreadInfoEntry::getMaxPriority() const uint8_t nn::hac::ThreadInfoEntry::getMaxPriority() const
{ {
return mMaxPriority; return mMaxPriority;
} }
void nx::ThreadInfoEntry::setMaxPriority(uint8_t priority) void nn::hac::ThreadInfoEntry::setMaxPriority(uint8_t priority)
{ {
if (priority > kMaxVal) if (priority > kMaxVal)
{ {
@ -101,12 +101,12 @@ void nx::ThreadInfoEntry::setMaxPriority(uint8_t priority)
updateCapField(); updateCapField();
} }
uint8_t nx::ThreadInfoEntry::getMinCpuId() const uint8_t nn::hac::ThreadInfoEntry::getMinCpuId() const
{ {
return mMinCpuId; return mMinCpuId;
} }
void nx::ThreadInfoEntry::setMinCpuId(uint8_t core_num) void nn::hac::ThreadInfoEntry::setMinCpuId(uint8_t core_num)
{ {
if (core_num > kMaxVal) if (core_num > kMaxVal)
{ {
@ -117,12 +117,12 @@ void nx::ThreadInfoEntry::setMinCpuId(uint8_t core_num)
updateCapField(); updateCapField();
} }
uint8_t nx::ThreadInfoEntry::getMaxCpuId() const uint8_t nn::hac::ThreadInfoEntry::getMaxCpuId() const
{ {
return mMaxCpuId; return mMaxCpuId;
} }
void nx::ThreadInfoEntry::setMaxCpuId(uint8_t core_num) void nn::hac::ThreadInfoEntry::setMaxCpuId(uint8_t core_num)
{ {
if (core_num > kMaxVal) if (core_num > kMaxVal)
{ {

View file

@ -1,28 +1,28 @@
#include <nx/ThreadInfoHandler.h> #include <nn/hac/ThreadInfoHandler.h>
nx::ThreadInfoHandler::ThreadInfoHandler() : nn::hac::ThreadInfoHandler::ThreadInfoHandler() :
mIsSet(false), mIsSet(false),
mEntry(0,0,0,0) mEntry(0,0,0,0)
{} {}
void nx::ThreadInfoHandler::operator=(const ThreadInfoHandler & other) void nn::hac::ThreadInfoHandler::operator=(const ThreadInfoHandler & other)
{ {
mIsSet = other.mIsSet; mIsSet = other.mIsSet;
mEntry.setKernelCapability(other.mEntry.getKernelCapability()); mEntry.setKernelCapability(other.mEntry.getKernelCapability());
} }
bool nx::ThreadInfoHandler::operator==(const ThreadInfoHandler & other) const bool nn::hac::ThreadInfoHandler::operator==(const ThreadInfoHandler & other) const
{ {
return (mIsSet == other.mIsSet) \ return (mIsSet == other.mIsSet) \
&& (mEntry.getKernelCapability() == other.mEntry.getKernelCapability()); && (mEntry.getKernelCapability() == other.mEntry.getKernelCapability());
} }
bool nx::ThreadInfoHandler::operator!=(const ThreadInfoHandler & other) const bool nn::hac::ThreadInfoHandler::operator!=(const ThreadInfoHandler & other) const
{ {
return !(*this == other); return !(*this == other);
} }
void nx::ThreadInfoHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps) void nn::hac::ThreadInfoHandler::importKernelCapabilityList(const fnd::List<KernelCapabilityEntry>& caps)
{ {
if (caps.size() > kMaxKernelCapNum) if (caps.size() > kMaxKernelCapNum)
{ {
@ -36,7 +36,7 @@ void nx::ThreadInfoHandler::importKernelCapabilityList(const fnd::List<KernelCap
mIsSet = true; mIsSet = true;
} }
void nx::ThreadInfoHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const void nn::hac::ThreadInfoHandler::exportKernelCapabilityList(fnd::List<KernelCapabilityEntry>& caps) const
{ {
if (isSet() == false) if (isSet() == false)
return; return;
@ -44,7 +44,7 @@ void nx::ThreadInfoHandler::exportKernelCapabilityList(fnd::List<KernelCapabilit
caps.addElement(mEntry.getKernelCapability()); caps.addElement(mEntry.getKernelCapability());
} }
void nx::ThreadInfoHandler::clear() void nn::hac::ThreadInfoHandler::clear()
{ {
mIsSet = false; mIsSet = false;
mEntry.setMaxPriority(0); mEntry.setMaxPriority(0);
@ -53,50 +53,50 @@ void nx::ThreadInfoHandler::clear()
mEntry.setMinCpuId(0); mEntry.setMinCpuId(0);
} }
bool nx::ThreadInfoHandler::isSet() const bool nn::hac::ThreadInfoHandler::isSet() const
{ {
return mIsSet; return mIsSet;
} }
uint8_t nx::ThreadInfoHandler::getMinPriority() const uint8_t nn::hac::ThreadInfoHandler::getMinPriority() const
{ {
return mEntry.getMinPriority(); return mEntry.getMinPriority();
} }
void nx::ThreadInfoHandler::setMinPriority(uint8_t priority) void nn::hac::ThreadInfoHandler::setMinPriority(uint8_t priority)
{ {
mEntry.setMinPriority(priority); mEntry.setMinPriority(priority);
mIsSet = true; mIsSet = true;
} }
uint8_t nx::ThreadInfoHandler::getMaxPriority() const uint8_t nn::hac::ThreadInfoHandler::getMaxPriority() const
{ {
return mEntry.getMaxPriority(); return mEntry.getMaxPriority();
} }
void nx::ThreadInfoHandler::setMaxPriority(uint8_t priority) void nn::hac::ThreadInfoHandler::setMaxPriority(uint8_t priority)
{ {
mEntry.setMaxPriority(priority); mEntry.setMaxPriority(priority);
mIsSet = true; mIsSet = true;
} }
uint8_t nx::ThreadInfoHandler::getMinCpuId() const uint8_t nn::hac::ThreadInfoHandler::getMinCpuId() const
{ {
return mEntry.getMinCpuId(); return mEntry.getMinCpuId();
} }
void nx::ThreadInfoHandler::setMinCpuId(uint8_t core_num) void nn::hac::ThreadInfoHandler::setMinCpuId(uint8_t core_num)
{ {
mEntry.setMinCpuId(core_num); mEntry.setMinCpuId(core_num);
mIsSet = true; mIsSet = true;
} }
uint8_t nx::ThreadInfoHandler::getMaxCpuId() const uint8_t nn::hac::ThreadInfoHandler::getMaxCpuId() const
{ {
return mEntry.getMaxCpuId(); return mEntry.getMaxCpuId();
} }
void nx::ThreadInfoHandler::setMaxCpuId(uint8_t core_num) void nn::hac::ThreadInfoHandler::setMaxCpuId(uint8_t core_num)
{ {
mEntry.setMaxCpuId(core_num); mEntry.setMaxCpuId(core_num);
mIsSet = true; mIsSet = true;

Some files were not shown because too many files have changed in this diff Show more