1
0

106 lines
3.1 KiB
C#

using System.Runtime.InteropServices;
using Flawless.Abstraction;
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 : MD5 Checksum (Standard DepotMD5Checksum)
* 9 : ~
* 10 : ~
* 11 : ~
* ------------------------------------------------------------
* 12 : ~
* 13 : ~
* 14 : ~
* 15 : ~
* ------------------------------------------------------------
* 16 : ~
* 17 : ~
* 18 : ~
* 19 : ~
* ------------------------------------------------------------
* 20 : ~
* 21 : ~
* 22 : ~
* 23 : ~
* ------------------------------------------------------------
* 24 : Depot Generate Time
* 25 : ~
* 26 : ~
* 27 : ~
* ------------------------------------------------------------
* 28 : ~
* 29 : ~
* 30 : ~
* 31 : ~
* ------------------------------------------------------------
* 32 : File Map Size
* 33 : ~
* 34 : ~
* 35 : ~
* ------------------------------------------------------------
* 36 : ~
* 37 : ~
* 38 : ~
* 39 : ~
* ------------------------------------------------------------
* 40 : Payload Size
* 41 : ~
* 42 : ~
* 43 : ~
* ------------------------------------------------------------
* 44 : ~
* 45 : ~
* 46 : ~
* 47 : ~
* ------------------------------------------------------------
* PAYLOAD (Optional, Binary, Uncompress)
* ------------------------------------------------------------
* FILE MAP (Optional, UTF-8, Uncompress)
* ------------------------------------------------------------
*/
[Flags]
public enum NetworkTransmissionFeatureFlag: byte
{
WithPayload = 1 << 0,
WithFileMap = 1 << 1,
}
[Serializable, StructLayout(LayoutKind.Explicit, CharSet = CharSet.Ansi, Pack = 4, Size = 48)]
public struct NetworkDepotHeaderV1
{
[FieldOffset(0)] public byte Version;
[FieldOffset(1)] public byte NetworkTransmissionFeature;
[FieldOffset(8)] public ulong Md5ChecksumLower;
[FieldOffset(16)] public ulong Md5ChecksumUpper;
[FieldOffset(24)] public ulong GenerateTime;
[FieldOffset(32)] public ulong FileMapSize;
[FieldOffset(40)] public ulong PayloadSize;
}