| 22 | } |
| 23 | |
| 24 | Archive* openArchiveFile(const char* defaultArchive, ArchiveType type, const char* filename) |
| 25 | { |
| 26 | // First try reading from the custom Archive, if there is one. |
| 27 | if (s_customArchive) |
| 28 | { |
| 29 | const u32 index = s_customArchive->getFileIndex(filename); |
| 30 | if (index != INVALID_FILE && s_customArchive->openFile(index)) |
| 31 | { |
| 32 | return s_customArchive; |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | // Otherwise read from the specified GOB archive. |
| 37 | char gobPath[TFE_MAX_PATH]; |
| 38 | TFE_Paths::appendPath(PATH_SOURCE_DATA, defaultArchive, gobPath); |
| 39 | Archive* archive = Archive::getArchive(type, defaultArchive, gobPath); |
| 40 | if (!archive) |
| 41 | { |
| 42 | TFE_System::logWrite(LOG_ERROR, "Archive", "Cannot open source archive file \"%s\"", gobPath); |
| 43 | return nullptr; |
| 44 | } |
| 45 | |
| 46 | if (!archive->openFile(filename)) |
| 47 | { |
| 48 | return nullptr; |
| 49 | } |
| 50 | return archive; |
| 51 | } |
| 52 | |
| 53 | bool readAssetFromArchive(const char* defaultArchive, ArchiveType type, const char* filename, std::vector<u8>& buffer) |
| 54 | { |
no test coverage detected