From b57a5455987408dca2e663070ef72d1c694680b2 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Tue, 23 Apr 2024 20:38:11 -0400 Subject: [PATCH] Add layouts for some GCF models --- GCF/DirectoryEntry.cs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/GCF/DirectoryEntry.cs b/GCF/DirectoryEntry.cs index 5b3c8ef..4190546 100644 --- a/GCF/DirectoryEntry.cs +++ b/GCF/DirectoryEntry.cs @@ -1,46 +1,45 @@ +using System.Runtime.InteropServices; + namespace SabreTools.Models.GCF { /// + [StructLayout(LayoutKind.Sequential)] public sealed class DirectoryEntry { /// /// Offset to the directory item name from the end of the directory items. /// - public uint NameOffset { get; set; } - - /// - /// Directory item name from the end of the directory items. - /// - public string? Name { get; set; } + public uint NameOffset; /// /// Size of the item. (If file, file size. If folder, num items.) /// - public uint ItemSize { get; set; } + public uint ItemSize; /// /// Checksome index. (0xFFFFFFFF == None). /// - public uint ChecksumIndex { get; set; } + public uint ChecksumIndex; /// /// Flags for the directory item. (0x00000000 == Folder). /// - public HL_GCF_FLAG DirectoryFlags { get; set; } + [MarshalAs(UnmanagedType.U4)] + public HL_GCF_FLAG DirectoryFlags; /// /// Index of the parent directory item. (0xFFFFFFFF == None). /// - public uint ParentIndex { get; set; } + public uint ParentIndex; /// /// Index of the next directory item. (0x00000000 == None). /// - public uint NextIndex { get; set; } + public uint NextIndex; /// /// Index of the first directory item. (0x00000000 == None). /// - public uint FirstIndex { get; set; } + public uint FirstIndex; } } \ No newline at end of file