forked from difcareer/010templates
-
Notifications
You must be signed in to change notification settings - Fork 1
/
RDBTemplate.bt
executable file
·58 lines (44 loc) · 1.3 KB
/
RDBTemplate.bt
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
//-----------------------------------
//--- 010 Editor v2.0 Binary Template
//
// File: RDBTemplate.bt
// Author: AnTler
// Revision: 1.0
// Purpose: Defines a template for parsing RDB files.
// Changes:
//-----------------------------------
// Define structures used in RDB files
// Defines a file header
typedef struct {
CHAR reserved[16];
DWORD fhFileTotalCount;
INT64 fhFileNameOffBits <format=hex>;
INT64 fhFileDataOffBits <format=hex>;
} RDBFILEHEADER ;
// Defines a file record
typedef struct {
local INT fileNameLength = 0;
local USHORT value = 0;
do
{
value = ReadUShort( FTell() + fileNameLength) ;
fileNameLength += sizeof(value);
} while(value != 0x0000);
CHAR frCurFileName[fileNameLength];
INT64 frCurFileDataOffBits <format=hex>;
INT64 frCurFileDataSize;
} RDBFILERECORD <read=ReadRDBFILERECORD>;
string ReadRDBFILERECORD( RDBFILERECORD &r )
{
string s;
SPrintf( s, "%s", r.frCurFileName);
return s;
}
//--------------------------------------------
// Define the file
LittleEndian();
RDBFILEHEADER rdbFileHeader;
FSeek(rdbFileHeader.fhFileNameOffBits);
local int i;
for( i = 0; i < rdbFileHeader.fhFileTotalCount; i++ )
RDBFILERECORD rdbFileRecord;