mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-03-07 05:23:02 +00:00
fix: filling union members that are not supposed to be written
* This causes some pointers to be partially overwritten when filling in the wrong order as well
This commit is contained in:
@@ -189,15 +189,15 @@ bool MemberComputations::IsInRuntimeBlock() const
|
||||
return m_info->m_fast_file_block != nullptr && m_info->m_fast_file_block->m_type == FastFileBlockType::RUNTIME;
|
||||
}
|
||||
|
||||
bool MemberComputations::IsFirstUsedMember() const
|
||||
bool MemberComputations::IsFirstUsedMember(const bool includeLeafs) const
|
||||
{
|
||||
const auto parentUsedMembers = StructureComputations(m_info->m_parent).GetUsedMembers();
|
||||
const auto parentUsedMembers = StructureComputations(m_info->m_parent).GetUsedMembers(includeLeafs);
|
||||
return !parentUsedMembers.empty() && parentUsedMembers[0] == m_info;
|
||||
}
|
||||
|
||||
bool MemberComputations::IsLastUsedMember() const
|
||||
bool MemberComputations::IsLastUsedMember(const bool includeLeafs) const
|
||||
{
|
||||
const auto parentUsedMembers = StructureComputations(m_info->m_parent).GetUsedMembers();
|
||||
const auto parentUsedMembers = StructureComputations(m_info->m_parent).GetUsedMembers(includeLeafs);
|
||||
return !parentUsedMembers.empty() && parentUsedMembers[parentUsedMembers.size() - 1] == m_info;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ public:
|
||||
[[nodiscard]] bool IsNotInDefaultNormalBlock() const;
|
||||
[[nodiscard]] bool IsInTempBlock() const;
|
||||
[[nodiscard]] bool IsInRuntimeBlock() const;
|
||||
[[nodiscard]] bool IsFirstUsedMember() const;
|
||||
[[nodiscard]] bool IsLastUsedMember() const;
|
||||
[[nodiscard]] bool IsFirstUsedMember(bool includeLeafs) const;
|
||||
[[nodiscard]] bool IsLastUsedMember(bool includeLeafs) const;
|
||||
[[nodiscard]] bool HasDynamicArraySize() const;
|
||||
[[nodiscard]] bool IsDynamicMember() const;
|
||||
[[nodiscard]] bool IsAfterPartialLoad() const;
|
||||
|
||||
@@ -38,7 +38,7 @@ bool StructureComputations::HasNonDynamicMember() const
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<MemberInformation*> StructureComputations::GetUsedMembers() const
|
||||
std::vector<MemberInformation*> StructureComputations::GetUsedMembers(const bool includeLeafs) const
|
||||
{
|
||||
std::vector<MemberInformation*> members;
|
||||
|
||||
@@ -54,7 +54,7 @@ std::vector<MemberInformation*> StructureComputations::GetUsedMembers() const
|
||||
{
|
||||
for (const auto& member : m_info->m_ordered_members)
|
||||
{
|
||||
if (!member->m_is_leaf && !MemberComputations(member.get()).ShouldIgnore())
|
||||
if ((includeLeafs || !member->m_is_leaf) && !MemberComputations(member.get()).ShouldIgnore())
|
||||
members.push_back(member.get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ public:
|
||||
[[nodiscard]] bool IsAsset() const;
|
||||
[[nodiscard]] MemberInformation* GetDynamicMember() const;
|
||||
[[nodiscard]] bool HasNonDynamicMember() const;
|
||||
[[nodiscard]] std::vector<MemberInformation*> GetUsedMembers() const;
|
||||
[[nodiscard]] std::vector<MemberInformation*> GetUsedMembers(bool includeLeafs) const;
|
||||
[[nodiscard]] bool IsInTempBlock() const;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user