mirror of
https://github.com/jakcron/nstool.git
synced 2024-12-22 18:55:29 +00:00
Removed u8,u16,u32,u64 typedef
This commit is contained in:
parent
1362bac1cb
commit
1c60c86803
|
@ -28,19 +28,19 @@ namespace es
|
||||||
|
|
||||||
ETicketBody_V2();
|
ETicketBody_V2();
|
||||||
ETicketBody_V2(const ETicketBody_V2& other);
|
ETicketBody_V2(const ETicketBody_V2& other);
|
||||||
ETicketBody_V2(const u8* bytes, size_t len);
|
ETicketBody_V2(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
bool operator==(const ETicketBody_V2& other) const;
|
bool operator==(const ETicketBody_V2& other) const;
|
||||||
bool operator!=(const ETicketBody_V2& other) const;
|
bool operator!=(const ETicketBody_V2& other) const;
|
||||||
void operator=(const ETicketBody_V2& other);
|
void operator=(const ETicketBody_V2& other);
|
||||||
|
|
||||||
// to be used after export
|
// to be used after export
|
||||||
const u8* getBytes() const;
|
const byte_t* getBytes() const;
|
||||||
size_t getSize() const;
|
size_t getSize() const;
|
||||||
|
|
||||||
// export/import binary
|
// export/import binary
|
||||||
virtual void exportBinary();
|
virtual void exportBinary();
|
||||||
virtual void importBinary(const u8* bytes, size_t len);
|
virtual void importBinary(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
|
@ -48,20 +48,20 @@ namespace es
|
||||||
const std::string& getIssuer() const;
|
const std::string& getIssuer() const;
|
||||||
void setIssuer(const std::string& issuer);
|
void setIssuer(const std::string& issuer);
|
||||||
|
|
||||||
const u8* getEncTitleKey() const;
|
const byte_t* getEncTitleKey() const;
|
||||||
void setEncTitleKey(const u8* data, size_t len);
|
void setEncTitleKey(const byte_t* data, size_t len);
|
||||||
|
|
||||||
TitleKeyEncType getTitleKeyEncType() const;
|
TitleKeyEncType getTitleKeyEncType() const;
|
||||||
void setTitleKeyEncType(TitleKeyEncType type);
|
void setTitleKeyEncType(TitleKeyEncType type);
|
||||||
|
|
||||||
u16 getTicketVersion() const;
|
uint16_t getTicketVersion() const;
|
||||||
void setTicketVersion(u16 version);
|
void setTicketVersion(uint16_t version);
|
||||||
|
|
||||||
LicenseType getLicenseType() const;
|
LicenseType getLicenseType() const;
|
||||||
void setLicenseType(LicenseType type);
|
void setLicenseType(LicenseType type);
|
||||||
|
|
||||||
u8 getCommonKeyId() const;
|
byte_t getCommonKeyId() const;
|
||||||
void setCommonKeyId(u8 id);
|
void setCommonKeyId(byte_t id);
|
||||||
|
|
||||||
bool isPreInstall() const;
|
bool isPreInstall() const;
|
||||||
void setIsPreInstall(bool isPreInstall);
|
void setIsPreInstall(bool isPreInstall);
|
||||||
|
@ -72,37 +72,37 @@ namespace es
|
||||||
bool allowAllContent() const;
|
bool allowAllContent() const;
|
||||||
void setAllowAllContent(bool allowAllContent);
|
void setAllowAllContent(bool allowAllContent);
|
||||||
|
|
||||||
const u8* getReservedRegion() const;
|
const byte_t* getReservedRegion() const;
|
||||||
void setReservedRegion(const u8* data, size_t len);
|
void setReservedRegion(const byte_t* data, size_t len);
|
||||||
|
|
||||||
u64 getTicketId() const;
|
uint64_t getTicketId() const;
|
||||||
void setTicketId(u64 id);
|
void setTicketId(uint64_t id);
|
||||||
|
|
||||||
u64 getDeviceId() const;
|
uint64_t getDeviceId() const;
|
||||||
void setDeviceId(u64 id);
|
void setDeviceId(uint64_t id);
|
||||||
|
|
||||||
const u8* getRightsId() const;
|
const byte_t* getRightsId() const;
|
||||||
void setRightsId(const u8* id);
|
void setRightsId(const byte_t* id);
|
||||||
|
|
||||||
u32 getAccountId() const;
|
uint32_t getAccountId() const;
|
||||||
void setAccountId(u32 id);
|
void setAccountId(uint32_t id);
|
||||||
|
|
||||||
u32 getSectionTotalSize() const;
|
uint32_t getSectionTotalSize() const;
|
||||||
void setSectionTotalSize(u32 size);
|
void setSectionTotalSize(uint32_t size);
|
||||||
|
|
||||||
u32 getSectionHeaderOffset() const;
|
uint32_t getSectionHeaderOffset() const;
|
||||||
void setSectionHeaderOffset(u32 offset);
|
void setSectionHeaderOffset(uint32_t offset);
|
||||||
|
|
||||||
u16 getSectionNum() const;
|
uint16_t getSectionNum() const;
|
||||||
void setSectionNum(u16 num);
|
void setSectionNum(uint16_t num);
|
||||||
|
|
||||||
u16 getSectionEntrySize() const;
|
uint16_t getSectionEntrySize() const;
|
||||||
void setSectionEntrySize(u16 size);
|
void setSectionEntrySize(uint16_t size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "ES_ETICKET_BODY_V2";
|
const std::string kModuleName = "ES_ETICKET_BODY_V2";
|
||||||
static const size_t kIssuerLen = 0x40;
|
static const size_t kIssuerLen = 0x40;
|
||||||
static const u8 kFormatVersion = 2;
|
static const byte_t kFormatVersion = 2;
|
||||||
static const size_t kEncTitleKeyLen = crypto::rsa::kRsa2048Size;
|
static const size_t kEncTitleKeyLen = crypto::rsa::kRsa2048Size;
|
||||||
static const size_t kReservedRegionLen = 8;
|
static const size_t kReservedRegionLen = 8;
|
||||||
static const size_t kRightsIdLen = 16;
|
static const size_t kRightsIdLen = 16;
|
||||||
|
@ -119,74 +119,74 @@ namespace es
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
char issuer_[kIssuerLen];
|
char issuer_[kIssuerLen];
|
||||||
u8 enc_title_key_[kEncTitleKeyLen];
|
byte_t enc_title_key_[kEncTitleKeyLen];
|
||||||
u8 format_version_;
|
byte_t format_version_;
|
||||||
u8 title_key_enc_type_;
|
byte_t title_key_enc_type_;
|
||||||
u16 ticket_version_;
|
uint16_t ticket_version_;
|
||||||
u8 license_type_;
|
byte_t license_type_;
|
||||||
u8 common_key_id_;
|
byte_t common_key_id_;
|
||||||
u8 property_mask_;
|
byte_t property_mask_;
|
||||||
u8 reserved_0_;
|
byte_t reserved_0_;
|
||||||
u8 reserved_region_[kReservedRegionLen]; // explicitly reserved
|
byte_t reserved_region_[kReservedRegionLen]; // explicitly reserved
|
||||||
u64 ticket_id_;
|
uint64_t ticket_id_;
|
||||||
u64 device_id_;
|
uint64_t device_id_;
|
||||||
u8 rights_id_[kRightsIdLen];
|
byte_t rights_id_[kRightsIdLen];
|
||||||
u32 account_id_;
|
uint32_t account_id_;
|
||||||
u32 sect_total_size_;
|
uint32_t sect_total_size_;
|
||||||
u32 sect_header_offset_;
|
uint32_t sect_header_offset_;
|
||||||
u16 sect_num_;
|
uint16_t sect_num_;
|
||||||
u16 sect_entry_size_;
|
uint16_t sect_entry_size_;
|
||||||
public:
|
public:
|
||||||
const char* issuer() const { return issuer_; }
|
const char* issuer() const { return issuer_; }
|
||||||
void set_issuer(const char issuer[kIssuerLen]) { strncpy(issuer_, issuer, kIssuerLen); }
|
void set_issuer(const char issuer[kIssuerLen]) { strncpy(issuer_, issuer, kIssuerLen); }
|
||||||
|
|
||||||
const u8* enc_title_key() const { return enc_title_key_; }
|
const byte_t* enc_title_key() const { return enc_title_key_; }
|
||||||
void set_enc_title_key(const u8* enc_title_key, size_t len) { memset(enc_title_key_, 0, kEncTitleKeyLen); memcpy(enc_title_key_, enc_title_key, MIN(len, kEncTitleKeyLen)); }
|
void set_enc_title_key(const byte_t* enc_title_key, size_t len) { memset(enc_title_key_, 0, kEncTitleKeyLen); memcpy(enc_title_key_, enc_title_key, MIN(len, kEncTitleKeyLen)); }
|
||||||
|
|
||||||
u8 format_version() const { return format_version_; }
|
byte_t format_version() const { return format_version_; }
|
||||||
void set_format_version(u8 version) { format_version_ = version; }
|
void set_format_version(byte_t version) { format_version_ = version; }
|
||||||
|
|
||||||
u8 title_key_enc_type() const { return title_key_enc_type_; }
|
byte_t title_key_enc_type() const { return title_key_enc_type_; }
|
||||||
void set_title_key_enc_type(u8 type) { title_key_enc_type_ = type; }
|
void set_title_key_enc_type(byte_t type) { title_key_enc_type_ = type; }
|
||||||
|
|
||||||
u16 ticket_version() const { return le_hword(ticket_version_); }
|
uint16_t ticket_version() const { return le_hword(ticket_version_); }
|
||||||
void set_ticket_version(u16 version) { ticket_version_ = le_hword(version); }
|
void set_ticket_version(uint16_t version) { ticket_version_ = le_hword(version); }
|
||||||
|
|
||||||
u8 license_type() const { return license_type_; }
|
byte_t license_type() const { return license_type_; }
|
||||||
void set_license_type(u8 license_type) { license_type_ = license_type; }
|
void set_license_type(byte_t license_type) { license_type_ = license_type; }
|
||||||
|
|
||||||
u8 common_key_id() const { return common_key_id_; }
|
byte_t common_key_id() const { return common_key_id_; }
|
||||||
void set_common_key_id(u8 common_key_id) { common_key_id_ = common_key_id; }
|
void set_common_key_id(byte_t common_key_id) { common_key_id_ = common_key_id; }
|
||||||
|
|
||||||
u8 property_mask() const { return property_mask_; }
|
byte_t property_mask() const { return property_mask_; }
|
||||||
void set_property_mask(u8 mask) { property_mask_ = mask; }
|
void set_property_mask(byte_t mask) { property_mask_ = mask; }
|
||||||
|
|
||||||
const u8* reserved_region() const { return reserved_region_; }
|
const byte_t* reserved_region() const { return reserved_region_; }
|
||||||
void set_reserved_region(const u8* reserved_region, size_t len) { memcpy(reserved_region_, reserved_region, MIN(len, kReservedRegionLen)); }
|
void set_reserved_region(const byte_t* reserved_region, size_t len) { memcpy(reserved_region_, reserved_region, MIN(len, kReservedRegionLen)); }
|
||||||
|
|
||||||
u64 ticket_id() const { return le_dword(ticket_id_); }
|
uint64_t ticket_id() const { return le_dword(ticket_id_); }
|
||||||
void set_ticket_id(u64 ticket_id) { ticket_id_ = le_dword(ticket_id); }
|
void set_ticket_id(uint64_t ticket_id) { ticket_id_ = le_dword(ticket_id); }
|
||||||
|
|
||||||
u64 device_id() const { return le_dword(device_id_); }
|
uint64_t device_id() const { return le_dword(device_id_); }
|
||||||
void set_device_id(u64 device_id) { device_id_ = le_dword(device_id); }
|
void set_device_id(uint64_t device_id) { device_id_ = le_dword(device_id); }
|
||||||
|
|
||||||
const u8* rights_id() const { return rights_id_; }
|
const byte_t* rights_id() const { return rights_id_; }
|
||||||
void set_rights_id(const u8 rights_id[kRightsIdLen]) { memcpy(rights_id_, rights_id, kRightsIdLen); }
|
void set_rights_id(const byte_t rights_id[kRightsIdLen]) { memcpy(rights_id_, rights_id, kRightsIdLen); }
|
||||||
|
|
||||||
u32 account_id() const { return le_word(account_id_); }
|
uint32_t account_id() const { return le_word(account_id_); }
|
||||||
void set_account_id(u32 id) { account_id_ = le_word(id); }
|
void set_account_id(uint32_t id) { account_id_ = le_word(id); }
|
||||||
|
|
||||||
u32 sect_total_size() const { return le_word(sect_total_size_); }
|
uint32_t sect_total_size() const { return le_word(sect_total_size_); }
|
||||||
void set_sect_total_size(u32 size) { sect_total_size_ = le_word(size); }
|
void set_sect_total_size(uint32_t size) { sect_total_size_ = le_word(size); }
|
||||||
|
|
||||||
u32 sect_header_offset() const { return le_word(sect_header_offset_); }
|
uint32_t sect_header_offset() const { return le_word(sect_header_offset_); }
|
||||||
void set_sect_header_offset(u32 offset) { sect_header_offset_ = le_word(offset); }
|
void set_sect_header_offset(uint32_t offset) { sect_header_offset_ = le_word(offset); }
|
||||||
|
|
||||||
u16 sect_num() const { return le_hword(sect_num_); }
|
uint16_t sect_num() const { return le_hword(sect_num_); }
|
||||||
void set_sect_num(u16 num) { sect_num_ = num; }
|
void set_sect_num(uint16_t num) { sect_num_ = num; }
|
||||||
|
|
||||||
u16 sect_entry_size() const { return le_hword(sect_entry_size_); }
|
uint16_t sect_entry_size() const { return le_hword(sect_entry_size_); }
|
||||||
void set_sect_entry_size(u16 size) { sect_entry_size_ = le_hword(size); }
|
void set_sect_entry_size(uint16_t size) { sect_entry_size_ = le_hword(size); }
|
||||||
};
|
};
|
||||||
#pragma pack (pop)
|
#pragma pack (pop)
|
||||||
|
|
||||||
|
@ -195,23 +195,23 @@ namespace es
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
std::string mIssuer;
|
std::string mIssuer;
|
||||||
u8 mEncTitleKey[kEncTitleKeyLen];
|
byte_t mEncTitleKey[kEncTitleKeyLen];
|
||||||
TitleKeyEncType mEncType; // 0 = aes-cbc, 1 = rsa2048
|
TitleKeyEncType mEncType; // 0 = aes-cbc, 1 = rsa2048
|
||||||
u16 mTicketVersion;
|
uint16_t mTicketVersion;
|
||||||
LicenseType mLicenseType;
|
LicenseType mLicenseType;
|
||||||
u8 mCommonKeyId;
|
byte_t mCommonKeyId;
|
||||||
bool mPreInstall;
|
bool mPreInstall;
|
||||||
bool mSharedTitle;
|
bool mSharedTitle;
|
||||||
bool mAllowAllContent;
|
bool mAllowAllContent;
|
||||||
u8 mReservedRegion[kReservedRegionLen]; // explicitly reserved
|
byte_t mReservedRegion[kReservedRegionLen]; // explicitly reserved
|
||||||
u64 mTicketId;
|
uint64_t mTicketId;
|
||||||
u64 mDeviceId;
|
uint64_t mDeviceId;
|
||||||
u8 mRightsId[kRightsIdLen];
|
byte_t mRightsId[kRightsIdLen];
|
||||||
u32 mAccountId;
|
uint32_t mAccountId;
|
||||||
u32 mSectTotalSize;
|
uint32_t mSectTotalSize;
|
||||||
u32 mSectHeaderOffset;
|
uint32_t mSectHeaderOffset;
|
||||||
u16 mSectNum;
|
uint16_t mSectNum;
|
||||||
u16 mSectEntrySize;
|
uint16_t mSectEntrySize;
|
||||||
|
|
||||||
// helpers
|
// helpers
|
||||||
bool isEqual(const ETicketBody_V2& other) const;
|
bool isEqual(const ETicketBody_V2& other) const;
|
||||||
|
|
|
@ -20,14 +20,14 @@ namespace es
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static const size_t kAccessMaskSize = 0x80;
|
static const size_t kAccessMaskSize = 0x80;
|
||||||
static const u16 kGroupMask = 0xFC00;
|
static const uint16_t kGroupMask = 0xFC00;
|
||||||
static const u16 kAccessMaskMask = 0x3FF;
|
static const uint16_t kAccessMaskMask = 0x3FF;
|
||||||
|
|
||||||
u32 group_;
|
uint32_t group_;
|
||||||
u8 access_mask_[kAccessMaskSize];
|
byte_t access_mask_[kAccessMaskSize];
|
||||||
public:
|
public:
|
||||||
u32 index_group() const { return be_word(group_); }
|
uint32_t index_group() const { return be_word(group_); }
|
||||||
bool is_index_enabled(u16 index) const
|
bool is_index_enabled(uint16_t index) const
|
||||||
{
|
{
|
||||||
return (index_group() == get_group(index)) \
|
return (index_group() == get_group(index)) \
|
||||||
&& ((access_mask_[get_access_mask(index) / 8] & BIT(get_access_mask(index) % 8)) != 0);
|
&& ((access_mask_[get_access_mask(index) / 8] & BIT(get_access_mask(index) % 8)) != 0);
|
||||||
|
@ -35,12 +35,12 @@ namespace es
|
||||||
|
|
||||||
void clear() { memset(this, 0, sizeof(sContentRecord_v1)); }
|
void clear() { memset(this, 0, sizeof(sContentRecord_v1)); }
|
||||||
|
|
||||||
void set_index_group(u16 index) { group_ = be_hword(get_group(index)); }
|
void set_index_group(uint16_t index) { group_ = be_hword(get_group(index)); }
|
||||||
void enable_index(u16 index) { access_mask_[get_access_mask(index) / 8] |= BIT(get_access_mask(index) % 8); }
|
void enable_index(uint16_t index) { access_mask_[get_access_mask(index) / 8] |= BIT(get_access_mask(index) % 8); }
|
||||||
void disable_index(u16 index) { access_mask_[get_access_mask(index) / 8] &= ~BIT(get_access_mask(index) % 8); }
|
void disable_index(uint16_t index) { access_mask_[get_access_mask(index) / 8] &= ~BIT(get_access_mask(index) % 8); }
|
||||||
|
|
||||||
inline u16 get_access_mask(u16 index) const { return index & kAccessMaskMask; }
|
inline uint16_t get_access_mask(uint16_t index) const { return index & kAccessMaskMask; }
|
||||||
inline u16 get_group(u16 index) const { return index & kGroupMask; }
|
inline uint16_t get_group(uint16_t index) const { return index & kGroupMask; }
|
||||||
};
|
};
|
||||||
#pragma pack (pop)
|
#pragma pack (pop)
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,34 +21,34 @@ namespace es
|
||||||
|
|
||||||
ETicketSectionHeader_V2();
|
ETicketSectionHeader_V2();
|
||||||
ETicketSectionHeader_V2(const ETicketSectionHeader_V2& other);
|
ETicketSectionHeader_V2(const ETicketSectionHeader_V2& other);
|
||||||
ETicketSectionHeader_V2(const u8* bytes, size_t len);
|
ETicketSectionHeader_V2(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
bool operator==(const ETicketSectionHeader_V2& other) const;
|
bool operator==(const ETicketSectionHeader_V2& other) const;
|
||||||
bool operator!=(const ETicketSectionHeader_V2& other) const;
|
bool operator!=(const ETicketSectionHeader_V2& other) const;
|
||||||
void operator=(const ETicketSectionHeader_V2& other);
|
void operator=(const ETicketSectionHeader_V2& other);
|
||||||
|
|
||||||
// to be used after export
|
// to be used after export
|
||||||
const u8* getBytes() const;
|
const byte_t* getBytes() const;
|
||||||
size_t getSize() const;
|
size_t getSize() const;
|
||||||
|
|
||||||
// export/import binary
|
// export/import binary
|
||||||
virtual void exportBinary();
|
virtual void exportBinary();
|
||||||
virtual void importBinary(const u8* bytes, size_t len);
|
virtual void importBinary(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
|
|
||||||
u32 getSectionOffset() const;
|
uint32_t getSectionOffset() const;
|
||||||
void setSectionOffset(u32 offset);
|
void setSectionOffset(uint32_t offset);
|
||||||
|
|
||||||
u32 getRecordSize() const;
|
uint32_t getRecordSize() const;
|
||||||
void setRecordSize(u32 size);
|
void setRecordSize(uint32_t size);
|
||||||
|
|
||||||
u32 getSectionSize() const;
|
uint32_t getSectionSize() const;
|
||||||
void getSectionSize(u32 size);
|
void getSectionSize(uint32_t size);
|
||||||
|
|
||||||
u16 getRecordNum() const;
|
uint16_t getRecordNum() const;
|
||||||
void setRecordNum(u16 record_num);
|
void setRecordNum(uint16_t record_num);
|
||||||
|
|
||||||
SectionType getSectionType() const;
|
SectionType getSectionType() const;
|
||||||
void setSectionType(SectionType type);
|
void setSectionType(SectionType type);
|
||||||
|
@ -59,26 +59,26 @@ namespace es
|
||||||
struct sSectionHeader_v2
|
struct sSectionHeader_v2
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
u32 section_offset_;
|
uint32_t section_offset_;
|
||||||
u32 record_size_;
|
uint32_t record_size_;
|
||||||
u32 section_size_;
|
uint32_t section_size_;
|
||||||
u16 record_num_;
|
uint16_t record_num_;
|
||||||
u16 section_type_;
|
uint16_t section_type_;
|
||||||
public:
|
public:
|
||||||
u32 section_offset() const { return le_word(section_offset_); }
|
uint32_t section_offset() const { return le_word(section_offset_); }
|
||||||
void set_section_offset(u32 offset) { section_offset_ = le_word(offset); }
|
void set_section_offset(uint32_t offset) { section_offset_ = le_word(offset); }
|
||||||
|
|
||||||
u32 record_size() const { return le_word(record_size_); }
|
uint32_t record_size() const { return le_word(record_size_); }
|
||||||
void set_record_size(u32 size) { record_size_ = le_word(size); }
|
void set_record_size(uint32_t size) { record_size_ = le_word(size); }
|
||||||
|
|
||||||
u32 section_size() const { return le_word(section_size_); }
|
uint32_t section_size() const { return le_word(section_size_); }
|
||||||
void set_section_size(u32 size) { section_size_ = le_word(size); }
|
void set_section_size(uint32_t size) { section_size_ = le_word(size); }
|
||||||
|
|
||||||
u16 record_num() const { return le_hword(record_num_); }
|
uint16_t record_num() const { return le_hword(record_num_); }
|
||||||
void set_record_num(u16 num) { record_num_ = le_hword(num); }
|
void set_record_num(uint16_t num) { record_num_ = le_hword(num); }
|
||||||
|
|
||||||
u16 section_type() const { return le_hword(section_type_); }
|
uint16_t section_type() const { return le_hword(section_type_); }
|
||||||
void set_section_type(u16 type) { section_type_ = le_hword(type); }
|
void set_section_type(uint16_t type) { section_type_ = le_hword(type); }
|
||||||
};
|
};
|
||||||
#pragma pack (pop)
|
#pragma pack (pop)
|
||||||
|
|
||||||
|
@ -86,10 +86,10 @@ namespace es
|
||||||
fnd::MemoryBlob mBinaryBlob;
|
fnd::MemoryBlob mBinaryBlob;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
u32 mSectionOffset;
|
uint32_t mSectionOffset;
|
||||||
u32 mRecordSize;
|
uint32_t mRecordSize;
|
||||||
u32 mSectionSize;
|
uint32_t mSectionSize;
|
||||||
u16 mRecordNum;
|
uint16_t mRecordNum;
|
||||||
SectionType mSectionType;
|
SectionType mSectionType;
|
||||||
|
|
||||||
// helpers
|
// helpers
|
||||||
|
|
|
@ -12,7 +12,7 @@ es::ETicketBody_V2::ETicketBody_V2(const ETicketBody_V2 & other)
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
es::ETicketBody_V2::ETicketBody_V2(const u8 * bytes, size_t len)
|
es::ETicketBody_V2::ETicketBody_V2(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
importBinary(bytes, len);
|
importBinary(bytes, len);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ void es::ETicketBody_V2::operator=(const ETicketBody_V2 & other)
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 * es::ETicketBody_V2::getBytes() const
|
const byte_t * es::ETicketBody_V2::getBytes() const
|
||||||
{
|
{
|
||||||
return mBinaryBlob.getBytes();
|
return mBinaryBlob.getBytes();
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ void es::ETicketBody_V2::exportBinary()
|
||||||
body->set_enc_title_key(mEncTitleKey, kEncTitleKeyLen);
|
body->set_enc_title_key(mEncTitleKey, kEncTitleKeyLen);
|
||||||
body->set_title_key_enc_type(mEncType);
|
body->set_title_key_enc_type(mEncType);
|
||||||
body->set_ticket_version(mTicketVersion);
|
body->set_ticket_version(mTicketVersion);
|
||||||
u8 property_mask = 0;
|
byte_t property_mask = 0;
|
||||||
property_mask |= mPreInstall ? BIT(FLAG_PRE_INSTALL) : 0;
|
property_mask |= mPreInstall ? BIT(FLAG_PRE_INSTALL) : 0;
|
||||||
property_mask |= mSharedTitle ? BIT(FLAG_SHARED_TITLE) : 0;
|
property_mask |= mSharedTitle ? BIT(FLAG_SHARED_TITLE) : 0;
|
||||||
property_mask |= mAllowAllContent ? BIT(FLAG_ALLOW_ALL_CONTENT) : 0;
|
property_mask |= mAllowAllContent ? BIT(FLAG_ALLOW_ALL_CONTENT) : 0;
|
||||||
|
@ -119,7 +119,7 @@ void es::ETicketBody_V2::exportBinary()
|
||||||
body->set_sect_entry_size(mSectEntrySize);
|
body->set_sect_entry_size(mSectEntrySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::ETicketBody_V2::importBinary(const u8 * bytes, size_t len)
|
void es::ETicketBody_V2::importBinary(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
if (len < sizeof(sTicketBody_v2))
|
if (len < sizeof(sTicketBody_v2))
|
||||||
{
|
{
|
||||||
|
@ -193,12 +193,12 @@ void es::ETicketBody_V2::setIssuer(const std::string & issuer)
|
||||||
mIssuer = issuer;
|
mIssuer = issuer;
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 * es::ETicketBody_V2::getEncTitleKey() const
|
const byte_t * es::ETicketBody_V2::getEncTitleKey() const
|
||||||
{
|
{
|
||||||
return mEncTitleKey;
|
return mEncTitleKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::ETicketBody_V2::setEncTitleKey(const u8 * data, size_t len)
|
void es::ETicketBody_V2::setEncTitleKey(const byte_t * data, size_t len)
|
||||||
{
|
{
|
||||||
memset(mEncTitleKey, 0, kEncTitleKeyLen);
|
memset(mEncTitleKey, 0, kEncTitleKeyLen);
|
||||||
memcpy(mEncTitleKey, data, MIN(len, kEncTitleKeyLen));
|
memcpy(mEncTitleKey, data, MIN(len, kEncTitleKeyLen));
|
||||||
|
@ -214,12 +214,12 @@ void es::ETicketBody_V2::setTitleKeyEncType(TitleKeyEncType type)
|
||||||
mEncType = type;
|
mEncType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 es::ETicketBody_V2::getTicketVersion() const
|
uint16_t es::ETicketBody_V2::getTicketVersion() const
|
||||||
{
|
{
|
||||||
return mTicketVersion;
|
return mTicketVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::ETicketBody_V2::setTicketVersion(u16 version)
|
void es::ETicketBody_V2::setTicketVersion(uint16_t version)
|
||||||
{
|
{
|
||||||
mTicketVersion = version;
|
mTicketVersion = version;
|
||||||
}
|
}
|
||||||
|
@ -234,12 +234,12 @@ void es::ETicketBody_V2::setLicenseType(LicenseType type)
|
||||||
mLicenseType = type;
|
mLicenseType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 es::ETicketBody_V2::getCommonKeyId() const
|
byte_t es::ETicketBody_V2::getCommonKeyId() const
|
||||||
{
|
{
|
||||||
return mCommonKeyId;
|
return mCommonKeyId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::ETicketBody_V2::setCommonKeyId(u8 id)
|
void es::ETicketBody_V2::setCommonKeyId(byte_t id)
|
||||||
{
|
{
|
||||||
mCommonKeyId = id;
|
mCommonKeyId = id;
|
||||||
}
|
}
|
||||||
|
@ -274,93 +274,93 @@ void es::ETicketBody_V2::setAllowAllContent(bool allowAllContent)
|
||||||
mAllowAllContent = allowAllContent;
|
mAllowAllContent = allowAllContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 * es::ETicketBody_V2::getReservedRegion() const
|
const byte_t * es::ETicketBody_V2::getReservedRegion() const
|
||||||
{
|
{
|
||||||
return mReservedRegion;
|
return mReservedRegion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::ETicketBody_V2::setReservedRegion(const u8 * data, size_t len)
|
void es::ETicketBody_V2::setReservedRegion(const byte_t * data, size_t len)
|
||||||
{
|
{
|
||||||
memset(mReservedRegion, 0, kReservedRegionLen);
|
memset(mReservedRegion, 0, kReservedRegionLen);
|
||||||
memcpy(mReservedRegion, data, MIN(len, kReservedRegionLen));
|
memcpy(mReservedRegion, data, MIN(len, kReservedRegionLen));
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 es::ETicketBody_V2::getTicketId() const
|
uint64_t es::ETicketBody_V2::getTicketId() const
|
||||||
{
|
{
|
||||||
return mTicketId;
|
return mTicketId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::ETicketBody_V2::setTicketId(u64 id)
|
void es::ETicketBody_V2::setTicketId(uint64_t id)
|
||||||
{
|
{
|
||||||
mTicketId = id;
|
mTicketId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 es::ETicketBody_V2::getDeviceId() const
|
uint64_t es::ETicketBody_V2::getDeviceId() const
|
||||||
{
|
{
|
||||||
return mDeviceId;
|
return mDeviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::ETicketBody_V2::setDeviceId(u64 id)
|
void es::ETicketBody_V2::setDeviceId(uint64_t id)
|
||||||
{
|
{
|
||||||
mDeviceId = id;
|
mDeviceId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 * es::ETicketBody_V2::getRightsId() const
|
const byte_t * es::ETicketBody_V2::getRightsId() const
|
||||||
{
|
{
|
||||||
return mRightsId;
|
return mRightsId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::ETicketBody_V2::setRightsId(const u8 * id)
|
void es::ETicketBody_V2::setRightsId(const byte_t * id)
|
||||||
{
|
{
|
||||||
memcpy(mRightsId, id, kRightsIdLen);
|
memcpy(mRightsId, id, kRightsIdLen);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 es::ETicketBody_V2::getAccountId() const
|
uint32_t es::ETicketBody_V2::getAccountId() const
|
||||||
{
|
{
|
||||||
return mAccountId;
|
return mAccountId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::ETicketBody_V2::setAccountId(u32 id)
|
void es::ETicketBody_V2::setAccountId(uint32_t id)
|
||||||
{
|
{
|
||||||
mAccountId = id;
|
mAccountId = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 es::ETicketBody_V2::getSectionTotalSize() const
|
uint32_t es::ETicketBody_V2::getSectionTotalSize() const
|
||||||
{
|
{
|
||||||
return mSectTotalSize;
|
return mSectTotalSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::ETicketBody_V2::setSectionTotalSize(u32 size)
|
void es::ETicketBody_V2::setSectionTotalSize(uint32_t size)
|
||||||
{
|
{
|
||||||
mSectTotalSize = size;
|
mSectTotalSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 es::ETicketBody_V2::getSectionHeaderOffset() const
|
uint32_t es::ETicketBody_V2::getSectionHeaderOffset() const
|
||||||
{
|
{
|
||||||
return mSectHeaderOffset;
|
return mSectHeaderOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::ETicketBody_V2::setSectionHeaderOffset(u32 offset)
|
void es::ETicketBody_V2::setSectionHeaderOffset(uint32_t offset)
|
||||||
{
|
{
|
||||||
mSectHeaderOffset = offset;
|
mSectHeaderOffset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 es::ETicketBody_V2::getSectionNum() const
|
uint16_t es::ETicketBody_V2::getSectionNum() const
|
||||||
{
|
{
|
||||||
return mSectNum;
|
return mSectNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::ETicketBody_V2::setSectionNum(u16 num)
|
void es::ETicketBody_V2::setSectionNum(uint16_t num)
|
||||||
{
|
{
|
||||||
mSectNum = num;
|
mSectNum = num;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 es::ETicketBody_V2::getSectionEntrySize() const
|
uint16_t es::ETicketBody_V2::getSectionEntrySize() const
|
||||||
{
|
{
|
||||||
return mSectEntrySize;
|
return mSectEntrySize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::ETicketBody_V2::setSectionEntrySize(u16 size)
|
void es::ETicketBody_V2::setSectionEntrySize(uint16_t size)
|
||||||
{
|
{
|
||||||
mSectEntrySize = size;
|
mSectEntrySize = size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ es::ETicketSectionHeader_V2::ETicketSectionHeader_V2(const ETicketSectionHeader_
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
es::ETicketSectionHeader_V2::ETicketSectionHeader_V2(const u8 * bytes, size_t len)
|
es::ETicketSectionHeader_V2::ETicketSectionHeader_V2(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
importBinary(bytes, len);
|
importBinary(bytes, len);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ void es::ETicketSectionHeader_V2::operator=(const ETicketSectionHeader_V2 & othe
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 * es::ETicketSectionHeader_V2::getBytes() const
|
const byte_t * es::ETicketSectionHeader_V2::getBytes() const
|
||||||
{
|
{
|
||||||
return mBinaryBlob.getBytes();
|
return mBinaryBlob.getBytes();
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ void es::ETicketSectionHeader_V2::exportBinary()
|
||||||
hdr->set_section_type(mSectionType);
|
hdr->set_section_type(mSectionType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::ETicketSectionHeader_V2::importBinary(const u8 * bytes, size_t len)
|
void es::ETicketSectionHeader_V2::importBinary(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
if (len < sizeof(sSectionHeader_v2))
|
if (len < sizeof(sSectionHeader_v2))
|
||||||
{
|
{
|
||||||
|
@ -108,42 +108,42 @@ void es::ETicketSectionHeader_V2::clear()
|
||||||
mSectionType = PERMANENT;
|
mSectionType = PERMANENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 es::ETicketSectionHeader_V2::getSectionOffset() const
|
uint32_t es::ETicketSectionHeader_V2::getSectionOffset() const
|
||||||
{
|
{
|
||||||
return mSectionOffset;
|
return mSectionOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::ETicketSectionHeader_V2::setSectionOffset(u32 offset)
|
void es::ETicketSectionHeader_V2::setSectionOffset(uint32_t offset)
|
||||||
{
|
{
|
||||||
mSectionOffset = offset;
|
mSectionOffset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 es::ETicketSectionHeader_V2::getRecordSize() const
|
uint32_t es::ETicketSectionHeader_V2::getRecordSize() const
|
||||||
{
|
{
|
||||||
return mRecordSize;
|
return mRecordSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::ETicketSectionHeader_V2::setRecordSize(u32 size)
|
void es::ETicketSectionHeader_V2::setRecordSize(uint32_t size)
|
||||||
{
|
{
|
||||||
mRecordSize = size;
|
mRecordSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 es::ETicketSectionHeader_V2::getSectionSize() const
|
uint32_t es::ETicketSectionHeader_V2::getSectionSize() const
|
||||||
{
|
{
|
||||||
return mSectionSize;
|
return mSectionSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::ETicketSectionHeader_V2::getSectionSize(u32 size)
|
void es::ETicketSectionHeader_V2::getSectionSize(uint32_t size)
|
||||||
{
|
{
|
||||||
mSectionSize = size;
|
mSectionSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 es::ETicketSectionHeader_V2::getRecordNum() const
|
uint16_t es::ETicketSectionHeader_V2::getRecordNum() const
|
||||||
{
|
{
|
||||||
return mRecordNum;
|
return mRecordNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
void es::ETicketSectionHeader_V2::setRecordNum(u16 record_num)
|
void es::ETicketSectionHeader_V2::setRecordNum(uint16_t record_num)
|
||||||
{
|
{
|
||||||
mRecordNum = record_num;
|
mRecordNum = record_num;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,11 @@ namespace fnd
|
||||||
class ISerialiseableBinary
|
class ISerialiseableBinary
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual const u8* getBytes() const = 0;
|
virtual const byte_t* getBytes() const = 0;
|
||||||
virtual size_t getSize() const = 0;
|
virtual size_t getSize() const = 0;
|
||||||
|
|
||||||
virtual void exportBinary() = 0;
|
virtual void exportBinary() = 0;
|
||||||
virtual void importBinary(const u8* bytes, size_t len) = 0;
|
virtual void importBinary(const byte_t* bytes, size_t len) = 0;
|
||||||
|
|
||||||
virtual void clear() = 0;
|
virtual void clear() = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,6 +8,6 @@ namespace fnd
|
||||||
{
|
{
|
||||||
void readFile(const std::string& path, MemoryBlob& blob);
|
void readFile(const std::string& path, MemoryBlob& blob);
|
||||||
void writeFile(const std::string& path, const MemoryBlob& blob);
|
void writeFile(const std::string& path, const MemoryBlob& blob);
|
||||||
void writeFile(const std::string& path, const u8* data, size_t len);
|
void writeFile(const std::string& path, const byte_t* data, size_t len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,6 @@
|
||||||
#include <fnd/BitMath.h>
|
#include <fnd/BitMath.h>
|
||||||
#include <fnd/Endian.h>
|
#include <fnd/Endian.h>
|
||||||
|
|
||||||
typedef uint64_t u64;
|
|
||||||
typedef uint32_t u32;
|
|
||||||
typedef uint16_t u16;
|
|
||||||
typedef uint8_t u8;
|
|
||||||
typedef uint8_t byte_t;
|
typedef uint8_t byte_t;
|
||||||
|
|
||||||
#define MIN(x,y) ((x) <= (y)? (x) : (y))
|
#define MIN(x,y) ((x) <= (y)? (x) : (y))
|
||||||
|
|
|
@ -46,7 +46,7 @@ void io::writeFile(const std::string& path, const MemoryBlob & blob)
|
||||||
writeFile(path, blob.getBytes(), blob.getSize());
|
writeFile(path, blob.getBytes(), blob.getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void io::writeFile(const std::string & path, const u8 * data, size_t len)
|
void io::writeFile(const std::string & path, const byte_t * data, size_t len)
|
||||||
{
|
{
|
||||||
FILE* fp;
|
FILE* fp;
|
||||||
size_t filesz, filepos;
|
size_t filesz, filepos;
|
||||||
|
|
|
@ -15,19 +15,19 @@ namespace nx
|
||||||
public:
|
public:
|
||||||
AciBinary();
|
AciBinary();
|
||||||
AciBinary(const AciBinary& other);
|
AciBinary(const AciBinary& other);
|
||||||
AciBinary(const u8* bytes, size_t len);
|
AciBinary(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
bool operator==(const AciBinary& other) const;
|
bool operator==(const AciBinary& other) const;
|
||||||
bool operator!=(const AciBinary& other) const;
|
bool operator!=(const AciBinary& other) const;
|
||||||
void operator=(const AciBinary& other);
|
void operator=(const AciBinary& other);
|
||||||
|
|
||||||
// to be used after export
|
// to be used after export
|
||||||
const u8* getBytes() const;
|
const byte_t* getBytes() const;
|
||||||
size_t getSize() const;
|
size_t getSize() const;
|
||||||
|
|
||||||
// export/import binary
|
// export/import binary
|
||||||
virtual void exportBinary();
|
virtual void exportBinary();
|
||||||
virtual void importBinary(const u8* bytes, size_t len);
|
virtual void importBinary(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
|
|
|
@ -41,35 +41,35 @@ namespace nx
|
||||||
|
|
||||||
AciHeader();
|
AciHeader();
|
||||||
AciHeader(const AciHeader& other);
|
AciHeader(const AciHeader& other);
|
||||||
AciHeader(const u8* bytes, size_t len);
|
AciHeader(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
bool operator==(const AciHeader& other) const;
|
bool operator==(const AciHeader& other) const;
|
||||||
bool operator!=(const AciHeader& other) const;
|
bool operator!=(const AciHeader& other) const;
|
||||||
void operator=(const AciHeader& other);
|
void operator=(const AciHeader& other);
|
||||||
|
|
||||||
// to be used after export
|
// to be used after export
|
||||||
const u8* getBytes() const;
|
const byte_t* getBytes() const;
|
||||||
size_t getSize() const;
|
size_t getSize() const;
|
||||||
|
|
||||||
// export/import binary
|
// export/import binary
|
||||||
virtual void exportBinary();
|
virtual void exportBinary();
|
||||||
virtual void importBinary(const u8* bytes, size_t len);
|
virtual void importBinary(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
size_t getAciSize() const;
|
size_t getAciSize() const;
|
||||||
|
|
||||||
// ACI0 only
|
// ACI0 only
|
||||||
u64 getProgramId() const;
|
uint64_t getProgramId() const;
|
||||||
void setProgramId(u64 program_id);
|
void setProgramId(uint64_t program_id);
|
||||||
|
|
||||||
// ACID only
|
// ACID only
|
||||||
size_t getAcidSize() const;
|
size_t getAcidSize() const;
|
||||||
//void setAcidSize(size_t size);
|
//void setAcidSize(size_t size);
|
||||||
u64 getProgramIdMin() const;
|
uint64_t getProgramIdMin() const;
|
||||||
void setProgramIdMin(u64 program_id);
|
void setProgramIdMin(uint64_t program_id);
|
||||||
u64 getProgramIdMax() const;
|
uint64_t getProgramIdMax() const;
|
||||||
void setProgramIdMax(u64 program_id);
|
void setProgramIdMax(uint64_t program_id);
|
||||||
|
|
||||||
// ACID & ACI0
|
// ACID & ACI0
|
||||||
void setHeaderOffset(size_t offset);
|
void setHeaderOffset(size_t offset);
|
||||||
|
@ -94,42 +94,42 @@ namespace nx
|
||||||
struct sAciHeader
|
struct sAciHeader
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
u8 signature_[4];
|
byte_t signature_[4];
|
||||||
u32 size_; // includes prefacing signature, set only in ACID made by SDK (it enables easy resigning)
|
uint32_t size_; // includes prefacing signature, set only in ACID made by SDK (it enables easy resigning)
|
||||||
u8 reserved_0[4];
|
byte_t reserved_0[4];
|
||||||
u32 flags_; // set in ACID only
|
uint32_t flags_; // set in ACID only
|
||||||
u64 program_id_; // set only in ACI0 (since ACID is generic)
|
uint64_t program_id_; // set only in ACI0 (since ACID is generic)
|
||||||
u64 program_id_max_;
|
uint64_t program_id_max_;
|
||||||
struct sAciSection
|
struct sAciSection
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
u32 offset_; // aligned by 0x10 from the last one
|
uint32_t offset_; // aligned by 0x10 from the last one
|
||||||
u32 size_;
|
uint32_t size_;
|
||||||
public:
|
public:
|
||||||
u32 offset() const { return le_word(offset_); }
|
uint32_t offset() const { return le_word(offset_); }
|
||||||
void set_offset(u32 offset) { offset_ = le_word(offset); }
|
void set_offset(uint32_t offset) { offset_ = le_word(offset); }
|
||||||
|
|
||||||
u32 size() const { return le_word(size_); }
|
uint32_t size() const { return le_word(size_); }
|
||||||
void set_size(u32 size) { size_ = le_word(size); }
|
void set_size(uint32_t size) { size_ = le_word(size); }
|
||||||
} fac_, sac_, kc_;
|
} fac_, sac_, kc_;
|
||||||
public:
|
public:
|
||||||
const char* signature() const { return (const char*)signature_; }
|
const char* signature() const { return (const char*)signature_; }
|
||||||
void set_signature(const char* signature) { memcpy(signature_, signature, 4); }
|
void set_signature(const char* signature) { memcpy(signature_, signature, 4); }
|
||||||
|
|
||||||
u32 size() const { return le_word(size_); }
|
uint32_t size() const { return le_word(size_); }
|
||||||
void set_size(u32 size) { size_ = le_word(size); }
|
void set_size(uint32_t size) { size_ = le_word(size); }
|
||||||
|
|
||||||
u32 flags() const { return le_word(flags_); }
|
uint32_t flags() const { return le_word(flags_); }
|
||||||
void set_flags(u32 flags) { flags_ = le_word(flags); }
|
void set_flags(uint32_t flags) { flags_ = le_word(flags); }
|
||||||
|
|
||||||
u64 program_id() const { return le_dword(program_id_); }
|
uint64_t program_id() const { return le_dword(program_id_); }
|
||||||
void set_program_id(u64 program_id) { program_id_ = le_dword(program_id); }
|
void set_program_id(uint64_t program_id) { program_id_ = le_dword(program_id); }
|
||||||
|
|
||||||
u64 program_id_min() const { return program_id(); }
|
uint64_t program_id_min() const { return program_id(); }
|
||||||
void set_program_id_min(u64 program_id) { set_program_id(program_id); }
|
void set_program_id_min(uint64_t program_id) { set_program_id(program_id); }
|
||||||
|
|
||||||
u64 program_id_max() const { return le_dword(program_id_max_); }
|
uint64_t program_id_max() const { return le_dword(program_id_max_); }
|
||||||
void set_program_id_max(u64 program_id) { program_id_max_ = le_dword(program_id); }
|
void set_program_id_max(uint64_t program_id) { program_id_max_ = le_dword(program_id); }
|
||||||
|
|
||||||
const sAciSection& fac() const { return fac_; }
|
const sAciSection& fac() const { return fac_; }
|
||||||
sAciSection& fac() { return fac_; }
|
sAciSection& fac() { return fac_; }
|
||||||
|
@ -146,12 +146,12 @@ namespace nx
|
||||||
fnd::MemoryBlob mBinaryBlob;
|
fnd::MemoryBlob mBinaryBlob;
|
||||||
|
|
||||||
// ACI variables
|
// ACI variables
|
||||||
u64 mProgramId;
|
uint64_t mProgramId;
|
||||||
|
|
||||||
// ACID variables
|
// ACID variables
|
||||||
size_t mAcidSize;
|
size_t mAcidSize;
|
||||||
u64 mProgramIdMin;
|
uint64_t mProgramIdMin;
|
||||||
u64 mProgramIdMax;
|
uint64_t mProgramIdMax;
|
||||||
|
|
||||||
// ACI(D) variables
|
// ACI(D) variables
|
||||||
size_t mHeaderOffset;
|
size_t mHeaderOffset;
|
||||||
|
|
|
@ -12,20 +12,20 @@ namespace nx
|
||||||
public:
|
public:
|
||||||
AcidBinary();
|
AcidBinary();
|
||||||
AcidBinary(const AcidBinary& other);
|
AcidBinary(const AcidBinary& other);
|
||||||
AcidBinary(const u8* bytes, size_t len);
|
AcidBinary(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
bool operator==(const AcidBinary& other) const;
|
bool operator==(const AcidBinary& other) const;
|
||||||
bool operator!=(const AcidBinary& other) const;
|
bool operator!=(const AcidBinary& other) const;
|
||||||
void operator=(const AcidBinary& other);
|
void operator=(const AcidBinary& other);
|
||||||
|
|
||||||
// to be used after export
|
// to be used after export
|
||||||
const u8* getBytes() const;
|
const byte_t* getBytes() const;
|
||||||
size_t getSize() const;
|
size_t getSize() const;
|
||||||
|
|
||||||
// export/import binary
|
// export/import binary
|
||||||
virtual void exportBinary();
|
virtual void exportBinary();
|
||||||
void signBinary(const crypto::rsa::sRsa2048Key& key);
|
void signBinary(const crypto::rsa::sRsa2048Key& key);
|
||||||
virtual void importBinary(const u8* bytes, size_t len);
|
virtual void importBinary(const byte_t* bytes, size_t len);
|
||||||
void verifyBinary(const crypto::rsa::sRsa2048Key& key);
|
void verifyBinary(const crypto::rsa::sRsa2048Key& key);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
|
|
|
@ -13,39 +13,39 @@ namespace nx
|
||||||
public:
|
public:
|
||||||
FacBinary();
|
FacBinary();
|
||||||
FacBinary(const FacBinary& other);
|
FacBinary(const FacBinary& other);
|
||||||
FacBinary(const u8* bytes, size_t len);
|
FacBinary(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
bool operator==(const FacBinary& other) const;
|
bool operator==(const FacBinary& other) const;
|
||||||
bool operator!=(const FacBinary& other) const;
|
bool operator!=(const FacBinary& other) const;
|
||||||
void operator=(const FacBinary& other);
|
void operator=(const FacBinary& other);
|
||||||
|
|
||||||
// to be used after export
|
// to be used after export
|
||||||
const u8* getBytes() const;
|
const byte_t* getBytes() const;
|
||||||
size_t getSize() const;
|
size_t getSize() const;
|
||||||
|
|
||||||
// export/import binary
|
// export/import binary
|
||||||
void exportBinary();
|
void exportBinary();
|
||||||
void importBinary(const u8* bytes, size_t len);
|
void importBinary(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
const fnd::List<u32>& getContentOwnerIdList() const;
|
const fnd::List<uint32_t>& getContentOwnerIdList() const;
|
||||||
void setContentOwnerIdList(const fnd::List<u32>& list);
|
void setContentOwnerIdList(const fnd::List<uint32_t>& list);
|
||||||
|
|
||||||
const fnd::List<u32>& getSaveDataOwnerIdList() const;
|
const fnd::List<uint32_t>& getSaveDataOwnerIdList() const;
|
||||||
void setSaveDataOwnerIdList(const fnd::List<u32>& list);
|
void setSaveDataOwnerIdList(const fnd::List<uint32_t>& list);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "FAC_BINARY";
|
const std::string kModuleName = "FAC_BINARY";
|
||||||
static const u32 kFacFormatVersion = 1;
|
static const uint32_t kFacFormatVersion = 1;
|
||||||
|
|
||||||
// raw binary
|
// raw binary
|
||||||
fnd::MemoryBlob mBinaryBlob;
|
fnd::MemoryBlob mBinaryBlob;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
fnd::List<u32> mContentOwnerIdList;
|
fnd::List<uint32_t> mContentOwnerIdList;
|
||||||
fnd::List<u32> mSaveDataOwnerIdList;
|
fnd::List<uint32_t> mSaveDataOwnerIdList;
|
||||||
|
|
||||||
bool isEqual(const FacBinary& other) const;
|
bool isEqual(const FacBinary& other) const;
|
||||||
void copyFrom(const FacBinary& other);
|
void copyFrom(const FacBinary& other);
|
||||||
|
|
|
@ -38,26 +38,26 @@ namespace nx
|
||||||
|
|
||||||
FacHeader();
|
FacHeader();
|
||||||
FacHeader(const FacHeader& other);
|
FacHeader(const FacHeader& other);
|
||||||
FacHeader(const u8* bytes, size_t len);
|
FacHeader(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
bool operator==(const FacHeader& other) const;
|
bool operator==(const FacHeader& other) const;
|
||||||
bool operator!=(const FacHeader& other) const;
|
bool operator!=(const FacHeader& other) const;
|
||||||
void operator=(const FacHeader& other);
|
void operator=(const FacHeader& other);
|
||||||
|
|
||||||
// to be used after export
|
// to be used after export
|
||||||
const u8* getBytes() const;
|
const byte_t* getBytes() const;
|
||||||
size_t getSize() const;
|
size_t getSize() const;
|
||||||
|
|
||||||
// export/import binary
|
// export/import binary
|
||||||
void exportBinary();
|
void exportBinary();
|
||||||
void importBinary(const u8* bytes, size_t len);
|
void importBinary(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
size_t getFacSize() const;
|
size_t getFacSize() const;
|
||||||
|
|
||||||
u32 getFormatVersion() const;
|
uint32_t getFormatVersion() const;
|
||||||
void setFormatVersion(u32 version);
|
void setFormatVersion(uint32_t version);
|
||||||
|
|
||||||
const fnd::List<FsAccessFlag>& getFsaRightsList() const;
|
const fnd::List<FsAccessFlag>& getFsaRightsList() const;
|
||||||
void setFsaRightsList(const fnd::List<FsAccessFlag>& list);
|
void setFsaRightsList(const fnd::List<FsAccessFlag>& list);
|
||||||
|
@ -72,38 +72,18 @@ namespace nx
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "FAC_HEADER";
|
const std::string kModuleName = "FAC_HEADER";
|
||||||
static const u32 kFacFormatVersion = 1;
|
static const uint32_t kFacFormatVersion = 1;
|
||||||
|
|
||||||
#pragma pack (push, 1)
|
#pragma pack (push, 1)
|
||||||
struct sFacHeader
|
struct sFacHeader
|
||||||
{
|
{
|
||||||
private:
|
le_uint32_t version; // default 1
|
||||||
u32 version_; // default 1
|
le_uint64_t fac_flags;
|
||||||
u64 fac_flags_;
|
|
||||||
struct sFacSection
|
struct sFacSection
|
||||||
{
|
{
|
||||||
private:
|
le_uint32_t start;
|
||||||
u32 start_;
|
le_uint32_t end;
|
||||||
u32 end_;
|
} content_owner_ids, save_data_owner_ids; // the data for these follow later in binary. start/end relative to base of FacData instance
|
||||||
public:
|
|
||||||
u32 start() const { return le_word(start_); }
|
|
||||||
void set_start(u32 start) { start_ = le_word(start); }
|
|
||||||
|
|
||||||
u32 end() const { return le_word(end_); }
|
|
||||||
void set_end(u32 end) { end_ = le_word(end); }
|
|
||||||
} content_owner_ids_, save_data_owner_ids_; // the data for these follow later in binary. start/end relative to base of FacData instance
|
|
||||||
public:
|
|
||||||
u32 version() const { return le_word(version_); }
|
|
||||||
void set_version(u32 version) { version_ = le_word(version); }
|
|
||||||
|
|
||||||
u64 fac_flags() const { return le_dword(fac_flags_); }
|
|
||||||
void set_fac_flags(u64 fac_flags) { fac_flags_ = le_dword(fac_flags); }
|
|
||||||
|
|
||||||
const sFacSection& content_owner_ids() const { return content_owner_ids_; }
|
|
||||||
sFacSection& content_owner_ids() { return content_owner_ids_; }
|
|
||||||
|
|
||||||
const sFacSection& save_data_owner_ids() const { return save_data_owner_ids_; }
|
|
||||||
sFacSection& save_data_owner_ids() { return save_data_owner_ids_; }
|
|
||||||
};
|
};
|
||||||
#pragma pack (pop)
|
#pragma pack (pop)
|
||||||
|
|
||||||
|
@ -111,7 +91,7 @@ namespace nx
|
||||||
fnd::MemoryBlob mBinaryBlob;
|
fnd::MemoryBlob mBinaryBlob;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
u32 mVersion;
|
uint32_t mVersion;
|
||||||
fnd::List<FsAccessFlag> mFsaRights;
|
fnd::List<FsAccessFlag> mFsaRights;
|
||||||
struct sSection
|
struct sSection
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,33 +10,33 @@ namespace nx
|
||||||
public:
|
public:
|
||||||
HandleTableSizeEntry();
|
HandleTableSizeEntry();
|
||||||
HandleTableSizeEntry(const KernelCapability& kernel_cap);
|
HandleTableSizeEntry(const KernelCapability& kernel_cap);
|
||||||
HandleTableSizeEntry(u16 size);
|
HandleTableSizeEntry(uint16_t size);
|
||||||
|
|
||||||
// kernel capability
|
// kernel capability
|
||||||
const KernelCapability& getKernelCapability() const;
|
const KernelCapability& getKernelCapability() const;
|
||||||
void setKernelCapability(const KernelCapability& kernel_cap);
|
void setKernelCapability(const KernelCapability& kernel_cap);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
u16 getHandleTableSize() const;
|
uint16_t getHandleTableSize() const;
|
||||||
void setHandleTableSize(u16 size);
|
void setHandleTableSize(uint16_t size);
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "HANDLE_TABLE_SIZE_ENTRY";
|
const std::string kModuleName = "HANDLE_TABLE_SIZE_ENTRY";
|
||||||
static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_HANDLE_TABLE_SIZE;
|
static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_HANDLE_TABLE_SIZE;
|
||||||
static const u16 kValBits = 10;
|
static const uint16_t kValBits = 10;
|
||||||
static const u16 kMaxHandleTableSize = BIT(kValBits) - 1;
|
static const uint16_t kMaxHandleTableSize = BIT(kValBits) - 1;
|
||||||
|
|
||||||
KernelCapability mCap;
|
KernelCapability mCap;
|
||||||
u16 mHandleTableSize;
|
uint16_t mHandleTableSize;
|
||||||
|
|
||||||
inline void updateCapField()
|
inline void updateCapField()
|
||||||
{
|
{
|
||||||
u32 field = mHandleTableSize & kMaxHandleTableSize;
|
uint32_t field = mHandleTableSize & kMaxHandleTableSize;
|
||||||
mCap.setField(field);
|
mCap.setField(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void processCapField()
|
inline void processCapField()
|
||||||
{
|
{
|
||||||
u32 field = mCap.getField();
|
uint32_t field = mCap.getField();
|
||||||
mHandleTableSize = field & kMaxHandleTableSize;
|
mHandleTableSize = field & kMaxHandleTableSize;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,8 +21,8 @@ namespace nx
|
||||||
bool isSet() const;
|
bool isSet() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
u16 getHandleTableSize() const;
|
uint16_t getHandleTableSize() const;
|
||||||
void setHandleTableSize(u16 size);
|
void setHandleTableSize(uint16_t size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "HANDLE_TABLE_SIZE_HANDLER";
|
const std::string kModuleName = "HANDLE_TABLE_SIZE_HANDLER";
|
||||||
|
|
|
@ -8,42 +8,42 @@ namespace nx
|
||||||
class InteruptEntry
|
class InteruptEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const u32 kInteruptBits = 10;
|
static const uint32_t kInteruptBits = 10;
|
||||||
static const u32 kInteruptMax = BIT(kInteruptBits) - 1;
|
static const uint32_t kInteruptMax = BIT(kInteruptBits) - 1;
|
||||||
static const u32 kInteruptNum = 2;
|
static const uint32_t kInteruptNum = 2;
|
||||||
|
|
||||||
InteruptEntry();
|
InteruptEntry();
|
||||||
InteruptEntry(const KernelCapability& kernel_cap);
|
InteruptEntry(const KernelCapability& kernel_cap);
|
||||||
InteruptEntry(u32 interupt0, u32 interupt1);
|
InteruptEntry(uint32_t interupt0, uint32_t interupt1);
|
||||||
|
|
||||||
// kernel capability
|
// kernel capability
|
||||||
const KernelCapability& getKernelCapability() const;
|
const KernelCapability& getKernelCapability() const;
|
||||||
void setKernelCapability(const KernelCapability& kernel_cap);
|
void setKernelCapability(const KernelCapability& kernel_cap);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
u32 operator[](size_t index) const;
|
uint32_t operator[](size_t index) const;
|
||||||
|
|
||||||
u32 getInterupt(size_t index) const;
|
uint32_t getInterupt(size_t index) const;
|
||||||
void setInterupt(size_t index, u32 interupt);
|
void setInterupt(size_t index, uint32_t interupt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "INTERUPT_ENTRY";
|
const std::string kModuleName = "INTERUPT_ENTRY";
|
||||||
static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_ENABLE_INTERUPTS;
|
static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_ENABLE_INTERUPTS;
|
||||||
|
|
||||||
KernelCapability mCap;
|
KernelCapability mCap;
|
||||||
u32 mInterupt[kInteruptNum];
|
uint32_t mInterupt[kInteruptNum];
|
||||||
|
|
||||||
inline void updateCapField()
|
inline void updateCapField()
|
||||||
{
|
{
|
||||||
u32 field = 0;
|
uint32_t field = 0;
|
||||||
field |= (u32)(mInterupt[0] & kInteruptMax) << 0;
|
field |= (uint32_t)(mInterupt[0] & kInteruptMax) << 0;
|
||||||
field |= (u32)(mInterupt[1] & kInteruptMax) << kInteruptBits;
|
field |= (uint32_t)(mInterupt[1] & kInteruptMax) << kInteruptBits;
|
||||||
mCap.setField(field);
|
mCap.setField(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void processCapField()
|
inline void processCapField()
|
||||||
{
|
{
|
||||||
u32 field = mCap.getField();
|
uint32_t field = mCap.getField();
|
||||||
mInterupt[0] = (field >> 0) & kInteruptMax;
|
mInterupt[0] = (field >> 0) & kInteruptMax;
|
||||||
mInterupt[1] = (field >> kInteruptBits) & kInteruptMax;
|
mInterupt[1] = (field >> kInteruptBits) & kInteruptMax;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,14 +21,14 @@ namespace nx
|
||||||
bool isSet() const;
|
bool isSet() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
const fnd::List<u16>& getInteruptList() const;
|
const fnd::List<uint16_t>& getInteruptList() const;
|
||||||
void setInteruptList(const fnd::List<u16>& interupts);
|
void setInteruptList(const fnd::List<uint16_t>& interupts);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "INTERUPT_HANDLER";
|
const std::string kModuleName = "INTERUPT_HANDLER";
|
||||||
|
|
||||||
bool mIsSet;
|
bool mIsSet;
|
||||||
fnd::List<u16> mInterupts;
|
fnd::List<uint16_t> mInterupts;
|
||||||
|
|
||||||
void copyFrom(const InteruptHandler& other);
|
void copyFrom(const InteruptHandler& other);
|
||||||
bool isEqual(const InteruptHandler& other) const;
|
bool isEqual(const InteruptHandler& other) const;
|
||||||
|
|
|
@ -21,19 +21,19 @@ namespace nx
|
||||||
public:
|
public:
|
||||||
KcBinary();
|
KcBinary();
|
||||||
KcBinary(const KcBinary& other);
|
KcBinary(const KcBinary& other);
|
||||||
KcBinary(const u8* bytes, size_t len);
|
KcBinary(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
bool operator==(const KcBinary& other) const;
|
bool operator==(const KcBinary& other) const;
|
||||||
bool operator!=(const KcBinary& other) const;
|
bool operator!=(const KcBinary& other) const;
|
||||||
void operator=(const KcBinary& other);
|
void operator=(const KcBinary& other);
|
||||||
|
|
||||||
// to be used after export
|
// to be used after export
|
||||||
const u8* getBytes() const;
|
const byte_t* getBytes() const;
|
||||||
size_t getSize() const;
|
size_t getSize() const;
|
||||||
|
|
||||||
// export/import binary
|
// export/import binary
|
||||||
void exportBinary();
|
void exportBinary();
|
||||||
void importBinary(const u8* bytes, size_t len);
|
void importBinary(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
// variables (consider further abstraction?)
|
// variables (consider further abstraction?)
|
||||||
void clear();
|
void clear();
|
||||||
|
|
|
@ -22,32 +22,32 @@ namespace nx
|
||||||
|
|
||||||
KernelCapability();
|
KernelCapability();
|
||||||
KernelCapability(KernelCapId type);
|
KernelCapability(KernelCapId type);
|
||||||
KernelCapability(KernelCapId type, u32 field);
|
KernelCapability(KernelCapId type, uint32_t field);
|
||||||
|
|
||||||
const KernelCapability& operator=(const KernelCapability& other);
|
const KernelCapability& operator=(const KernelCapability& other);
|
||||||
bool operator==(const KernelCapability& other) const;
|
bool operator==(const KernelCapability& other) const;
|
||||||
bool operator!=(const KernelCapability& other) const;
|
bool operator!=(const KernelCapability& other) const;
|
||||||
|
|
||||||
u32 getCap() const;
|
uint32_t getCap() const;
|
||||||
void setCap(u32 cap);
|
void setCap(uint32_t cap);
|
||||||
|
|
||||||
KernelCapId getType() const;
|
KernelCapId getType() const;
|
||||||
void setType(KernelCapId type);
|
void setType(KernelCapId type);
|
||||||
|
|
||||||
u32 getField() const;
|
uint32_t getField() const;
|
||||||
void setField(u32 field);
|
void setField(uint32_t field);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KernelCapId mType;
|
KernelCapId mType;
|
||||||
u32 mField;
|
uint32_t mField;
|
||||||
|
|
||||||
inline u32 getFieldShift() const { return mType + 1; }
|
inline uint32_t getFieldShift() const { return mType + 1; }
|
||||||
inline u32 getFieldMask() const { return BIT(31 - mType) - 1; }
|
inline uint32_t getFieldMask() const { return BIT(31 - mType) - 1; }
|
||||||
inline u32 getCapMask() const { return BIT(mType) - 1; }
|
inline uint32_t getCapMask() const { return BIT(mType) - 1; }
|
||||||
inline KernelCapId getCapId(u32 cap) const
|
inline KernelCapId getCapId(uint32_t cap) const
|
||||||
{
|
{
|
||||||
KernelCapId id = KC_INVALID;
|
KernelCapId id = KC_INVALID;
|
||||||
for (u8 tmp = 0; tmp < 31; tmp++)
|
for (byte_t tmp = 0; tmp < 31; tmp++)
|
||||||
{
|
{
|
||||||
if (((cap >> tmp) & 1) == 0)
|
if (((cap >> tmp) & 1) == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,40 +10,40 @@ namespace nx
|
||||||
public:
|
public:
|
||||||
KernelVersionEntry();
|
KernelVersionEntry();
|
||||||
KernelVersionEntry(const KernelCapability& kernel_cap);
|
KernelVersionEntry(const KernelCapability& kernel_cap);
|
||||||
KernelVersionEntry(u16 major, u8 minor);
|
KernelVersionEntry(uint16_t major, uint8_t minor);
|
||||||
|
|
||||||
// kernel capability
|
// kernel capability
|
||||||
const KernelCapability& getKernelCapability() const;
|
const KernelCapability& getKernelCapability() const;
|
||||||
void setKernelCapability(const KernelCapability& kernel_cap);
|
void setKernelCapability(const KernelCapability& kernel_cap);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
u16 getVerMajor() const;
|
uint16_t getVerMajor() const;
|
||||||
void setVerMajor(u16 major);
|
void setVerMajor(uint16_t major);
|
||||||
u8 getVerMinor() const;
|
uint8_t getVerMinor() const;
|
||||||
void setVerMinor(u8 minor);
|
void setVerMinor(uint8_t minor);
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "KERNEL_VERSION_ENTRY";
|
const std::string kModuleName = "KERNEL_VERSION_ENTRY";
|
||||||
static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_KERNEL_VERSION;
|
static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_KERNEL_VERSION;
|
||||||
static const u32 kVerMajorBits = 13;
|
static const uint32_t kVerMajorBits = 13;
|
||||||
static const u32 kVerMajorMax = BIT(kVerMajorBits) - 1;
|
static const uint32_t kVerMajorMax = BIT(kVerMajorBits) - 1;
|
||||||
static const u32 kVerMinorBits = 4;
|
static const uint32_t kVerMinorBits = 4;
|
||||||
static const u32 kVerMinorMax = BIT(kVerMinorBits) - 1;
|
static const uint32_t kVerMinorMax = BIT(kVerMinorBits) - 1;
|
||||||
|
|
||||||
KernelCapability mCap;
|
KernelCapability mCap;
|
||||||
u16 mVerMajor;
|
uint16_t mVerMajor;
|
||||||
u8 mVerMinor;
|
uint8_t mVerMinor;
|
||||||
|
|
||||||
inline void updateCapField()
|
inline void updateCapField()
|
||||||
{
|
{
|
||||||
u32 field = 0;
|
uint32_t field = 0;
|
||||||
field |= (u32)(mVerMinor & kVerMinorMax) << 0;
|
field |= (uint32_t)(mVerMinor & kVerMinorMax) << 0;
|
||||||
field |= (u32)(mVerMajor & kVerMajorMax) << kVerMinorBits;
|
field |= (uint32_t)(mVerMajor & kVerMajorMax) << kVerMinorBits;
|
||||||
mCap.setField(field);
|
mCap.setField(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void processCapField()
|
inline void processCapField()
|
||||||
{
|
{
|
||||||
u32 field = mCap.getField();
|
uint32_t field = mCap.getField();
|
||||||
mVerMinor = (field >> 0) & kVerMinorMax;
|
mVerMinor = (field >> 0) & kVerMinorMax;
|
||||||
mVerMajor = (field >> kVerMinorBits) & kVerMajorMax;
|
mVerMajor = (field >> kVerMinorBits) & kVerMajorMax;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,10 +21,10 @@ namespace nx
|
||||||
bool isSet() const;
|
bool isSet() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
u16 getVerMajor() const;
|
uint16_t getVerMajor() const;
|
||||||
void setVerMajor(u16 major);
|
void setVerMajor(uint16_t major);
|
||||||
u8 getVerMinor() const;
|
uint8_t getVerMinor() const;
|
||||||
void setVerMinor(u8 minor);
|
void setVerMinor(uint8_t minor);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "KERNEL_VERSION_HANDLER";
|
const std::string kModuleName = "KERNEL_VERSION_HANDLER";
|
||||||
|
|
|
@ -21,8 +21,8 @@ namespace nx
|
||||||
|
|
||||||
struct sMemoryMapping
|
struct sMemoryMapping
|
||||||
{
|
{
|
||||||
u32 addr; // page index
|
uint32_t addr; // page index
|
||||||
u32 size; // page num
|
uint32_t size; // page num
|
||||||
MemoryPerm perm;
|
MemoryPerm perm;
|
||||||
MappingType type;
|
MappingType type;
|
||||||
|
|
||||||
|
@ -67,8 +67,8 @@ namespace nx
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "MEMORY_MAPPING_HANDLER";
|
const std::string kModuleName = "MEMORY_MAPPING_HANDLER";
|
||||||
static const u32 kMaxPageAddr = BIT(24) - 1;
|
static const uint32_t kMaxPageAddr = BIT(24) - 1;
|
||||||
static const u32 kMaxPageNum = BIT(20) - 1;
|
static const uint32_t kMaxPageNum = BIT(20) - 1;
|
||||||
|
|
||||||
bool mIsSet;
|
bool mIsSet;
|
||||||
fnd::List<sMemoryMapping> mMemRange;
|
fnd::List<sMemoryMapping> mMemRange;
|
||||||
|
|
|
@ -10,16 +10,16 @@ namespace nx
|
||||||
public:
|
public:
|
||||||
MemoryPageEntry();
|
MemoryPageEntry();
|
||||||
MemoryPageEntry(const KernelCapability& kernel_cap);
|
MemoryPageEntry(const KernelCapability& kernel_cap);
|
||||||
MemoryPageEntry(u32 page);
|
MemoryPageEntry(uint32_t page);
|
||||||
MemoryPageEntry(u32 page, bool flag);
|
MemoryPageEntry(uint32_t page, bool flag);
|
||||||
|
|
||||||
// kernel capability
|
// kernel capability
|
||||||
const KernelCapability& getKernelCapability() const;
|
const KernelCapability& getKernelCapability() const;
|
||||||
void setKernelCapability(const KernelCapability& kernel_cap);
|
void setKernelCapability(const KernelCapability& kernel_cap);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
u32 getPage() const;
|
uint32_t getPage() const;
|
||||||
void setPage(u32 page);
|
void setPage(uint32_t page);
|
||||||
bool getFlag() const;
|
bool getFlag() const;
|
||||||
void setFlag(bool flag);
|
void setFlag(bool flag);
|
||||||
|
|
||||||
|
@ -27,26 +27,26 @@ namespace nx
|
||||||
void setMapMultiplePages(bool useFlag);
|
void setMapMultiplePages(bool useFlag);
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "MEMORY_PAGE_ENTRY";
|
const std::string kModuleName = "MEMORY_PAGE_ENTRY";
|
||||||
static const u32 kPageBits = 24;
|
static const uint32_t kPageBits = 24;
|
||||||
static const u32 kMaxPage = BIT(kPageBits) - 1;
|
static const uint32_t kMaxPage = BIT(kPageBits) - 1;
|
||||||
|
|
||||||
KernelCapability mCap;
|
KernelCapability mCap;
|
||||||
u32 mPage;
|
uint32_t mPage;
|
||||||
bool mFlag;
|
bool mFlag;
|
||||||
bool mUseFlag;
|
bool mUseFlag;
|
||||||
|
|
||||||
inline void updateCapField()
|
inline void updateCapField()
|
||||||
{
|
{
|
||||||
u32 field = 0;
|
uint32_t field = 0;
|
||||||
field |= (u32)(mPage & kMaxPage) << 0;
|
field |= (uint32_t)(mPage & kMaxPage) << 0;
|
||||||
field |= (u32)(mFlag) << kPageBits;
|
field |= (uint32_t)(mFlag) << kPageBits;
|
||||||
mCap.setField(field);
|
mCap.setField(field);
|
||||||
mCap.setType(mUseFlag ? KernelCapability::KC_MEMORY_MAP : KernelCapability::KC_IO_MEMORY_MAP);
|
mCap.setType(mUseFlag ? KernelCapability::KC_MEMORY_MAP : KernelCapability::KC_IO_MEMORY_MAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void processCapField()
|
inline void processCapField()
|
||||||
{
|
{
|
||||||
u32 field = mCap.getField();
|
uint32_t field = mCap.getField();
|
||||||
mPage = (field >> 0) & kMaxPage;
|
mPage = (field >> 0) & kMaxPage;
|
||||||
mFlag = (field >> kPageBits);
|
mFlag = (field >> kPageBits);
|
||||||
mUseFlag = mCap.getType() == KernelCapability::KC_MEMORY_MAP;
|
mUseFlag = mCap.getType() == KernelCapability::KC_MEMORY_MAP;
|
||||||
|
|
|
@ -10,33 +10,33 @@ namespace nx
|
||||||
public:
|
public:
|
||||||
MiscFlagsEntry();
|
MiscFlagsEntry();
|
||||||
MiscFlagsEntry(const KernelCapability& kernel_cap);
|
MiscFlagsEntry(const KernelCapability& kernel_cap);
|
||||||
MiscFlagsEntry(u32 flags);
|
MiscFlagsEntry(uint32_t flags);
|
||||||
|
|
||||||
// kernel capability
|
// kernel capability
|
||||||
const KernelCapability& getKernelCapability() const;
|
const KernelCapability& getKernelCapability() const;
|
||||||
void setKernelCapability(const KernelCapability& kernel_cap);
|
void setKernelCapability(const KernelCapability& kernel_cap);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
u32 getFlags() const;
|
uint32_t getFlags() const;
|
||||||
void setFlags(u32 flags);
|
void setFlags(uint32_t flags);
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "MISC_FLAG_ENTRY";
|
const std::string kModuleName = "MISC_FLAG_ENTRY";
|
||||||
static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_MISC_FLAGS;
|
static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_MISC_FLAGS;
|
||||||
static const u32 kValueBits = 15;
|
static const uint32_t kValueBits = 15;
|
||||||
static const u32 kMaxVal = BIT(kValueBits)-1;
|
static const uint32_t kMaxVal = BIT(kValueBits)-1;
|
||||||
|
|
||||||
KernelCapability mCap;
|
KernelCapability mCap;
|
||||||
u32 mFlags;
|
uint32_t mFlags;
|
||||||
|
|
||||||
inline void updateCapField()
|
inline void updateCapField()
|
||||||
{
|
{
|
||||||
u32 field = mFlags & kMaxVal;
|
uint32_t field = mFlags & kMaxVal;
|
||||||
mCap.setField(field);
|
mCap.setField(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void processCapField()
|
inline void processCapField()
|
||||||
{
|
{
|
||||||
u32 field = mCap.getField();
|
uint32_t field = mCap.getField();
|
||||||
mFlags = field & kMaxVal;
|
mFlags = field & kMaxVal;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,33 +10,33 @@ namespace nx
|
||||||
public:
|
public:
|
||||||
MiscParamsEntry();
|
MiscParamsEntry();
|
||||||
MiscParamsEntry(const KernelCapability& kernel_cap);
|
MiscParamsEntry(const KernelCapability& kernel_cap);
|
||||||
MiscParamsEntry(u8 program_type);
|
MiscParamsEntry(byte_t program_type);
|
||||||
|
|
||||||
// kernel capability
|
// kernel capability
|
||||||
const KernelCapability& getKernelCapability() const;
|
const KernelCapability& getKernelCapability() const;
|
||||||
void setKernelCapability(const KernelCapability& kernel_cap);
|
void setKernelCapability(const KernelCapability& kernel_cap);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
u8 getProgramType() const;
|
byte_t getProgramType() const;
|
||||||
void setProgramType(u8 type);
|
void setProgramType(byte_t type);
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "MISC_PARAMS_ENTRY";
|
const std::string kModuleName = "MISC_PARAMS_ENTRY";
|
||||||
static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_MISC_PARAMS;
|
static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_MISC_PARAMS;
|
||||||
static const u8 kValBits = 3;
|
static const byte_t kValBits = 3;
|
||||||
static const u8 kMaxProgramType = BIT(kValBits)-1;
|
static const byte_t kMaxProgramType = BIT(kValBits)-1;
|
||||||
|
|
||||||
KernelCapability mCap;
|
KernelCapability mCap;
|
||||||
u8 mProgramType;
|
byte_t mProgramType;
|
||||||
|
|
||||||
inline void updateCapField()
|
inline void updateCapField()
|
||||||
{
|
{
|
||||||
u32 field = mProgramType & kMaxProgramType;
|
uint32_t field = mProgramType & kMaxProgramType;
|
||||||
mCap.setField(field);
|
mCap.setField(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void processCapField()
|
inline void processCapField()
|
||||||
{
|
{
|
||||||
u32 field = mCap.getField();
|
uint32_t field = mCap.getField();
|
||||||
mProgramType = field & kMaxProgramType;
|
mProgramType = field & kMaxProgramType;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,8 +21,8 @@ namespace nx
|
||||||
bool isSet() const;
|
bool isSet() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
u8 getProgramType() const;
|
byte_t getProgramType() const;
|
||||||
void setProgramType(u8 type);
|
void setProgramType(byte_t type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "MISC_PARAMS_HANDLER";
|
const std::string kModuleName = "MISC_PARAMS_HANDLER";
|
||||||
|
|
|
@ -49,48 +49,48 @@ namespace crypto
|
||||||
namespace dev
|
namespace dev
|
||||||
{
|
{
|
||||||
// aes128-xts keys (seem to use 512 block sizes, aka 0x200 blocks)
|
// aes128-xts keys (seem to use 512 block sizes, aka 0x200 blocks)
|
||||||
u8 nca_body_key[2][16] =
|
byte_t nca_body_key[2][16] =
|
||||||
{
|
{
|
||||||
{ 0xE5, 0x64, 0xDB, 0xFE, 0x52, 0x93, 0x3A, 0x65, 0x3C, 0x8B, 0x5E, 0xF8, 0x2C, 0x9D, 0xF4, 0xB5 },
|
{ 0xE5, 0x64, 0xDB, 0xFE, 0x52, 0x93, 0x3A, 0x65, 0x3C, 0x8B, 0x5E, 0xF8, 0x2C, 0x9D, 0xF4, 0xB5 },
|
||||||
{ 0x60, 0x7B, 0x77, 0x3E, 0x31, 0xE9, 0x6A, 0x8F, 0x8E, 0x44, 0x5C, 0x98, 0x71, 0xC0, 0x57, 0xDB },
|
{ 0x60, 0x7B, 0x77, 0x3E, 0x31, 0xE9, 0x6A, 0x8F, 0x8E, 0x44, 0x5C, 0x98, 0x71, 0xC0, 0x57, 0xDB },
|
||||||
};
|
};
|
||||||
|
|
||||||
u8 nca_header_key[2][16] =
|
byte_t nca_header_key[2][16] =
|
||||||
{
|
{
|
||||||
{ 0xCB, 0x9A, 0x93, 0x9F, 0x82, 0x72, 0x54, 0x4A, 0x74, 0x5D, 0x28, 0x46, 0x9D, 0xCC, 0x38, 0x12 },
|
{ 0xCB, 0x9A, 0x93, 0x9F, 0x82, 0x72, 0x54, 0x4A, 0x74, 0x5D, 0x28, 0x46, 0x9D, 0xCC, 0x38, 0x12 },
|
||||||
{ 0x06, 0x31, 0x27, 0x06, 0xAE, 0x62, 0x56, 0x8C, 0x5B, 0x7E, 0xE6, 0x9F, 0x7E, 0x01, 0x02, 0x24 },
|
{ 0x06, 0x31, 0x27, 0x06, 0xAE, 0x62, 0x56, 0x8C, 0x5B, 0x7E, 0xE6, 0x9F, 0x7E, 0x01, 0x02, 0x24 },
|
||||||
};
|
};
|
||||||
|
|
||||||
// aeskey, related to m_KeyAreaEncryptionKeyList (first in list?)
|
// aeskey, related to m_KeyAreaEncryptionKeyList (first in list?)
|
||||||
u8 key_area_encryption_key_0[0x10] = { 0x3A, 0x7C, 0x3E, 0x38, 0x4A, 0x8F, 0x22, 0xFF, 0x4B, 0x21, 0x57, 0x19, 0xB7, 0x81, 0xAD, 0x0C };
|
byte_t key_area_encryption_key_0[0x10] = { 0x3A, 0x7C, 0x3E, 0x38, 0x4A, 0x8F, 0x22, 0xFF, 0x4B, 0x21, 0x57, 0x19, 0xB7, 0x81, 0xAD, 0x0C };
|
||||||
|
|
||||||
u8 titlekey_generate_key[0x20] = { 39, 111, 56, 188, 68, 106, 241, 86, 31, 44, 90, 111, 116, 32, 93, 197, 25, 181, 59, 188, 178, 159, 211, 175, 212, 178, 162, 4, 28, 152, 117, 126 };
|
byte_t titlekey_generate_key[0x20] = { 39, 111, 56, 188, 68, 106, 241, 86, 31, 44, 90, 111, 116, 32, 93, 197, 25, 181, 59, 188, 178, 159, 211, 175, 212, 178, 162, 4, 28, 152, 117, 126 };
|
||||||
|
|
||||||
// aes128-cbc keys
|
// aes128-cbc keys
|
||||||
u8 xci_header_key[16] = { 0x01, 0xc5, 0x8f, 0xe7, 0x2d, 0x13, 0x5a, 0xb2, 0x9a, 0x3f, 0x69, 0x33, 0x95, 0x74, 0xb1 };
|
byte_t xci_header_key[16] = { 0x01, 0xc5, 0x8f, 0xe7, 0x2d, 0x13, 0x5a, 0xb2, 0x9a, 0x3f, 0x69, 0x33, 0x95, 0x74, 0xb1 };
|
||||||
u8 eticket_common_key[16] = { 0x55, 0xA3, 0xF8, 0x72, 0xBD, 0xC8, 0x0C, 0x55, 0x5A, 0x65, 0x43, 0x81, 0x13, 0x9E, 0x15, 0x3B }; // lol this 3ds dev common key
|
byte_t eticket_common_key[16] = { 0x55, 0xA3, 0xF8, 0x72, 0xBD, 0xC8, 0x0C, 0x55, 0x5A, 0x65, 0x43, 0x81, 0x13, 0x9E, 0x15, 0x3B }; // lol this 3ds dev common key
|
||||||
|
|
||||||
u8 wii_sd_key[16] = { 0xAB, 0x01, 0xB9, 0xD8, 0xE1, 0x62, 0x2B, 0x08, 0xAF, 0xBA, 0xD8, 0x4D, 0xBF, 0xC2, 0xA5, 0x5D };
|
byte_t wii_sd_key[16] = { 0xAB, 0x01, 0xB9, 0xD8, 0xE1, 0x62, 0x2B, 0x08, 0xAF, 0xBA, 0xD8, 0x4D, 0xBF, 0xC2, 0xA5, 0x5D };
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace prod
|
namespace prod
|
||||||
{
|
{
|
||||||
// encrypted with ProdNcaHeaderEncryptionKek
|
// encrypted with ProdNcaHeaderEncryptionKek
|
||||||
u8 nca_enc_header_key[2][16] =
|
byte_t nca_enc_header_key[2][16] =
|
||||||
{
|
{
|
||||||
{ 0x5A, 0x3E, 0xD8, 0x4F, 0xDE, 0xC0, 0xD8, 0x26, 0x31, 0xF7, 0xE2, 0x5D, 0x19, 0x7B, 0xF5, 0xD0 },
|
{ 0x5A, 0x3E, 0xD8, 0x4F, 0xDE, 0xC0, 0xD8, 0x26, 0x31, 0xF7, 0xE2, 0x5D, 0x19, 0x7B, 0xF5, 0xD0 },
|
||||||
{ 0x1C, 0x9B, 0x7B, 0xFA, 0xF6, 0x28, 0x18, 0x3D, 0x71, 0xF6, 0x4D, 0x73, 0xF1, 0x50, 0xB9, 0xD2 }
|
{ 0x1C, 0x9B, 0x7B, 0xFA, 0xF6, 0x28, 0x18, 0x3D, 0x71, 0xF6, 0x4D, 0x73, 0xF1, 0x50, 0xB9, 0xD2 }
|
||||||
};
|
};
|
||||||
|
|
||||||
u8 master_key_0[16] = { 0xC2, 0xCA, 0xAF, 0xF0, 0x89, 0xB9, 0xAE, 0xD5, 0x56, 0x94, 0x87, 0x60, 0x55, 0x27, 0x1C, 0x7D };
|
byte_t master_key_0[16] = { 0xC2, 0xCA, 0xAF, 0xF0, 0x89, 0xB9, 0xAE, 0xD5, 0x56, 0x94, 0x87, 0x60, 0x55, 0x27, 0x1C, 0x7D };
|
||||||
|
|
||||||
u8 nca_header_key[2][16] =
|
byte_t nca_header_key[2][16] =
|
||||||
{
|
{
|
||||||
{ 0xAE, 0xAA, 0xB1, 0xCA, 0x08, 0xAD, 0xF9, 0xBE, 0xF1, 0x29, 0x91, 0xF3, 0x69, 0xE3, 0xC5, 0x67 },
|
{ 0xAE, 0xAA, 0xB1, 0xCA, 0x08, 0xAD, 0xF9, 0xBE, 0xF1, 0x29, 0x91, 0xF3, 0x69, 0xE3, 0xC5, 0x67 },
|
||||||
{ 0xD6, 0x88, 0x1E, 0x4E, 0x4A, 0x6A, 0x47, 0xA5, 0x1F, 0x6E, 0x48, 0x77, 0x06, 0x2D, 0x54, 0x2D }
|
{ 0xD6, 0x88, 0x1E, 0x4E, 0x4A, 0x6A, 0x47, 0xA5, 0x1F, 0x6E, 0x48, 0x77, 0x06, 0x2D, 0x54, 0x2D }
|
||||||
};
|
};
|
||||||
|
|
||||||
u8 xci_header_key[16] = { 0x01, 0xC5, 0x8F, 0xE7, 0x00, 0x2D, 0x13, 0x5A, 0xB2, 0x9A, 0x3F, 0x69, 0x33, 0x95, 0x74, 0xB1 };
|
byte_t xci_header_key[16] = { 0x01, 0xC5, 0x8F, 0xE7, 0x00, 0x2D, 0x13, 0x5A, 0xB2, 0x9A, 0x3F, 0x69, 0x33, 0x95, 0x74, 0xB1 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,22 +127,22 @@ namespace crypto
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// unknown key "EncryptionKeyData"
|
// unknown key "EncryptionKeyData"
|
||||||
u8 unk_rsa_key_mod[0x100] = { 0x85, 0xF8, 0x8C, 0x41, 0x8A, 0x2D, 0x96, 0xB3, 0xF3, 0x92, 0xD0, 0x6C, 0x9D, 0x90, 0x96, 0x7F, 0x1A, 0x78, 0xD8, 0x17, 0x7A, 0xB8, 0xEC, 0x0E, 0x6E, 0x10, 0x55, 0xC8, 0xCA, 0x7F, 0x18, 0xC7, 0x18, 0x94, 0x75, 0x0D, 0xBA, 0x19, 0x44, 0xDE, 0xFA, 0x93, 0xC8, 0xCB, 0x5F, 0xCA, 0x9B, 0x09, 0x3C, 0x2E, 0x2D, 0x12, 0xB2, 0xFA, 0x0B, 0xB7, 0xC0, 0xFC, 0x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6F, 0xA5, 0x3F, 0x28, 0x3A, 0xBB, 0x37, 0x2B, 0xAD, 0xF7, 0x0F, 0x85, 0xB1, 0xDF, 0x6C, 0xC9, 0x9F, 0x85, 0x46, 0xF7, 0x50, 0xC4, 0x87, 0xA1, 0xD4, 0xAA, 0xCB, 0x01, 0x85, 0xFA, 0xC6, 0x79, 0x01, 0x2C, 0x0B, 0x2F, 0xEE, 0x71, 0xFE, 0x5D, 0x86, 0x17, 0xE5, 0x91, 0x5F, 0x44, 0x79, 0x6D, 0xC3, 0x89, 0xE3, 0x8A, 0xDD, 0x03, 0xD4, 0xCA, 0xEA, 0x79, 0xCB, 0x34, 0x61, 0xE7, 0x53, 0x41 };
|
||||||
|
|
||||||
// rsa2048-pkcs1-sha256 keys
|
// rsa2048-pkcs1-sha256 keys
|
||||||
u8 XS00000020_d[0x100] = { 0x51, 0x02, 0x71, 0x58, 0xCA, 0x69, 0xD9, 0x61, 0x3A, 0x81, 0xDE, 0x76, 0x55, 0xBB, 0xCE, 0xEA, 0x40, 0xE9, 0x9E, 0x66, 0xC7, 0xD5, 0x36, 0x36, 0x8D, 0xD3, 0xCC, 0x75, 0xAF, 0x08, 0x23, 0x9A, 0x8B, 0x07, 0xB0, 0xF4, 0xA8, 0xC9, 0xB6, 0x52, 0xC3, 0xEF, 0x00, 0x4D, 0x0A, 0x58, 0x4F, 0xA2, 0x70, 0xA3, 0xD1, 0x98, 0xE8, 0x56, 0x3B, 0x01, 0x27, 0x4C, 0x1F, 0x97, 0x2F, 0x01, 0x44, 0x86, 0x1C, 0xA9, 0x61, 0x64, 0xDF, 0x73, 0x9E, 0xAA, 0x83, 0x00, 0xA3, 0x97, 0xB9, 0x81, 0xEC, 0x13, 0xCC, 0x8E, 0x34, 0xC3, 0xCC, 0x8F, 0xF7, 0x5E, 0x61, 0xF1, 0xB2, 0x8C, 0x3D, 0xEC, 0xE9, 0x09, 0x54, 0xAA, 0x2C, 0xF4, 0xE8, 0xBC, 0xE5, 0x74, 0x4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0x08, 0x8D, 0x74, 0x35, 0xA6, 0xDE, 0x7B, 0x25, 0xAB, 0x82, 0xDD, 0x54, 0x10, 0xF2, 0x57, 0x9C, 0xAE, 0xF1, 0x49, 0x1A, 0x90, 0x9D, 0x30, 0x2B };
|
||||||
|
|
||||||
// rsa2048-pss-sha256 keys
|
// rsa2048-pss-sha256 keys
|
||||||
u8 nca_header1_d[0x100] = { 0x0C, 0x05, 0xB5, 0x6D, 0xE9, 0x0F, 0xE6, 0x41, 0x55, 0x6D, 0x52, 0x36, 0xC8, 0x57, 0xB3, 0x60, 0x57, 0xDB, 0xCD, 0xB3, 0x03, 0x0F, 0x57, 0xF1, 0x17, 0x8A, 0x30, 0x33, 0x8A, 0x68, 0x92, 0xFB, 0x73, 0x57, 0x04, 0x8A, 0xCB, 0xE3, 0xF4, 0x8A, 0xBF, 0xE3, 0xF2, 0xAC, 0x38, 0x23, 0x30, 0x26, 0x95, 0x42, 0x3D, 0x50, 0xFA, 0xB4, 0xAF, 0x60, 0x21, 0x75, 0xDC, 0xD9, 0x57, 0xB4, 0xC3, 0x6C, 0xE5, 0xF6, 0xE5, 0xE0, 0x55, 0x65, 0x77, 0x4B, 0xC7, 0xA6, 0x7E, 0x0A, 0xFE, 0xDD, 0x80, 0x42, 0x4F, 0x0D, 0x7E, 0x15, 0x8D, 0xF4, 0x27, 0x37, 0x24, 0x99, 0xF2, 0x12, 0x31, 0xDB, 0xD7, 0x7F, 0x1E, 0x92, 0x21, 0x14, 0xCA, 0x21, 0xF6, 0x50, 0x08, 0x92, 0xAE, 0x31, 0xDE, 0xF4, 0x29, 0x24, 0xD6, 0x41, 0xB3, 0x47, 0x18, 0x37, 0x14, 0xF9, 0x8D, 0x5D, 0x95, 0xF4, 0xF5, 0x7F, 0x99, 0xFB, 0x86, 0xDA, 0x65, 0xE9, 0x72, 0xA9, 0x77, 0x65, 0xC8, 0xC5, 0x29, 0x5A, 0x19, 0x2B, 0x51, 0x1C, 0x72, 0xEB, 0x49, 0xD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0x18, 0x77, 0x86, 0xD0, 0x12, 0xEB, 0x4F, 0x81, 0xA0, 0xDF, 0x20, 0x42, 0xF0, 0xF8, 0xE3, 0x00, 0xE6, 0xFC, 0xA7, 0x44, 0xF0, 0xDC, 0x2B, 0x5B, 0xA0, 0xD3, 0x01, 0x34, 0xD0, 0xD7, 0xFD, 0xEF, 0x66, 0x92, 0xB3, 0x87, 0x64, 0xD9, 0x76, 0xDA, 0x6E, 0x3A, 0x19, 0x98, 0x1F, 0xBD, 0x1F, 0x25, 0x69, 0x9F, 0x28, 0xE6, 0x9E, 0xB7, 0x38, 0x92, 0x12, 0x16, 0xDE, 0xDA, 0xE2, 0xB9, 0x7E, 0xFA, 0x98, 0x94, 0xF4, 0x9A, 0xDF, 0x2D, 0xC0, 0x99, 0x83, 0x61, 0xAD, 0xB8, 0x3E, 0x27, 0x3F, 0x0E, 0xB8, 0x9E, 0x9B, 0x11, 0x78, 0xF1, 0x06, 0x30, 0x5B, 0xCA, 0xF4, 0xEB, 0x72, 0x20, 0xD3, 0x15, 0x15, 0xC0, 0xC7, 0x1A, 0x08, 0xAE, 0x6E, 0xB2, 0x02, 0x43, 0xE9 };
|
||||||
|
|
||||||
// rsa2048-oaep-sha256 key
|
// rsa2048-oaep-sha256 key
|
||||||
u8 xci_keyarea_labledigest[0x20] = { 0xB1, 0x7B, 0x5F, 0x65, 0x0E, 0x75, 0x90, 0xED, 0xFE, 0x3A, 0xF0, 0x75, 0x0B, 0x92, 0x05, 0xB3, 0x0E, 0x7D, 0x49, 0x89, 0x24, 0xD8, 0xE3, 0x85, 0xCB, 0x40, 0xE0, 0xE7, 0xF8, 0xDE, 0xF0, 0x77 };
|
byte_t xci_keyarea_labledigest[0x20] = { 0xB1, 0x7B, 0x5F, 0x65, 0x0E, 0x75, 0x90, 0xED, 0xFE, 0x3A, 0xF0, 0x75, 0x0B, 0x92, 0x05, 0xB3, 0x0E, 0x7D, 0x49, 0x89, 0x24, 0xD8, 0xE3, 0x85, 0xCB,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 0x2B, 0x6C, 0x09, 0x2A, 0x58, 0x8A, 0x21, 0xE5, 0xB6, 0xCD, 0xAC, 0xCB, 0x84, 0x5F, 0x22, 0x16, 0x82, 0x54, 0x14, 0x03, 0xEB, 0xBB, 0x86, 0xEC, 0x59, 0x36, 0x38, 0xF8, 0x41, 0x41, 0xCA, 0x23, 0x8A, 0xF2, 0x98, 0x01, 0xAD, 0x14, 0xB6, 0x65, 0x15, 0x3B, 0x63, 0x42, 0xC1, 0x3E, 0x55, 0x8C, 0xC2, 0x38, 0x4E, 0xC0, 0x57, 0x5E, 0xFA, 0x2A, 0x2C, 0xC7, 0x9C, 0xBE, 0x5C, 0xD7, 0x56, 0x4D, 0xCF, 0x36, 0x31, 0x93, 0xD2, 0xB1, 0x0A, 0x8C, 0x7C, 0x7F, 0xFE, 0x46, 0x20, 0xE3, 0x91, 0x7C, 0x63, 0x3F, 0x24, 0x81, 0xFF, 0x4C, 0x68, 0x4F, 0xBE, 0x16, 0x68, 0x66, 0x1C, 0x90, 0xCD, 0xFE, 0x8D, 0xC5, 0x63, 0x3B, 0x2D, 0x5C, 0x25, 0x95, 0xA8, 0x4B, 0x3C, 0xAF, 0x57, 0x07, 0x84, 0x31, 0x37, 0xFA, 0x63, 0x98, 0x1B, 0xAC, 0xB2, 0x81, 0xB1, 0x29, 0x67, 0x0A, 0x31, 0x3D, 0x7E, 0x2D, 0x7F, 0xFE, 0xA5, 0x29, 0x3D, 0xBF, 0xD3, 0xCC, 0x9D, 0x73, 0x75, 0x40, 0x8B, 0x79, 0x98, 0x39, 0x8A, 0xAD, 0x90, 0x65, 0x82, 0x90, 0x09, 0xA4, 0x74, 0xA2, 0x3F, 0xEE, 0xC7, 0x75, 0x06, 0x29, 0x85 };
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,8 @@ namespace nx
|
||||||
|
|
||||||
struct sSection
|
struct sSection
|
||||||
{
|
{
|
||||||
u64 offset;
|
uint64_t offset;
|
||||||
u64 size;
|
uint64_t size;
|
||||||
crypto::sha::sSha256Hash hash;
|
crypto::sha::sSha256Hash hash;
|
||||||
|
|
||||||
const sSection& operator=(const sSection& other)
|
const sSection& operator=(const sSection& other)
|
||||||
|
@ -74,19 +74,19 @@ namespace nx
|
||||||
|
|
||||||
NcaHeader();
|
NcaHeader();
|
||||||
NcaHeader(const NcaHeader& other);
|
NcaHeader(const NcaHeader& other);
|
||||||
NcaHeader(const u8* bytes, size_t len);
|
NcaHeader(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
bool operator==(const NcaHeader& other) const;
|
bool operator==(const NcaHeader& other) const;
|
||||||
bool operator!=(const NcaHeader& other) const;
|
bool operator!=(const NcaHeader& other) const;
|
||||||
void operator=(const NcaHeader& other);
|
void operator=(const NcaHeader& other);
|
||||||
|
|
||||||
// to be used after export
|
// to be used after export
|
||||||
const u8* getBytes() const;
|
const byte_t* getBytes() const;
|
||||||
size_t getSize() const;
|
size_t getSize() const;
|
||||||
|
|
||||||
// export/import binary
|
// export/import binary
|
||||||
void exportBinary();
|
void exportBinary();
|
||||||
void importBinary(const u8* bytes, size_t len);
|
void importBinary(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
@ -100,14 +100,14 @@ namespace nx
|
||||||
void setCryptoType(byte_t type);
|
void setCryptoType(byte_t type);
|
||||||
byte_t getKaekIndex() const;
|
byte_t getKaekIndex() const;
|
||||||
void setKaekIndex(byte_t index);
|
void setKaekIndex(byte_t index);
|
||||||
u64 getNcaSize() const;
|
uint64_t getNcaSize() const;
|
||||||
void setNcaSize(u64 size);
|
void setNcaSize(uint64_t size);
|
||||||
u64 getProgramId() const;
|
uint64_t getProgramId() const;
|
||||||
void setProgramId(u64 program_id);
|
void setProgramId(uint64_t program_id);
|
||||||
u32 getContentIndex() const;
|
uint32_t getContentIndex() const;
|
||||||
void setContentIndex(u32 index);
|
void setContentIndex(uint32_t index);
|
||||||
u32 getSdkAddonVersion() const;
|
uint32_t getSdkAddonVersion() const;
|
||||||
void setSdkAddonVersion(u32 version);
|
void setSdkAddonVersion(uint32_t version);
|
||||||
const fnd::List<sSection>& getSections() const;
|
const fnd::List<sSection>& getSections() const;
|
||||||
void addSection(const sSection& section);
|
void addSection(const sSection& section);
|
||||||
const fnd::List<crypto::aes::sAes128Key>& getEncAesKeys() const;
|
const fnd::List<crypto::aes::sAes128Key>& getEncAesKeys() const;
|
||||||
|
@ -119,7 +119,7 @@ namespace nx
|
||||||
const std::string kNca3Sig = "NCA3";
|
const std::string kNca3Sig = "NCA3";
|
||||||
static const size_t kSectionNum = 4;
|
static const size_t kSectionNum = 4;
|
||||||
static const size_t kAesKeyNum = 4;
|
static const size_t kAesKeyNum = 4;
|
||||||
static const u32 kDefaultSdkAddonVersion = 721920;
|
static const uint32_t kDefaultSdkAddonVersion = 721920;
|
||||||
|
|
||||||
enum ProgramPartitionId
|
enum ProgramPartitionId
|
||||||
{
|
{
|
||||||
|
@ -166,15 +166,15 @@ namespace nx
|
||||||
ContentType mContentType;
|
ContentType mContentType;
|
||||||
byte_t mCryptoType;
|
byte_t mCryptoType;
|
||||||
byte_t mKaekIndex;
|
byte_t mKaekIndex;
|
||||||
u64 mNcaSize;
|
uint64_t mNcaSize;
|
||||||
u64 mProgramId;
|
uint64_t mProgramId;
|
||||||
u32 mContentIndex;
|
uint32_t mContentIndex;
|
||||||
u32 mSdkAddonVersion;
|
uint32_t mSdkAddonVersion;
|
||||||
fnd::List<sSection> mSections;
|
fnd::List<sSection> mSections;
|
||||||
fnd::List<crypto::aes::sAes128Key> mEncAesKeys;
|
fnd::List<crypto::aes::sAes128Key> mEncAesKeys;
|
||||||
|
|
||||||
u64 blockNumToSize(u32 block_num) const;
|
uint64_t blockNumToSize(uint32_t block_num) const;
|
||||||
u32 sizeToBlockNum(u64 real_size) const;
|
uint32_t sizeToBlockNum(uint64_t real_size) const;
|
||||||
bool isEqual(const NcaHeader& other) const;
|
bool isEqual(const NcaHeader& other) const;
|
||||||
void copyFrom(const NcaHeader& other);
|
void copyFrom(const NcaHeader& other);
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,19 +15,19 @@ namespace nx
|
||||||
public:
|
public:
|
||||||
NpdmBinary();
|
NpdmBinary();
|
||||||
NpdmBinary(const NpdmBinary& other);
|
NpdmBinary(const NpdmBinary& other);
|
||||||
NpdmBinary(const u8* bytes, size_t len);
|
NpdmBinary(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
bool operator==(const NpdmBinary& other) const;
|
bool operator==(const NpdmBinary& other) const;
|
||||||
bool operator!=(const NpdmBinary& other) const;
|
bool operator!=(const NpdmBinary& other) const;
|
||||||
void operator=(const NpdmBinary& other);
|
void operator=(const NpdmBinary& other);
|
||||||
|
|
||||||
// to be used after export
|
// to be used after export
|
||||||
const u8* getBytes() const;
|
const byte_t* getBytes() const;
|
||||||
size_t getSize() const;
|
size_t getSize() const;
|
||||||
|
|
||||||
// export/import binary
|
// export/import binary
|
||||||
void exportBinary();
|
void exportBinary();
|
||||||
void importBinary(const u8* bytes, size_t len);
|
void importBinary(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
|
|
@ -48,19 +48,19 @@ namespace nx
|
||||||
|
|
||||||
NpdmHeader();
|
NpdmHeader();
|
||||||
NpdmHeader(const NpdmHeader& other);
|
NpdmHeader(const NpdmHeader& other);
|
||||||
NpdmHeader(const u8* bytes, size_t len);
|
NpdmHeader(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
bool operator==(const NpdmHeader& other) const;
|
bool operator==(const NpdmHeader& other) const;
|
||||||
bool operator!=(const NpdmHeader& other) const;
|
bool operator!=(const NpdmHeader& other) const;
|
||||||
void operator=(const NpdmHeader& other);
|
void operator=(const NpdmHeader& other);
|
||||||
|
|
||||||
// to be used after export
|
// to be used after export
|
||||||
const u8* getBytes() const;
|
const byte_t* getBytes() const;
|
||||||
size_t getSize() const;
|
size_t getSize() const;
|
||||||
|
|
||||||
// export/import binary
|
// export/import binary
|
||||||
void exportBinary();
|
void exportBinary();
|
||||||
void importBinary(const u8* bytes, size_t len);
|
void importBinary(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
@ -72,17 +72,17 @@ namespace nx
|
||||||
ProcAddrSpaceType getProcAddressSpaceType() const;
|
ProcAddrSpaceType getProcAddressSpaceType() const;
|
||||||
void setProcAddressSpaceType(ProcAddrSpaceType type);
|
void setProcAddressSpaceType(ProcAddrSpaceType type);
|
||||||
|
|
||||||
u8 getMainThreadPriority() const;
|
byte_t getMainThreadPriority() const;
|
||||||
void setMainThreadPriority(u8 priority);
|
void setMainThreadPriority(byte_t priority);
|
||||||
|
|
||||||
u8 getMainThreadCpuId() const;
|
byte_t getMainThreadCpuId() const;
|
||||||
void setMainThreadCpuId(u8 cpu_id);
|
void setMainThreadCpuId(byte_t cpu_id);
|
||||||
|
|
||||||
u32 getVersion() const;
|
uint32_t getVersion() const;
|
||||||
void setVersion(u32 version);
|
void setVersion(uint32_t version);
|
||||||
|
|
||||||
u32 getMainThreadStackSize() const;
|
uint32_t getMainThreadStackSize() const;
|
||||||
void setMainThreadStackSize(u32 size);
|
void setMainThreadStackSize(uint32_t size);
|
||||||
|
|
||||||
const std::string& getName() const;
|
const std::string& getName() const;
|
||||||
void setName(const std::string& name);
|
void setName(const std::string& name);
|
||||||
|
@ -100,7 +100,7 @@ namespace nx
|
||||||
const std::string kNpdmStructSig = "META";
|
const std::string kNpdmStructSig = "META";
|
||||||
static const size_t kNameMaxLen = 0x10;
|
static const size_t kNameMaxLen = 0x10;
|
||||||
static const size_t kProductCodeMaxLen = 0x10;
|
static const size_t kProductCodeMaxLen = 0x10;
|
||||||
static const u32 kMaxPriority = BIT(6) -1 ;
|
static const uint32_t kMaxPriority = BIT(6) -1 ;
|
||||||
static const size_t kNpdmAlignSize = 0x10;
|
static const size_t kNpdmAlignSize = 0x10;
|
||||||
|
|
||||||
|
|
||||||
|
@ -108,49 +108,49 @@ namespace nx
|
||||||
struct sNpdmHeader
|
struct sNpdmHeader
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
u8 signature_[4]; // be"META"
|
byte_t signature_[4]; // be"META"
|
||||||
u8 reserved_0[8];
|
byte_t reserved_0[8];
|
||||||
u8 flags_;
|
byte_t flags_;
|
||||||
u8 reserved_1;
|
byte_t reserved_1;
|
||||||
u8 main_thread_priority_; // 0-63 inclusive
|
byte_t main_thread_priority_; // 0-63 inclusive
|
||||||
u8 main_thread_cpu_id_;
|
byte_t main_thread_cpu_id_;
|
||||||
u8 reserved_2[8];
|
byte_t reserved_2[8];
|
||||||
u32 version_;
|
uint32_t version_;
|
||||||
u32 main_thread_stack_size_; // default 4096
|
uint32_t main_thread_stack_size_; // default 4096
|
||||||
u8 name_[kNameMaxLen]; // important
|
byte_t name_[kNameMaxLen]; // important
|
||||||
u8 product_code_[kProductCodeMaxLen]; // can be empty
|
byte_t product_code_[kProductCodeMaxLen]; // can be empty
|
||||||
u8 reserved_3[48];
|
byte_t reserved_3[48];
|
||||||
// Access Control Info
|
// Access Control Info
|
||||||
struct sNpdmSection
|
struct sNpdmSection
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
u32 offset_;
|
uint32_t offset_;
|
||||||
u32 size_;
|
uint32_t size_;
|
||||||
public:
|
public:
|
||||||
u32 offset() const { return le_word(offset_); }
|
uint32_t offset() const { return le_word(offset_); }
|
||||||
void set_offset(u32 offset) { offset_ = le_word(offset); }
|
void set_offset(uint32_t offset) { offset_ = le_word(offset); }
|
||||||
|
|
||||||
u32 size() const { return le_word(size_); }
|
uint32_t size() const { return le_word(size_); }
|
||||||
void set_size(u32 size) { size_ = le_word(size); }
|
void set_size(uint32_t size) { size_ = le_word(size); }
|
||||||
} aci_, acid_;
|
} aci_, acid_;
|
||||||
public:
|
public:
|
||||||
const char* signature() const { return (const char*)signature_; }
|
const char* signature() const { return (const char*)signature_; }
|
||||||
void set_signature(const char* signature) { memcpy(signature_, signature, 4); }
|
void set_signature(const char* signature) { memcpy(signature_, signature, 4); }
|
||||||
|
|
||||||
u8 flags() const { return flags_; }
|
byte_t flags() const { return flags_; }
|
||||||
void set_flags(u8 flags) { flags_ = flags; }
|
void set_flags(byte_t flags) { flags_ = flags; }
|
||||||
|
|
||||||
u8 main_thread_priority() const { return main_thread_priority_; }
|
byte_t main_thread_priority() const { return main_thread_priority_; }
|
||||||
void set_main_thread_priority(u8 priority) { main_thread_priority_ = priority; }
|
void set_main_thread_priority(byte_t priority) { main_thread_priority_ = priority; }
|
||||||
|
|
||||||
u8 main_thread_cpu_id() const { return main_thread_cpu_id_; }
|
byte_t main_thread_cpu_id() const { return main_thread_cpu_id_; }
|
||||||
void set_main_thread_cpu_id(u8 cpu_id) { main_thread_cpu_id_ = cpu_id; }
|
void set_main_thread_cpu_id(byte_t cpu_id) { main_thread_cpu_id_ = cpu_id; }
|
||||||
|
|
||||||
u32 version() const { return le_word(version_); }
|
uint32_t version() const { return le_word(version_); }
|
||||||
void set_version(u32 version) { version_ = le_word(version); }
|
void set_version(uint32_t version) { version_ = le_word(version); }
|
||||||
|
|
||||||
u32 main_thread_stack_size() const { return le_word(main_thread_stack_size_); }
|
uint32_t main_thread_stack_size() const { return le_word(main_thread_stack_size_); }
|
||||||
void set_main_thread_stack_size(u32 size) { main_thread_stack_size_ = le_word(size); }
|
void set_main_thread_stack_size(uint32_t size) { main_thread_stack_size_ = le_word(size); }
|
||||||
|
|
||||||
const char* name() const { return (const char*)name_; }
|
const char* name() const { return (const char*)name_; }
|
||||||
void set_name(const char* name) { strncpy((char*)name_, name, kNameMaxLen); }
|
void set_name(const char* name) { strncpy((char*)name_, name, kNameMaxLen); }
|
||||||
|
@ -172,10 +172,10 @@ namespace nx
|
||||||
// variables
|
// variables
|
||||||
InstructionType mInstructionType;
|
InstructionType mInstructionType;
|
||||||
ProcAddrSpaceType mProcAddressSpaceType;
|
ProcAddrSpaceType mProcAddressSpaceType;
|
||||||
u8 mMainThreadPriority;
|
byte_t mMainThreadPriority;
|
||||||
u8 mMainThreadCpuId;
|
byte_t mMainThreadCpuId;
|
||||||
u32 mVersion;
|
uint32_t mVersion;
|
||||||
u32 mMainThreadStackSize;
|
uint32_t mMainThreadStackSize;
|
||||||
std::string mName;
|
std::string mName;
|
||||||
std::string mProductCode;
|
std::string mProductCode;
|
||||||
sSection mAciPos;
|
sSection mAciPos;
|
||||||
|
|
|
@ -51,19 +51,19 @@ namespace nx
|
||||||
|
|
||||||
PfsHeader();
|
PfsHeader();
|
||||||
PfsHeader(const PfsHeader& other);
|
PfsHeader(const PfsHeader& other);
|
||||||
PfsHeader(const u8* bytes, size_t len);
|
PfsHeader(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
bool operator==(const PfsHeader& other) const;
|
bool operator==(const PfsHeader& other) const;
|
||||||
bool operator!=(const PfsHeader& other) const;
|
bool operator!=(const PfsHeader& other) const;
|
||||||
void operator=(const PfsHeader& other);
|
void operator=(const PfsHeader& other);
|
||||||
|
|
||||||
// to be used after export
|
// to be used after export
|
||||||
const u8* getBytes() const;
|
const byte_t* getBytes() const;
|
||||||
size_t getSize() const;
|
size_t getSize() const;
|
||||||
|
|
||||||
// export/import binary
|
// export/import binary
|
||||||
void exportBinary();
|
void exportBinary();
|
||||||
void importBinary(const u8* bytes, size_t len);
|
void importBinary(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
@ -79,36 +79,16 @@ namespace nx
|
||||||
#pragma pack (push, 1)
|
#pragma pack (push, 1)
|
||||||
struct sPfsFile
|
struct sPfsFile
|
||||||
{
|
{
|
||||||
private:
|
le_uint64_t data_offset;
|
||||||
u64 data_offset_;
|
le_uint64_t size;
|
||||||
u64 size_;
|
le_uint64_t name_offset;
|
||||||
u64 name_offset_;
|
|
||||||
public:
|
|
||||||
u64 offset() const { return le_dword(data_offset_); }
|
|
||||||
void set_offset(u64 offset) { data_offset_ = le_dword(offset); }
|
|
||||||
|
|
||||||
u64 size() const { return le_dword(size_); }
|
|
||||||
void set_size(u64 size) { size_ = le_dword(size); }
|
|
||||||
|
|
||||||
u64 name_offset() const { return le_dword(name_offset_); }
|
|
||||||
void set_name_offset(u64 offset) { name_offset_ = le_dword(offset); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sPfsHeader
|
struct sPfsHeader
|
||||||
{
|
{
|
||||||
private:
|
char signature[4];
|
||||||
u8 signature_[4];
|
le_uint32_t file_num;
|
||||||
u32 file_num_;
|
le_uint64_t name_table_size;
|
||||||
u64 name_table_size_;
|
|
||||||
public:
|
|
||||||
const char* signature() const { return (const char*)signature_; }
|
|
||||||
void set_signature(const char* signature) { memcpy(signature_, signature, 4); }
|
|
||||||
|
|
||||||
u32 file_num() const { return le_word(file_num_); }
|
|
||||||
void set_file_num(u32 file_num) { file_num_ = le_word(file_num); }
|
|
||||||
|
|
||||||
u64 name_table_size() const { return le_dword(name_table_size_); }
|
|
||||||
void set_name_table_size(u64 size) { name_table_size_ = le_dword(size); }
|
|
||||||
};
|
};
|
||||||
#pragma pack (pop)
|
#pragma pack (pop)
|
||||||
|
|
||||||
|
|
|
@ -14,19 +14,19 @@ namespace nx
|
||||||
public:
|
public:
|
||||||
SacBinary();
|
SacBinary();
|
||||||
SacBinary(const SacBinary& other);
|
SacBinary(const SacBinary& other);
|
||||||
SacBinary(const u8* bytes, size_t len);
|
SacBinary(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
bool operator==(const SacBinary& other) const;
|
bool operator==(const SacBinary& other) const;
|
||||||
bool operator!=(const SacBinary& other) const;
|
bool operator!=(const SacBinary& other) const;
|
||||||
void operator=(const SacBinary& other);
|
void operator=(const SacBinary& other);
|
||||||
|
|
||||||
// to be used after export
|
// to be used after export
|
||||||
const u8* getBytes() const;
|
const byte_t* getBytes() const;
|
||||||
size_t getSize() const;
|
size_t getSize() const;
|
||||||
|
|
||||||
// export/import binary
|
// export/import binary
|
||||||
void exportBinary();
|
void exportBinary();
|
||||||
void importBinary(const u8* bytes, size_t len);
|
void importBinary(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
|
|
@ -19,12 +19,12 @@ namespace nx
|
||||||
void operator=(const SacEntry& other);
|
void operator=(const SacEntry& other);
|
||||||
|
|
||||||
// to be used after export
|
// to be used after export
|
||||||
const u8* getBytes() const;
|
const byte_t* getBytes() const;
|
||||||
size_t getSize() const;
|
size_t getSize() const;
|
||||||
|
|
||||||
// export/import binary
|
// export/import binary
|
||||||
void exportBinary();
|
void exportBinary();
|
||||||
void importBinary(const u8* bytes, size_t len);
|
void importBinary(const byte_t* bytes, size_t len);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
void clear();
|
void clear();
|
||||||
|
|
|
@ -10,41 +10,41 @@ namespace nx
|
||||||
public:
|
public:
|
||||||
SystemCallEntry();
|
SystemCallEntry();
|
||||||
SystemCallEntry(const KernelCapability& kernel_cap);
|
SystemCallEntry(const KernelCapability& kernel_cap);
|
||||||
SystemCallEntry(u32 upper_bits, u32 lower_bits);
|
SystemCallEntry(uint32_t upper_bits, uint32_t lower_bits);
|
||||||
|
|
||||||
// kernel capability
|
// kernel capability
|
||||||
const KernelCapability& getKernelCapability() const;
|
const KernelCapability& getKernelCapability() const;
|
||||||
void setKernelCapability(const KernelCapability& kernel_cap);
|
void setKernelCapability(const KernelCapability& kernel_cap);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
u32 getSystemCallUpperBits() const;
|
uint32_t getSystemCallUpperBits() const;
|
||||||
void setSystemCallUpperBits(u32 upper_bits);
|
void setSystemCallUpperBits(uint32_t upper_bits);
|
||||||
u32 getSystemCallLowerBits() const;
|
uint32_t getSystemCallLowerBits() const;
|
||||||
void setSystemCallLowerBits(u32 lower_bits);
|
void setSystemCallLowerBits(uint32_t lower_bits);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "SYSTEM_CALL_ENTRY";
|
const std::string kModuleName = "SYSTEM_CALL_ENTRY";
|
||||||
static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_ENABLE_SYSTEM_CALLS;
|
static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_ENABLE_SYSTEM_CALLS;
|
||||||
static const u32 kSysCallUpperBits = 3;
|
static const uint32_t kSysCallUpperBits = 3;
|
||||||
static const u32 kSysCallLowerBits = 24;
|
static const uint32_t kSysCallLowerBits = 24;
|
||||||
static const u32 kSysCallUpperMax = BIT(kSysCallUpperBits) - 1;
|
static const uint32_t kSysCallUpperMax = BIT(kSysCallUpperBits) - 1;
|
||||||
static const u32 kSysCallLowerMax = BIT(kSysCallLowerBits) - 1;
|
static const uint32_t kSysCallLowerMax = BIT(kSysCallLowerBits) - 1;
|
||||||
|
|
||||||
KernelCapability mCap;
|
KernelCapability mCap;
|
||||||
u32 mSystemCallUpper;
|
uint32_t mSystemCallUpper;
|
||||||
u32 mSystemCallLower;
|
uint32_t mSystemCallLower;
|
||||||
|
|
||||||
inline void updateCapField()
|
inline void updateCapField()
|
||||||
{
|
{
|
||||||
u32 field = 0;
|
uint32_t field = 0;
|
||||||
field |= (u32)(mSystemCallLower & kSysCallLowerMax) << 0;
|
field |= (uint32_t)(mSystemCallLower & kSysCallLowerMax) << 0;
|
||||||
field |= (u32)(mSystemCallUpper & kSysCallUpperMax) << kSysCallLowerBits;
|
field |= (uint32_t)(mSystemCallUpper & kSysCallUpperMax) << kSysCallLowerBits;
|
||||||
mCap.setField(field);
|
mCap.setField(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void processCapField()
|
inline void processCapField()
|
||||||
{
|
{
|
||||||
u32 field = mCap.getField();
|
uint32_t field = mCap.getField();
|
||||||
mSystemCallLower = (field >> 0) & kSysCallLowerMax;
|
mSystemCallLower = (field >> 0) & kSysCallLowerMax;
|
||||||
mSystemCallUpper = (field >> kSysCallLowerBits) & kSysCallUpperMax;
|
mSystemCallUpper = (field >> kSysCallLowerBits) & kSysCallUpperMax;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,16 +20,16 @@ namespace nx
|
||||||
bool isSet() const;
|
bool isSet() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
const fnd::List<u8>& getSystemCalls() const;
|
const fnd::List<uint8_t>& getSystemCalls() const;
|
||||||
void setSystemCallList(const fnd::List<u8>& calls);
|
void setSystemCallList(const fnd::List<uint8_t>& calls);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "SYSTEM_CALL_HANDLER";
|
const std::string kModuleName = "SYSTEM_CALL_HANDLER";
|
||||||
static const u32 kMaxSystemCall = (BIT(3) * 24) - 1;
|
static const uint32_t kMaxSystemCall = (BIT(3) * 24) - 1;
|
||||||
static const size_t kSyscallTotalEntryNum = (kMaxSystemCall / 24) + 1;
|
static const size_t kSyscallTotalEntryNum = (kMaxSystemCall / 24) + 1;
|
||||||
|
|
||||||
bool mIsSet;
|
bool mIsSet;
|
||||||
fnd::List<u8> mSystemCalls;
|
fnd::List<uint8_t> mSystemCalls;
|
||||||
|
|
||||||
void copyFrom(const SystemCallHandler& other);
|
void copyFrom(const SystemCallHandler& other);
|
||||||
bool isEqual(const SystemCallHandler& other) const;
|
bool isEqual(const SystemCallHandler& other) const;
|
||||||
|
|
|
@ -10,49 +10,49 @@ namespace nx
|
||||||
public:
|
public:
|
||||||
ThreadInfoEntry();
|
ThreadInfoEntry();
|
||||||
ThreadInfoEntry(const KernelCapability& kernel_cap);
|
ThreadInfoEntry(const KernelCapability& kernel_cap);
|
||||||
ThreadInfoEntry(u8 min_priority, u8 max_priority, u8 min_cpu_id, u8 max_cpu_id);
|
ThreadInfoEntry(uint8_t min_priority, uint8_t max_priority, uint8_t min_cpu_id, uint8_t max_cpu_id);
|
||||||
|
|
||||||
// kernel capability
|
// kernel capability
|
||||||
const KernelCapability& getKernelCapability() const;
|
const KernelCapability& getKernelCapability() const;
|
||||||
void setKernelCapability(const KernelCapability& kernel_cap);
|
void setKernelCapability(const KernelCapability& kernel_cap);
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
u8 getMinPriority() const;
|
uint8_t getMinPriority() const;
|
||||||
void setMinPriority(u8 priority);
|
void setMinPriority(uint8_t priority);
|
||||||
u8 getMaxPriority() const;
|
uint8_t getMaxPriority() const;
|
||||||
void setMaxPriority(u8 priority);
|
void setMaxPriority(uint8_t priority);
|
||||||
u8 getMinCpuId() const;
|
uint8_t getMinCpuId() const;
|
||||||
void setMinCpuId(u8 cpu_id);
|
void setMinCpuId(uint8_t cpu_id);
|
||||||
u8 getMaxCpuId() const;
|
uint8_t getMaxCpuId() const;
|
||||||
void setMaxCpuId(u8 cpu_id);
|
void setMaxCpuId(uint8_t cpu_id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "THREAD_INFO_ENTRY";
|
const std::string kModuleName = "THREAD_INFO_ENTRY";
|
||||||
static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_THREAD_INFO;
|
static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_THREAD_INFO;
|
||||||
static const u8 kValBits = 6;
|
static const uint8_t kValBits = 6;
|
||||||
static const u8 kMaxVal = BIT(kValBits)-1;
|
static const uint8_t kMaxVal = BIT(kValBits)-1;
|
||||||
static const u8 kDefaultPriority = 6;
|
static const uint8_t kDefaultPriority = 6;
|
||||||
static const u8 kDefaultCpuId = 8;
|
static const uint8_t kDefaultCpuId = 8;
|
||||||
|
|
||||||
KernelCapability mCap;
|
KernelCapability mCap;
|
||||||
u8 mMinPriority;
|
uint8_t mMinPriority;
|
||||||
u8 mMaxPriority;
|
uint8_t mMaxPriority;
|
||||||
u8 mMinCpuId;
|
uint8_t mMinCpuId;
|
||||||
u8 mMaxCpuId;
|
uint8_t mMaxCpuId;
|
||||||
|
|
||||||
inline void updateCapField()
|
inline void updateCapField()
|
||||||
{
|
{
|
||||||
u32 field = 0;
|
uint32_t field = 0;
|
||||||
field |= (u32)(mMinPriority & kMaxVal) << (kValBits * 0);
|
field |= (uint32_t)(mMinPriority & kMaxVal) << (kValBits * 0);
|
||||||
field |= (u32)(mMaxPriority & kMaxVal) << (kValBits * 1);
|
field |= (uint32_t)(mMaxPriority & kMaxVal) << (kValBits * 1);
|
||||||
field |= (u32)(mMinCpuId & kMaxVal) << (kValBits * 2);
|
field |= (uint32_t)(mMinCpuId & kMaxVal) << (kValBits * 2);
|
||||||
field |= (u32)(mMaxCpuId & kMaxVal) << (kValBits * 3);
|
field |= (uint32_t)(mMaxCpuId & kMaxVal) << (kValBits * 3);
|
||||||
mCap.setField(field);
|
mCap.setField(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void processCapField()
|
inline void processCapField()
|
||||||
{
|
{
|
||||||
u32 field = mCap.getField();
|
uint32_t field = mCap.getField();
|
||||||
mMinPriority = (field >> (kValBits * 0)) & kMaxVal;
|
mMinPriority = (field >> (kValBits * 0)) & kMaxVal;
|
||||||
mMaxPriority = (field >> (kValBits * 1)) & kMaxVal;
|
mMaxPriority = (field >> (kValBits * 1)) & kMaxVal;
|
||||||
mMinCpuId = (field >> (kValBits * 2)) & kMaxVal;
|
mMinCpuId = (field >> (kValBits * 2)) & kMaxVal;
|
||||||
|
|
|
@ -21,14 +21,14 @@ namespace nx
|
||||||
bool isSet() const;
|
bool isSet() const;
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
u8 getMinPriority() const;
|
uint8_t getMinPriority() const;
|
||||||
void setMinPriority(u8 priority);
|
void setMinPriority(uint8_t priority);
|
||||||
u8 getMaxPriority() const;
|
uint8_t getMaxPriority() const;
|
||||||
void setMaxPriority(u8 priority);
|
void setMaxPriority(uint8_t priority);
|
||||||
u8 getMinCpuId() const;
|
uint8_t getMinCpuId() const;
|
||||||
void setMinCpuId(u8 core_num);
|
void setMinCpuId(uint8_t core_num);
|
||||||
u8 getMaxCpuId() const;
|
uint8_t getMaxCpuId() const;
|
||||||
void setMaxCpuId(u8 core_num);
|
void setMaxCpuId(uint8_t core_num);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string kModuleName = "THREAD_INFO_HANDLER";
|
const std::string kModuleName = "THREAD_INFO_HANDLER";
|
||||||
|
|
|
@ -45,45 +45,45 @@ namespace nx
|
||||||
|
|
||||||
struct sContentMetaInfo
|
struct sContentMetaInfo
|
||||||
{
|
{
|
||||||
u64 id;
|
uint64_t id;
|
||||||
u32 version;
|
uint32_t version;
|
||||||
u8 type; // ContentMetaType
|
byte_t type; // ContentMetaType
|
||||||
u8 attributes;
|
byte_t attributes;
|
||||||
u8 reserved[2];
|
byte_t reserved[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sContentInfo
|
struct sContentInfo
|
||||||
{
|
{
|
||||||
u8 id[16];
|
byte_t id[16];
|
||||||
u32 size_low;
|
uint32_t size_low;
|
||||||
u16 size_high;
|
uint16_t size_high;
|
||||||
u8 type;
|
byte_t type;
|
||||||
u8 reserved;
|
byte_t reserved;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sXciHeader
|
struct sXciHeader
|
||||||
{
|
{
|
||||||
u8 signature[4];
|
byte_t signature[4];
|
||||||
u32 rom_area_start_page;
|
uint32_t rom_area_start_page;
|
||||||
u32 backup_area_start_page;
|
uint32_t backup_area_start_page;
|
||||||
u8 key_flag; // bit0-3 = KekIndex, bit4-7 = TitleKeyDecIndex
|
byte_t key_flag; // bit0-3 = KekIndex, bit4-7 = TitleKeyDecIndex
|
||||||
u8 rom_size; // this is an enum
|
byte_t rom_size; // this is an enum
|
||||||
u8 flags;
|
byte_t flags;
|
||||||
u8 package_id[8]; // stylised as 0x{0:x2}{1:x2}{2:x2}{3:x2}_{4:x2}{5:x2}{6:x2}{7:x2}
|
byte_t package_id[8]; // stylised as 0x{0:x2}{1:x2}{2:x2}{3:x2}_{4:x2}{5:x2}{6:x2}{7:x2}
|
||||||
u32 valid_data_end_page;
|
uint32_t valid_data_end_page;
|
||||||
u8 reserved_0[100];
|
byte_t reserved_0[100];
|
||||||
u32 sel_sec;
|
uint32_t sel_sec;
|
||||||
u32 sel_t1_key;
|
uint32_t sel_t1_key;
|
||||||
u32 sel_key;
|
uint32_t sel_key;
|
||||||
u32 lim_area;
|
uint32_t lim_area;
|
||||||
u32 fw_version[2]; // [0]=minor, [1]=major
|
uint32_t fw_version[2]; // [0]=minor, [1]=major
|
||||||
u32 acc_ctrl_1;
|
uint32_t acc_ctrl_1;
|
||||||
u8 reserved_1[0x10];
|
byte_t reserved_1[0x10];
|
||||||
u32 fw_mode;
|
uint32_t fw_mode;
|
||||||
u32 cup_version;
|
uint32_t cup_version;
|
||||||
u8 reserved_2[0x4];
|
byte_t reserved_2[0x4];
|
||||||
u8 upp_hash[8]; // stylised as 0x{0:x2}{1:x2}{2:x2}{3:x2}_{4:x2}{5:x2}{6:x2}{7:x2}
|
byte_t upp_hash[8]; // stylised as 0x{0:x2}{1:x2}{2:x2}{3:x2}_{4:x2}{5:x2}{6:x2}{7:x2}
|
||||||
u64 cup_id; // cup programID?
|
uint64_t cup_id; // cup programID?
|
||||||
|
|
||||||
};
|
};
|
||||||
#pragma pack (pop)
|
#pragma pack (pop)
|
||||||
|
|
|
@ -12,7 +12,7 @@ nx::AciBinary::AciBinary(const AciBinary & other)
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
nx::AciBinary::AciBinary(const u8 * bytes, size_t len)
|
nx::AciBinary::AciBinary(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
importBinary(bytes, len);
|
importBinary(bytes, len);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ void nx::AciBinary::operator=(const AciBinary & other)
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 * nx::AciBinary::getBytes() const
|
const byte_t * nx::AciBinary::getBytes() const
|
||||||
{
|
{
|
||||||
return mBinaryBlob.getBytes();
|
return mBinaryBlob.getBytes();
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ void nx::AciBinary::exportBinary()
|
||||||
memcpy(mBinaryBlob.getBytes() + getKcPos().offset, mKc.getBytes(), mKc.getSize());
|
memcpy(mBinaryBlob.getBytes() + getKcPos().offset, mKc.getBytes(), mKc.getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::AciBinary::importBinary(const u8 * bytes, size_t len)
|
void nx::AciBinary::importBinary(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
AciHeader::importBinary(bytes, len);
|
AciHeader::importBinary(bytes, len);
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ AciHeader::AciHeader(const AciHeader & other)
|
||||||
importBinary(other.getBytes(), other.getSize());
|
importBinary(other.getBytes(), other.getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
AciHeader::AciHeader(const u8 * bytes, size_t len)
|
AciHeader::AciHeader(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
importBinary(bytes, len);
|
importBinary(bytes, len);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ void AciHeader::operator=(const AciHeader & other)
|
||||||
this->importBinary(other.getBytes(), other.getSize());
|
this->importBinary(other.getBytes(), other.getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 * AciHeader::getBytes() const
|
const byte_t * AciHeader::getBytes() const
|
||||||
{
|
{
|
||||||
return mBinaryBlob.getBytes();
|
return mBinaryBlob.getBytes();
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ void AciHeader::exportBinary()
|
||||||
hdr->kc().set_offset(mKc.offset);
|
hdr->kc().set_offset(mKc.offset);
|
||||||
hdr->kc().set_size(mKc.size);
|
hdr->kc().set_size(mKc.size);
|
||||||
|
|
||||||
u32 flags = 0;
|
uint32_t flags = 0;
|
||||||
if (mIsProduction)
|
if (mIsProduction)
|
||||||
flags |= BIT(0);
|
flags |= BIT(0);
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ void AciHeader::exportBinary()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AciHeader::importBinary(const u8 * bytes, size_t len)
|
void AciHeader::importBinary(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
if (len < sizeof(sAciHeader))
|
if (len < sizeof(sAciHeader))
|
||||||
{
|
{
|
||||||
|
@ -216,22 +216,22 @@ void nx::AciHeader::setAcidSize(size_t size)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
u64 nx::AciHeader::getProgramIdMin() const
|
uint64_t nx::AciHeader::getProgramIdMin() const
|
||||||
{
|
{
|
||||||
return mProgramIdMin;
|
return mProgramIdMin;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::AciHeader::setProgramIdMin(u64 program_id)
|
void nx::AciHeader::setProgramIdMin(uint64_t program_id)
|
||||||
{
|
{
|
||||||
mProgramIdMin = program_id;
|
mProgramIdMin = program_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 nx::AciHeader::getProgramIdMax() const
|
uint64_t nx::AciHeader::getProgramIdMax() const
|
||||||
{
|
{
|
||||||
return mProgramIdMax;
|
return mProgramIdMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::AciHeader::setProgramIdMax(u64 program_id)
|
void nx::AciHeader::setProgramIdMax(uint64_t program_id)
|
||||||
{
|
{
|
||||||
mProgramIdMax = program_id;
|
mProgramIdMax = program_id;
|
||||||
}
|
}
|
||||||
|
@ -261,12 +261,12 @@ void nx::AciHeader::setIsProduction(bool isProduction)
|
||||||
mIsProduction = isProduction;
|
mIsProduction = isProduction;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 AciHeader::getProgramId() const
|
uint64_t AciHeader::getProgramId() const
|
||||||
{
|
{
|
||||||
return mProgramId;
|
return mProgramId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AciHeader::setProgramId(u64 program_id)
|
void AciHeader::setProgramId(uint64_t program_id)
|
||||||
{
|
{
|
||||||
mProgramId = program_id;
|
mProgramId = program_id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ nx::AcidBinary::AcidBinary(const AcidBinary & other)
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
nx::AcidBinary::AcidBinary(const u8 * bytes, size_t len)
|
nx::AcidBinary::AcidBinary(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
importBinary(bytes, len);
|
importBinary(bytes, len);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ void nx::AcidBinary::operator=(const AcidBinary & other)
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 * nx::AcidBinary::getBytes() const
|
const byte_t * nx::AcidBinary::getBytes() const
|
||||||
{
|
{
|
||||||
return mBinaryBlob.getBytes();
|
return mBinaryBlob.getBytes();
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ void nx::AcidBinary::signBinary(const crypto::rsa::sRsa2048Key & key)
|
||||||
exportBinary();
|
exportBinary();
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 hash[crypto::sha::kSha256HashLen];
|
byte_t hash[crypto::sha::kSha256HashLen];
|
||||||
crypto::sha::Sha256(mBinaryBlob.getBytes() + crypto::rsa::kRsa2048Size, mBinaryBlob.getSize() - crypto::rsa::kRsa2048Size, hash);
|
crypto::sha::Sha256(mBinaryBlob.getBytes() + crypto::rsa::kRsa2048Size, mBinaryBlob.getSize() - crypto::rsa::kRsa2048Size, hash);
|
||||||
|
|
||||||
if (crypto::rsa::pkcs::rsaSign(key, crypto::sha::HASH_SHA256, hash, mBinaryBlob.getBytes()) != 0)
|
if (crypto::rsa::pkcs::rsaSign(key, crypto::sha::HASH_SHA256, hash, mBinaryBlob.getBytes()) != 0)
|
||||||
|
@ -103,7 +103,7 @@ void nx::AcidBinary::signBinary(const crypto::rsa::sRsa2048Key & key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::AcidBinary::importBinary(const u8 * bytes, size_t len)
|
void nx::AcidBinary::importBinary(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
if (len <= crypto::rsa::kRsa2048Size*2)
|
if (len <= crypto::rsa::kRsa2048Size*2)
|
||||||
{
|
{
|
||||||
|
@ -132,7 +132,7 @@ void nx::AcidBinary::verifyBinary(const crypto::rsa::sRsa2048Key & key)
|
||||||
throw fnd::Exception(kModuleName, "No ACID binary exists to verify");
|
throw fnd::Exception(kModuleName, "No ACID binary exists to verify");
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 hash[crypto::sha::kSha256HashLen];
|
byte_t hash[crypto::sha::kSha256HashLen];
|
||||||
crypto::sha::Sha256(mBinaryBlob.getBytes() + crypto::rsa::kRsa2048Size, mBinaryBlob.getSize() - crypto::rsa::kRsa2048Size, hash);
|
crypto::sha::Sha256(mBinaryBlob.getBytes() + crypto::rsa::kRsa2048Size, mBinaryBlob.getSize() - crypto::rsa::kRsa2048Size, hash);
|
||||||
|
|
||||||
if (crypto::rsa::pkcs::rsaVerify(key, crypto::sha::HASH_SHA256, hash, mBinaryBlob.getBytes()) != 0)
|
if (crypto::rsa::pkcs::rsaVerify(key, crypto::sha::HASH_SHA256, hash, mBinaryBlob.getBytes()) != 0)
|
||||||
|
|
|
@ -10,7 +10,7 @@ nx::FacBinary::FacBinary(const FacBinary & other)
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
nx::FacBinary::FacBinary(const u8 * bytes, size_t len)
|
nx::FacBinary::FacBinary(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
importBinary(bytes, len);
|
importBinary(bytes, len);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ void nx::FacBinary::operator=(const FacBinary & other)
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 * nx::FacBinary::getBytes() const
|
const byte_t * nx::FacBinary::getBytes() const
|
||||||
{
|
{
|
||||||
return mBinaryBlob.getBytes();
|
return mBinaryBlob.getBytes();
|
||||||
}
|
}
|
||||||
|
@ -42,27 +42,27 @@ size_t nx::FacBinary::getSize() const
|
||||||
|
|
||||||
void nx::FacBinary::exportBinary()
|
void nx::FacBinary::exportBinary()
|
||||||
{
|
{
|
||||||
FacHeader::setContentOwnerIdSize(mContentOwnerIdList.getSize() * sizeof(u32));
|
FacHeader::setContentOwnerIdSize(mContentOwnerIdList.getSize() * sizeof(uint32_t));
|
||||||
FacHeader::setSaveDataOwnerIdSize(mSaveDataOwnerIdList.getSize() * sizeof(u32));
|
FacHeader::setSaveDataOwnerIdSize(mSaveDataOwnerIdList.getSize() * sizeof(uint32_t));
|
||||||
FacHeader::exportBinary();
|
FacHeader::exportBinary();
|
||||||
|
|
||||||
mBinaryBlob.alloc(getFacSize());
|
mBinaryBlob.alloc(getFacSize());
|
||||||
memcpy(mBinaryBlob.getBytes(), FacHeader::getBytes(), FacHeader::getSize());
|
memcpy(mBinaryBlob.getBytes(), FacHeader::getBytes(), FacHeader::getSize());
|
||||||
|
|
||||||
u32* rawContentOwnerIds = (u32*)(mBinaryBlob.getBytes() + FacHeader::getContentOwnerIdOffset());
|
uint32_t* rawContentOwnerIds = (uint32_t*)(mBinaryBlob.getBytes() + FacHeader::getContentOwnerIdOffset());
|
||||||
for (size_t i = 0; i < mContentOwnerIdList.getSize(); i++)
|
for (size_t i = 0; i < mContentOwnerIdList.getSize(); i++)
|
||||||
{
|
{
|
||||||
rawContentOwnerIds[i] = le_word(mContentOwnerIdList[i]);
|
rawContentOwnerIds[i] = le_word(mContentOwnerIdList[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32* rawSaveDataOwnerIds = (u32*)(mBinaryBlob.getBytes() + FacHeader::getSaveDataOwnerIdOffset());
|
uint32_t* rawSaveDataOwnerIds = (uint32_t*)(mBinaryBlob.getBytes() + FacHeader::getSaveDataOwnerIdOffset());
|
||||||
for (size_t i = 0; i < mSaveDataOwnerIdList.getSize(); i++)
|
for (size_t i = 0; i < mSaveDataOwnerIdList.getSize(); i++)
|
||||||
{
|
{
|
||||||
rawSaveDataOwnerIds[i] = le_word(mSaveDataOwnerIdList[i]);
|
rawSaveDataOwnerIds[i] = le_word(mSaveDataOwnerIdList[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::FacBinary::importBinary(const u8 * bytes, size_t len)
|
void nx::FacBinary::importBinary(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
FacHeader::importBinary(bytes, len);
|
FacHeader::importBinary(bytes, len);
|
||||||
|
@ -74,15 +74,15 @@ void nx::FacBinary::importBinary(const u8 * bytes, size_t len)
|
||||||
mBinaryBlob.alloc(FacHeader::getFacSize());
|
mBinaryBlob.alloc(FacHeader::getFacSize());
|
||||||
memcpy(mBinaryBlob.getBytes(), bytes, mBinaryBlob.getSize());
|
memcpy(mBinaryBlob.getBytes(), bytes, mBinaryBlob.getSize());
|
||||||
|
|
||||||
u32* rawContentOwnerIds = (u32*)(mBinaryBlob.getBytes() + FacHeader::getContentOwnerIdOffset());
|
uint32_t* rawContentOwnerIds = (uint32_t*)(mBinaryBlob.getBytes() + FacHeader::getContentOwnerIdOffset());
|
||||||
size_t rawContentOwnerIdNum = FacHeader::getContentOwnerIdSize() / sizeof(u32);
|
size_t rawContentOwnerIdNum = FacHeader::getContentOwnerIdSize() / sizeof(uint32_t);
|
||||||
for (size_t i = 0; i < rawContentOwnerIdNum; i++)
|
for (size_t i = 0; i < rawContentOwnerIdNum; i++)
|
||||||
{
|
{
|
||||||
mContentOwnerIdList.addElement(le_word(rawContentOwnerIds[i]));
|
mContentOwnerIdList.addElement(le_word(rawContentOwnerIds[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
u32* rawSaveDataOwnerIds = (u32*)(mBinaryBlob.getBytes() + FacHeader::getSaveDataOwnerIdOffset());
|
uint32_t* rawSaveDataOwnerIds = (uint32_t*)(mBinaryBlob.getBytes() + FacHeader::getSaveDataOwnerIdOffset());
|
||||||
size_t rawSaveDataOwnerIdNum = FacHeader::getSaveDataOwnerIdSize() / sizeof(u32);
|
size_t rawSaveDataOwnerIdNum = FacHeader::getSaveDataOwnerIdSize() / sizeof(uint32_t);
|
||||||
for (size_t i = 0; i < rawSaveDataOwnerIdNum; i++)
|
for (size_t i = 0; i < rawSaveDataOwnerIdNum; i++)
|
||||||
{
|
{
|
||||||
mSaveDataOwnerIdList.addElement(le_word(rawSaveDataOwnerIds[i]));
|
mSaveDataOwnerIdList.addElement(le_word(rawSaveDataOwnerIds[i]));
|
||||||
|
@ -117,22 +117,22 @@ void nx::FacBinary::clear()
|
||||||
mSaveDataOwnerIdList.clear();
|
mSaveDataOwnerIdList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<u32>& nx::FacBinary::getContentOwnerIdList() const
|
const fnd::List<uint32_t>& nx::FacBinary::getContentOwnerIdList() const
|
||||||
{
|
{
|
||||||
return mContentOwnerIdList;
|
return mContentOwnerIdList;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::FacBinary::setContentOwnerIdList(const fnd::List<u32>& list)
|
void nx::FacBinary::setContentOwnerIdList(const fnd::List<uint32_t>& list)
|
||||||
{
|
{
|
||||||
mContentOwnerIdList = list;
|
mContentOwnerIdList = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<u32>& nx::FacBinary::getSaveDataOwnerIdList() const
|
const fnd::List<uint32_t>& nx::FacBinary::getSaveDataOwnerIdList() const
|
||||||
{
|
{
|
||||||
return mSaveDataOwnerIdList;
|
return mSaveDataOwnerIdList;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::FacBinary::setSaveDataOwnerIdList(const fnd::List<u32>& list)
|
void nx::FacBinary::setSaveDataOwnerIdList(const fnd::List<uint32_t>& list)
|
||||||
{
|
{
|
||||||
mSaveDataOwnerIdList = list;
|
mSaveDataOwnerIdList = list;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ nx::FacHeader::FacHeader(const FacHeader & other) :
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
nx::FacHeader::FacHeader(const u8 * bytes, size_t len) :
|
nx::FacHeader::FacHeader(const byte_t * bytes, size_t len) :
|
||||||
mFsaRights()
|
mFsaRights()
|
||||||
{
|
{
|
||||||
importBinary(bytes, len);
|
importBinary(bytes, len);
|
||||||
|
@ -35,7 +35,7 @@ void nx::FacHeader::operator=(const FacHeader & other)
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 * nx::FacHeader::getBytes() const
|
const byte_t * nx::FacHeader::getBytes() const
|
||||||
{
|
{
|
||||||
return mBinaryBlob.getBytes();
|
return mBinaryBlob.getBytes();
|
||||||
}
|
}
|
||||||
|
@ -54,23 +54,23 @@ void nx::FacHeader::exportBinary()
|
||||||
{
|
{
|
||||||
fnd::Exception(kModuleName, "Unsupported format version");
|
fnd::Exception(kModuleName, "Unsupported format version");
|
||||||
}
|
}
|
||||||
hdr->set_version(mVersion);
|
hdr->version = (mVersion);
|
||||||
|
|
||||||
u64 flag = 0;
|
uint64_t flag = 0;
|
||||||
for (size_t i = 0; i < mFsaRights.getSize(); i++)
|
for (size_t i = 0; i < mFsaRights.getSize(); i++)
|
||||||
{
|
{
|
||||||
flag |= BIT((u64)mFsaRights[i]);
|
flag |= BIT((uint64_t)mFsaRights[i]);
|
||||||
}
|
}
|
||||||
hdr->set_fac_flags(flag);
|
hdr->fac_flags = (flag);
|
||||||
|
|
||||||
calculateOffsets();
|
calculateOffsets();
|
||||||
hdr->content_owner_ids().set_start(mContentOwnerIdPos.offset);
|
hdr->content_owner_ids.start = (mContentOwnerIdPos.offset);
|
||||||
hdr->content_owner_ids().set_end(mContentOwnerIdPos.offset + mContentOwnerIdPos.size);
|
hdr->content_owner_ids.end = (mContentOwnerIdPos.offset + mContentOwnerIdPos.size);
|
||||||
hdr->save_data_owner_ids().set_start(mSaveDataOwnerIdPos.offset);
|
hdr->save_data_owner_ids.start = (mSaveDataOwnerIdPos.offset);
|
||||||
hdr->save_data_owner_ids().set_end(mSaveDataOwnerIdPos.offset + mSaveDataOwnerIdPos.size);
|
hdr->save_data_owner_ids.end = (mSaveDataOwnerIdPos.offset + mSaveDataOwnerIdPos.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::FacHeader::importBinary(const u8 * bytes, size_t len)
|
void nx::FacHeader::importBinary(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
if (len < sizeof(sFacHeader))
|
if (len < sizeof(sFacHeader))
|
||||||
{
|
{
|
||||||
|
@ -81,24 +81,24 @@ void nx::FacHeader::importBinary(const u8 * bytes, size_t len)
|
||||||
memcpy(mBinaryBlob.getBytes(), bytes, mBinaryBlob.getSize());
|
memcpy(mBinaryBlob.getBytes(), bytes, mBinaryBlob.getSize());
|
||||||
sFacHeader* hdr = (sFacHeader*)mBinaryBlob.getBytes();
|
sFacHeader* hdr = (sFacHeader*)mBinaryBlob.getBytes();
|
||||||
|
|
||||||
if (hdr->version() != kFacFormatVersion)
|
if (hdr->version.get() != kFacFormatVersion)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "Unsupported FAC format version");
|
throw fnd::Exception(kModuleName, "Unsupported FAC format version");
|
||||||
}
|
}
|
||||||
mVersion = hdr->version();
|
mVersion = hdr->version.get();
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
for (u64 i = 0; i < 64; i++)
|
for (uint64_t i = 0; i < 64; i++)
|
||||||
{
|
{
|
||||||
if ((hdr->fac_flags() >> i) & 1)
|
if ((hdr->fac_flags.get() >> i) & 1)
|
||||||
{
|
{
|
||||||
mFsaRights.addElement((FsAccessFlag)i);
|
mFsaRights.addElement((FsAccessFlag)i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mContentOwnerIdPos.offset = hdr->content_owner_ids().start();
|
mContentOwnerIdPos.offset = hdr->content_owner_ids.start.get();
|
||||||
mContentOwnerIdPos.size = hdr->content_owner_ids().end() > hdr->content_owner_ids().start() ? hdr->content_owner_ids().end() - hdr->content_owner_ids().start() : 0;
|
mContentOwnerIdPos.size = hdr->content_owner_ids.end.get() > hdr->content_owner_ids.start.get() ? hdr->content_owner_ids.end.get() - hdr->content_owner_ids.start.get() : 0;
|
||||||
mSaveDataOwnerIdPos.offset = hdr->save_data_owner_ids().start();
|
mSaveDataOwnerIdPos.offset = hdr->save_data_owner_ids.start.get();
|
||||||
mSaveDataOwnerIdPos.size = hdr->save_data_owner_ids().end() > hdr->save_data_owner_ids().start() ? hdr->save_data_owner_ids().end() - hdr->save_data_owner_ids().start() : 0;
|
mSaveDataOwnerIdPos.size = hdr->save_data_owner_ids.end.get() > hdr->save_data_owner_ids.start.get() ? hdr->save_data_owner_ids.end.get() - hdr->save_data_owner_ids.start.get() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::FacHeader::clear()
|
void nx::FacHeader::clear()
|
||||||
|
@ -117,12 +117,12 @@ size_t nx::FacHeader::getFacSize() const
|
||||||
return MAX(MAX(savedata, content), sizeof(sFacHeader));
|
return MAX(MAX(savedata, content), sizeof(sFacHeader));
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 nx::FacHeader::getFormatVersion() const
|
uint32_t nx::FacHeader::getFormatVersion() const
|
||||||
{
|
{
|
||||||
return mVersion;
|
return mVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::FacHeader::setFormatVersion(u32 version)
|
void nx::FacHeader::setFormatVersion(uint32_t version)
|
||||||
{
|
{
|
||||||
mVersion = version;
|
mVersion = version;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ nx::HandleTableSizeEntry::HandleTableSizeEntry(const KernelCapability & kernel_c
|
||||||
setKernelCapability(kernel_cap);
|
setKernelCapability(kernel_cap);
|
||||||
}
|
}
|
||||||
|
|
||||||
nx::HandleTableSizeEntry::HandleTableSizeEntry(u16 size) :
|
nx::HandleTableSizeEntry::HandleTableSizeEntry(uint16_t size) :
|
||||||
mCap(kCapId),
|
mCap(kCapId),
|
||||||
mHandleTableSize(0)
|
mHandleTableSize(0)
|
||||||
{
|
{
|
||||||
|
@ -37,12 +37,12 @@ void nx::HandleTableSizeEntry::setKernelCapability(const KernelCapability & kern
|
||||||
processCapField();
|
processCapField();
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 nx::HandleTableSizeEntry::getHandleTableSize() const
|
uint16_t nx::HandleTableSizeEntry::getHandleTableSize() const
|
||||||
{
|
{
|
||||||
return mHandleTableSize;
|
return mHandleTableSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::HandleTableSizeEntry::setHandleTableSize(u16 size)
|
void nx::HandleTableSizeEntry::setHandleTableSize(uint16_t size)
|
||||||
{
|
{
|
||||||
if (size > kMaxHandleTableSize)
|
if (size > kMaxHandleTableSize)
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,12 +55,12 @@ bool nx::HandleTableSizeHandler::isSet() const
|
||||||
return mIsSet;
|
return mIsSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 nx::HandleTableSizeHandler::getHandleTableSize() const
|
uint16_t nx::HandleTableSizeHandler::getHandleTableSize() const
|
||||||
{
|
{
|
||||||
return mEntry.getHandleTableSize();
|
return mEntry.getHandleTableSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::HandleTableSizeHandler::setHandleTableSize(u16 size)
|
void nx::HandleTableSizeHandler::setHandleTableSize(uint16_t size)
|
||||||
{
|
{
|
||||||
mEntry.setHandleTableSize(size);
|
mEntry.setHandleTableSize(size);
|
||||||
mIsSet = true;
|
mIsSet = true;
|
||||||
|
|
|
@ -16,7 +16,7 @@ nx::InteruptEntry::InteruptEntry(const KernelCapability & kernel_cap) :
|
||||||
setKernelCapability(kernel_cap);
|
setKernelCapability(kernel_cap);
|
||||||
}
|
}
|
||||||
|
|
||||||
nx::InteruptEntry::InteruptEntry(u32 interupt0, u32 interupt1) :
|
nx::InteruptEntry::InteruptEntry(uint32_t interupt0, uint32_t interupt1) :
|
||||||
mCap(kCapId),
|
mCap(kCapId),
|
||||||
mInterupt{ 0,0 }
|
mInterupt{ 0,0 }
|
||||||
{
|
{
|
||||||
|
@ -40,17 +40,17 @@ void nx::InteruptEntry::setKernelCapability(const KernelCapability & kernel_cap)
|
||||||
processCapField();
|
processCapField();
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 nx::InteruptEntry::operator[](size_t index) const
|
uint32_t nx::InteruptEntry::operator[](size_t index) const
|
||||||
{
|
{
|
||||||
return getInterupt(index);
|
return getInterupt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 nx::InteruptEntry::getInterupt(size_t index) const
|
uint32_t nx::InteruptEntry::getInterupt(size_t index) const
|
||||||
{
|
{
|
||||||
return mInterupt[index % kInteruptNum];
|
return mInterupt[index % kInteruptNum];
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::InteruptEntry::setInterupt(size_t index, u32 interupt)
|
void nx::InteruptEntry::setInterupt(size_t index, uint32_t interupt)
|
||||||
{
|
{
|
||||||
if (interupt > kInteruptMax)
|
if (interupt > kInteruptMax)
|
||||||
{
|
{
|
||||||
|
|
|
@ -95,12 +95,12 @@ bool nx::InteruptHandler::isSet() const
|
||||||
return mIsSet;
|
return mIsSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<u16>& nx::InteruptHandler::getInteruptList() const
|
const fnd::List<uint16_t>& nx::InteruptHandler::getInteruptList() const
|
||||||
{
|
{
|
||||||
return mInterupts;
|
return mInterupts;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::InteruptHandler::setInteruptList(const fnd::List<u16>& interupts)
|
void nx::InteruptHandler::setInteruptList(const fnd::List<uint16_t>& interupts)
|
||||||
{
|
{
|
||||||
mInterupts.clear();
|
mInterupts.clear();
|
||||||
for (size_t i = 0; i < interupts.getSize(); i++)
|
for (size_t i = 0; i < interupts.getSize(); i++)
|
||||||
|
|
|
@ -10,7 +10,7 @@ nx::KcBinary::KcBinary(const KcBinary & other)
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
nx::KcBinary::KcBinary(const u8 * bytes, size_t len)
|
nx::KcBinary::KcBinary(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
importBinary(bytes, len);
|
importBinary(bytes, len);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ void nx::KcBinary::operator=(const KcBinary & other)
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 * nx::KcBinary::getBytes() const
|
const byte_t * nx::KcBinary::getBytes() const
|
||||||
{
|
{
|
||||||
return mBinaryBlob.getBytes();
|
return mBinaryBlob.getBytes();
|
||||||
}
|
}
|
||||||
|
@ -55,19 +55,19 @@ void nx::KcBinary::exportBinary()
|
||||||
mMiscFlags.exportKernelCapabilityList(caps);
|
mMiscFlags.exportKernelCapabilityList(caps);
|
||||||
|
|
||||||
// allocate memory
|
// allocate memory
|
||||||
mBinaryBlob.alloc(caps.getSize() * sizeof(u32));
|
mBinaryBlob.alloc(caps.getSize() * sizeof(uint32_t));
|
||||||
|
|
||||||
// write to binary
|
// write to binary
|
||||||
u32* raw_caps = (u32*)mBinaryBlob.getBytes();
|
uint32_t* raw_caps = (uint32_t*)mBinaryBlob.getBytes();
|
||||||
for (size_t i = 0; i < caps.getSize(); i++)
|
for (size_t i = 0; i < caps.getSize(); i++)
|
||||||
{
|
{
|
||||||
raw_caps[i] = le_word(caps[i].getCap());
|
raw_caps[i] = le_word(caps[i].getCap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::KcBinary::importBinary(const u8 * bytes, size_t len)
|
void nx::KcBinary::importBinary(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
if ((len % sizeof(u32)) != 0)
|
if ((len % sizeof(uint32_t)) != 0)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "KernelCapability list must be aligned to 4 bytes");
|
throw fnd::Exception(kModuleName, "KernelCapability list must be aligned to 4 bytes");
|
||||||
}
|
}
|
||||||
|
@ -81,8 +81,8 @@ void nx::KcBinary::importBinary(const u8 * bytes, size_t len)
|
||||||
fnd::List<KernelCapability> handleTableSizeCaps;
|
fnd::List<KernelCapability> handleTableSizeCaps;
|
||||||
fnd::List<KernelCapability> miscFlagsCaps;
|
fnd::List<KernelCapability> miscFlagsCaps;
|
||||||
|
|
||||||
const u32* raw_caps = (const u32*)bytes;
|
const uint32_t* raw_caps = (const uint32_t*)bytes;
|
||||||
size_t cap_num = len / sizeof(u32);
|
size_t cap_num = len / sizeof(uint32_t);
|
||||||
KernelCapability cap;
|
KernelCapability cap;
|
||||||
for (size_t i = 0; i < cap_num; i++)
|
for (size_t i = 0; i < cap_num; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@ KernelCapability::KernelCapability(KernelCapId type) :
|
||||||
mField(0)
|
mField(0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
KernelCapability::KernelCapability(KernelCapId type, u32 field) :
|
KernelCapability::KernelCapability(KernelCapId type, uint32_t field) :
|
||||||
mType(type),
|
mType(type),
|
||||||
mField(field)
|
mField(field)
|
||||||
{}
|
{}
|
||||||
|
@ -34,12 +34,12 @@ bool nx::KernelCapability::operator!=(const KernelCapability & other) const
|
||||||
return !operator==(other);
|
return !operator==(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 KernelCapability::getCap() const
|
uint32_t KernelCapability::getCap() const
|
||||||
{
|
{
|
||||||
return (mField & getFieldMask()) << getFieldShift() | getCapMask();
|
return (mField & getFieldMask()) << getFieldShift() | getCapMask();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KernelCapability::setCap(u32 cap)
|
void KernelCapability::setCap(uint32_t cap)
|
||||||
{
|
{
|
||||||
mType = getCapId(cap);
|
mType = getCapId(cap);
|
||||||
mField = (cap >> getFieldShift()) & getFieldMask();
|
mField = (cap >> getFieldShift()) & getFieldMask();
|
||||||
|
@ -55,12 +55,12 @@ void KernelCapability::setType(KernelCapId type)
|
||||||
mType = type;
|
mType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 KernelCapability::getField() const
|
uint32_t KernelCapability::getField() const
|
||||||
{
|
{
|
||||||
return mField & getFieldMask();
|
return mField & getFieldMask();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KernelCapability::setField(u32 field)
|
void KernelCapability::setField(uint32_t field)
|
||||||
{
|
{
|
||||||
mField = field;
|
mField = field;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ nx::KernelVersionEntry::KernelVersionEntry(const KernelCapability & kernel_cap)
|
||||||
setKernelCapability(kernel_cap);
|
setKernelCapability(kernel_cap);
|
||||||
}
|
}
|
||||||
|
|
||||||
nx::KernelVersionEntry::KernelVersionEntry(u16 major, u8 minor) :
|
nx::KernelVersionEntry::KernelVersionEntry(uint16_t major, uint8_t minor) :
|
||||||
mCap(kCapId),
|
mCap(kCapId),
|
||||||
mVerMajor(0),
|
mVerMajor(0),
|
||||||
mVerMinor(0)
|
mVerMinor(0)
|
||||||
|
@ -41,12 +41,12 @@ void nx::KernelVersionEntry::setKernelCapability(const KernelCapability & kernel
|
||||||
processCapField();
|
processCapField();
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 nx::KernelVersionEntry::getVerMajor() const
|
uint16_t nx::KernelVersionEntry::getVerMajor() const
|
||||||
{
|
{
|
||||||
return mVerMajor;
|
return mVerMajor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::KernelVersionEntry::setVerMajor(u16 major)
|
void nx::KernelVersionEntry::setVerMajor(uint16_t major)
|
||||||
{
|
{
|
||||||
if (major > kVerMajorMax)
|
if (major > kVerMajorMax)
|
||||||
{
|
{
|
||||||
|
@ -57,12 +57,12 @@ void nx::KernelVersionEntry::setVerMajor(u16 major)
|
||||||
updateCapField();
|
updateCapField();
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 nx::KernelVersionEntry::getVerMinor() const
|
uint8_t nx::KernelVersionEntry::getVerMinor() const
|
||||||
{
|
{
|
||||||
return mVerMinor;
|
return mVerMinor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::KernelVersionEntry::setVerMinor(u8 minor)
|
void nx::KernelVersionEntry::setVerMinor(uint8_t minor)
|
||||||
{
|
{
|
||||||
if (minor > kVerMinorMax)
|
if (minor > kVerMinorMax)
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,23 +57,23 @@ bool nx::KernelVersionHandler::isSet() const
|
||||||
return mIsSet;
|
return mIsSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 nx::KernelVersionHandler::getVerMajor() const
|
uint16_t nx::KernelVersionHandler::getVerMajor() const
|
||||||
{
|
{
|
||||||
return mEntry.getVerMajor();
|
return mEntry.getVerMajor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::KernelVersionHandler::setVerMajor(u16 major)
|
void nx::KernelVersionHandler::setVerMajor(uint16_t major)
|
||||||
{
|
{
|
||||||
mEntry.setVerMajor(major);
|
mEntry.setVerMajor(major);
|
||||||
mIsSet = true;
|
mIsSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 nx::KernelVersionHandler::getVerMinor() const
|
uint8_t nx::KernelVersionHandler::getVerMinor() const
|
||||||
{
|
{
|
||||||
return mEntry.getVerMinor();
|
return mEntry.getVerMinor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::KernelVersionHandler::setVerMinor(u8 minor)
|
void nx::KernelVersionHandler::setVerMinor(uint8_t minor)
|
||||||
{
|
{
|
||||||
mEntry.setVerMinor(minor);
|
mEntry.setVerMinor(minor);
|
||||||
mIsSet = true;
|
mIsSet = true;
|
||||||
|
|
|
@ -18,7 +18,7 @@ nx::MemoryPageEntry::MemoryPageEntry(const KernelCapability & kernel_cap) :
|
||||||
setKernelCapability(kernel_cap);
|
setKernelCapability(kernel_cap);
|
||||||
}
|
}
|
||||||
|
|
||||||
nx::MemoryPageEntry::MemoryPageEntry(u32 page) :
|
nx::MemoryPageEntry::MemoryPageEntry(uint32_t page) :
|
||||||
mCap(KernelCapability::KC_INVALID),
|
mCap(KernelCapability::KC_INVALID),
|
||||||
mPage(0),
|
mPage(0),
|
||||||
mFlag(false),
|
mFlag(false),
|
||||||
|
@ -27,7 +27,7 @@ nx::MemoryPageEntry::MemoryPageEntry(u32 page) :
|
||||||
setPage(page);
|
setPage(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
nx::MemoryPageEntry::MemoryPageEntry(u32 page, bool flag) :
|
nx::MemoryPageEntry::MemoryPageEntry(uint32_t page, bool flag) :
|
||||||
mCap(KernelCapability::KC_INVALID),
|
mCap(KernelCapability::KC_INVALID),
|
||||||
mPage(0),
|
mPage(0),
|
||||||
mFlag(false),
|
mFlag(false),
|
||||||
|
@ -53,12 +53,12 @@ void nx::MemoryPageEntry::setKernelCapability(const KernelCapability & kernel_ca
|
||||||
processCapField();
|
processCapField();
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 nx::MemoryPageEntry::getPage() const
|
uint32_t nx::MemoryPageEntry::getPage() const
|
||||||
{
|
{
|
||||||
return mPage;
|
return mPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::MemoryPageEntry::setPage(u32 page)
|
void nx::MemoryPageEntry::setPage(uint32_t page)
|
||||||
{
|
{
|
||||||
if (page > kMaxPage)
|
if (page > kMaxPage)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,7 @@ nx::MiscFlagsEntry::MiscFlagsEntry(const KernelCapability & kernel_cap) :
|
||||||
setKernelCapability(kernel_cap);
|
setKernelCapability(kernel_cap);
|
||||||
}
|
}
|
||||||
|
|
||||||
nx::MiscFlagsEntry::MiscFlagsEntry(u32 flags) :
|
nx::MiscFlagsEntry::MiscFlagsEntry(uint32_t flags) :
|
||||||
mCap(kCapId),
|
mCap(kCapId),
|
||||||
mFlags(0)
|
mFlags(0)
|
||||||
{
|
{
|
||||||
|
@ -37,12 +37,12 @@ void nx::MiscFlagsEntry::setKernelCapability(const KernelCapability & kernel_cap
|
||||||
processCapField();
|
processCapField();
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 nx::MiscFlagsEntry::getFlags() const
|
uint32_t nx::MiscFlagsEntry::getFlags() const
|
||||||
{
|
{
|
||||||
return mFlags;
|
return mFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::MiscFlagsEntry::setFlags(u32 flags)
|
void nx::MiscFlagsEntry::setFlags(uint32_t flags)
|
||||||
{
|
{
|
||||||
if ((flags & ~kMaxVal) != 0)
|
if ((flags & ~kMaxVal) != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,7 +35,7 @@ void nx::MiscFlagsHandler::importKernelCapabilityList(const fnd::List<KernelCapa
|
||||||
entry.setKernelCapability(caps[0]);
|
entry.setKernelCapability(caps[0]);
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
for (u32 i = 0; i < FLAG_NUM; i++)
|
for (uint32_t i = 0; i < FLAG_NUM; i++)
|
||||||
{
|
{
|
||||||
if ((entry.getFlags() & BIT(i)) == BIT(i))
|
if ((entry.getFlags() & BIT(i)) == BIT(i))
|
||||||
{
|
{
|
||||||
|
@ -52,7 +52,7 @@ void nx::MiscFlagsHandler::exportKernelCapabilityList(fnd::List<KernelCapability
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// convert list to word flags
|
// convert list to word flags
|
||||||
u32 flag = 0;
|
uint32_t flag = 0;
|
||||||
for (size_t i = 0; i < mFlags.getSize(); i++)
|
for (size_t i = 0; i < mFlags.getSize(); i++)
|
||||||
{
|
{
|
||||||
flag |= BIT(mFlags[i]);
|
flag |= BIT(mFlags[i]);
|
||||||
|
|
|
@ -14,7 +14,7 @@ nx::MiscParamsEntry::MiscParamsEntry(const KernelCapability & kernel_cap) :
|
||||||
setKernelCapability(kernel_cap);
|
setKernelCapability(kernel_cap);
|
||||||
}
|
}
|
||||||
|
|
||||||
nx::MiscParamsEntry::MiscParamsEntry(u8 program_type) :
|
nx::MiscParamsEntry::MiscParamsEntry(uint8_t program_type) :
|
||||||
mCap(kCapId),
|
mCap(kCapId),
|
||||||
mProgramType(0)
|
mProgramType(0)
|
||||||
{
|
{
|
||||||
|
@ -37,12 +37,12 @@ void nx::MiscParamsEntry::setKernelCapability(const KernelCapability & kernel_ca
|
||||||
processCapField();
|
processCapField();
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 nx::MiscParamsEntry::getProgramType() const
|
uint8_t nx::MiscParamsEntry::getProgramType() const
|
||||||
{
|
{
|
||||||
return mProgramType;
|
return mProgramType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::MiscParamsEntry::setProgramType(u8 type)
|
void nx::MiscParamsEntry::setProgramType(uint8_t type)
|
||||||
{
|
{
|
||||||
if (type > kMaxProgramType)
|
if (type > kMaxProgramType)
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,12 +56,12 @@ bool nx::MiscParamsHandler::isSet() const
|
||||||
return mIsSet;
|
return mIsSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 nx::MiscParamsHandler::getProgramType() const
|
uint8_t nx::MiscParamsHandler::getProgramType() const
|
||||||
{
|
{
|
||||||
return mEntry.getProgramType();
|
return mEntry.getProgramType();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::MiscParamsHandler::setProgramType(u8 type)
|
void nx::MiscParamsHandler::setProgramType(uint8_t type)
|
||||||
{
|
{
|
||||||
mEntry.setProgramType(type);
|
mEntry.setProgramType(type);
|
||||||
mIsSet = true;
|
mIsSet = true;
|
||||||
|
|
|
@ -35,7 +35,7 @@ void NcaHeader::exportBinary()
|
||||||
for (size_t i = 0; i < mSections.getSize(); i++)
|
for (size_t i = 0; i < mSections.getSize(); i++)
|
||||||
{
|
{
|
||||||
// determine section index
|
// determine section index
|
||||||
u8 section = mSections.getSize() - 1 - i;
|
byte_t section = mSections.getSize() - 1 - i;
|
||||||
|
|
||||||
hdr->section[section].start = sizeToBlockNum(mSections[i].offset);
|
hdr->section[section].start = sizeToBlockNum(mSections[i].offset);
|
||||||
hdr->section[section].end = (sizeToBlockNum(mSections[i].offset) + sizeToBlockNum(mSections[i].size));
|
hdr->section[section].end = (sizeToBlockNum(mSections[i].offset) + sizeToBlockNum(mSections[i].size));
|
||||||
|
@ -49,7 +49,7 @@ void NcaHeader::exportBinary()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NcaHeader::importBinary(const u8 * bytes, size_t len)
|
void NcaHeader::importBinary(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
if (len < sizeof(sNcaHeader))
|
if (len < sizeof(sNcaHeader))
|
||||||
{
|
{
|
||||||
|
@ -88,7 +88,7 @@ void NcaHeader::importBinary(const u8 * bytes, size_t len)
|
||||||
for (size_t i = 0; i < kSectionNum; i++)
|
for (size_t i = 0; i < kSectionNum; i++)
|
||||||
{
|
{
|
||||||
// determine section index
|
// determine section index
|
||||||
u8 section = kSectionNum - 1 - i;
|
byte_t section = kSectionNum - 1 - i;
|
||||||
|
|
||||||
// skip sections that don't exist
|
// skip sections that don't exist
|
||||||
if (*hdr->section[section].start == 0 && *hdr->section[section].end == 0) continue;
|
if (*hdr->section[section].start == 0 && *hdr->section[section].end == 0) continue;
|
||||||
|
@ -168,42 +168,42 @@ void nx::NcaHeader::setKaekIndex(byte_t index)
|
||||||
mKaekIndex = index;
|
mKaekIndex = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 NcaHeader::getNcaSize() const
|
uint64_t NcaHeader::getNcaSize() const
|
||||||
{
|
{
|
||||||
return mNcaSize;
|
return mNcaSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NcaHeader::setNcaSize(u64 size)
|
void NcaHeader::setNcaSize(uint64_t size)
|
||||||
{
|
{
|
||||||
mNcaSize = size;
|
mNcaSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 NcaHeader::getProgramId() const
|
uint64_t NcaHeader::getProgramId() const
|
||||||
{
|
{
|
||||||
return mProgramId;
|
return mProgramId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NcaHeader::setProgramId(u64 program_id)
|
void NcaHeader::setProgramId(uint64_t program_id)
|
||||||
{
|
{
|
||||||
mProgramId = program_id;
|
mProgramId = program_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 nx::NcaHeader::getContentIndex() const
|
uint32_t nx::NcaHeader::getContentIndex() const
|
||||||
{
|
{
|
||||||
return mContentIndex;
|
return mContentIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::NcaHeader::setContentIndex(u32 index)
|
void nx::NcaHeader::setContentIndex(uint32_t index)
|
||||||
{
|
{
|
||||||
mContentIndex = index;
|
mContentIndex = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 nx::NcaHeader::getSdkAddonVersion() const
|
uint32_t nx::NcaHeader::getSdkAddonVersion() const
|
||||||
{
|
{
|
||||||
return mSdkAddonVersion;
|
return mSdkAddonVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::NcaHeader::setSdkAddonVersion(u32 version)
|
void nx::NcaHeader::setSdkAddonVersion(uint32_t version)
|
||||||
{
|
{
|
||||||
mSdkAddonVersion = version;
|
mSdkAddonVersion = version;
|
||||||
}
|
}
|
||||||
|
@ -237,12 +237,12 @@ void NcaHeader::addEncAesKey(const crypto::aes::sAes128Key & key)
|
||||||
mEncAesKeys.addElement(key);
|
mEncAesKeys.addElement(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
u64 NcaHeader::blockNumToSize(u32 block_num) const
|
uint64_t NcaHeader::blockNumToSize(uint32_t block_num) const
|
||||||
{
|
{
|
||||||
return block_num*kBlockSize;
|
return block_num*kBlockSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 NcaHeader::sizeToBlockNum(u64 real_size) const
|
uint32_t NcaHeader::sizeToBlockNum(uint64_t real_size) const
|
||||||
{
|
{
|
||||||
return align(real_size, kBlockSize)/kBlockSize;
|
return align(real_size, kBlockSize)/kBlockSize;
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@ NcaHeader::NcaHeader(const NcaHeader & other)
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
NcaHeader::NcaHeader(const u8 * bytes, size_t len)
|
NcaHeader::NcaHeader(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
importBinary(bytes, len);
|
importBinary(bytes, len);
|
||||||
}
|
}
|
||||||
|
@ -313,7 +313,7 @@ void NcaHeader::operator=(const NcaHeader & other)
|
||||||
this->importBinary(other.getBytes(), other.getSize());
|
this->importBinary(other.getBytes(), other.getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 * NcaHeader::getBytes() const
|
const byte_t * NcaHeader::getBytes() const
|
||||||
{
|
{
|
||||||
return mBinaryBlob.getBytes();
|
return mBinaryBlob.getBytes();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ nx::NpdmBinary::NpdmBinary(const NpdmBinary & other) :
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
nx::NpdmBinary::NpdmBinary(const u8 * bytes, size_t len) :
|
nx::NpdmBinary::NpdmBinary(const byte_t * bytes, size_t len) :
|
||||||
mAci(),
|
mAci(),
|
||||||
mAcid()
|
mAcid()
|
||||||
{
|
{
|
||||||
|
@ -47,7 +47,7 @@ void nx::NpdmBinary::exportBinary()
|
||||||
setAcidSize(mAcid.getSize());
|
setAcidSize(mAcid.getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::NpdmBinary::importBinary(const u8 * bytes, size_t len)
|
void nx::NpdmBinary::importBinary(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
// clear
|
// clear
|
||||||
clear();
|
clear();
|
||||||
|
@ -125,7 +125,7 @@ void nx::NpdmBinary::copyFrom(const NpdmBinary & other)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 * nx::NpdmBinary::getBytes() const
|
const byte_t * nx::NpdmBinary::getBytes() const
|
||||||
{
|
{
|
||||||
return mBinaryBlob.getBytes();
|
return mBinaryBlob.getBytes();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ nx::NpdmHeader::NpdmHeader(const NpdmHeader & other)
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
nx::NpdmHeader::NpdmHeader(const u8 * bytes, size_t len)
|
nx::NpdmHeader::NpdmHeader(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
importBinary(bytes, len);
|
importBinary(bytes, len);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ void nx::NpdmHeader::operator=(const NpdmHeader & other)
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 * nx::NpdmHeader::getBytes() const
|
const byte_t * nx::NpdmHeader::getBytes() const
|
||||||
{
|
{
|
||||||
return mBinaryBlob.getBytes();
|
return mBinaryBlob.getBytes();
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ void nx::NpdmHeader::exportBinary()
|
||||||
sNpdmHeader* hdr = (sNpdmHeader*)mBinaryBlob.getBytes();
|
sNpdmHeader* hdr = (sNpdmHeader*)mBinaryBlob.getBytes();
|
||||||
|
|
||||||
hdr->set_signature(kNpdmStructSig.c_str());
|
hdr->set_signature(kNpdmStructSig.c_str());
|
||||||
u8 flag = ((u8)(mInstructionType & 1) | (u8)((mProcAddressSpaceType & 3) << 1)) & 0xf;
|
byte_t flag = ((byte_t)(mInstructionType & 1) | (byte_t)((mProcAddressSpaceType & 3) << 1)) & 0xf;
|
||||||
hdr->set_flags(flag);
|
hdr->set_flags(flag);
|
||||||
hdr->set_main_thread_priority(mMainThreadPriority);
|
hdr->set_main_thread_priority(mMainThreadPriority);
|
||||||
hdr->set_main_thread_cpu_id(mMainThreadCpuId);
|
hdr->set_main_thread_cpu_id(mMainThreadCpuId);
|
||||||
|
@ -105,7 +105,7 @@ void nx::NpdmHeader::exportBinary()
|
||||||
hdr->acid().set_size(mAcidPos.size);
|
hdr->acid().set_size(mAcidPos.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::NpdmHeader::importBinary(const u8 * bytes, size_t len)
|
void nx::NpdmHeader::importBinary(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
if (len < sizeof(sNpdmHeader))
|
if (len < sizeof(sNpdmHeader))
|
||||||
{
|
{
|
||||||
|
@ -123,7 +123,7 @@ void nx::NpdmHeader::importBinary(const u8 * bytes, size_t len)
|
||||||
throw fnd::Exception(kModuleName, "NPDM header corrupt");
|
throw fnd::Exception(kModuleName, "NPDM header corrupt");
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 flag = hdr->flags() & 0xf;
|
byte_t flag = hdr->flags() & 0xf;
|
||||||
mInstructionType = (InstructionType)(flag & 1);
|
mInstructionType = (InstructionType)(flag & 1);
|
||||||
mProcAddressSpaceType = (ProcAddrSpaceType)((flag >> 1) & 3);
|
mProcAddressSpaceType = (ProcAddrSpaceType)((flag >> 1) & 3);
|
||||||
mMainThreadPriority = hdr->main_thread_priority();
|
mMainThreadPriority = hdr->main_thread_priority();
|
||||||
|
@ -188,12 +188,12 @@ void nx::NpdmHeader::setProcAddressSpaceType(ProcAddrSpaceType type)
|
||||||
mProcAddressSpaceType = type;
|
mProcAddressSpaceType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 nx::NpdmHeader::getMainThreadPriority() const
|
byte_t nx::NpdmHeader::getMainThreadPriority() const
|
||||||
{
|
{
|
||||||
return mMainThreadPriority;
|
return mMainThreadPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::NpdmHeader::setMainThreadPriority(u8 priority)
|
void nx::NpdmHeader::setMainThreadPriority(byte_t priority)
|
||||||
{
|
{
|
||||||
if (priority > kMaxPriority)
|
if (priority > kMaxPriority)
|
||||||
{
|
{
|
||||||
|
@ -203,32 +203,32 @@ void nx::NpdmHeader::setMainThreadPriority(u8 priority)
|
||||||
mMainThreadPriority = priority;
|
mMainThreadPriority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 nx::NpdmHeader::getMainThreadCpuId() const
|
byte_t nx::NpdmHeader::getMainThreadCpuId() const
|
||||||
{
|
{
|
||||||
return mMainThreadCpuId;
|
return mMainThreadCpuId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::NpdmHeader::setMainThreadCpuId(u8 core_num)
|
void nx::NpdmHeader::setMainThreadCpuId(byte_t core_num)
|
||||||
{
|
{
|
||||||
mMainThreadCpuId = core_num;
|
mMainThreadCpuId = core_num;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 nx::NpdmHeader::getVersion() const
|
uint32_t nx::NpdmHeader::getVersion() const
|
||||||
{
|
{
|
||||||
return mVersion;
|
return mVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::NpdmHeader::setVersion(u32 version)
|
void nx::NpdmHeader::setVersion(uint32_t version)
|
||||||
{
|
{
|
||||||
mVersion = version;
|
mVersion = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 nx::NpdmHeader::getMainThreadStackSize() const
|
uint32_t nx::NpdmHeader::getMainThreadStackSize() const
|
||||||
{
|
{
|
||||||
return mMainThreadStackSize;
|
return mMainThreadStackSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::NpdmHeader::setMainThreadStackSize(u32 size)
|
void nx::NpdmHeader::setMainThreadStackSize(uint32_t size)
|
||||||
{
|
{
|
||||||
mMainThreadStackSize = size;
|
mMainThreadStackSize = size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ nx::PfsHeader::PfsHeader(const PfsHeader & other)
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
nx::PfsHeader::PfsHeader(const u8 * bytes, size_t len)
|
nx::PfsHeader::PfsHeader(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
importBinary(bytes, len);
|
importBinary(bytes, len);
|
||||||
}
|
}
|
||||||
|
@ -34,9 +34,9 @@ void nx::PfsHeader::exportBinary()
|
||||||
sPfsHeader* hdr = (sPfsHeader*)mBinaryBlob.getBytes();
|
sPfsHeader* hdr = (sPfsHeader*)mBinaryBlob.getBytes();
|
||||||
|
|
||||||
// set header fields
|
// set header fields
|
||||||
hdr->set_signature(kPfsStructSig.c_str());
|
strncpy(hdr->signature, kPfsStructSig.c_str(), 4);
|
||||||
hdr->set_file_num(mFileList.getSize());
|
hdr->file_num = mFileList.getSize();
|
||||||
hdr->set_name_table_size(name_table_size);
|
hdr->name_table_size = name_table_size;
|
||||||
|
|
||||||
// set file entries
|
// set file entries
|
||||||
sPfsFile* raw_files = (sPfsFile*)(mBinaryBlob.getBytes() + sizeof(sPfsHeader));
|
sPfsFile* raw_files = (sPfsFile*)(mBinaryBlob.getBytes() + sizeof(sPfsHeader));
|
||||||
|
@ -46,16 +46,16 @@ void nx::PfsHeader::exportBinary()
|
||||||
calculateOffsets(pfs_header_size);
|
calculateOffsets(pfs_header_size);
|
||||||
for (size_t i = 0; i < mFileList.getSize(); i++)
|
for (size_t i = 0; i < mFileList.getSize(); i++)
|
||||||
{
|
{
|
||||||
raw_files[i].set_offset(mFileList[i].offset - pfs_header_size);
|
raw_files[i].data_offset = (mFileList[i].offset - pfs_header_size);
|
||||||
raw_files[i].set_size(mFileList[i].size);
|
raw_files[i].size = (mFileList[i].size);
|
||||||
raw_files[i].set_name_offset(raw_name_table_pos);
|
raw_files[i].name_offset = (raw_name_table_pos);
|
||||||
|
|
||||||
strcpy(raw_name_table + raw_name_table_pos, mFileList[i].name.c_str());
|
strcpy(raw_name_table + raw_name_table_pos, mFileList[i].name.c_str());
|
||||||
raw_name_table_pos += mFileList[i].name.length() + 1;
|
raw_name_table_pos += mFileList[i].name.length() + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::PfsHeader::importBinary(const u8 * bytes, size_t len)
|
void nx::PfsHeader::importBinary(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
// check input length meets minimum size
|
// check input length meets minimum size
|
||||||
if (len < sizeof(sPfsHeader))
|
if (len < sizeof(sPfsHeader))
|
||||||
|
@ -69,13 +69,13 @@ void nx::PfsHeader::importBinary(const u8 * bytes, size_t len)
|
||||||
const sPfsHeader* hdr = (const sPfsHeader*)mBinaryBlob.getBytes();
|
const sPfsHeader* hdr = (const sPfsHeader*)mBinaryBlob.getBytes();
|
||||||
|
|
||||||
// check struct signature
|
// check struct signature
|
||||||
if (memcmp(hdr->signature(), kPfsStructSig.c_str(), 4) != 0)
|
if (memcmp(hdr->signature, kPfsStructSig.c_str(), 4) != 0)
|
||||||
{
|
{
|
||||||
throw fnd::Exception(kModuleName, "PFS header corrupt");
|
throw fnd::Exception(kModuleName, "PFS header corrupt");
|
||||||
}
|
}
|
||||||
|
|
||||||
// determine complete header size
|
// determine complete header size
|
||||||
size_t pfs_full_header_size = sizeof(sPfsHeader) + sizeof(sPfsFile) * hdr->file_num() + hdr->name_table_size();
|
size_t pfs_full_header_size = sizeof(sPfsHeader) + sizeof(sPfsFile) * hdr->file_num.get() + hdr->name_table_size.get();
|
||||||
|
|
||||||
// check input length meets complete size
|
// check input length meets complete size
|
||||||
if (len < pfs_full_header_size)
|
if (len < pfs_full_header_size)
|
||||||
|
@ -93,12 +93,12 @@ void nx::PfsHeader::importBinary(const u8 * bytes, size_t len)
|
||||||
|
|
||||||
// get pointers to raw data
|
// get pointers to raw data
|
||||||
const sPfsFile* raw_files = (const sPfsFile*)(mBinaryBlob.getBytes() + sizeof(sPfsHeader));
|
const sPfsFile* raw_files = (const sPfsFile*)(mBinaryBlob.getBytes() + sizeof(sPfsHeader));
|
||||||
const char* raw_name_table = (const char*)(mBinaryBlob.getBytes() + sizeof(sPfsHeader) + sizeof(sPfsFile) * hdr->file_num());
|
const char* raw_name_table = (const char*)(mBinaryBlob.getBytes() + sizeof(sPfsHeader) + sizeof(sPfsFile) * hdr->file_num.get());
|
||||||
|
|
||||||
// process file entries
|
// process file entries
|
||||||
for (size_t i = 0; i < hdr->file_num(); i++)
|
for (size_t i = 0; i < hdr->file_num.get(); i++)
|
||||||
{
|
{
|
||||||
mFileList.addElement({ std::string(raw_name_table + raw_files[i].name_offset()), raw_files[i].offset() + pfs_full_header_size, raw_files[i].size() });
|
mFileList.addElement({ std::string(raw_name_table + raw_files[i].name_offset.get()), raw_files[i].data_offset.get() + pfs_full_header_size, raw_files[i].size.get() });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ void nx::PfsHeader::operator=(const PfsHeader & other)
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 * nx::PfsHeader::getBytes() const
|
const byte_t * nx::PfsHeader::getBytes() const
|
||||||
{
|
{
|
||||||
return mBinaryBlob.getBytes();
|
return mBinaryBlob.getBytes();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ SacBinary::SacBinary(const SacBinary & other)
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
SacBinary::SacBinary(const u8 * bytes, size_t len)
|
SacBinary::SacBinary(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
importBinary(bytes, len);
|
importBinary(bytes, len);
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ void SacBinary::operator=(const SacBinary & other)
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 * SacBinary::getBytes() const
|
const byte_t * SacBinary::getBytes() const
|
||||||
{
|
{
|
||||||
return mBinaryBlob.getBytes();
|
return mBinaryBlob.getBytes();
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ void SacBinary::exportBinary()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SacBinary::importBinary(const u8 * bytes, size_t len)
|
void SacBinary::importBinary(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
mBinaryBlob.alloc(len);
|
mBinaryBlob.alloc(len);
|
||||||
|
@ -66,7 +66,7 @@ void SacBinary::importBinary(const u8 * bytes, size_t len)
|
||||||
SacEntry svc;
|
SacEntry svc;
|
||||||
for (size_t pos = 0; pos < len; pos += mServices.atBack().getSize())
|
for (size_t pos = 0; pos < len; pos += mServices.atBack().getSize())
|
||||||
{
|
{
|
||||||
svc.importBinary((const u8*)(mBinaryBlob.getBytes() + pos), len - pos);
|
svc.importBinary((const byte_t*)(mBinaryBlob.getBytes() + pos), len - pos);
|
||||||
mServices.addElement(svc);
|
mServices.addElement(svc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ void SacEntry::operator=(const SacEntry & other)
|
||||||
copyFrom(other);
|
copyFrom(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 * SacEntry::getBytes() const
|
const byte_t * SacEntry::getBytes() const
|
||||||
{
|
{
|
||||||
return mBinaryBlob.getBytes();
|
return mBinaryBlob.getBytes();
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ void SacEntry::exportBinary()
|
||||||
memcpy(mBinaryBlob.getBytes() + 1, mName.c_str(), mName.length());
|
memcpy(mBinaryBlob.getBytes() + 1, mName.c_str(), mName.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SacEntry::importBinary(const u8 * bytes, size_t len)
|
void SacEntry::importBinary(const byte_t * bytes, size_t len)
|
||||||
{
|
{
|
||||||
bool isServer = (bytes[0] & SAC_IS_SERVER) == SAC_IS_SERVER;
|
bool isServer = (bytes[0] & SAC_IS_SERVER) == SAC_IS_SERVER;
|
||||||
size_t nameLen = (bytes[0] & SAC_NAME_LEN_MASK) + 1; // bug?
|
size_t nameLen = (bytes[0] & SAC_NAME_LEN_MASK) + 1; // bug?
|
||||||
|
|
|
@ -18,7 +18,7 @@ nx::SystemCallEntry::SystemCallEntry(const KernelCapability & kernel_cap) :
|
||||||
setKernelCapability(kernel_cap);
|
setKernelCapability(kernel_cap);
|
||||||
}
|
}
|
||||||
|
|
||||||
nx::SystemCallEntry::SystemCallEntry(u32 upper_bits, u32 lower_bits) :
|
nx::SystemCallEntry::SystemCallEntry(uint32_t upper_bits, uint32_t lower_bits) :
|
||||||
mCap(kCapId),
|
mCap(kCapId),
|
||||||
mSystemCallUpper(0),
|
mSystemCallUpper(0),
|
||||||
mSystemCallLower(0)
|
mSystemCallLower(0)
|
||||||
|
@ -43,12 +43,12 @@ void nx::SystemCallEntry::setKernelCapability(const KernelCapability & kernel_ca
|
||||||
processCapField();
|
processCapField();
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 nx::SystemCallEntry::getSystemCallUpperBits() const
|
uint32_t nx::SystemCallEntry::getSystemCallUpperBits() const
|
||||||
{
|
{
|
||||||
return mSystemCallUpper;
|
return mSystemCallUpper;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::SystemCallEntry::setSystemCallUpperBits(u32 upper_bits)
|
void nx::SystemCallEntry::setSystemCallUpperBits(uint32_t upper_bits)
|
||||||
{
|
{
|
||||||
if (upper_bits > kSysCallUpperMax)
|
if (upper_bits > kSysCallUpperMax)
|
||||||
{
|
{
|
||||||
|
@ -59,12 +59,12 @@ void nx::SystemCallEntry::setSystemCallUpperBits(u32 upper_bits)
|
||||||
updateCapField();
|
updateCapField();
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 nx::SystemCallEntry::getSystemCallLowerBits() const
|
uint32_t nx::SystemCallEntry::getSystemCallLowerBits() const
|
||||||
{
|
{
|
||||||
return mSystemCallLower;
|
return mSystemCallLower;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::SystemCallEntry::setSystemCallLowerBits(u32 lower_bits)
|
void nx::SystemCallEntry::setSystemCallLowerBits(uint32_t lower_bits)
|
||||||
{
|
{
|
||||||
if (lower_bits > kSysCallLowerMax)
|
if (lower_bits > kSysCallLowerMax)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,12 +29,12 @@ void nx::SystemCallHandler::importKernelCapabilityList(const fnd::List<KernelCap
|
||||||
|
|
||||||
SystemCallEntry entry;
|
SystemCallEntry entry;
|
||||||
|
|
||||||
u8 syscallUpper, syscall;
|
uint8_t syscallUpper, syscall;
|
||||||
for (size_t i = 0; i < caps.getSize(); i++)
|
for (size_t i = 0; i < caps.getSize(); i++)
|
||||||
{
|
{
|
||||||
entry.setKernelCapability(caps[i]);
|
entry.setKernelCapability(caps[i]);
|
||||||
syscallUpper = 24 * entry.getSystemCallUpperBits();
|
syscallUpper = 24 * entry.getSystemCallUpperBits();
|
||||||
for (u8 j = 0; j < 24; j++)
|
for (uint8_t j = 0; j < 24; j++)
|
||||||
{
|
{
|
||||||
syscall = syscallUpper + j;
|
syscall = syscallUpper + j;
|
||||||
if (((entry.getSystemCallLowerBits() >> j) & 1) == 1)
|
if (((entry.getSystemCallLowerBits() >> j) & 1) == 1)
|
||||||
|
@ -90,12 +90,12 @@ bool nx::SystemCallHandler::isSet() const
|
||||||
return mIsSet;
|
return mIsSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fnd::List<u8>& nx::SystemCallHandler::getSystemCalls() const
|
const fnd::List<uint8_t>& nx::SystemCallHandler::getSystemCalls() const
|
||||||
{
|
{
|
||||||
return mSystemCalls;
|
return mSystemCalls;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::SystemCallHandler::setSystemCallList(const fnd::List<u8>& calls)
|
void nx::SystemCallHandler::setSystemCallList(const fnd::List<uint8_t>& calls)
|
||||||
{
|
{
|
||||||
mSystemCalls.clear();
|
mSystemCalls.clear();
|
||||||
for (size_t i = 0; i < calls.getSize(); i++)
|
for (size_t i = 0; i < calls.getSize(); i++)
|
||||||
|
|
|
@ -20,7 +20,7 @@ nx::ThreadInfoEntry::ThreadInfoEntry(const KernelCapability & kernel_cap) :
|
||||||
setKernelCapability(kernel_cap);
|
setKernelCapability(kernel_cap);
|
||||||
}
|
}
|
||||||
|
|
||||||
nx::ThreadInfoEntry::ThreadInfoEntry(u8 min_priority, u8 max_priority, u8 min_core_number, u8 max_core_number) :
|
nx::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),
|
||||||
|
@ -49,12 +49,12 @@ void nx::ThreadInfoEntry::setKernelCapability(const KernelCapability & kernel_ca
|
||||||
processCapField();
|
processCapField();
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 nx::ThreadInfoEntry::getMinPriority() const
|
uint8_t nx::ThreadInfoEntry::getMinPriority() const
|
||||||
{
|
{
|
||||||
return mMinPriority;
|
return mMinPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::ThreadInfoEntry::setMinPriority(u8 priority)
|
void nx::ThreadInfoEntry::setMinPriority(uint8_t priority)
|
||||||
{
|
{
|
||||||
if (priority > kMaxVal)
|
if (priority > kMaxVal)
|
||||||
{
|
{
|
||||||
|
@ -65,12 +65,12 @@ void nx::ThreadInfoEntry::setMinPriority(u8 priority)
|
||||||
updateCapField();
|
updateCapField();
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 nx::ThreadInfoEntry::getMaxPriority() const
|
uint8_t nx::ThreadInfoEntry::getMaxPriority() const
|
||||||
{
|
{
|
||||||
return mMaxPriority;
|
return mMaxPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::ThreadInfoEntry::setMaxPriority(u8 priority)
|
void nx::ThreadInfoEntry::setMaxPriority(uint8_t priority)
|
||||||
{
|
{
|
||||||
if (priority > kMaxVal)
|
if (priority > kMaxVal)
|
||||||
{
|
{
|
||||||
|
@ -81,12 +81,12 @@ void nx::ThreadInfoEntry::setMaxPriority(u8 priority)
|
||||||
updateCapField();
|
updateCapField();
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 nx::ThreadInfoEntry::getMinCpuId() const
|
uint8_t nx::ThreadInfoEntry::getMinCpuId() const
|
||||||
{
|
{
|
||||||
return mMinCpuId;
|
return mMinCpuId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::ThreadInfoEntry::setMinCpuId(u8 core_num)
|
void nx::ThreadInfoEntry::setMinCpuId(uint8_t core_num)
|
||||||
{
|
{
|
||||||
if (core_num > kMaxVal)
|
if (core_num > kMaxVal)
|
||||||
{
|
{
|
||||||
|
@ -97,12 +97,12 @@ void nx::ThreadInfoEntry::setMinCpuId(u8 core_num)
|
||||||
updateCapField();
|
updateCapField();
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 nx::ThreadInfoEntry::getMaxCpuId() const
|
uint8_t nx::ThreadInfoEntry::getMaxCpuId() const
|
||||||
{
|
{
|
||||||
return mMaxCpuId;
|
return mMaxCpuId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::ThreadInfoEntry::setMaxCpuId(u8 core_num)
|
void nx::ThreadInfoEntry::setMaxCpuId(uint8_t core_num)
|
||||||
{
|
{
|
||||||
if (core_num > kMaxVal)
|
if (core_num > kMaxVal)
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,45 +58,45 @@ bool nx::ThreadInfoHandler::isSet() const
|
||||||
return mIsSet;
|
return mIsSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 nx::ThreadInfoHandler::getMinPriority() const
|
uint8_t nx::ThreadInfoHandler::getMinPriority() const
|
||||||
{
|
{
|
||||||
return mEntry.getMinPriority();
|
return mEntry.getMinPriority();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::ThreadInfoHandler::setMinPriority(u8 priority)
|
void nx::ThreadInfoHandler::setMinPriority(uint8_t priority)
|
||||||
{
|
{
|
||||||
mEntry.setMinPriority(priority);
|
mEntry.setMinPriority(priority);
|
||||||
mIsSet = true;
|
mIsSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 nx::ThreadInfoHandler::getMaxPriority() const
|
uint8_t nx::ThreadInfoHandler::getMaxPriority() const
|
||||||
{
|
{
|
||||||
return mEntry.getMaxPriority();
|
return mEntry.getMaxPriority();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::ThreadInfoHandler::setMaxPriority(u8 priority)
|
void nx::ThreadInfoHandler::setMaxPriority(uint8_t priority)
|
||||||
{
|
{
|
||||||
mEntry.setMaxPriority(priority);
|
mEntry.setMaxPriority(priority);
|
||||||
mIsSet = true;
|
mIsSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 nx::ThreadInfoHandler::getMinCpuId() const
|
uint8_t nx::ThreadInfoHandler::getMinCpuId() const
|
||||||
{
|
{
|
||||||
return mEntry.getMinCpuId();
|
return mEntry.getMinCpuId();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::ThreadInfoHandler::setMinCpuId(u8 core_num)
|
void nx::ThreadInfoHandler::setMinCpuId(uint8_t core_num)
|
||||||
{
|
{
|
||||||
mEntry.setMinCpuId(core_num);
|
mEntry.setMinCpuId(core_num);
|
||||||
mIsSet = true;
|
mIsSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 nx::ThreadInfoHandler::getMaxCpuId() const
|
uint8_t nx::ThreadInfoHandler::getMaxCpuId() const
|
||||||
{
|
{
|
||||||
return mEntry.getMaxCpuId();
|
return mEntry.getMaxCpuId();
|
||||||
}
|
}
|
||||||
|
|
||||||
void nx::ThreadInfoHandler::setMaxCpuId(u8 core_num)
|
void nx::ThreadInfoHandler::setMaxCpuId(uint8_t core_num)
|
||||||
{
|
{
|
||||||
mEntry.setMaxCpuId(core_num);
|
mEntry.setMaxCpuId(core_num);
|
||||||
mIsSet = true;
|
mIsSet = true;
|
||||||
|
|
|
@ -323,7 +323,7 @@ void displayKernelCap(const nx::KcBinary& kern)
|
||||||
}
|
}
|
||||||
if (kern.getSystemCalls().isSet())
|
if (kern.getSystemCalls().isSet())
|
||||||
{
|
{
|
||||||
fnd::List<u8> syscalls = kern.getSystemCalls().getSystemCalls();
|
fnd::List<uint8_t> syscalls = kern.getSystemCalls().getSystemCalls();
|
||||||
printf(" SystemCalls:");
|
printf(" SystemCalls:");
|
||||||
printf("\n ");
|
printf("\n ");
|
||||||
size_t lineLen = 0;
|
size_t lineLen = 0;
|
||||||
|
@ -346,19 +346,19 @@ void displayKernelCap(const nx::KcBinary& kern)
|
||||||
printf(" MemoryMaps:\n");
|
printf(" MemoryMaps:\n");
|
||||||
for (size_t i = 0; i < maps.getSize(); i++)
|
for (size_t i = 0; i < maps.getSize(); i++)
|
||||||
{
|
{
|
||||||
printf(" 0x%016" PRIx64 " - 0x%016" PRIx64 " (perm=%s) (type=%s)\n", (u64)maps[i].addr << 12, ((u64)(maps[i].addr + maps[i].size) << 12) - 1, kMemMapPerm[maps[i].perm].c_str(), kMemMapType[maps[i].type].c_str());
|
printf(" 0x%016" PRIx64 " - 0x%016" PRIx64 " (perm=%s) (type=%s)\n", (uint64_t)maps[i].addr << 12, ((uint64_t)(maps[i].addr + maps[i].size) << 12) - 1, kMemMapPerm[maps[i].perm].c_str(), kMemMapType[maps[i].type].c_str());
|
||||||
}
|
}
|
||||||
//printf(" IoMaps:\n");
|
//printf(" IoMaps:\n");
|
||||||
for (size_t i = 0; i < ioMaps.getSize(); i++)
|
for (size_t i = 0; i < ioMaps.getSize(); i++)
|
||||||
{
|
{
|
||||||
printf(" 0x%016" PRIx64 " - 0x%016" PRIx64 " (perm=%s) (type=%s)\n", (u64)ioMaps[i].addr << 12, ((u64)(ioMaps[i].addr + ioMaps[i].size) << 12) - 1, kMemMapPerm[ioMaps[i].perm].c_str(), kMemMapType[ioMaps[i].type].c_str());
|
printf(" 0x%016" PRIx64 " - 0x%016" PRIx64 " (perm=%s) (type=%s)\n", (uint64_t)ioMaps[i].addr << 12, ((uint64_t)(ioMaps[i].addr + ioMaps[i].size) << 12) - 1, kMemMapPerm[ioMaps[i].perm].c_str(), kMemMapType[ioMaps[i].type].c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (kern.getInterupts().isSet())
|
if (kern.getInterupts().isSet())
|
||||||
{
|
{
|
||||||
fnd::List<u16> interupts = kern.getInterupts().getInteruptList();
|
fnd::List<uint16_t> interupts = kern.getInterupts().getInteruptList();
|
||||||
printf(" Interupts Flags:\n");
|
printf(" Interupts Flags:\n");
|
||||||
for (u32 i = 0; i < interupts.getSize(); i++)
|
for (uint32_t i = 0; i < interupts.getSize(); i++)
|
||||||
{
|
{
|
||||||
if (i % 10 == 0)
|
if (i % 10 == 0)
|
||||||
{
|
{
|
||||||
|
@ -384,7 +384,7 @@ void displayKernelCap(const nx::KcBinary& kern)
|
||||||
fnd::List<nx::MiscFlagsHandler::Flags> flagList = kern.getMiscFlags().getFlagList();
|
fnd::List<nx::MiscFlagsHandler::Flags> flagList = kern.getMiscFlags().getFlagList();
|
||||||
|
|
||||||
printf(" Misc Flags:\n");
|
printf(" Misc Flags:\n");
|
||||||
for (u32 i = 0; i < flagList.getSize(); i++)
|
for (uint32_t i = 0; i < flagList.getSize(); i++)
|
||||||
{
|
{
|
||||||
if (i % 10 == 0)
|
if (i % 10 == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,7 +27,7 @@ const std::string kBooleanStr[2] =
|
||||||
"TRUE"
|
"TRUE"
|
||||||
};
|
};
|
||||||
|
|
||||||
u8 eticket_common_key[16] = { 0x55, 0xA3, 0xF8, 0x72, 0xBD, 0xC8, 0x0C, 0x55, 0x5A, 0x65, 0x43, 0x81, 0x13, 0x9E, 0x15, 0x3B }; // lol this 3ds dev common key
|
const byte_t eticket_common_key[16] = { 0x55, 0xA3, 0xF8, 0x72, 0xBD, 0xC8, 0x0C, 0x55, 0x5A, 0x65, 0x43, 0x81, 0x13, 0x9E, 0x15, 0x3B }; // lol this 3ds dev common key
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@ int main(int argc, char** argv)
|
||||||
printf(" CommonKeyId: %02X\n", body.getCommonKeyId());
|
printf(" CommonKeyId: %02X\n", body.getCommonKeyId());
|
||||||
printf(" EncData:");
|
printf(" EncData:");
|
||||||
size_t size = body.getTitleKeyEncType() == es::ETicketBody_V2::RSA2048 ? crypto::rsa::kRsa2048Size : crypto::aes::kAes128KeySize;
|
size_t size = body.getTitleKeyEncType() == es::ETicketBody_V2::RSA2048 ? crypto::rsa::kRsa2048Size : crypto::aes::kAes128KeySize;
|
||||||
for (u32 i = 0; i < size; i++)
|
for (uint32_t i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
if (i % 16 == 0)
|
if (i % 16 == 0)
|
||||||
{
|
{
|
||||||
|
@ -64,13 +64,13 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
if (body.getTitleKeyEncType() == es::ETicketBody_V2::AES128_CBC && body.getCommonKeyId() == 0)
|
if (body.getTitleKeyEncType() == es::ETicketBody_V2::AES128_CBC && body.getCommonKeyId() == 0)
|
||||||
{
|
{
|
||||||
u8 iv[crypto::aes::kAesBlockSize];
|
byte_t iv[crypto::aes::kAesBlockSize];
|
||||||
u8 key[crypto::aes::kAes128KeySize];
|
byte_t key[crypto::aes::kAes128KeySize];
|
||||||
memcpy(iv, body.getRightsId(), crypto::aes::kAesBlockSize);
|
memcpy(iv, body.getRightsId(), crypto::aes::kAesBlockSize);
|
||||||
crypto::aes::AesCbcDecrypt(body.getEncTitleKey(), crypto::aes::kAes128KeySize, eticket_common_key, iv, key);
|
crypto::aes::AesCbcDecrypt(body.getEncTitleKey(), crypto::aes::kAes128KeySize, eticket_common_key, iv, key);
|
||||||
size = crypto::aes::kAes128KeySize;
|
size = crypto::aes::kAes128KeySize;
|
||||||
printf(" TitleKey:");
|
printf(" TitleKey:");
|
||||||
for (u32 i = 0; i < size; i++)
|
for (uint32_t i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
if (i % 16 == 0)
|
if (i % 16 == 0)
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,7 @@ int main(int argc, char** argv)
|
||||||
printf(" SharedTitle: %s\n", kBooleanStr[body.isSharedTitle()].c_str());
|
printf(" SharedTitle: %s\n", kBooleanStr[body.isSharedTitle()].c_str());
|
||||||
printf(" AllContent: %s\n", kBooleanStr[body.allowAllContent()].c_str());
|
printf(" AllContent: %s\n", kBooleanStr[body.allowAllContent()].c_str());
|
||||||
printf(" Reserved Region:");
|
printf(" Reserved Region:");
|
||||||
for (u32 i = 0; i < 8; i++)
|
for (uint32_t i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
if (i % 16 == 0)
|
if (i % 16 == 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue