MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / open

Method open

TheForceEngine/TFE_Archive/labArchive.cpp:19–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19bool LabArchive::open(const char *archivePath)
20{
21 m_archiveOpen = m_file.open(archivePath, Stream::MODE_READ);
22 m_curFile = -1;
23 m_fileOffset = 0;
24 if (!m_archiveOpen) { return false; }
25
26 // Read the directory.
27 m_file.readBuffer(&m_header, sizeof(LAB_Header_t));
28 m_stringTable = new char[m_header.stringTableSize + 1];
29 m_entries = new LAB_Entry_t[m_header.fileCount];
30
31 // Read the file entries.
32 m_file.readBuffer(m_entries, sizeof(LAB_Entry_t), m_header.fileCount);
33
34 // Read string table.
35 m_file.readBuffer(m_stringTable, m_header.stringTableSize);
36 m_file.close();
37
38 strcpy(m_archivePath, archivePath);
39
40 return true;
41}
42
43void LabArchive::close()
44{

Callers 1

openFileMethod · 0.45

Calls 2

readBufferMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected