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

Function openArchiveFile

TheForceEngine/TFE_Asset/assetSystem.cpp:24–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 1

readAssetFromArchiveFunction · 0.85

Calls 5

logWriteFunction · 0.85
appendPathFunction · 0.50
getArchiveFunction · 0.50
getFileIndexMethod · 0.45
openFileMethod · 0.45

Tested by

no test coverage detected