mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-17 18:27:56 -05:00
fix: fill structs in runtime block that are not matching structure
This commit is contained in:
@ -1129,7 +1129,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
void LoadMember_ArrayPointer(const StructureInformation* info, const MemberInformation* member, const DeclarationModifierComputations& modifier) const
|
||||
void LoadMember_ArrayPointer(const StructureInformation* info, const MemberInformation* member, const DeclarationModifierComputations& modifier)
|
||||
{
|
||||
const MemberComputations computations(member);
|
||||
if (member->m_type && !member->m_type->m_is_leaf && !computations.IsInRuntimeBlock())
|
||||
@ -1151,6 +1151,20 @@ namespace
|
||||
LINE(MakeCustomActionCall(member->m_post_load_action.get()))
|
||||
}
|
||||
}
|
||||
else if (member->m_type && !member->m_type->m_has_matching_cross_platform_structure && computations.IsInRuntimeBlock())
|
||||
{
|
||||
LINEF("const auto runtimeArraySize = static_cast<size_t>({0});", MakeEvaluation(modifier.GetArrayPointerCountEvaluation()))
|
||||
LINEF("const auto runtimeFill = m_stream.LoadWithFill({0} * runtimeArraySize);", member->m_member->m_type_declaration->m_type->GetSize())
|
||||
LINE("for (auto i = 0uz; i < runtimeArraySize; i++)")
|
||||
LINE("{")
|
||||
m_intendation++;
|
||||
LINEF("{0} = &{1}[i];", MakeTypeVarName(member->m_member->m_type_declaration->m_type), MakeMemberAccess(info, member, modifier))
|
||||
LINEF("FillStruct_{0}(runtimeFill.AtOffset(i * {1}));",
|
||||
MakeSafeTypeName(member->m_member->m_type_declaration->m_type),
|
||||
member->m_member->m_type_declaration->m_type->GetSize())
|
||||
m_intendation--;
|
||||
LINE("}")
|
||||
}
|
||||
else
|
||||
{
|
||||
LINEF("m_stream.Load<{0}{1}>({2}, {3});",
|
||||
@ -1310,6 +1324,13 @@ namespace
|
||||
LINE(MakeCustomActionCall(member->m_post_load_action.get()))
|
||||
}
|
||||
}
|
||||
else if (member->m_type && !member->m_type->m_has_matching_cross_platform_structure && computations.IsInRuntimeBlock())
|
||||
{
|
||||
LINEF("{0} = {1};", MakeTypeVarName(member->m_member->m_type_declaration->m_type), MakeMemberAccess(info, member, modifier))
|
||||
LINEF("FillStruct_{0}(m_stream.LoadWithFill({1}));",
|
||||
MakeSafeTypeName(member->m_member->m_type_declaration->m_type),
|
||||
member->m_member->m_type_declaration->m_type->GetSize())
|
||||
}
|
||||
else
|
||||
{
|
||||
LINEF("m_stream.Load<{0}{1}>({2});",
|
||||
|
Reference in New Issue
Block a user