-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathteStructuredDataDataStructures.cs
More file actions
90 lines (76 loc) · 2.72 KB
/
Copy pathteStructuredDataDataStructures.cs
File metadata and controls
90 lines (76 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using TankLib.Helpers;
namespace TankLib.STU {
#region V2
public sealed class STUBag<T> : List<T>, ISerializable where T : ISerializable, new() {
public void Deserialize(BinaryReader reader) {
int size = reader.ReadInt32();
int offset = reader.ReadInt32();
long oldPosition = reader.BaseStream.Position;
reader.BaseStream.Position = offset;
Capacity = size;
for (int i = 0; i != size; ++i) {
SerializableHelper.Deserialize(reader, out T val);
Add(val);
}
reader.BaseStream.Position = oldPosition;
}
public void Serialize(BinaryWriter writer) {
throw new System.NotImplementedException();
}
}
public class STUField_Info : ISerializable {
public uint Hash;
public int Size;
public void Deserialize(BinaryReader reader) {
Hash = reader.ReadUInt32();
Size = reader.ReadInt32();
}
public void Serialize(BinaryWriter writer) {
throw new System.NotImplementedException();
}
}
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct STUInstance_Info : ISerializable {
public uint Hash;
public uint EmbedderFieldHash; // Help me find a better name?
public int EmbedderInstanceIdx; // Help me find a better name?
public int Size;
public void Deserialize(BinaryReader reader) {
Hash = reader.ReadUInt32();
EmbedderFieldHash = reader.ReadUInt32();
EmbedderInstanceIdx = reader.ReadInt32();
Size = reader.ReadInt32();
}
public void Serialize(BinaryWriter writer) {
throw new System.NotImplementedException();
}
}
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct STUInlineArray_Info : ISerializable {
public uint TypeHash;
public int ArrayCount; // Size of the array that references this type.
public void Deserialize(BinaryReader reader) {
TypeHash = reader.ReadUInt32();
ArrayCount = reader.ReadInt32();
}
public void Serialize(BinaryWriter writer) {
throw new System.NotImplementedException();
}
}
#endregion
#region V1
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct STUHeaderV1 {
public uint Magic;
public uint InstanceCount;
}
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct STUInstanceRecordV1 {
public int Offset;
public uint Flags;
}
#endregion
}