fix: various wrong alignment values (#823)

* fix: alignment mistakes on various games

* chore: reduce overhead of zcg definition with members fields

* fix: make sure Material alloc alignment is 4
This commit is contained in:
Jan authored and GitHub committed 2026-06-07 01:14:37 +00:00
1 parent 036b27568c
commit ab7d8f5670
24 files changed
+62 -50

No files matched your search

@@ -7,10 +7,7 @@ DefinitionWithMembers::DefinitionWithMembers(std::string _namespace, std::string
m_flags(0),
m_size(0),
m_alignment(0),
m_has_alignment_override(false),
m_anonymous(false),
m_pack(pack),
m_alignment_override(0)
m_pack(pack)
{
}
@@ -23,8 +20,6 @@ unsigned DefinitionWithMembers::GetAlignment() const
bool DefinitionWithMembers::GetForceAlignment() const
{
assert(m_flags & FLAG_FIELDS_CALCULATED);
return m_flags & FLAG_ALIGNMENT_FORCED;
}
@@ -34,3 +29,8 @@ unsigned DefinitionWithMembers::GetSize() const
return m_size;
}
bool DefinitionWithMembers::IsAnonymous() const
{
return m_flags & FLAG_ANONYMOUS;
}
@@ -12,22 +12,19 @@ public:
static constexpr int FLAG_FIELDS_CALCULATED = 1 << 0;
static constexpr int FLAG_FIELDS_CALCULATING = 1 << 1;
static constexpr int FLAG_ALIGNMENT_FORCED = 1 << 2;
static constexpr int FLAG_ANONYMOUS = 1 << 3;
DefinitionWithMembers(std::string _namespace, std::string name, unsigned pack);
[[nodiscard]] unsigned GetAlignment() const override;
[[nodiscard]] bool GetForceAlignment() const override;
[[nodiscard]] unsigned GetSize() const override;
[[nodiscard]] bool IsAnonymous() const;
unsigned m_flags;
unsigned m_size;
unsigned m_alignment;
bool m_has_alignment_override;
bool m_anonymous;
const unsigned m_pack;
unsigned m_alignment_override;
unsigned m_pack;
std::vector<std::shared_ptr<Variable>> m_members;
};