File Access
| 80 | |
| 81 | // File Access |
| 82 | bool LfdArchive::openFile(const char *file) |
| 83 | { |
| 84 | if (!m_archiveOpen) { return false; } |
| 85 | |
| 86 | m_file.open(m_archivePath, Stream::MODE_READ); |
| 87 | m_curFile = -1; |
| 88 | m_fileOffset = 0; |
| 89 | |
| 90 | //search for this file. |
| 91 | for (u32 i = 0; i < m_fileList.MASTERN; i++) |
| 92 | { |
| 93 | if (strcasecmp(file, m_fileList.entries[i].NAME) == 0) |
| 94 | { |
| 95 | m_curFile = i; |
| 96 | break; |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | if (m_curFile == -1) |
| 101 | { |
| 102 | m_file.close(); |
| 103 | TFE_System::logWrite(LOG_ERROR, "LFD", "Failed to load \"%s\" from \"%s\"", file, m_archivePath); |
| 104 | } |
| 105 | else |
| 106 | { |
| 107 | m_file.seek(m_fileList.entries[m_curFile].IX); |
| 108 | } |
| 109 | return m_curFile > -1 ? true : false; |
| 110 | } |
| 111 | |
| 112 | bool LfdArchive::openFile(u32 index) |
| 113 | { |