Skip to content

Commit

Permalink
Update .BIT 010 template.
Browse files Browse the repository at this point in the history
  • Loading branch information
Doom2fan committed Nov 27, 2024
1 parent 9dfef2e commit 69fa92e
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions _010Templates/BIT.bt
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@
LittleEndian();

typedef enum <byte> {
Copy = 0,
RLE = 1,
LZRLE = 2,
Compression_Copy = 0,
Compression_RLE = 1,
Compression_LZRLE = 2,
} BIT_CompressionMode;

typedef enum <ubyte> {
BITF_None = 0,
BITF_SimpleHeader = 1,
} BIT_Flags;

struct BIT_File {
struct BIT_Header {
char IdMagic [4];
Expand All @@ -24,7 +29,12 @@ struct BIT_File {
Exit (-1);
}

ushort Revision;
ubyte Revision;
BIT_Flags Flags;
if ((Flags & BITF_SimpleHeader) == 0) {
Warning ("Only \"simple\" BIT files supported.");
Exit (0);
}
uint EntryCount;
} header;

Expand All @@ -34,7 +44,7 @@ struct BIT_File {
uint Offset;
uint Length;
uint Hash <format=hex>;
byte FileIdentA <format=hex>;
ubyte FileIdentA <format=hex>;
} entries [header.EntryCount] <read=ReadBITEntry>;
local int directoryEnd = FTell ();

Expand All @@ -45,7 +55,8 @@ struct BIT_File {
FSeek (entries [i].Offset);
struct BIT_EntryData {
BIT_CompressionMode CompressionMode;
byte FileIdent [3] <format=hex>;
typedef ubyte FileIdentType [3] <format=hex, read=Str ("%.2X:%.2X:%.2X", this [0], this [1], this [2])>;
FileIdentType FileIdent;
uint Length;
ushort UncompressedBytes;
} entryData;
Expand All @@ -55,9 +66,7 @@ struct BIT_File {
} file <open=true>;

string ReadBITEntry (BIT_Entry &entry) {
string ret;
SPrintf (ret, "%8X", entry.Id);
return ret;
return Str ("%.8X.%.8X", entry.Id, entry.Hash);
}

return 0;

0 comments on commit 69fa92e

Please sign in to comment.