File Access
| 50 | |
| 51 | // File Access |
| 52 | bool LabArchive::openFile(const char *file) |
| 53 | { |
| 54 | if (!m_archiveOpen) { return false; } |
| 55 | |
| 56 | m_file.open(m_archivePath, Stream::MODE_READ); |
| 57 | m_curFile = -1; |
| 58 | m_fileOffset = 0; |
| 59 | |
| 60 | //search for this file. |
| 61 | for (u32 i = 0; i < m_header.fileCount; i++) |
| 62 | { |
| 63 | if (strcasecmp(file, &m_stringTable[m_entries[i].nameOffset]) == 0) |
| 64 | { |
| 65 | m_curFile = i; |
| 66 | break; |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | if (m_curFile == -1) |
| 71 | { |
| 72 | m_file.close(); |
| 73 | TFE_System::logWrite(LOG_ERROR, "GOB", "Failed to load \"%s\" from \"%s\"", file, m_archivePath); |
| 74 | } |
| 75 | else |
| 76 | { |
| 77 | m_file.seek(m_entries[m_curFile].dataOffset); |
| 78 | } |
| 79 | return m_curFile > -1 ? true : false; |
| 80 | } |
| 81 | |
| 82 | bool LabArchive::openFile(u32 index) |
| 83 | { |