using System.Runtime.InteropServices;
namespace BurnOutSharp.Models.MoPaQ
{
///
/// The BET table is present if the BetTablePos64 member of MPQ header is set
/// to nonzero. BET table is a successor of classic block table, and can fully
/// replace it. It is also supposed to be more effective.
///
///
[StructLayout(LayoutKind.Sequential)]
public class BetTable
{
// TODO: Extract this out and make in common between HET and BET
#region Common Table Headers
///
/// 'BET\x1A'
///
public uint Signature;
///
/// Version. Seems to be always 1
///
public uint Version;
///
/// Size of the contained table
///
public uint DataSize;
#endregion
///
/// Size of the entire hash table, including the header (in bytes)
///
public uint TableSize;
///
/// Number of files in the BET table
///
public uint FileCount;
///
/// Unknown, set to 0x10
///
public uint Unknown;
///
/// Size of one table entry (in bits)
///
public uint TableEntrySize;
///
/// Bit index of the file position (within the entry record)
///
public uint FilePositionBitIndex;
///
/// Bit index of the file size (within the entry record)
///
public uint FileSizeBitIndex;
///
/// Bit index of the compressed size (within the entry record)
///
public uint CompressedSizeBitIndex;
///
/// Bit index of the flag index (within the entry record)
///
public uint FlagIndexBitIndex;
///
/// Bit index of the ??? (within the entry record)
///
public uint UnknownBitIndex;
///
/// Bit size of file position (in the entry record)
///
public uint FilePositionBitCount;
///
/// Bit size of file size (in the entry record)
///
public uint FileSizeBitCount;
///
/// Bit size of compressed file size (in the entry record)
///
public uint CompressedSizeBitCount;
///
/// Bit size of flags index (in the entry record)
///
public uint FlagIndexBitCount;
///
/// Bit size of ??? (in the entry record)
///
public uint UnknownBitCount;
///
/// Total size of the BET hash
///
public uint TotalBetHashSize;
///
/// Extra bits in the BET hash
///
public uint BetHashSizeExtra;
///
/// Effective size of BET hash (in bits)
///
public uint BetHashSize;
///
/// Size of BET hashes array, in bytes
///
public uint BetHashArraySize;
///
/// Number of flags in the following array
///
public uint FlagCount;
///
/// Followed by array of file flags. Each entry is 32-bit size and its meaning is the same like
///
/// Size from
public uint[] FlagsArray;
// File table. Size of each entry is taken from dwTableEntrySize.
// Size of the table is (dwTableEntrySize * dwMaxFileCount), round up to 8.
// Array of BET hashes. Table size is taken from dwMaxFileCount from HET table
}
}