From 95c7032f05e5b37c61b8b912f11c8b9a898e8f86 Mon Sep 17 00:00:00 2001 From: rbran Date: Tue, 21 Jan 2025 16:00:28 -0300 Subject: [PATCH] fix tilib struct alignment --- src/tools/tilib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tools/tilib.rs b/src/tools/tilib.rs index 4de10b4..f548e68 100644 --- a/src/tools/tilib.rs +++ b/src/tools/tilib.rs @@ -1599,6 +1599,11 @@ fn print_til_type_struct_layout( .as_ref() .map(IDBString::as_utf8_lossy) .unwrap_or(Cow::Owned(String::new())); + // offset alignment + let align_diff = offset % member_align; + if align_diff != 0 { + offset += member_align - align_diff; + } write!(fmt, "//{i:>3}. {offset:04X} {member_size:04X} effalign({member_align}) fda=0 bits=0000 {name}.")?; if !member_name.as_bytes().is_empty() { fmt.write_all(member_name.as_bytes())?;