Changed DrawableModel.Geometries to array

This commit is contained in:
dexy
2020-03-14 01:30:56 +11:00
Unverified
parent 4941f86193
commit e48503e130
10 changed files with 160 additions and 80 deletions
@@ -234,6 +234,18 @@ namespace CodeWalker.GameFiles
}
}
public T[] ReadBlocks<T>(ulong[] pointers) where T : IResourceBlock, new()
{
if (pointers == null) return null;
var count = pointers.Length;
var items = new T[count];
for (int i = 0; i < count; i++)
{
items[i] = ReadBlockAt<T>(pointers[i]);
}
return items;
}
public byte[] ReadBytesAt(ulong position, uint count, bool cache = true)
{
@@ -549,6 +561,17 @@ namespace CodeWalker.GameFiles
}
/// <summary>
/// Write enough bytes to the stream to get to the specified alignment.
/// </summary>
/// <param name="alignment">value to align to</param>
public void WritePadding(int alignment)
{
var pad = ((alignment - (Position % alignment)) % alignment);
if (pad > 0) Write(new byte[pad]);
}
}