Remove hash conflict and adjust structure to simplify hash calculating.
This commit is contained in:
parent
48bff49511
commit
733e2b7a63
@ -1,108 +0,0 @@
|
|||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace Flawless.Core.BinaryDataFormat;
|
|
||||||
|
|
||||||
/* Depot Transmission Format Design - Version 1
|
|
||||||
*
|
|
||||||
* We have shrink some layout design and remap fields in order to optimize for networking transmission.
|
|
||||||
*
|
|
||||||
* Notice that we have assumed that all data are represent as LITTLE ENDIAN.
|
|
||||||
*
|
|
||||||
* Padding with 8 byte width, so:
|
|
||||||
*
|
|
||||||
* ------------------------------------------
|
|
||||||
* 0 : Version Code
|
|
||||||
* 1 : Network Transmission Feature
|
|
||||||
* 2 : Compressing Algorithm Type (CompressType)
|
|
||||||
* 3 : Checksum Confuser
|
|
||||||
* 4 : Depot Generate Time
|
|
||||||
* 5 : ~
|
|
||||||
* 6 : ~
|
|
||||||
* 7 : ~
|
|
||||||
* ------------------------------------------
|
|
||||||
* 8 : ~
|
|
||||||
* 9 : ~
|
|
||||||
* 10 : ~
|
|
||||||
* 11 : ~
|
|
||||||
* 12 : File Map String Size
|
|
||||||
* 13 : ~
|
|
||||||
* 14 : ~
|
|
||||||
* 15 : ~
|
|
||||||
* ------------------------------------------
|
|
||||||
* 16 : ~
|
|
||||||
* 17 : ~
|
|
||||||
* 18 : ~
|
|
||||||
* 19 : ~
|
|
||||||
* 20 : ~
|
|
||||||
* 21 : ~
|
|
||||||
* 22 : ~
|
|
||||||
* 23 : ~
|
|
||||||
* ------------------------------------------
|
|
||||||
* 24 : ~
|
|
||||||
* 25 : ~
|
|
||||||
* 26 : ~
|
|
||||||
* 27 : ~
|
|
||||||
* 28 : Payload Size
|
|
||||||
* 29 : ~
|
|
||||||
* 30 : ~
|
|
||||||
* 31 : ~
|
|
||||||
* ------------------------------------------
|
|
||||||
* 32 : ~
|
|
||||||
* 33 : ~
|
|
||||||
* 34 : ~
|
|
||||||
* 35 : ~
|
|
||||||
* 36 : MD5 Checksum (Standard MD5Checksum)
|
|
||||||
* 37 : ~
|
|
||||||
* 38 : ~
|
|
||||||
* 39 : ~
|
|
||||||
* ------------------------------------------
|
|
||||||
* 40 : ~
|
|
||||||
* 41 : ~
|
|
||||||
* 42 : ~
|
|
||||||
* 43 : ~
|
|
||||||
* 44 : ~
|
|
||||||
* 45 : ~
|
|
||||||
* 46 : ~
|
|
||||||
* 47 : ~
|
|
||||||
* ------------------------------------------
|
|
||||||
* 48 : ~
|
|
||||||
* 49 : ~
|
|
||||||
* 50 : ~
|
|
||||||
* 51 : ~
|
|
||||||
* 52 : ~
|
|
||||||
* ------------------------------------------
|
|
||||||
* FILE NAME MAP (STRING IN UTF8)
|
|
||||||
* ------------------------------------------
|
|
||||||
* PAYLOAD
|
|
||||||
*/
|
|
||||||
|
|
||||||
[Flags]
|
|
||||||
public enum NetworkTransmissionFeatureFlag: byte
|
|
||||||
{
|
|
||||||
FileMapIsJson = 1 << 0,
|
|
||||||
FileMapUseCompressionArgument = 1 << 7,
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable, StructLayout(LayoutKind.Explicit, CharSet = CharSet.Ansi, Pack = 8, Size = 52)]
|
|
||||||
public struct NetworkDepotHeaderV1
|
|
||||||
{
|
|
||||||
[FieldOffset(0)] public byte Version;
|
|
||||||
|
|
||||||
[FieldOffset(1)] public NetworkTransmissionFeatureFlag NetworkTransmissionFeature;
|
|
||||||
|
|
||||||
[FieldOffset(2)] public byte CompressType;
|
|
||||||
|
|
||||||
[FieldOffset(3)] public byte Md5Confuser;
|
|
||||||
|
|
||||||
[FieldOffset(4)] public ulong GenerateTime;
|
|
||||||
|
|
||||||
[FieldOffset(12)] public ulong FileMapStringSizeLower;
|
|
||||||
|
|
||||||
[FieldOffset(20)] public ulong FileMapStringSizeUpper;
|
|
||||||
|
|
||||||
[FieldOffset(28)] public ulong PayloadSize;
|
|
||||||
|
|
||||||
[FieldOffset(36)] public ulong Md5ChecksumLower;
|
|
||||||
|
|
||||||
[FieldOffset(44)] public ulong Md5ChecksumUpper;
|
|
||||||
}
|
|
||||||
108
Flawless.Core/BinaryDataFormat/NetworkDepotObjectV1.cs
Normal file
108
Flawless.Core/BinaryDataFormat/NetworkDepotObjectV1.cs
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Flawless.Core.BinaryDataFormat;
|
||||||
|
|
||||||
|
/* Depot Transmission Format Design - Version 1
|
||||||
|
*
|
||||||
|
* We have shrink some layout design and remap fields in order to optimize for networking transmission. You may noticed
|
||||||
|
* that we don't have a compressing info, this is due to compressing is mainly about how did depot stored in local disk,
|
||||||
|
* when using network transmission, we may compress it from outside. So we let compressing to go.
|
||||||
|
*
|
||||||
|
* Notice that we assume that all data are represent as LITTLE ENDIAN.
|
||||||
|
*
|
||||||
|
* Padding with 4 byte width, so:
|
||||||
|
*
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 0 : Version Code
|
||||||
|
* 1 : Network Transmission Feature
|
||||||
|
* 2 : (Preserve)
|
||||||
|
* 3 : (Preserve)
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 4 : (Preserve)
|
||||||
|
* 5 : (Preserve)
|
||||||
|
* 6 : (Preserve)
|
||||||
|
* 7 : (Preserve)
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 8 : File Map String Size
|
||||||
|
* 9 : ~
|
||||||
|
* 10 : ~
|
||||||
|
* 11 : ~
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 12 : ~
|
||||||
|
* 13 : ~
|
||||||
|
* 14 : ~
|
||||||
|
* 15 : ~
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 16 : MD5 Checksum (Standard DepotMD5Checksum)
|
||||||
|
* 17 : ~
|
||||||
|
* 18 : ~
|
||||||
|
* 19 : ~
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 20 : ~
|
||||||
|
* 21 : ~
|
||||||
|
* 22 : ~
|
||||||
|
* 23 : ~
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 24 :
|
||||||
|
* 25 : ~
|
||||||
|
* 26 : ~
|
||||||
|
* 27 : ~
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 28 : ~
|
||||||
|
* 29 : ~
|
||||||
|
* 30 : ~
|
||||||
|
* 31 : ~
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 32 : Depot Generate Time
|
||||||
|
* 33 : ~
|
||||||
|
* 34 : ~
|
||||||
|
* 35 : ~
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 36 : ~
|
||||||
|
* 37 : ~
|
||||||
|
* 38 : ~
|
||||||
|
* 39 : ~
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 40 : Payload Size
|
||||||
|
* 41 : ~
|
||||||
|
* 42 : ~
|
||||||
|
* 43 : ~
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 44 : ~
|
||||||
|
* 45 : ~
|
||||||
|
* 46 : ~
|
||||||
|
* 47 : ~
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* PAYLOAD (OPTIONAL)
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* FILE NAME MAP (OPTIONAL)
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
[Flags]
|
||||||
|
public enum NetworkTransmissionFeatureFlag: byte
|
||||||
|
{
|
||||||
|
FileMapIsJson = 1 << 0,
|
||||||
|
WithFileMap = 1 << 1,
|
||||||
|
WithPayload = 1 << 2,
|
||||||
|
CompressFileMap = 1 << 7,
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable, StructLayout(LayoutKind.Explicit, CharSet = CharSet.Ansi, Pack = 4, Size = 48)]
|
||||||
|
public struct NetworkDepotHeaderV1
|
||||||
|
{
|
||||||
|
[FieldOffset(0)] public byte Version;
|
||||||
|
|
||||||
|
[FieldOffset(1)] public NetworkTransmissionFeatureFlag NetworkTransmissionFeature;
|
||||||
|
|
||||||
|
[FieldOffset(8)] public ulong FileMapStringSize;
|
||||||
|
|
||||||
|
[FieldOffset(16)] public ulong Md5ChecksumLower;
|
||||||
|
|
||||||
|
[FieldOffset(24)] public ulong Md5ChecksumUpper;
|
||||||
|
|
||||||
|
[FieldOffset(32)] public ulong GenerateTime;
|
||||||
|
|
||||||
|
[FieldOffset(40)] public ulong PayloadSize;
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,131 +0,0 @@
|
|||||||
using System.Runtime.InteropServices;
|
|
||||||
using Flawless.Core.Modal;
|
|
||||||
|
|
||||||
namespace Flawless.Core.BinaryDataFormat;
|
|
||||||
|
|
||||||
/* Depot File System Format Design - Version 1
|
|
||||||
*
|
|
||||||
* For best accessing performance, consider use checksum as filename. Binary info did not contains file name mapping, so
|
|
||||||
* use another file to get the file map of this depot. The structure to describe a map has already defined below.
|
|
||||||
*
|
|
||||||
* Consider of compability when depot format was updated, we have configure a lots of area as empty.
|
|
||||||
*
|
|
||||||
* Notice that we assuming that all data are represent as LITTLE ENDIAN.
|
|
||||||
*
|
|
||||||
* Padding with 4 byte width, so:
|
|
||||||
*
|
|
||||||
* ------------------------------------------
|
|
||||||
* 0 : Magic Number
|
|
||||||
* 1 : ~
|
|
||||||
* 2 : ~
|
|
||||||
* 3 : ~
|
|
||||||
* ------------------------------------------
|
|
||||||
* 4 : MD5 Checksum (Header + Data)
|
|
||||||
* 5 : ~
|
|
||||||
* 6 : ~
|
|
||||||
* 7 : ~
|
|
||||||
* ------------------------------------------
|
|
||||||
* 8 : ~
|
|
||||||
* 9 : ~
|
|
||||||
* 10 : ~
|
|
||||||
* 11 : ~
|
|
||||||
* ------------------------------------------
|
|
||||||
* 12 : ~
|
|
||||||
* 13 : ~
|
|
||||||
* 14 : ~
|
|
||||||
* 15 : ~
|
|
||||||
* ------------------------------------------
|
|
||||||
* 16 : ~
|
|
||||||
* 17 : ~
|
|
||||||
* 18 : ~
|
|
||||||
* 19 : ~
|
|
||||||
* ------------------------------------------
|
|
||||||
* 20 : Version Code
|
|
||||||
* 21 : Checksum Confuser
|
|
||||||
* 22 : (Unused)
|
|
||||||
* 23 : (Unused)
|
|
||||||
* ------------------------------------------
|
|
||||||
* 24 : Depot Generate Time
|
|
||||||
* 25 : ~
|
|
||||||
* 26 : ~
|
|
||||||
* 27 : ~
|
|
||||||
* ------------------------------------------
|
|
||||||
* 28 : ~
|
|
||||||
* 29 : ~
|
|
||||||
* 30 : ~
|
|
||||||
* 31 : ~
|
|
||||||
* ------------------------------------------
|
|
||||||
* 32 : Compressing Algorithm Type (CompressType)
|
|
||||||
* 33 : (Preserve)
|
|
||||||
* 34 : (Preserve)
|
|
||||||
* 35 : (Preserve)
|
|
||||||
* ------------------------------------------
|
|
||||||
* 36 : (Preserve)
|
|
||||||
* 37 : (Preserve)
|
|
||||||
* 38 : (Preserve)
|
|
||||||
* 39 : (Preserve)
|
|
||||||
* ------------------------------------------
|
|
||||||
* 40 : Payload Size
|
|
||||||
* 41 : ~
|
|
||||||
* 42 : ~
|
|
||||||
* 43 : ~
|
|
||||||
* ------------------------------------------
|
|
||||||
* 44 : ~
|
|
||||||
* 45 : ~
|
|
||||||
* 46 : ~
|
|
||||||
* 47 : ~
|
|
||||||
* ------------------------------------------
|
|
||||||
* 48 : (Unused)
|
|
||||||
* 49 : (Unused)
|
|
||||||
* 50 : (Unused)
|
|
||||||
* 51 : (Unused)
|
|
||||||
* ------------------------------------------
|
|
||||||
* 52 : (Unused)
|
|
||||||
* 53 : (Unused)
|
|
||||||
* 54 : (Unused)
|
|
||||||
* 55 : (Unused)
|
|
||||||
* ------------------------------------------
|
|
||||||
* 56 : (Unused)
|
|
||||||
* 57 : (Unused)
|
|
||||||
* 58 : (Unused)
|
|
||||||
* 59 : (Unused)
|
|
||||||
* ------------------------------------------
|
|
||||||
* 60 : (Unused)
|
|
||||||
* 61 : (Unused)
|
|
||||||
* 62 : (Unused)
|
|
||||||
* 63 : (Unused)
|
|
||||||
* ------------------------------------------
|
|
||||||
* PAYLOAD
|
|
||||||
*/
|
|
||||||
|
|
||||||
[Serializable, StructLayout(LayoutKind.Explicit, CharSet = CharSet.Ansi, Pack = 4, Size = 64)]
|
|
||||||
public struct StandardDepotHeaderV1
|
|
||||||
{
|
|
||||||
public const uint FormatMagicNumber = 0xAAAAAAAAu;
|
|
||||||
|
|
||||||
[FieldOffset(0)] public uint MagicNumber;
|
|
||||||
|
|
||||||
[FieldOffset(4)] public ulong Md5ChecksumLower;
|
|
||||||
|
|
||||||
[FieldOffset(12)] public ulong Md5ChecksumUpper;
|
|
||||||
|
|
||||||
[FieldOffset(20)] public byte Version;
|
|
||||||
|
|
||||||
[FieldOffset(21)] public byte Md5Confuser;
|
|
||||||
|
|
||||||
[FieldOffset(22)] public ushort PayloadUnit;
|
|
||||||
|
|
||||||
[FieldOffset(24)] public ulong GenerateTime;
|
|
||||||
|
|
||||||
[FieldOffset(32)] public byte CompressType;
|
|
||||||
|
|
||||||
[FieldOffset(40)] public ulong PayloadSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable]
|
|
||||||
public struct StandardDepotMapV1
|
|
||||||
{
|
|
||||||
public uint FileCount;
|
|
||||||
|
|
||||||
public DepotFileInfo[] Files;
|
|
||||||
}
|
|
||||||
129
Flawless.Core/BinaryDataFormat/StandardDepotObjectV1.cs
Normal file
129
Flawless.Core/BinaryDataFormat/StandardDepotObjectV1.cs
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using Flawless.Core.Modal;
|
||||||
|
|
||||||
|
namespace Flawless.Core.BinaryDataFormat;
|
||||||
|
|
||||||
|
/* Depot File System Format Design - Version 1
|
||||||
|
*
|
||||||
|
* For best accessing performance, consider use checksum as filename. Binary info did not contains file name mapping, so
|
||||||
|
* use another file to get the file map of this depot. The structure to describe a map has already defined below and you
|
||||||
|
* can choose binary or text to store them. Advice to use JSON as text-based solution.
|
||||||
|
*
|
||||||
|
* Consider of compability when depot format was updated, we have configure a lots of area as empty.
|
||||||
|
*
|
||||||
|
* Notice that we assume that all data are represent as LITTLE ENDIAN.
|
||||||
|
*
|
||||||
|
* Padding with 8 byte width, so:
|
||||||
|
*
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 0 : Magic Number
|
||||||
|
* 1 : ~
|
||||||
|
* 2 : ~
|
||||||
|
* 3 : ~
|
||||||
|
* 4 : Header CRC Checksum (From self range 8 to 63)
|
||||||
|
* 5 : ~
|
||||||
|
* 6 : ~
|
||||||
|
* 7 : ~
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 8 : Version Code
|
||||||
|
* 9 : Compressing Algorithm Type
|
||||||
|
* 10 : (Preserve)
|
||||||
|
* 11 : (Preserve)
|
||||||
|
* 12 : (Preserve)
|
||||||
|
* 13 : (Preserve)
|
||||||
|
* 14 : (Preserve)
|
||||||
|
* 15 : (Preserve)
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 16 : File Map MD5 Checksum (From extern map data)
|
||||||
|
* 17 : ~
|
||||||
|
* 18 : ~
|
||||||
|
* 19 : ~
|
||||||
|
* 20 : ~
|
||||||
|
* 21 : ~
|
||||||
|
* 22 : ~
|
||||||
|
* 23 : ~
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 24 :
|
||||||
|
* 25 : ~
|
||||||
|
* 26 : ~
|
||||||
|
* 27 : ~
|
||||||
|
* 28 : ~
|
||||||
|
* 29 : ~
|
||||||
|
* 30 : ~
|
||||||
|
* 31 : ~
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 32 : Depot MD5 Checksum (From 48 to end, uncompressed)
|
||||||
|
* 33 : ~
|
||||||
|
* 34 : ~
|
||||||
|
* 35 : ~
|
||||||
|
* 36 : ~
|
||||||
|
* 37 : ~
|
||||||
|
* 38 : ~
|
||||||
|
* 39 : ~
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 40 : ~
|
||||||
|
* 41 : ~
|
||||||
|
* 42 : ~
|
||||||
|
* 43 : ~
|
||||||
|
* 44 : ~
|
||||||
|
* 45 : ~
|
||||||
|
* 46 : ~
|
||||||
|
* 47 : ~
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 48 : Depot Generate Time
|
||||||
|
* 49 : ~
|
||||||
|
* 50 : ~
|
||||||
|
* 51 : ~
|
||||||
|
* 52 : ~
|
||||||
|
* 53 : ~
|
||||||
|
* 54 : ~
|
||||||
|
* 55 : ~
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* 56 : Payload Size
|
||||||
|
* 57 : ~
|
||||||
|
* 58 : ~
|
||||||
|
* 59 : ~
|
||||||
|
* 60 : ~
|
||||||
|
* 61 : ~
|
||||||
|
* 62 : ~
|
||||||
|
* 63 : ~
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
* PAYLOAD
|
||||||
|
* ------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
[Serializable, StructLayout(LayoutKind.Explicit, CharSet = CharSet.Ansi, Pack = 8, Size = 64)]
|
||||||
|
public struct StandardDepotHeaderV1
|
||||||
|
{
|
||||||
|
// 1A: Not a text-based file
|
||||||
|
// F7A373 = Flawless
|
||||||
|
public const uint FormatMagicNumber = 0x1AF7A373u;
|
||||||
|
|
||||||
|
[FieldOffset(0)] public uint MagicNumber;
|
||||||
|
|
||||||
|
[FieldOffset(4)] public uint HeaderCRCChecksum;
|
||||||
|
|
||||||
|
[FieldOffset(8)] public byte Version;
|
||||||
|
|
||||||
|
[FieldOffset(9)] public byte CompressType;
|
||||||
|
|
||||||
|
[FieldOffset(16)] public ulong FileMapMd5ChecksumLower;
|
||||||
|
|
||||||
|
[FieldOffset(24)] public ulong FileMapMd5ChecksumUpper;
|
||||||
|
|
||||||
|
[FieldOffset(32)] public ulong DepotMd5ChecksumLower;
|
||||||
|
|
||||||
|
[FieldOffset(40)] public ulong DepotMd5ChecksumUpper;
|
||||||
|
|
||||||
|
[FieldOffset(48)] public ulong GenerateTime;
|
||||||
|
|
||||||
|
[FieldOffset(56)] public ulong PayloadSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public struct StandardDepotMapV1
|
||||||
|
{
|
||||||
|
public uint FileCount;
|
||||||
|
|
||||||
|
public DepotFileInfo[] Files;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user