mirror of
https://github.com/jakcron/nstool.git
synced 2024-12-22 10:45:28 +00:00
[nx] AciHeader updated to inherit from ISerialisableBinary.
This commit is contained in:
parent
e7172949da
commit
844a46c83a
|
@ -19,6 +19,37 @@ void AciHeader::calculateSectionOffsets()
|
||||||
mKc.offset = mSac.offset + align(mSac.size, kAciAlignSize);
|
mKc.offset = mSac.offset + align(mSac.size, kAciAlignSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AciHeader::isEqual(const AciHeader & other) const
|
||||||
|
{
|
||||||
|
return (mType == other.mType) \
|
||||||
|
&& (mProgramId == other.mProgramId) \
|
||||||
|
&& (mFac.offset == other.mFac.offset) \
|
||||||
|
&& (mFac.size == other.mFac.size) \
|
||||||
|
&& (mSac.offset == other.mSac.offset) \
|
||||||
|
&& (mSac.size == other.mSac.size) \
|
||||||
|
&& (mKc.offset == other.mKc.offset) \
|
||||||
|
&& (mKc.size == other.mKc.size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AciHeader::copyFrom(const AciHeader & other)
|
||||||
|
{
|
||||||
|
if (other.getSize())
|
||||||
|
{
|
||||||
|
importBinary(other.getBytes(), other.getSize());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mType = other.mType;
|
||||||
|
mProgramId = other.mProgramId;
|
||||||
|
mFac.offset = other.mFac.offset;
|
||||||
|
mFac.size = other.mFac.size;
|
||||||
|
mSac.offset = other.mSac.offset;
|
||||||
|
mSac.size = other.mSac.size;
|
||||||
|
mKc.offset = other.mKc.offset;
|
||||||
|
mKc.size = other.mKc.size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
AciHeader::AciHeader()
|
AciHeader::AciHeader()
|
||||||
{
|
{
|
||||||
clearVariables();
|
clearVariables();
|
||||||
|
@ -34,9 +65,14 @@ AciHeader::AciHeader(const u8 * bytes)
|
||||||
importBinary(bytes);
|
importBinary(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AciHeader::operator==(const AciHeader & other)
|
bool AciHeader::operator==(const AciHeader & other) const
|
||||||
{
|
{
|
||||||
return memcmp(this->getBytes(), other.getBytes(), this->getSize());
|
return isEqual(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AciHeader::operator!=(const AciHeader & other) const
|
||||||
|
{
|
||||||
|
return !isEqual(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AciHeader::operator=(const AciHeader & other)
|
void AciHeader::operator=(const AciHeader & other)
|
||||||
|
|
|
@ -23,7 +23,8 @@ public:
|
||||||
AciHeader(const AciHeader& other);
|
AciHeader(const AciHeader& other);
|
||||||
AciHeader(const u8* bytes);
|
AciHeader(const u8* bytes);
|
||||||
|
|
||||||
bool operator==(const AciHeader& other);
|
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
|
||||||
|
@ -102,5 +103,7 @@ private:
|
||||||
|
|
||||||
void clearVariables();
|
void clearVariables();
|
||||||
void calculateSectionOffsets();
|
void calculateSectionOffsets();
|
||||||
|
bool isEqual(const AciHeader& other) const;
|
||||||
|
void copyFrom(const AciHeader& other);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue