1
0

120 lines
3.2 KiB
C#

using System.Runtime.InteropServices;
using Flawless.Abstraction;
using Flawless.Core.Modal;
namespace Flawless.Core.BinaryDataFormat;
/* Depot File System Format Design - Version 1
*
* For best accessing performance, consider use checksum as filename.
*
* 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 : Depot MD5 Checksum (From 64 to end, uncompressed)
* 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 : File Map Size
* 41 : ~
* 42 : ~
* 43 : ~
* 44 : ~
* 45 : ~
* 46 : ~
* 47 : ~
* ------------------------------------------------------------
* 48 : Payload Size
* 49 : ~
* 50 : ~
* 51 : ~
* 52 : ~
* 53 : ~
* 54 : ~
* 55 : ~
* ------------------------------------------------------------
* 56 : (Preserve)
* 57 : (Preserve)
* 58 : (Preserve)
* 59 : (Preserve)
* 60 : (Preserve)
* 61 : (Preserve)
* 62 : (Preserve)
* 63 : (Preserve)
* ------------------------------------------------------------
* PAYLOAD (Binary, Compressed)
* ------------------------------------------------------------
* FILE MAP (UTF-8, Compressed)
* ------------------------------------------------------------
*/
[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 DepotMd5ChecksumLower;
[FieldOffset(24)] public ulong DepotMd5ChecksumUpper;
[FieldOffset(32)] public ulong GenerateTime;
[FieldOffset(40)] public ulong FileMapSize;
[FieldOffset(48)] public ulong PayloadSize;
}