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

Method openFile

TheForceEngine/TFE_Archive/lfdArchive.cpp:82–110  ·  view source on GitHub ↗

File Access

Source from the content-addressed store, hash-verified

80
81// File Access
82bool 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
112bool LfdArchive::openFile(u32 index)
113{

Callers

nothing calls this directly

Calls 4

logWriteFunction · 0.85
openMethod · 0.45
closeMethod · 0.45
seekMethod · 0.45

Tested by

no test coverage detected