From ede52275da7e3a120a035bc2fa1f028f57e8c36b Mon Sep 17 00:00:00 2001 From: KillzXGaming Date: Thu, 16 Feb 2023 21:14:16 -0500 Subject: [PATCH] Fix GUID endianness --- .../FileFormats/DKCTF/FileData/Common.cs | 11 ++++++----- .../FileFormats/DKCTF/FileData/IOFileExtension.cs | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/File_Format_Library/FileFormats/DKCTF/FileData/Common.cs b/File_Format_Library/FileFormats/DKCTF/FileData/Common.cs index fe43275c..75ae46ab 100644 --- a/File_Format_Library/FileFormats/DKCTF/FileData/Common.cs +++ b/File_Format_Library/FileFormats/DKCTF/FileData/Common.cs @@ -253,8 +253,8 @@ namespace DKCTF { return Guid.Part1 == 0 && Guid.Part2 == 0 && - Guid.Part3 == 0 && - Guid.Part4 == 0; + Guid.Part3 == 0 && + Guid.Part4[0] == 0; } } @@ -300,12 +300,13 @@ namespace DKCTF public uint Part1; public ushort Part2; public ushort Part3; - public ulong Part4; + + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public byte[] Part4; public Guid ToGUID() { - var bytes = BitConverter.GetBytes(Part4).Reverse().ToArray(); - return new Guid(Part1, Part2, Part3, bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6], bytes[7]); + return new Guid(Part1, Part2, Part3, Part4[0], Part4[1], Part4[2], Part4[3], Part4[4], Part4[5], Part4[6], Part4[7]); } public override string ToString() //Represented based on output guids in demo files diff --git a/File_Format_Library/FileFormats/DKCTF/FileData/IOFileExtension.cs b/File_Format_Library/FileFormats/DKCTF/FileData/IOFileExtension.cs index 820aeedc..d6b91743 100644 --- a/File_Format_Library/FileFormats/DKCTF/FileData/IOFileExtension.cs +++ b/File_Format_Library/FileFormats/DKCTF/FileData/IOFileExtension.cs @@ -45,7 +45,7 @@ namespace DKCTF Part1 = reader.ReadUInt32(), Part2 = reader.ReadUInt16(), Part3 = reader.ReadUInt16(), - Part4 = reader.ReadUInt64(), + Part4 = reader.ReadBytes(8), }, }; }