From f9a67fbf6fd72987133d841a710ab6f417f264cb Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Tue, 25 Apr 2017 17:29:49 -0700 Subject: [PATCH] FifoFileStruct: replace unions with explicit padding --- Source/Core/Core/FifoPlayer/FifoFileStruct.h | 61 +++++++++----------- 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/Source/Core/Core/FifoPlayer/FifoFileStruct.h b/Source/Core/Core/FifoPlayer/FifoFileStruct.h index bfe6bdb741..d40f8f6a1f 100644 --- a/Source/Core/Core/FifoPlayer/FifoFileStruct.h +++ b/Source/Core/Core/FifoPlayer/FifoFileStruct.h @@ -15,44 +15,38 @@ enum MIN_LOADER_VERSION = 1, }; -#pragma pack(push, 4) +#pragma pack(push, 1) -union FileHeader +struct FileHeader { - struct - { - u32 fileId; - u32 file_version; - u32 min_loader_version; - u64 bpMemOffset; - u32 bpMemSize; - u64 cpMemOffset; - u32 cpMemSize; - u64 xfMemOffset; - u32 xfMemSize; - u64 xfRegsOffset; - u32 xfRegsSize; - u64 frameListOffset; - u32 frameCount; - u32 flags; - u64 texMemOffset; - u32 texMemSize; - }; - u32 rawData[32]; + u32 fileId; + u32 file_version; + u32 min_loader_version; + u64 bpMemOffset; + u32 bpMemSize; + u64 cpMemOffset; + u32 cpMemSize; + u64 xfMemOffset; + u32 xfMemSize; + u64 xfRegsOffset; + u32 xfRegsSize; + u64 frameListOffset; + u32 frameCount; + u32 flags; + u64 texMemOffset; + u32 texMemSize; + u8 reserved[40]; }; -union FileFrameInfo +struct FileFrameInfo { - struct - { - u64 fifoDataOffset; - u32 fifoDataSize; - u32 fifoStart; - u32 fifoEnd; - u64 memoryUpdatesOffset; - u32 numMemoryUpdates; - }; - u32 rawData[16]; + u64 fifoDataOffset; + u32 fifoDataSize; + u32 fifoStart; + u32 fifoEnd; + u64 memoryUpdatesOffset; + u32 numMemoryUpdates; + u8 reserved[32]; }; struct FileMemoryUpdate @@ -62,6 +56,7 @@ struct FileMemoryUpdate u64 dataOffset; u32 dataSize; u8 type; + u8 reserved[3]; }; #pragma pack(pop)