| 17 | } |
| 18 | |
| 19 | bool 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 | |
| 43 | void LabArchive::close() |
| 44 | { |
no test coverage detected