| Line 179... |
Line 179... |
| 179 |
Utils::String file = dir + "/" + Utils::String::PadNumber(number, 2);
|
179 |
Utils::String file = dir + "/" + Utils::String::PadNumber(number, 2);
|
| 180 |
if ( !CFileIO::Exists(file + ".dat") )
|
180 |
if ( !CFileIO::Exists(file + ".dat") )
|
| 181 |
break;
|
181 |
break;
|
| 182 |
|
182 |
|
| 183 |
CCatFile cat;
|
183 |
CCatFile cat;
|
| 184 |
if ( cat.Open(file + ".cat", m_sAddon, CATREAD_JUSTCONTENTS, false) == CATERR_NONE )
|
184 |
if ( cat.open(file + ".cat", m_sAddon, CATREAD_JUSTCONTENTS, false) == CATERR_NONE )
|
| 185 |
{
|
185 |
{
|
| 186 |
for(auto itr = cat.GetFiles()->cbegin(); itr != cat.GetFiles()->cend(); itr++)
|
186 |
for(auto itr = cat.GetFiles()->cbegin(); itr != cat.GetFiles()->cend(); itr++)
|
| 187 |
{
|
187 |
{
|
| 188 |
this->_addModFile(CFileIO((*itr)->sFile).fullFilename(), file + ".cat", m_pMap);
|
188 |
this->_addModFile(CFileIO((*itr)->sFile).fullFilename(), file + ".cat", m_pMap);
|
| 189 |
m_bLoaded = true;
|
189 |
m_bLoaded = true;
|
| Line 209... |
Line 209... |
| 209 |
Utils::CStringList list;
|
209 |
Utils::CStringList list;
|
| 210 |
if (Dir.dirList(list))
|
210 |
if (Dir.dirList(list))
|
| 211 |
{
|
211 |
{
|
| 212 |
for (auto itr = list.begin(); itr != list.end(); itr++)
|
212 |
for (auto itr = list.begin(); itr != list.end(); itr++)
|
| 213 |
{
|
213 |
{
|
| 214 |
if (CDirIO(Dir.dir((*itr)->str)).IsDir()) _addDir(sStart, sDir + "/" + (*itr)->str);
|
214 |
if (CDirIO(Dir.dir((*itr)->str)).isDir()) _addDir(sStart, sDir + "/" + (*itr)->str);
|
| 215 |
else if (CFileIO((*itr)->str).isFileExtension("cat")) continue;
|
215 |
else if (CFileIO((*itr)->str).isFileExtension("cat")) continue;
|
| 216 |
else if (CFileIO((*itr)->str).isFileExtension("dat")) continue;
|
216 |
else if (CFileIO((*itr)->str).isFileExtension("dat")) continue;
|
| 217 |
else this->_addFile(sDir + "/" + (*itr)->str, Dir.file((*itr)->str), m_pMap);
|
217 |
else this->_addFile(sDir + "/" + (*itr)->str, Dir.file((*itr)->str), m_pMap);
|
| 218 |
}
|
218 |
}
|
| 219 |
}
|
219 |
}
|
| Line 262... |
Line 262... |
| 262 |
bool loaded = false;
|
262 |
bool loaded = false;
|
| 263 |
|
263 |
|
| 264 |
if ( !m_pModMap ) m_pModMap = new FileList;
|
264 |
if ( !m_pModMap ) m_pModMap = new FileList;
|
| 265 |
|
265 |
|
| 266 |
CCatFile cat;
|
266 |
CCatFile cat;
|
| 267 |
if ( CCatFile::Opened(cat.Open(mod, m_sAddon, CATREAD_JUSTCONTENTS, false), false) )
|
267 |
if ( CCatFile::Opened(cat.open(mod, m_sAddon, CATREAD_JUSTCONTENTS, false), false) )
|
| 268 |
{
|
268 |
{
|
| 269 |
for (auto itr = cat.GetFiles()->cbegin(); itr != cat.GetFiles()->cend(); itr++)
|
269 |
for (auto itr = cat.GetFiles()->cbegin(); itr != cat.GetFiles()->cend(); itr++)
|
| 270 |
{
|
270 |
{
|
| 271 |
this->_addModFile(CFileIO((*itr)->sFile).fullFilename(), mod, m_pModMap);
|
271 |
this->_addModFile(CFileIO((*itr)->sFile).fullFilename(), mod, m_pModMap);
|
| 272 |
loaded = true;
|
272 |
loaded = true;
|
| Line 281... |
Line 281... |
| 281 |
bool loaded = false;
|
281 |
bool loaded = false;
|
| 282 |
|
282 |
|
| 283 |
if ( !m_pMap ) m_pMap = new FileList;
|
283 |
if ( !m_pMap ) m_pMap = new FileList;
|
| 284 |
|
284 |
|
| 285 |
CCatFile cat;
|
285 |
CCatFile cat;
|
| 286 |
if ( CCatFile::Opened(cat.Open(mod, m_sAddon, CATREAD_JUSTCONTENTS, false), false) )
|
286 |
if ( CCatFile::Opened(cat.open(mod, m_sAddon, CATREAD_JUSTCONTENTS, false), false) )
|
| 287 |
{
|
287 |
{
|
| 288 |
for (auto itr = cat.GetFiles()->cbegin(); itr != cat.GetFiles()->cend(); itr++)
|
288 |
for (auto itr = cat.GetFiles()->cbegin(); itr != cat.GetFiles()->cend(); itr++)
|
| 289 |
{
|
289 |
{
|
| 290 |
this->_addModFile(CFileIO((*itr)->sFile).fullFilename(), mod, m_pMap);
|
290 |
this->_addModFile(CFileIO((*itr)->sFile).fullFilename(), mod, m_pMap);
|
| 291 |
loaded = true;
|
291 |
loaded = true;
|
| Line 368... |
Line 368... |
| 368 |
}
|
368 |
}
|
| 369 |
|
369 |
|
| 370 |
Utils::String CVirtualFileSystem::_extractFromCat(const Utils::String &sCat, const Utils::String &sFile, const Utils::String &sTo)
|
370 |
Utils::String CVirtualFileSystem::_extractFromCat(const Utils::String &sCat, const Utils::String &sFile, const Utils::String &sTo)
|
| 371 |
{
|
371 |
{
|
| 372 |
CCatFile catFile;
|
372 |
CCatFile catFile;
|
| 373 |
if ( catFile.Open(sCat, m_sAddon, CATREAD_CATDECRYPT, false) == CATERR_NONE )
|
373 |
if ( catFile.open(sCat, m_sAddon, CATREAD_CATDECRYPT, false) == CATERR_NONE )
|
| 374 |
{
|
374 |
{
|
| 375 |
// check for the file
|
375 |
// check for the file
|
| 376 |
if ( catFile.ExtractFile(sFile, sTo) ) return sTo;
|
376 |
if ( catFile.ExtractFile(sFile, sTo) ) return sTo;
|
| 377 |
if ( catFile.error() == CATERR_INVALIDDEST || catFile.error() == CATERR_CANTCREATEDIR ) {
|
377 |
if ( catFile.error() == CATERR_INVALIDDEST || catFile.error() == CATERR_CANTCREATEDIR ) {
|
| 378 |
if ( catFile.ExtractFile(sFile) ) return sFile;
|
378 |
if ( catFile.ExtractFile(sFile) ) return sFile;
|