mirror of
https://github.com/jakcron/nstool
synced 2024-11-15 02:06:40 +00:00
[nx] Added operators to AciHeader::sSection.
This commit is contained in:
parent
7b34bd404d
commit
544d484690
2 changed files with 32 additions and 17 deletions
|
@ -25,12 +25,9 @@ bool AciHeader::isEqual(const AciHeader & other) const
|
||||||
{
|
{
|
||||||
return (mType == other.mType) \
|
return (mType == other.mType) \
|
||||||
&& (mProgramId == other.mProgramId) \
|
&& (mProgramId == other.mProgramId) \
|
||||||
&& (mFac.offset == other.mFac.offset) \
|
&& (mFac == other.mFac) \
|
||||||
&& (mFac.size == other.mFac.size) \
|
&& (mSac == other.mSac) \
|
||||||
&& (mSac.offset == other.mSac.offset) \
|
&& (mKc == other.mKc);
|
||||||
&& (mSac.size == other.mSac.size) \
|
|
||||||
&& (mKc.offset == other.mKc.offset) \
|
|
||||||
&& (mKc.size == other.mKc.size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AciHeader::copyFrom(const AciHeader & other)
|
void AciHeader::copyFrom(const AciHeader & other)
|
||||||
|
@ -43,12 +40,9 @@ void AciHeader::copyFrom(const AciHeader & other)
|
||||||
{
|
{
|
||||||
mType = other.mType;
|
mType = other.mType;
|
||||||
mProgramId = other.mProgramId;
|
mProgramId = other.mProgramId;
|
||||||
mFac.offset = other.mFac.offset;
|
mFac = other.mFac;
|
||||||
mFac.size = other.mFac.size;
|
mSac = other.mSac;
|
||||||
mSac.offset = other.mSac.offset;
|
mKc = other.mKc;
|
||||||
mSac.size = other.mSac.size;
|
|
||||||
mKc.offset = other.mKc.offset;
|
|
||||||
mKc.size = other.mKc.size;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,23 @@ namespace nx
|
||||||
{
|
{
|
||||||
size_t offset;
|
size_t offset;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
|
void operator=(const sSection& other)
|
||||||
|
{
|
||||||
|
offset = other.offset;
|
||||||
|
size = other.size;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(const sSection& other) const
|
||||||
|
{
|
||||||
|
return (offset == other.offset) \
|
||||||
|
&& (size == other.size);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator!=(const sSection& other) const
|
||||||
|
{
|
||||||
|
return !operator==(other);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
AciHeader();
|
AciHeader();
|
||||||
|
@ -61,26 +78,30 @@ namespace nx
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
u8 signature_[4];
|
u8 signature_[4];
|
||||||
u8 reserved_1[12];
|
u32 size_; // includes prefacing signature, set only in ACID since it is signed
|
||||||
u64 program_id_;
|
u8 reserved_1[8];
|
||||||
|
u64 program_id_; // set only in ACI0 (since ACID is generic)
|
||||||
u8 reserved_2[8];
|
u8 reserved_2[8];
|
||||||
struct sAciSection
|
struct sAciSection
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
u32 offset_; // aligned by 0x10 from the last one
|
u32 offset_; // aligned by 0x10 from the last one
|
||||||
u32 mSize;
|
u32 size_;
|
||||||
public:
|
public:
|
||||||
u32 offset() const { return le_word(offset_); }
|
u32 offset() const { return le_word(offset_); }
|
||||||
void set_offset(u32 offset) { offset_ = le_word(offset); }
|
void set_offset(u32 offset) { offset_ = le_word(offset); }
|
||||||
|
|
||||||
u32 size() const { return le_word(mSize); }
|
u32 size() const { return le_word(size_); }
|
||||||
void set_size(u32 size) { mSize = le_word(size); }
|
void set_size(u32 size) { size_ = le_word(size); }
|
||||||
} fac_, sac_, kc_;
|
} fac_, sac_, kc_;
|
||||||
u8 reserved_3[8];
|
u8 reserved_3[8];
|
||||||
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_); }
|
||||||
|
void set_size(u32 size) { size_ = le_word(size); }
|
||||||
|
|
||||||
u64 program_id() const { return le_dword(program_id_); }
|
u64 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(u64 program_id) { program_id_ = le_dword(program_id); }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue