-
Notifications
You must be signed in to change notification settings - Fork 6
/
cTurbineFile.h
107 lines (90 loc) · 1.75 KB
/
cTurbineFile.h
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#pragma once
#include <map>
const long FILEHEADERLOC = 0x140;
struct stTFMap
{
stTFMap()
{
Data = NULL;
}
stTFMap(DWORD NPos, DWORD NLen, cPortalFile *NData = NULL)
{
Position = NPos;
Length = NLen;
Data = NData;
}
~stTFMap()
{
delete Data;
}
DWORD Position;
DWORD Length;
cPortalFile * Data;
};
typedef std::map< DWORD, QWORD > InfoMap;
typedef std::map< DWORD, cPortalFile * > FileMap;
typedef std::map<DWORD, stTFMap *> TFMapType;
struct TODDatFileHeader
{
DWORD dwMagicNumber;
DWORD dwBlockSize;
DWORD dwFileSize;
DWORD dwFileVersion;
DWORD dwUnknown1;
DWORD dwFirstFreeBlock;
DWORD dwLastFreeBlock;
DWORD dwFreeBlockCount;
DWORD dwRootOffset;
DWORD dwUnknown2;
DWORD dwUnknown3;
DWORD dwUnknown4;
DWORD dwUnknown5;
DWORD dwUnknown6;
DWORD dwUnknown7;
DWORD dwUnknown8;
};
struct TODFileEntry
{
DWORD dwUnknown1;
DWORD dwID;
DWORD dwFileOffset;
DWORD dwFileSize;
float fTimeStamp;
DWORD dwUnknown6;
};
struct TODDirectory
{
DWORD dwSubdirs[62];
DWORD dwEntryCount;
struct TODFileEntry feEntries[62];
};
class cTurbineFile
{
public:
cTurbineFile();
~cTurbineFile();
cPortalFile * OpenEntry( DWORD dwID );
void InsertEntry(cPortalFile * pfNew);
void LoadFile( std::string Filename );
DWORD GetPoolSize()
{
CalcPoolSize();
return m_dwPoolSize;
}
protected:
void CloseFile();
private:
void FindFiles( DWORD dirPos, std::unordered_set<DWORD> *LoadSet );
void LoadSection( DWORD offset, DWORD length, void * PlaceIn );
void CalcPoolSize();
std::string m_szACPath;
std::string m_szFilename;
HANDLE m_hFile,
m_hMapping;
BYTE *m_pData;
TODDatFileHeader m_FileHeader;
InfoMap m_mFileInfo;
FileMap m_mPool;
TFMapType m_TFMap;
DWORD m_dwPoolSize;
};