| 1 | 
           cycrow | 
           1 | 
              | 
        
        
            | 
            | 
           2 | 
           #include "VirtualFileSystem.h"
  | 
        
        
            | 
            | 
           3 | 
           #include "File_IO.h"
  | 
        
        
            | 
            | 
           4 | 
           #include "CatFile.h"
  | 
        
        
           | 35 | 
           cycrow | 
           5 | 
           #include "XspFile.h"
  | 
        
        
           | 94 | 
           cycrow | 
           6 | 
           #include "TextDB.h"
  | 
        
        
           | 1 | 
           cycrow | 
           7 | 
              | 
        
        
           | 79 | 
           cycrow | 
           8 | 
           #include "Packages.h"
  | 
        
        
           | 94 | 
           cycrow | 
           9 | 
           #include "Utils/StringList.h"
  | 
        
        
           | 101 | 
           cycrow | 
           10 | 
           #include "CyString.h"
  | 
        
        
           | 79 | 
           cycrow | 
           11 | 
              | 
        
        
           | 112 | 
           cycrow | 
           12 | 
           #define DELETELIST(list) if ( list ) { list->clear(); delete list; }
  | 
        
        
           | 94 | 
           cycrow | 
           13 | 
              | 
        
        
           | 35 | 
           cycrow | 
           14 | 
           namespace SPK {
  | 
        
        
            | 
            | 
           15 | 
              | 
        
        
           | 94 | 
           cycrow | 
           16 | 
           CVirtualFileSystem::CVirtualFileSystem() : _lShields(NULL),
  | 
        
        
            | 
            | 
           17 | 
           	_lLasers(NULL),
  | 
        
        
            | 
            | 
           18 | 
           	_lMissiles(NULL),
  | 
        
        
            | 
            | 
           19 | 
           	_lCockpits(NULL),
  | 
        
        
            | 
            | 
           20 | 
           	_lComponentSections(NULL),
  | 
        
        
            | 
            | 
           21 | 
           	_lDummySections(NULL),
  | 
        
        
           | 101 | 
           cycrow | 
           22 | 
           	_lBodiesSections(NULL),
  | 
        
        
            | 
            | 
           23 | 
           	_lShips(NULL)
  | 
        
        
           | 1 | 
           cycrow | 
           24 | 
           {
  | 
        
        
            | 
            | 
           25 | 
           	m_bLoaded = false;
  | 
        
        
           | 35 | 
           cycrow | 
           26 | 
           	m_pMap = new FileList;
  | 
        
        
            | 
            | 
           27 | 
           	m_pModMap = new FileList;
  | 
        
        
            | 
            | 
           28 | 
              | 
        
        
            | 
            | 
           29 | 
           	m_pTexts = new CTextDB();
  | 
        
        
            | 
            | 
           30 | 
           	m_pModTexts = new CTextDB();
  | 
        
        
            | 
            | 
           31 | 
              | 
        
        
           | 1 | 
           cycrow | 
           32 | 
           	m_sAddon = "";
  | 
        
        
           | 35 | 
           cycrow | 
           33 | 
              | 
        
        
            | 
            | 
           34 | 
           	m_iLang = 0;
  | 
        
        
           | 1 | 
           cycrow | 
           35 | 
           }
  | 
        
        
            | 
            | 
           36 | 
              | 
        
        
            | 
            | 
           37 | 
           CVirtualFileSystem::~CVirtualFileSystem(void)
  | 
        
        
            | 
            | 
           38 | 
           {
  | 
        
        
           | 101 | 
           cycrow | 
           39 | 
           	_clear();
  | 
        
        
           | 35 | 
           cycrow | 
           40 | 
              | 
        
        
            | 
            | 
           41 | 
           	if ( m_pTexts )		delete m_pTexts;
  | 
        
        
            | 
            | 
           42 | 
           	if ( m_pModTexts )  delete m_pModTexts;
  | 
        
        
           | 101 | 
           cycrow | 
           43 | 
           }
  | 
        
        
           | 94 | 
           cycrow | 
           44 | 
              | 
        
        
           | 101 | 
           cycrow | 
           45 | 
           void CVirtualFileSystem::setAddon(const Utils::String &addon)
  | 
        
        
            | 
            | 
           46 | 
           { 
  | 
        
        
            | 
            | 
           47 | 
           	m_sAddon = addon; 
  | 
        
        
           | 1 | 
           cycrow | 
           48 | 
           }
  | 
        
        
           | 35 | 
           cycrow | 
           49 | 
           void CVirtualFileSystem::setLanguage(int iLang)
  | 
        
        
           | 1 | 
           cycrow | 
           50 | 
           {
  | 
        
        
           | 35 | 
           cycrow | 
           51 | 
           	m_iLang = iLang;
  | 
        
        
            | 
            | 
           52 | 
           }
  | 
        
        
            | 
            | 
           53 | 
              | 
        
        
           | 94 | 
           cycrow | 
           54 | 
           Utils::String CVirtualFileSystem::firstShield()
  | 
        
        
            | 
            | 
           55 | 
           {
  | 
        
        
            | 
            | 
           56 | 
           	if ( !_lShields || _lShields->empty() ) _updateShields();
  | 
        
        
           | 112 | 
           cycrow | 
           57 | 
           	return _returnText(_lShields->first());
  | 
        
        
           | 94 | 
           cycrow | 
           58 | 
           }
  | 
        
        
            | 
            | 
           59 | 
              | 
        
        
            | 
            | 
           60 | 
           Utils::String CVirtualFileSystem::nextShield()
  | 
        
        
            | 
            | 
           61 | 
           {
  | 
        
        
           | 112 | 
           cycrow | 
           62 | 
           	return _returnText(_lShields->next());
  | 
        
        
           | 94 | 
           cycrow | 
           63 | 
           }
  | 
        
        
            | 
            | 
           64 | 
              | 
        
        
            | 
            | 
           65 | 
           Utils::String CVirtualFileSystem::firstComponentSection()
  | 
        
        
            | 
            | 
           66 | 
           {
  | 
        
        
            | 
            | 
           67 | 
           	if ( !_lComponentSections || _lComponentSections->empty() ) _updateComponentSections();
  | 
        
        
           | 112 | 
           cycrow | 
           68 | 
           	return _returnLine(_lComponentSections->first());
  | 
        
        
           | 94 | 
           cycrow | 
           69 | 
           }
  | 
        
        
            | 
            | 
           70 | 
              | 
        
        
            | 
            | 
           71 | 
           Utils::String CVirtualFileSystem::nextComponentSection()
  | 
        
        
            | 
            | 
           72 | 
           {
  | 
        
        
           | 112 | 
           cycrow | 
           73 | 
           	return _returnLine(_lComponentSections->next());
  | 
        
        
           | 94 | 
           cycrow | 
           74 | 
           }
  | 
        
        
            | 
            | 
           75 | 
              | 
        
        
            | 
            | 
           76 | 
           Utils::String CVirtualFileSystem::firstDummySection()
  | 
        
        
            | 
            | 
           77 | 
           {
  | 
        
        
            | 
            | 
           78 | 
           	if ( !_lDummySections || _lDummySections->empty() ) _updateDummySections();
  | 
        
        
           | 112 | 
           cycrow | 
           79 | 
           	return _returnLine(_lDummySections->first());
  | 
        
        
           | 94 | 
           cycrow | 
           80 | 
           }
  | 
        
        
            | 
            | 
           81 | 
              | 
        
        
            | 
            | 
           82 | 
           Utils::String CVirtualFileSystem::nextDummySection()
  | 
        
        
            | 
            | 
           83 | 
           {
  | 
        
        
           | 112 | 
           cycrow | 
           84 | 
           	return _returnLine(_lDummySections->next());
  | 
        
        
           | 94 | 
           cycrow | 
           85 | 
           }
  | 
        
        
            | 
            | 
           86 | 
              | 
        
        
            | 
            | 
           87 | 
           Utils::String CVirtualFileSystem::firstBodiesSection()
  | 
        
        
            | 
            | 
           88 | 
           {
  | 
        
        
            | 
            | 
           89 | 
           	if ( !_lBodiesSections || _lBodiesSections->empty() ) _updateBodiesSections();
  | 
        
        
           | 112 | 
           cycrow | 
           90 | 
           	return _returnLine(_lBodiesSections->first());
  | 
        
        
           | 94 | 
           cycrow | 
           91 | 
           }
  | 
        
        
            | 
            | 
           92 | 
              | 
        
        
            | 
            | 
           93 | 
           Utils::String CVirtualFileSystem::nextBodiesSection()
  | 
        
        
            | 
            | 
           94 | 
           {
  | 
        
        
           | 112 | 
           cycrow | 
           95 | 
           	return _returnLine(_lBodiesSections->next());
  | 
        
        
           | 94 | 
           cycrow | 
           96 | 
           }
  | 
        
        
            | 
            | 
           97 | 
              | 
        
        
            | 
            | 
           98 | 
           std::pair<Utils::String, Utils::String> CVirtualFileSystem::nextLaser()
  | 
        
        
            | 
            | 
           99 | 
           {
  | 
        
        
           | 112 | 
           cycrow | 
           100 | 
           	return _returnPair(_lLasers->next());
  | 
        
        
           | 94 | 
           cycrow | 
           101 | 
           }
  | 
        
        
            | 
            | 
           102 | 
              | 
        
        
            | 
            | 
           103 | 
           std::pair<Utils::String, Utils::String>  CVirtualFileSystem::firstLaser()
  | 
        
        
            | 
            | 
           104 | 
           {
  | 
        
        
            | 
            | 
           105 | 
           	if ( !_lLasers || _lLasers->empty() ) _updateLasers();
  | 
        
        
           | 112 | 
           cycrow | 
           106 | 
           	return _returnPair(_lLasers->first());
  | 
        
        
           | 94 | 
           cycrow | 
           107 | 
           }
  | 
        
        
            | 
            | 
           108 | 
              | 
        
        
            | 
            | 
           109 | 
           std::pair<Utils::String, Utils::String>  CVirtualFileSystem::firstMissile()
  | 
        
        
            | 
            | 
           110 | 
           {
  | 
        
        
            | 
            | 
           111 | 
           	if ( !_lMissiles || _lMissiles->empty() ) _updateMissiles();
  | 
        
        
           | 112 | 
           cycrow | 
           112 | 
           	return _returnPair(_lMissiles->first());
  | 
        
        
           | 94 | 
           cycrow | 
           113 | 
           }
  | 
        
        
            | 
            | 
           114 | 
              | 
        
        
            | 
            | 
           115 | 
           std::pair<Utils::String, Utils::String> CVirtualFileSystem::nextMissile()
  | 
        
        
            | 
            | 
           116 | 
           {
  | 
        
        
           | 112 | 
           cycrow | 
           117 | 
           	return _returnPair(_lMissiles->next());
  | 
        
        
           | 94 | 
           cycrow | 
           118 | 
           }
  | 
        
        
            | 
            | 
           119 | 
              | 
        
        
            | 
            | 
           120 | 
           Utils::String CVirtualFileSystem::firstCockpit()
  | 
        
        
            | 
            | 
           121 | 
           {
  | 
        
        
            | 
            | 
           122 | 
           	if ( !_lCockpits || _lCockpits->empty() ) _updateCockpits();
  | 
        
        
           | 112 | 
           cycrow | 
           123 | 
           	return _returnID(_lCockpits->first());
  | 
        
        
           | 94 | 
           cycrow | 
           124 | 
           }
  | 
        
        
            | 
            | 
           125 | 
              | 
        
        
            | 
            | 
           126 | 
           Utils::String CVirtualFileSystem::nextCockpit()
  | 
        
        
            | 
            | 
           127 | 
           {
  | 
        
        
           | 112 | 
           cycrow | 
           128 | 
           	return _returnID(_lCockpits->next());
  | 
        
        
           | 94 | 
           cycrow | 
           129 | 
           }
  | 
        
        
            | 
            | 
           130 | 
              | 
        
        
            | 
            | 
           131 | 
           std::pair<Utils::String, Utils::String> CVirtualFileSystem::_returnPair(Utils::SStringList *s)
  | 
        
        
            | 
            | 
           132 | 
           {
  | 
        
        
           | 121 | 
           cycrow | 
           133 | 
           	if ( s && !s->data.empty() && !s->data.left(8).Compare("ReadText") ) return std::make_pair<Utils::String, Utils::String>(std::move(s->str), std::move(s->data));
  | 
        
        
            | 
            | 
           134 | 
           	if ( s ) return std::make_pair<Utils::String, Utils::String>(std::move(s->str), s->str.token(";", -2));
  | 
        
        
           | 94 | 
           cycrow | 
           135 | 
           	return std::make_pair<Utils::String, Utils::String>(Utils::String::Null(), Utils::String::Null());
  | 
        
        
            | 
            | 
           136 | 
           }
  | 
        
        
            | 
            | 
           137 | 
              | 
        
        
            | 
            | 
           138 | 
           Utils::String CVirtualFileSystem::_returnText(Utils::SStringList *s)
  | 
        
        
            | 
            | 
           139 | 
           {
  | 
        
        
            | 
            | 
           140 | 
           	if ( s && !s->data.empty() && !s->data.left(8).Compare("ReadText") ) return s->data;
  | 
        
        
            | 
            | 
           141 | 
           	if ( s ) return s->str.token(";", -2);
  | 
        
        
            | 
            | 
           142 | 
           	return Utils::String::Null();
  | 
        
        
            | 
            | 
           143 | 
           }
  | 
        
        
            | 
            | 
           144 | 
              | 
        
        
            | 
            | 
           145 | 
           Utils::String CVirtualFileSystem::_returnID(Utils::SStringList *s)
  | 
        
        
            | 
            | 
           146 | 
           {
  | 
        
        
            | 
            | 
           147 | 
           	if ( s ) return s->str.token(";", -2);
  | 
        
        
            | 
            | 
           148 | 
           	return Utils::String::Null();
  | 
        
        
            | 
            | 
           149 | 
           }
  | 
        
        
            | 
            | 
           150 | 
              | 
        
        
            | 
            | 
           151 | 
           Utils::String CVirtualFileSystem::_returnLine(Utils::SStringList *s)
  | 
        
        
            | 
            | 
           152 | 
           {
  | 
        
        
            | 
            | 
           153 | 
           	if ( s ) return s->str;
  | 
        
        
            | 
            | 
           154 | 
           	return Utils::String::Null();
  | 
        
        
            | 
            | 
           155 | 
           }
  | 
        
        
            | 
            | 
           156 | 
              | 
        
        
            | 
            | 
           157 | 
              | 
        
        
           | 35 | 
           cycrow | 
           158 | 
           bool CVirtualFileSystem::LoadFilesystem(const Utils::String &dir, int maxPatch)
  | 
        
        
            | 
            | 
           159 | 
           {
  | 
        
        
            | 
            | 
           160 | 
           	return this->LoadFilesystem(dir, "", maxPatch);
  | 
        
        
            | 
            | 
           161 | 
           }
  | 
        
        
            | 
            | 
           162 | 
              | 
        
        
            | 
            | 
           163 | 
           bool CVirtualFileSystem::LoadFilesystem(const Utils::String &dir, const Utils::String &mod, int maxPatch)
  | 
        
        
            | 
            | 
           164 | 
           {
  | 
        
        
           | 114 | 
           cycrow | 
           165 | 
           	m_sDir = dir.findReplace("\\", "/");
  | 
        
        
           | 1 | 
           cycrow | 
           166 | 
              | 
        
        
           | 35 | 
           cycrow | 
           167 | 
           	this->_clear();
  | 
        
        
           | 1 | 
           cycrow | 
           168 | 
              | 
        
        
           | 114 | 
           cycrow | 
           169 | 
           	// if we are in the addon directory, then also read the previous directory
  | 
        
        
            | 
            | 
           170 | 
           	Utils::String s = dir.token("/", -1);
  | 
        
        
            | 
            | 
           171 | 
           	if ( !this->m_sAddon.empty() && dir.token("/", -1).Compare(this->m_sAddon) ) {
  | 
        
        
            | 
            | 
           172 | 
           		//LoadFilesystem(dir.tokens("/", 1, -2), "", 0);
  | 
        
        
            | 
            | 
           173 | 
           	}
  | 
        
        
            | 
            | 
           174 | 
              | 
        
        
           | 1 | 
           cycrow | 
           175 | 
           	int number = 1;
  | 
        
        
           | 101 | 
           cycrow | 
           176 | 
           	while ( CFileIO::Exists(dir + "/" + Utils::String::PadNumber(number, 2) + ".cat") )
  | 
        
        
           | 1 | 
           cycrow | 
           177 | 
           	{
  | 
        
        
           | 58 | 
           cycrow | 
           178 | 
           		if ( maxPatch && maxPatch < number ) break;
  | 
        
        
           | 101 | 
           cycrow | 
           179 | 
           		Utils::String file = dir + "/" + Utils::String::PadNumber(number, 2);
  | 
        
        
            | 
            | 
           180 | 
           		if ( !CFileIO::Exists(file + ".dat") )
  | 
        
        
           | 1 | 
           cycrow | 
           181 | 
           			break;
  | 
        
        
            | 
            | 
           182 | 
              | 
        
        
            | 
            | 
           183 | 
           		CCatFile cat;
  | 
        
        
           | 125 | 
           cycrow | 
           184 | 
           		if ( cat.open(file + ".cat", m_sAddon, CATREAD_JUSTCONTENTS, false) == CATERR_NONE )
  | 
        
        
           | 1 | 
           cycrow | 
           185 | 
           		{
  | 
        
        
           | 124 | 
           cycrow | 
           186 | 
           			for(auto itr = cat.GetFiles()->cbegin(); itr != cat.GetFiles()->cend(); itr++)
  | 
        
        
            | 
            | 
           187 | 
           			{
  | 
        
        
            | 
            | 
           188 | 
           				this->_addModFile(CFileIO((*itr)->sFile).fullFilename(), file + ".cat", m_pMap);
  | 
        
        
           | 1 | 
           cycrow | 
           189 | 
           				m_bLoaded = true;
  | 
        
        
            | 
            | 
           190 | 
           			}
  | 
        
        
            | 
            | 
           191 | 
           		}
  | 
        
        
            | 
            | 
           192 | 
           		++number;
  | 
        
        
            | 
            | 
           193 | 
           	}
  | 
        
        
            | 
            | 
           194 | 
              | 
        
        
           | 43 | 
           cycrow | 
           195 | 
           	// add all the files from the mod
  | 
        
        
           | 35 | 
           cycrow | 
           196 | 
           	if ( !mod.empty() )
  | 
        
        
            | 
            | 
           197 | 
           		this->addMod(mod);
  | 
        
        
            | 
            | 
           198 | 
              | 
        
        
           | 43 | 
           cycrow | 
           199 | 
           	// now add all the extracted data
  | 
        
        
            | 
            | 
           200 | 
           	this->_addDir(m_sDir, "");
  | 
        
        
            | 
            | 
           201 | 
              | 
        
        
           | 1 | 
           cycrow | 
           202 | 
           	return m_bLoaded;
  | 
        
        
            | 
            | 
           203 | 
           }
  | 
        
        
            | 
            | 
           204 | 
              | 
        
        
           | 43 | 
           cycrow | 
           205 | 
              | 
        
        
            | 
            | 
           206 | 
           void CVirtualFileSystem::_addDir(const Utils::String &sStart, const Utils::String &sDir)
  | 
        
        
            | 
            | 
           207 | 
           {
  | 
        
        
            | 
            | 
           208 | 
           	CDirIO Dir(sStart + "/" + sDir);
  | 
        
        
           | 124 | 
           cycrow | 
           209 | 
           	Utils::CStringList list;
  | 
        
        
            | 
            | 
           210 | 
           	if (Dir.dirList(list))
  | 
        
        
            | 
            | 
           211 | 
           	{
  | 
        
        
            | 
            | 
           212 | 
           		for (auto itr = list.begin(); itr != list.end(); itr++)
  | 
        
        
            | 
            | 
           213 | 
           		{
  | 
        
        
           | 125 | 
           cycrow | 
           214 | 
           			if (CDirIO(Dir.dir((*itr)->str)).isDir()) _addDir(sStart, sDir + "/" + (*itr)->str);
  | 
        
        
           | 124 | 
           cycrow | 
           215 | 
           			else if (CFileIO((*itr)->str).isFileExtension("cat")) continue;
  | 
        
        
            | 
            | 
           216 | 
           			else if (CFileIO((*itr)->str).isFileExtension("dat")) continue;
  | 
        
        
            | 
            | 
           217 | 
           			else this->_addFile(sDir + "/" + (*itr)->str, Dir.file((*itr)->str), m_pMap);
  | 
        
        
           | 43 | 
           cycrow | 
           218 | 
           		}
  | 
        
        
            | 
            | 
           219 | 
           	}
  | 
        
        
            | 
            | 
           220 | 
           }
  | 
        
        
            | 
            | 
           221 | 
              | 
        
        
           | 114 | 
           cycrow | 
           222 | 
              | 
        
        
            | 
            | 
           223 | 
           void CVirtualFileSystem::_removeSameFile(const Utils::String &sFile, const Utils::String &sDest, const Utils::String &ext, FileList *pList)
  | 
        
        
            | 
            | 
           224 | 
           {
  | 
        
        
            | 
            | 
           225 | 
           	CFileIO F(sFile);
  | 
        
        
            | 
            | 
           226 | 
              | 
        
        
            | 
            | 
           227 | 
           	Utils::String newFile = F.ChangeFileExtension(ext).ToString();
  | 
        
        
            | 
            | 
           228 | 
           	newFile = newFile.lower();
  | 
        
        
            | 
            | 
           229 | 
              | 
        
        
            | 
            | 
           230 | 
           	FileListItr itr = pList->find(newFile);
  | 
        
        
            | 
            | 
           231 | 
           	if ( itr != pList->end() ) {
  | 
        
        
            | 
            | 
           232 | 
           		if ( !CFileIO((*pList)[newFile]).dir().Compare(CFileIO(sDest).dir()) ) {
  | 
        
        
            | 
            | 
           233 | 
           			pList->erase(newFile);
  | 
        
        
            | 
            | 
           234 | 
           		}
  | 
        
        
            | 
            | 
           235 | 
           	}
  | 
        
        
            | 
            | 
           236 | 
           }
  | 
        
        
            | 
            | 
           237 | 
              | 
        
        
           | 43 | 
           cycrow | 
           238 | 
           void CVirtualFileSystem::_addFile(const Utils::String &sFile, const Utils::String &sDest, FileList *pList)
  | 
        
        
            | 
            | 
           239 | 
           {
  | 
        
        
           | 114 | 
           cycrow | 
           240 | 
           	Utils::String file = sFile.asFilename().removeIf(0, '/');
  | 
        
        
            | 
            | 
           241 | 
              | 
        
        
            | 
            | 
           242 | 
           	// check file extension, remove any patching files in previous files
  | 
        
        
            | 
            | 
           243 | 
           	CFileIO F(file);
  | 
        
        
           | 124 | 
           cycrow | 
           244 | 
           	Utils::String ext = F.extension().toLower();
  | 
        
        
            | 
            | 
           245 | 
           	if (ext.Compare("bob", true) || ext.Compare("pbd", true) || ext.Compare("bod", true) ) {
  | 
        
        
           | 114 | 
           cycrow | 
           246 | 
           		_removeSameFile(file, sDest, "pbb", pList);
  | 
        
        
            | 
            | 
           247 | 
           		_removeSameFile(file, sDest, "bob", pList);
  | 
        
        
            | 
            | 
           248 | 
           		_removeSameFile(file, sDest, "pbd", pList);
  | 
        
        
            | 
            | 
           249 | 
           	}
  | 
        
        
           | 124 | 
           cycrow | 
           250 | 
           	else if (ext.Compare("xml", true) || ext.Compare("txt", true) )
  | 
        
        
           | 116 | 
           cycrow | 
           251 | 
           		_removeSameFile(file, sDest, "pck", pList);
  | 
        
        
           | 114 | 
           cycrow | 
           252 | 
              | 
        
        
           | 124 | 
           cycrow | 
           253 | 
           	(*pList)[file.lower()] = sDest.findReplace("\\", "/").findReplace("//", "/");
  | 
        
        
           | 43 | 
           cycrow | 
           254 | 
           }
  | 
        
        
            | 
            | 
           255 | 
           void CVirtualFileSystem::_addModFile(const Utils::String &sFile, const Utils::String &sMod, FileList *pList)
  | 
        
        
            | 
            | 
           256 | 
           {
  | 
        
        
            | 
            | 
           257 | 
           	this->_addFile(sFile, sMod + "::" + sFile, pList);
  | 
        
        
            | 
            | 
           258 | 
           }
  | 
        
        
            | 
            | 
           259 | 
              | 
        
        
           | 35 | 
           cycrow | 
           260 | 
           bool CVirtualFileSystem::loadMod(const Utils::String &mod)
  | 
        
        
           | 1 | 
           cycrow | 
           261 | 
           {
  | 
        
        
            | 
            | 
           262 | 
           	bool loaded = false;
  | 
        
        
           | 35 | 
           cycrow | 
           263 | 
              | 
        
        
            | 
            | 
           264 | 
           	if ( !m_pModMap ) m_pModMap = new FileList;
  | 
        
        
            | 
            | 
           265 | 
              | 
        
        
           | 1 | 
           cycrow | 
           266 | 
           	CCatFile cat;
  | 
        
        
           | 125 | 
           cycrow | 
           267 | 
           	if ( CCatFile::Opened(cat.open(mod, m_sAddon, CATREAD_JUSTCONTENTS, false), false) )
  | 
        
        
           | 1 | 
           cycrow | 
           268 | 
           	{
  | 
        
        
           | 124 | 
           cycrow | 
           269 | 
           		for (auto itr = cat.GetFiles()->cbegin(); itr != cat.GetFiles()->cend(); itr++) 
  | 
        
        
            | 
            | 
           270 | 
           		{
  | 
        
        
            | 
            | 
           271 | 
           			this->_addModFile(CFileIO((*itr)->sFile).fullFilename(), mod, m_pModMap);
  | 
        
        
           | 35 | 
           cycrow | 
           272 | 
           			loaded = true;
  | 
        
        
            | 
            | 
           273 | 
           		}
  | 
        
        
            | 
            | 
           274 | 
           	}
  | 
        
        
            | 
            | 
           275 | 
              | 
        
        
            | 
            | 
           276 | 
           	return loaded;
  | 
        
        
            | 
            | 
           277 | 
           }
  | 
        
        
            | 
            | 
           278 | 
              | 
        
        
            | 
            | 
           279 | 
           bool CVirtualFileSystem::addMod(const Utils::String &mod)
  | 
        
        
            | 
            | 
           280 | 
           {
  | 
        
        
            | 
            | 
           281 | 
           	bool loaded = false;
  | 
        
        
            | 
            | 
           282 | 
              | 
        
        
            | 
            | 
           283 | 
           	if ( !m_pMap ) m_pMap = new FileList;
  | 
        
        
            | 
            | 
           284 | 
              | 
        
        
            | 
            | 
           285 | 
           	CCatFile cat;
  | 
        
        
           | 125 | 
           cycrow | 
           286 | 
           	if ( CCatFile::Opened(cat.open(mod, m_sAddon, CATREAD_JUSTCONTENTS, false), false) )
  | 
        
        
           | 35 | 
           cycrow | 
           287 | 
           	{
  | 
        
        
           | 124 | 
           cycrow | 
           288 | 
           		for (auto itr = cat.GetFiles()->cbegin(); itr != cat.GetFiles()->cend(); itr++)
  | 
        
        
           | 35 | 
           cycrow | 
           289 | 
           		{
  | 
        
        
           | 124 | 
           cycrow | 
           290 | 
           			this->_addModFile(CFileIO((*itr)->sFile).fullFilename(), mod, m_pMap);
  | 
        
        
           | 1 | 
           cycrow | 
           291 | 
           			loaded = true;
  | 
        
        
            | 
            | 
           292 | 
           		}
  | 
        
        
            | 
            | 
           293 | 
           	}
  | 
        
        
            | 
            | 
           294 | 
              | 
        
        
            | 
            | 
           295 | 
           	return loaded;
  | 
        
        
            | 
            | 
           296 | 
           }
  | 
        
        
            | 
            | 
           297 | 
              | 
        
        
           | 35 | 
           cycrow | 
           298 | 
           bool CVirtualFileSystem::textExists(int iLang, int iPage, int iID) const
  | 
        
        
           | 1 | 
           cycrow | 
           299 | 
           {
  | 
        
        
           | 94 | 
           cycrow | 
           300 | 
           	if ( iLang <= 0 ) iLang = m_iLang;
  | 
        
        
            | 
            | 
           301 | 
              | 
        
        
           | 35 | 
           cycrow | 
           302 | 
           	if ( m_pTexts ) {
  | 
        
        
            | 
            | 
           303 | 
           		if ( m_pTexts->exists(iLang, iPage, iID) ) return m_pTexts->exists(iLang, iPage, iID);
  | 
        
        
            | 
            | 
           304 | 
           	}
  | 
        
        
            | 
            | 
           305 | 
           	if ( m_pModTexts ) {
  | 
        
        
            | 
            | 
           306 | 
           		if ( m_pModTexts->exists(iLang, iPage, iID) ) return m_pModTexts->exists(iLang, iPage, iID);
  | 
        
        
            | 
            | 
           307 | 
           	}
  | 
        
        
            | 
            | 
           308 | 
              | 
        
        
            | 
            | 
           309 | 
           	return false;
  | 
        
        
           | 1 | 
           cycrow | 
           310 | 
           }
  | 
        
        
            | 
            | 
           311 | 
              | 
        
        
           | 35 | 
           cycrow | 
           312 | 
           Utils::String CVirtualFileSystem::findText(int iLang, int iPage, int iID) const
  | 
        
        
           | 1 | 
           cycrow | 
           313 | 
           {
  | 
        
        
           | 94 | 
           cycrow | 
           314 | 
           	if ( iLang <= 0 ) iLang = m_iLang;
  | 
        
        
            | 
            | 
           315 | 
              | 
        
        
           | 35 | 
           cycrow | 
           316 | 
           	if ( m_pTexts ) {
  | 
        
        
            | 
            | 
           317 | 
           		if ( m_pTexts->exists(iLang, iPage, iID) ) return m_pTexts->get(iLang, iPage, iID);
  | 
        
        
            | 
            | 
           318 | 
           	}
  | 
        
        
            | 
            | 
           319 | 
           	if ( m_pModTexts ) {
  | 
        
        
            | 
            | 
           320 | 
           		if ( m_pModTexts->exists(iLang, iPage, iID) ) return m_pModTexts->get(iLang, iPage, iID);
  | 
        
        
            | 
            | 
           321 | 
           	}
  | 
        
        
           | 1 | 
           cycrow | 
           322 | 
              | 
        
        
           | 35 | 
           cycrow | 
           323 | 
           	return Utils::String("ReadText") + (long)iPage + "-" + (long)iID;
  | 
        
        
            | 
            | 
           324 | 
           }
  | 
        
        
           | 43 | 
           cycrow | 
           325 | 
              | 
        
        
           | 101 | 
           cycrow | 
           326 | 
           const Utils::String &CVirtualFileSystem::directory() const
  | 
        
        
            | 
            | 
           327 | 
           {
  | 
        
        
            | 
            | 
           328 | 
           	return m_sDir;
  | 
        
        
            | 
            | 
           329 | 
           }
  | 
        
        
            | 
            | 
           330 | 
              | 
        
        
           | 43 | 
           cycrow | 
           331 | 
           bool CVirtualFileSystem::isFileAvailable(const Utils::String &file)
  | 
        
        
           | 35 | 
           cycrow | 
           332 | 
           {
  | 
        
        
           | 43 | 
           cycrow | 
           333 | 
           	return !this->_findFile(file).empty();
  | 
        
        
            | 
            | 
           334 | 
           }
  | 
        
        
            | 
            | 
           335 | 
              | 
        
        
           | 101 | 
           cycrow | 
           336 | 
           bool CVirtualFileSystem::isTextUpdated() const
  | 
        
        
            | 
            | 
           337 | 
           {
  | 
        
        
            | 
            | 
           338 | 
           	if ( m_pTexts ) return m_pTexts->anyTextLoaded();
  | 
        
        
            | 
            | 
           339 | 
           	return false;
  | 
        
        
            | 
            | 
           340 | 
           }
  | 
        
        
            | 
            | 
           341 | 
              | 
        
        
           | 43 | 
           cycrow | 
           342 | 
           Utils::String CVirtualFileSystem::_findFile(const Utils::String &file)
  | 
        
        
            | 
            | 
           343 | 
           {
  | 
        
        
            | 
            | 
           344 | 
           	Utils::String toFile = file.findReplace("\\", "/").lower();
  | 
        
        
            | 
            | 
           345 | 
              | 
        
        
           | 35 | 
           cycrow | 
           346 | 
           	if ( m_pModMap && !m_pModMap->empty() ) {
  | 
        
        
            | 
            | 
           347 | 
           		if ( !m_sAddon.empty() ) {
  | 
        
        
           | 102 | 
           cycrow | 
           348 | 
           			FileListItr aitr = m_pModMap->find(CFileIO(m_sAddon + "/" + toFile).fullFilename().lower().c_str());
  | 
        
        
            | 
            | 
           349 | 
           			if ( aitr == m_pModMap->end() ) aitr = m_pModMap->find(CFileIO(_convertExtension(m_sAddon + "/" + toFile)).fullFilename().lower().c_str());
  | 
        
        
           | 35 | 
           cycrow | 
           350 | 
           			if ( aitr != m_pModMap->end() ) return aitr->second;
  | 
        
        
            | 
            | 
           351 | 
           		}
  | 
        
        
           | 102 | 
           cycrow | 
           352 | 
           		FileListItr itr = m_pModMap->find(CFileIO(toFile).fullFilename().lower().c_str());
  | 
        
        
            | 
            | 
           353 | 
           		if ( itr == m_pModMap->end() ) itr = m_pModMap->find(CFileIO(_convertExtension(toFile)).fullFilename().lower().c_str());
  | 
        
        
           | 35 | 
           cycrow | 
           354 | 
           		if ( itr != m_pModMap->end() ) return itr->second;
  | 
        
        
            | 
            | 
           355 | 
           	}
  | 
        
        
           | 114 | 
           cycrow | 
           356 | 
              | 
        
        
            | 
            | 
           357 | 
           	if ( m_pMap && !m_pMap->empty() ) {
  | 
        
        
           | 35 | 
           cycrow | 
           358 | 
           		if ( !m_sAddon.empty() ) {
  | 
        
        
           | 58 | 
           cycrow | 
           359 | 
           			FileListItr aitr = m_pMap->find(CFileIO(m_sAddon + "/" + toFile).fullFilename().lower().c_str());
  | 
        
        
            | 
            | 
           360 | 
           			if ( aitr == m_pMap->end() ) aitr = m_pMap->find(CFileIO(_convertExtension(m_sAddon + "/" + file)).fullFilename().lower().c_str());
  | 
        
        
           | 35 | 
           cycrow | 
           361 | 
           			if ( aitr != m_pMap->end() ) return aitr->second;
  | 
        
        
            | 
            | 
           362 | 
           		}
  | 
        
        
           | 102 | 
           cycrow | 
           363 | 
           		FileListItr itr = m_pMap->find(CFileIO(file).fullFilename().lower().c_str());
  | 
        
        
            | 
            | 
           364 | 
           		if ( itr == m_pMap->end() ) itr = m_pMap->find(CFileIO(_convertExtension(file)).fullFilename().lower().c_str());
  | 
        
        
           | 35 | 
           cycrow | 
           365 | 
           		if ( itr != m_pMap->end() ) return itr->second;
  | 
        
        
            | 
            | 
           366 | 
           	}
  | 
        
        
            | 
            | 
           367 | 
           	return "";
  | 
        
        
            | 
            | 
           368 | 
           }
  | 
        
        
            | 
            | 
           369 | 
              | 
        
        
           | 58 | 
           cycrow | 
           370 | 
           Utils::String CVirtualFileSystem::_extractFromCat(const Utils::String &sCat, const Utils::String &sFile, const Utils::String &sTo)
  | 
        
        
           | 35 | 
           cycrow | 
           371 | 
           {
  | 
        
        
           | 58 | 
           cycrow | 
           372 | 
           	CCatFile catFile;
  | 
        
        
           | 125 | 
           cycrow | 
           373 | 
           	if ( catFile.open(sCat, m_sAddon, CATREAD_CATDECRYPT, false) == CATERR_NONE )
  | 
        
        
           | 58 | 
           cycrow | 
           374 | 
           	{
  | 
        
        
            | 
            | 
           375 | 
           		// check for the file
  | 
        
        
            | 
            | 
           376 | 
           		if ( catFile.ExtractFile(sFile, sTo) ) return sTo;
  | 
        
        
           | 124 | 
           cycrow | 
           377 | 
           		if ( catFile.error() == CATERR_INVALIDDEST || catFile.error() == CATERR_CANTCREATEDIR ) {
  | 
        
        
           | 58 | 
           cycrow | 
           378 | 
           			if ( catFile.ExtractFile(sFile) ) return sFile;
  | 
        
        
            | 
            | 
           379 | 
           		}
  | 
        
        
            | 
            | 
           380 | 
           	}
  | 
        
        
            | 
            | 
           381 | 
              | 
        
        
            | 
            | 
           382 | 
           	return "";
  | 
        
        
            | 
            | 
           383 | 
           }
  | 
        
        
            | 
            | 
           384 | 
              | 
        
        
            | 
            | 
           385 | 
           Utils::String CVirtualFileSystem::_extract(const Utils::String &sFile, const Utils::String &sTo)
  | 
        
        
            | 
            | 
           386 | 
           {
  | 
        
        
            | 
            | 
           387 | 
           	// check if we need to unpack the file
  | 
        
        
            | 
            | 
           388 | 
           	if ( CCatFile::CheckPackedExtension(sFile) ) {
  | 
        
        
            | 
            | 
           389 | 
           		CFileIO File(sFile);
  | 
        
        
           | 127 | 
           cycrow | 
           390 | 
           		C_File f(File.fullFilename());
  | 
        
        
           | 58 | 
           cycrow | 
           391 | 
           		if ( !f.readFromFile(File) ) return "";
  | 
        
        
            | 
            | 
           392 | 
           		if ( !f.UnPCKFile() ) return "";
  | 
        
        
            | 
            | 
           393 | 
           		if ( !f.WriteToFile(sTo) ) return "";
  | 
        
        
            | 
            | 
           394 | 
           		return sTo;
  | 
        
        
            | 
            | 
           395 | 
           	}
  | 
        
        
            | 
            | 
           396 | 
           	return sFile;
  | 
        
        
            | 
            | 
           397 | 
           }
  | 
        
        
            | 
            | 
           398 | 
              | 
        
        
            | 
            | 
           399 | 
           Utils::String CVirtualFileSystem::ExtractGameFile(const Utils::String &file, const Utils::String &to)
  | 
        
        
            | 
            | 
           400 | 
           {
  | 
        
        
           | 43 | 
           cycrow | 
           401 | 
           	Utils::String sIn = _findFile(file);
  | 
        
        
            | 
            | 
           402 | 
           	Utils::String sFile = file;
  | 
        
        
            | 
            | 
           403 | 
              | 
        
        
           | 58 | 
           cycrow | 
           404 | 
           	if ( sIn.empty() ) return "";
  | 
        
        
           | 35 | 
           cycrow | 
           405 | 
              | 
        
        
           | 43 | 
           cycrow | 
           406 | 
           	if ( sIn.isin("::") ) {
  | 
        
        
            | 
            | 
           407 | 
           		sFile = sIn.token("::", 2);
  | 
        
        
            | 
            | 
           408 | 
           		sIn = sIn.token("::", 1);
  | 
        
        
           | 58 | 
           cycrow | 
           409 | 
           		return _extractFromCat(sIn, sFile, to);
  | 
        
        
           | 43 | 
           cycrow | 
           410 | 
           	}
  | 
        
        
           | 58 | 
           cycrow | 
           411 | 
              | 
        
        
            | 
            | 
           412 | 
           	return _extract(sIn, to);
  | 
        
        
           | 1 | 
           cycrow | 
           413 | 
           }
  | 
        
        
            | 
            | 
           414 | 
              | 
        
        
           | 35 | 
           cycrow | 
           415 | 
           Utils::String CVirtualFileSystem::_convertExtension(const Utils::String &sFile)
  | 
        
        
            | 
            | 
           416 | 
           {
  | 
        
        
            | 
            | 
           417 | 
           	CFileIO File(sFile);
  | 
        
        
           | 119 | 
           cycrow | 
           418 | 
           	if ( File.isFileExtension("pck") ) {
  | 
        
        
           | 35 | 
           cycrow | 
           419 | 
           		return File.ChangeFileExtension("xml").ToString();
  | 
        
        
            | 
            | 
           420 | 
           	}
  | 
        
        
           | 119 | 
           cycrow | 
           421 | 
           	else if ( File.isFileExtension("xml") ) {
  | 
        
        
           | 35 | 
           cycrow | 
           422 | 
           		return File.ChangeFileExtension("pck").ToString();
  | 
        
        
            | 
            | 
           423 | 
           	}
  | 
        
        
           | 119 | 
           cycrow | 
           424 | 
           	else if ( File.isFileExtension("pbb") ) {
  | 
        
        
           | 35 | 
           cycrow | 
           425 | 
           		return File.ChangeFileExtension("bob").ToString();
  | 
        
        
            | 
            | 
           426 | 
           	}
  | 
        
        
           | 119 | 
           cycrow | 
           427 | 
           	else if ( File.isFileExtension("bob") ) {
  | 
        
        
           | 35 | 
           cycrow | 
           428 | 
           		return File.ChangeFileExtension("pbb").ToString();
  | 
        
        
            | 
            | 
           429 | 
           	}
  | 
        
        
           | 119 | 
           cycrow | 
           430 | 
           	else if ( File.isFileExtension("pbd") ) {
  | 
        
        
           | 35 | 
           cycrow | 
           431 | 
           		return File.ChangeFileExtension("bod").ToString();
  | 
        
        
            | 
            | 
           432 | 
           	}
  | 
        
        
           | 119 | 
           cycrow | 
           433 | 
           	else if ( File.isFileExtension("bod") ) {
  | 
        
        
           | 35 | 
           cycrow | 
           434 | 
           		return File.ChangeFileExtension("pbd").ToString();
  | 
        
        
            | 
            | 
           435 | 
           	}
  | 
        
        
            | 
            | 
           436 | 
              | 
        
        
            | 
            | 
           437 | 
           	return sFile;
  | 
        
        
            | 
            | 
           438 | 
           }
  | 
        
        
            | 
            | 
           439 | 
              | 
        
        
           | 101 | 
           cycrow | 
           440 | 
           Utils::CStringList *CVirtualFileSystem::getTShipsEntries()
  | 
        
        
           | 35 | 
           cycrow | 
           441 | 
           {
  | 
        
        
           | 101 | 
           cycrow | 
           442 | 
           	if ( !_lShips || _lShips->empty() ) _updateShips();
  | 
        
        
            | 
            | 
           443 | 
           	return _lShips;
  | 
        
        
           | 35 | 
           cycrow | 
           444 | 
           }
  | 
        
        
            | 
            | 
           445 | 
              | 
        
        
            | 
            | 
           446 | 
           C_File *CVirtualFileSystem::extractGameFileToPackage(CBaseFile *pPackage, const Utils::String &sFile, FileType iFileType)
  | 
        
        
            | 
            | 
           447 | 
           {
  | 
        
        
            | 
            | 
           448 | 
           	return this->extractGameFileToPackage(pPackage, sFile, iFileType, sFile);
  | 
        
        
            | 
            | 
           449 | 
           }
  | 
        
        
            | 
            | 
           450 | 
              | 
        
        
            | 
            | 
           451 | 
           C_File *CVirtualFileSystem::extractGameFileToPackage(CBaseFile *pPackage, const Utils::String &sFile, FileType iFileType, const Utils::String &sTo)
  | 
        
        
            | 
            | 
           452 | 
           {
  | 
        
        
           | 79 | 
           cycrow | 
           453 | 
           	Utils::String to = this->ExtractGameFile(sFile, CPackages::tempDirectory() + "tmp.dat");
  | 
        
        
           | 58 | 
           cycrow | 
           454 | 
           	if ( !to.empty() ) {
  | 
        
        
            | 
            | 
           455 | 
           		CFileIO File(to);
  | 
        
        
           | 35 | 
           cycrow | 
           456 | 
              | 
        
        
           | 102 | 
           cycrow | 
           457 | 
           		C_File *f = pPackage->AddFile(CFileIO(sTo).filename(), CFileIO(sTo).dir(), iFileType);
  | 
        
        
           | 35 | 
           cycrow | 
           458 | 
           		if ( f ) {
  | 
        
        
           | 79 | 
           cycrow | 
           459 | 
           			if ( f->ReadFromFile(CPackages::GetTempDirectory() + "tmp.dat") ) {
  | 
        
        
           | 52 | 
           cycrow | 
           460 | 
           				File.remove();
  | 
        
        
           | 35 | 
           cycrow | 
           461 | 
           				return f;
  | 
        
        
            | 
            | 
           462 | 
           			}
  | 
        
        
            | 
            | 
           463 | 
           		}
  | 
        
        
            | 
            | 
           464 | 
              | 
        
        
           | 52 | 
           cycrow | 
           465 | 
           		File.remove();
  | 
        
        
           | 35 | 
           cycrow | 
           466 | 
           	}
  | 
        
        
            | 
            | 
           467 | 
              | 
        
        
            | 
            | 
           468 | 
           	return NULL;
  | 
        
        
            | 
            | 
           469 | 
           }
  | 
        
        
            | 
            | 
           470 | 
              | 
        
        
            | 
            | 
           471 | 
           Utils::String CVirtualFileSystem::getTShipsEntry(const Utils::String &sId)
  | 
        
        
            | 
            | 
           472 | 
           {
  | 
        
        
           | 101 | 
           cycrow | 
           473 | 
           	if ( !_lShips || _lShips->empty() ) _updateShips();
  | 
        
        
            | 
            | 
           474 | 
           	return _lShips->findData(sId, true);
  | 
        
        
           | 35 | 
           cycrow | 
           475 | 
           }
  | 
        
        
            | 
            | 
           476 | 
              | 
        
        
            | 
            | 
           477 | 
           void CVirtualFileSystem::extractTexts(CXspFile *pPackage, int textId)
  | 
        
        
            | 
            | 
           478 | 
           {
  | 
        
        
            | 
            | 
           479 | 
           	//TODO: check for better finding of files in map
  | 
        
        
            | 
            | 
           480 | 
           	for ( FileListItr itr = m_pMap->begin(); itr != m_pMap->end(); ++itr ) {
  | 
        
        
            | 
            | 
           481 | 
           		Utils::String str = itr->first;
  | 
        
        
            | 
            | 
           482 | 
              | 
        
        
            | 
            | 
           483 | 
           		if ( !m_sAddon.empty() ) {
  | 
        
        
            | 
            | 
           484 | 
           			if ( !str.left(m_sAddon.length() + 3).Compare(m_sAddon + "/t/") && !str.left(m_sAddon.length() + 3).Compare(m_sAddon + "\\t\\") )
  | 
        
        
            | 
            | 
           485 | 
           				continue;
  | 
        
        
            | 
            | 
           486 | 
           		}
  | 
        
        
            | 
            | 
           487 | 
           		else {
  | 
        
        
            | 
            | 
           488 | 
           			if ( !str.left(2).Compare("t\\") && !str.left(2).Compare("t/") && !str.left(8).Compare("addon\t\\") && !str.left(8).Compare("addon/t/") )
  | 
        
        
            | 
            | 
           489 | 
           				continue;
  | 
        
        
            | 
            | 
           490 | 
           		}
  | 
        
        
            | 
            | 
           491 | 
              | 
        
        
           | 79 | 
           cycrow | 
           492 | 
           		Utils::String sTo = this->ExtractGameFile(str, CPackages::tempDirectory() + "tmp.dat");
  | 
        
        
           | 58 | 
           cycrow | 
           493 | 
           		if ( !sTo.empty() ) {
  | 
        
        
            | 
            | 
           494 | 
           			pPackage->AddTextFromFile(sTo, textId);
  | 
        
        
            | 
            | 
           495 | 
           			CFileIO::Remove(sTo);
  | 
        
        
           | 35 | 
           cycrow | 
           496 | 
           		}
  | 
        
        
            | 
            | 
           497 | 
           	}
  | 
        
        
            | 
            | 
           498 | 
           }
  | 
        
        
            | 
            | 
           499 | 
              | 
        
        
            | 
            | 
           500 | 
           void CVirtualFileSystem::updateTexts(int iFromPage, int iToPage)
  | 
        
        
            | 
            | 
           501 | 
           {
  | 
        
        
            | 
            | 
           502 | 
           	this->_updateTexts(iFromPage, iToPage, m_pMap, m_pTexts);
  | 
        
        
            | 
            | 
           503 | 
           }
  | 
        
        
            | 
            | 
           504 | 
           void CVirtualFileSystem::updateTexts(int iPage)
  | 
        
        
            | 
            | 
           505 | 
           {
  | 
        
        
            | 
            | 
           506 | 
           	this->_updateTexts(iPage, iPage, m_pMap, m_pTexts);
  | 
        
        
            | 
            | 
           507 | 
           }
  | 
        
        
            | 
            | 
           508 | 
           void CVirtualFileSystem::updateModTexts(int iFromPage, int iToPage)
  | 
        
        
            | 
            | 
           509 | 
           {
  | 
        
        
            | 
            | 
           510 | 
           	this->_updateTexts(iFromPage, iToPage, m_pModMap, m_pModTexts);
  | 
        
        
            | 
            | 
           511 | 
           }
  | 
        
        
            | 
            | 
           512 | 
           void CVirtualFileSystem::updateModTexts(int iPage)
  | 
        
        
            | 
            | 
           513 | 
           {
  | 
        
        
            | 
            | 
           514 | 
           	this->_updateTexts(iPage, iPage, m_pModMap, m_pModTexts);
  | 
        
        
            | 
            | 
           515 | 
           }
  | 
        
        
            | 
            | 
           516 | 
              | 
        
        
            | 
            | 
           517 | 
           void CVirtualFileSystem::_clear()
  | 
        
        
            | 
            | 
           518 | 
           {
  | 
        
        
            | 
            | 
           519 | 
           	m_bLoaded = false;
  | 
        
        
            | 
            | 
           520 | 
              | 
        
        
            | 
            | 
           521 | 
           	if ( m_pMap ) delete m_pMap;
  | 
        
        
            | 
            | 
           522 | 
           	m_pMap = new FileList;
  | 
        
        
            | 
            | 
           523 | 
           	if ( m_pModMap ) delete m_pModMap;
  | 
        
        
            | 
            | 
           524 | 
           	m_pModMap = new FileList;
  | 
        
        
           | 101 | 
           cycrow | 
           525 | 
              | 
        
        
            | 
            | 
           526 | 
           	DELETELIST(_lShields);
  | 
        
        
            | 
            | 
           527 | 
           	DELETELIST(_lLasers);
  | 
        
        
            | 
            | 
           528 | 
           	DELETELIST(_lMissiles);
  | 
        
        
            | 
            | 
           529 | 
           	DELETELIST(_lCockpits);
  | 
        
        
            | 
            | 
           530 | 
           	DELETELIST(_lComponentSections);
  | 
        
        
            | 
            | 
           531 | 
           	DELETELIST(_lDummySections);
  | 
        
        
            | 
            | 
           532 | 
           	DELETELIST(_lBodiesSections);
  | 
        
        
            | 
            | 
           533 | 
           	DELETELIST(_lShips);
  | 
        
        
           | 35 | 
           cycrow | 
           534 | 
           }
  | 
        
        
            | 
            | 
           535 | 
              | 
        
        
            | 
            | 
           536 | 
           void CVirtualFileSystem::_updateTexts(int iFromPage, int iToPage, FileList *pFileList, CTextDB *pTextList)
  | 
        
        
            | 
            | 
           537 | 
           {
  | 
        
        
            | 
            | 
           538 | 
           	// read all text files
  | 
        
        
            | 
            | 
           539 | 
           	for ( FileListItr itr = pFileList->begin(); itr != pFileList->end(); ++itr ) {
  | 
        
        
            | 
            | 
           540 | 
           		Utils::String str = itr->first;
  | 
        
        
            | 
            | 
           541 | 
              | 
        
        
            | 
            | 
           542 | 
           		if ( !m_sAddon.empty() ) {
  | 
        
        
            | 
            | 
           543 | 
           			if ( !str.left(m_sAddon.length() + 3).Compare(m_sAddon + "/t/") && !str.left(m_sAddon.length() + 3).Compare(m_sAddon + "\\t\\") )
  | 
        
        
            | 
            | 
           544 | 
           				continue;
  | 
        
        
            | 
            | 
           545 | 
           		}
  | 
        
        
            | 
            | 
           546 | 
           		else {
  | 
        
        
            | 
            | 
           547 | 
           			if ( !str.left(2).Compare("t\\") && !str.left(2).Compare("t/") )
  | 
        
        
            | 
            | 
           548 | 
           				continue;
  | 
        
        
            | 
            | 
           549 | 
           		}
  | 
        
        
            | 
            | 
           550 | 
              | 
        
        
           | 79 | 
           cycrow | 
           551 | 
           		Utils::String sTo = this->ExtractGameFile(str, CPackages::tempDirectory() + "tmp.dat");
  | 
        
        
           | 58 | 
           cycrow | 
           552 | 
           		if ( !sTo.empty() ) {
  | 
        
        
           | 35 | 
           cycrow | 
           553 | 
           			// add all texts into the map, id=(pageid, tid) data=text
  | 
        
        
           | 57 | 
           cycrow | 
           554 | 
           			Utils::String baseFile = CFileIO(str).baseName();
  | 
        
        
           | 35 | 
           cycrow | 
           555 | 
           			int lang = (baseFile.isin("-L")) ? baseFile.right(3) : baseFile.truncate(-4);
  | 
        
        
            | 
            | 
           556 | 
              | 
        
        
            | 
            | 
           557 | 
           			if ( m_iLang && lang != m_iLang ) continue;
  | 
        
        
            | 
            | 
           558 | 
           			// open the text file to add
  | 
        
        
           | 58 | 
           cycrow | 
           559 | 
           			pTextList->parseTextFile(iFromPage, iToPage, sTo, lang);
  | 
        
        
           | 35 | 
           cycrow | 
           560 | 
           		}
  | 
        
        
            | 
            | 
           561 | 
           	}
  | 
        
        
            | 
            | 
           562 | 
           }
  | 
        
        
            | 
            | 
           563 | 
              | 
        
        
           | 78 | 
           cycrow | 
           564 | 
           void CVirtualFileSystem::clearMods(bool bIncludeStandard)
  | 
        
        
           | 35 | 
           cycrow | 
           565 | 
           {
  | 
        
        
           | 78 | 
           cycrow | 
           566 | 
           	if ( bIncludeStandard ) {
  | 
        
        
            | 
            | 
           567 | 
           		if ( m_pTexts ) delete m_pTexts;
  | 
        
        
            | 
            | 
           568 | 
           		m_pTexts = new CTextDB();
  | 
        
        
            | 
            | 
           569 | 
           	}
  | 
        
        
            | 
            | 
           570 | 
              | 
        
        
           | 35 | 
           cycrow | 
           571 | 
           	if ( m_pModTexts ) delete m_pModTexts;
  | 
        
        
            | 
            | 
           572 | 
           	m_pModTexts = new CTextDB();
  | 
        
        
            | 
            | 
           573 | 
           }
  | 
        
        
            | 
            | 
           574 | 
              | 
        
        
           | 94 | 
           cycrow | 
           575 | 
           Utils::CStringList *CVirtualFileSystem::_updateList(const Utils::String &typesFile, int iTextPos)
  | 
        
        
            | 
            | 
           576 | 
           {
  | 
        
        
            | 
            | 
           577 | 
           	Utils::CStringList *list = new Utils::CStringList();
  | 
        
        
           | 35 | 
           cycrow | 
           578 | 
              | 
        
        
           | 94 | 
           cycrow | 
           579 | 
           	Utils::String file = this->ExtractGameFile("types\\" + typesFile + ".pck", CPackages::tempDirectory() + "/" + typesFile + ".txt");
  | 
        
        
            | 
            | 
           580 | 
              | 
        
        
            | 
            | 
           581 | 
           	CFileIO f(file);
  | 
        
        
            | 
            | 
           582 | 
              | 
        
        
            | 
            | 
           583 | 
           	if ( f.exists() && f.startRead() ) {
  | 
        
        
            | 
            | 
           584 | 
           		int itemsLeft = -1;
  | 
        
        
            | 
            | 
           585 | 
              | 
        
        
            | 
            | 
           586 | 
           		while(!f.atEnd()) {
  | 
        
        
            | 
            | 
           587 | 
           			// read the next line
  | 
        
        
            | 
            | 
           588 | 
           			Utils::String line = f.readEndOfLine();
  | 
        
        
            | 
            | 
           589 | 
              | 
        
        
            | 
            | 
           590 | 
           			// remove the unneeded characters
  | 
        
        
            | 
            | 
           591 | 
           			line.removeChar('\r');
  | 
        
        
            | 
            | 
           592 | 
           			line.removeChar(9);
  | 
        
        
            | 
            | 
           593 | 
           			line.removeFirstSpace();
  | 
        
        
            | 
            | 
           594 | 
              | 
        
        
            | 
            | 
           595 | 
           			// blank line ? skip it
  | 
        
        
            | 
            | 
           596 | 
           			if ( line.empty() ) continue;
  | 
        
        
            | 
            | 
           597 | 
           			// skip anything starting with / as its a comment
  | 
        
        
            | 
            | 
           598 | 
           			if ( line[0] == '/' ) continue;
  | 
        
        
            | 
            | 
           599 | 
              | 
        
        
            | 
            | 
           600 | 
           			// first line is the count
  | 
        
        
            | 
            | 
           601 | 
           			if ( itemsLeft == -1 )
  | 
        
        
            | 
            | 
           602 | 
           				itemsLeft = line.token(";", 2);
  | 
        
        
            | 
            | 
           603 | 
           			else {
  | 
        
        
            | 
            | 
           604 | 
           				if ( iTextPos == 0 )
  | 
        
        
            | 
            | 
           605 | 
           					list->pushBack(line, line);
  | 
        
        
            | 
            | 
           606 | 
           				else if ( iTextPos == -1 ) 
  | 
        
        
            | 
            | 
           607 | 
           					list->pushBack(line, line.token(";", -2));
  | 
        
        
            | 
            | 
           608 | 
           				else
  | 
        
        
            | 
            | 
           609 | 
           					list->pushBack(line, this->findText(m_iLang, TEXTPAGE_OBJECTS, line.token(";", iTextPos).toLong()));
  | 
        
        
            | 
            | 
           610 | 
           				--itemsLeft;
  | 
        
        
            | 
            | 
           611 | 
           			}
  | 
        
        
            | 
            | 
           612 | 
           		}
  | 
        
        
            | 
            | 
           613 | 
              | 
        
        
            | 
            | 
           614 | 
           		f.close();
  | 
        
        
            | 
            | 
           615 | 
           		f.remove();
  | 
        
        
            | 
            | 
           616 | 
           	}
  | 
        
        
            | 
            | 
           617 | 
              | 
        
        
            | 
            | 
           618 | 
           	return list;
  | 
        
        
            | 
            | 
           619 | 
           }
  | 
        
        
            | 
            | 
           620 | 
              | 
        
        
            | 
            | 
           621 | 
           void CVirtualFileSystem::_updateShields()
  | 
        
        
            | 
            | 
           622 | 
           {
  | 
        
        
            | 
            | 
           623 | 
           	DELETELIST(_lShields);
  | 
        
        
            | 
            | 
           624 | 
           	_lShields = _updateList("TShields", 7);
  | 
        
        
            | 
            | 
           625 | 
           }
  | 
        
        
            | 
            | 
           626 | 
              | 
        
        
            | 
            | 
           627 | 
           void CVirtualFileSystem::_updateLasers()
  | 
        
        
            | 
            | 
           628 | 
           {
  | 
        
        
            | 
            | 
           629 | 
           	DELETELIST(_lLasers);
  | 
        
        
            | 
            | 
           630 | 
           	_lLasers = _updateList("TLaser", 7);
  | 
        
        
            | 
            | 
           631 | 
           }
  | 
        
        
            | 
            | 
           632 | 
              | 
        
        
            | 
            | 
           633 | 
           void CVirtualFileSystem::_updateMissiles()
  | 
        
        
            | 
            | 
           634 | 
           {
  | 
        
        
            | 
            | 
           635 | 
           	DELETELIST(_lMissiles);
  | 
        
        
            | 
            | 
           636 | 
           	_lMissiles = _updateList("TMissiles", 7);
  | 
        
        
            | 
            | 
           637 | 
           }
  | 
        
        
            | 
            | 
           638 | 
              | 
        
        
            | 
            | 
           639 | 
           void CVirtualFileSystem::_updateCockpits()
  | 
        
        
            | 
            | 
           640 | 
           {
  | 
        
        
            | 
            | 
           641 | 
           	DELETELIST(_lCockpits);
  | 
        
        
            | 
            | 
           642 | 
           	_lCockpits = _updateList("TCockpits", -1);
  | 
        
        
            | 
            | 
           643 | 
           }
  | 
        
        
            | 
            | 
           644 | 
              | 
        
        
           | 101 | 
           cycrow | 
           645 | 
           void CVirtualFileSystem::_updateShips()
  | 
        
        
            | 
            | 
           646 | 
           {
  | 
        
        
            | 
            | 
           647 | 
           	DELETELIST(_lShips);
  | 
        
        
            | 
            | 
           648 | 
           	_lShips = _updateList("TShips", -1);
  | 
        
        
            | 
            | 
           649 | 
           }
  | 
        
        
            | 
            | 
           650 | 
              | 
        
        
           | 94 | 
           cycrow | 
           651 | 
           void CVirtualFileSystem::_updateComponentSections()
  | 
        
        
            | 
            | 
           652 | 
           {
  | 
        
        
            | 
            | 
           653 | 
           	DELETELIST(_lComponentSections);
  | 
        
        
            | 
            | 
           654 | 
              | 
        
        
            | 
            | 
           655 | 
           	_lComponentSections = new Utils::CStringList();
  | 
        
        
            | 
            | 
           656 | 
              | 
        
        
            | 
            | 
           657 | 
           	Utils::String file = this->ExtractGameFile("types\\Components.pck", CPackages::tempDirectory() + "/Components.txt");
  | 
        
        
            | 
            | 
           658 | 
              | 
        
        
            | 
            | 
           659 | 
           	CFileIO f(file);
  | 
        
        
            | 
            | 
           660 | 
              | 
        
        
            | 
            | 
           661 | 
           	if ( f.exists() && f.startRead() ) {
  | 
        
        
            | 
            | 
           662 | 
           		int sectionRemaining = 0;
  | 
        
        
            | 
            | 
           663 | 
           		int itemsRemaining = 0;
  | 
        
        
            | 
            | 
           664 | 
              | 
        
        
            | 
            | 
           665 | 
           		while(!f.atEnd()) {
  | 
        
        
            | 
            | 
           666 | 
           			// read the next line
  | 
        
        
            | 
            | 
           667 | 
           			Utils::String line = f.readEndOfLine();
  | 
        
        
            | 
            | 
           668 | 
              | 
        
        
            | 
            | 
           669 | 
           			// remove the unneeded characters
  | 
        
        
            | 
            | 
           670 | 
           			line.removeChar('\r');
  | 
        
        
            | 
            | 
           671 | 
           			line.removeChar(9);
  | 
        
        
            | 
            | 
           672 | 
           			line.removeFirstSpace();
  | 
        
        
            | 
            | 
           673 | 
              | 
        
        
            | 
            | 
           674 | 
           			// blank line ? skip it
  | 
        
        
            | 
            | 
           675 | 
           			if ( line.empty() ) continue;
  | 
        
        
            | 
            | 
           676 | 
           			// skip anything starting with / as its a comment
  | 
        
        
            | 
            | 
           677 | 
           			if ( line[0] == '/' ) continue;
  | 
        
        
            | 
            | 
           678 | 
              | 
        
        
            | 
            | 
           679 | 
           			if ( itemsRemaining )
  | 
        
        
            | 
            | 
           680 | 
           				--itemsRemaining;
  | 
        
        
            | 
            | 
           681 | 
           			else if ( !sectionRemaining )
  | 
        
        
            | 
            | 
           682 | 
           			{
  | 
        
        
            | 
            | 
           683 | 
           				sectionRemaining = line.token(";", 2).toLong();
  | 
        
        
            | 
            | 
           684 | 
           				Utils::String section = line.token(";", 1);
  | 
        
        
            | 
            | 
           685 | 
           				if ( !section.empty() )
  | 
        
        
            | 
            | 
           686 | 
           					_lComponentSections->pushBack(section, section);
  | 
        
        
            | 
            | 
           687 | 
           			}
  | 
        
        
            | 
            | 
           688 | 
           			else if ( !itemsRemaining )
  | 
        
        
            | 
            | 
           689 | 
           			{
  | 
        
        
            | 
            | 
           690 | 
           				itemsRemaining = line.token(";", 2).toLong();
  | 
        
        
            | 
            | 
           691 | 
           				--sectionRemaining;
  | 
        
        
            | 
            | 
           692 | 
           			}
  | 
        
        
            | 
            | 
           693 | 
           		}
  | 
        
        
            | 
            | 
           694 | 
              | 
        
        
            | 
            | 
           695 | 
           		f.close();
  | 
        
        
            | 
            | 
           696 | 
           		f.remove();
  | 
        
        
            | 
            | 
           697 | 
           	}
  | 
        
        
            | 
            | 
           698 | 
              | 
        
        
            | 
            | 
           699 | 
           	if ( _lComponentSections->empty() )
  | 
        
        
            | 
            | 
           700 | 
           	{
  | 
        
        
            | 
            | 
           701 | 
           		_lComponentSections->pushBack("SCTYPE_LASER", "SCTYPE_LASER");
  | 
        
        
            | 
            | 
           702 | 
           		_lComponentSections->pushBack("SCTYPE_COCKPIT", "SCTYPE_COCKPIT");
  | 
        
        
            | 
            | 
           703 | 
           		_lComponentSections->pushBack("SCTYPE_DOCKING", "SCTYPE_DOCKING");
  | 
        
        
            | 
            | 
           704 | 
           	}
  | 
        
        
            | 
            | 
           705 | 
           }
  | 
        
        
            | 
            | 
           706 | 
              | 
        
        
            | 
            | 
           707 | 
           Utils::CStringList *CVirtualFileSystem::_updateSectionList(const Utils::String &sFile, bool singleEntry)
  | 
        
        
            | 
            | 
           708 | 
           {
  | 
        
        
            | 
            | 
           709 | 
           	Utils::CStringList *list = new Utils::CStringList();
  | 
        
        
            | 
            | 
           710 | 
              | 
        
        
            | 
            | 
           711 | 
           	Utils::String file = this->ExtractGameFile("types\\" + sFile + ".pck", CPackages::tempDirectory() + "/" + sFile + ".txt");
  | 
        
        
            | 
            | 
           712 | 
              | 
        
        
            | 
            | 
           713 | 
           	CFileIO f(file);
  | 
        
        
            | 
            | 
           714 | 
              | 
        
        
            | 
            | 
           715 | 
           	if ( f.exists() && f.startRead() ) {
  | 
        
        
            | 
            | 
           716 | 
           		int sectionRemaining = 0;
  | 
        
        
            | 
            | 
           717 | 
              | 
        
        
            | 
            | 
           718 | 
           		while(!f.atEnd()) {
  | 
        
        
            | 
            | 
           719 | 
           			// read the next line
  | 
        
        
            | 
            | 
           720 | 
           			Utils::String line = f.readEndOfLine();
  | 
        
        
            | 
            | 
           721 | 
              | 
        
        
            | 
            | 
           722 | 
           			// remove the unneeded characters
  | 
        
        
            | 
            | 
           723 | 
           			line.removeChar('\r');
  | 
        
        
            | 
            | 
           724 | 
           			line.removeChar(9);
  | 
        
        
            | 
            | 
           725 | 
           			line.removeFirstSpace();
  | 
        
        
            | 
            | 
           726 | 
              | 
        
        
            | 
            | 
           727 | 
           			// blank line ? skip it
  | 
        
        
            | 
            | 
           728 | 
           			if ( line.empty() ) continue;
  | 
        
        
            | 
            | 
           729 | 
           			// skip anything starting with / as its a comment
  | 
        
        
            | 
            | 
           730 | 
           			if ( line[0] == '/' ) continue;
  | 
        
        
            | 
            | 
           731 | 
              | 
        
        
            | 
            | 
           732 | 
           			if ( !sectionRemaining )
  | 
        
        
            | 
            | 
           733 | 
           			{
  | 
        
        
            | 
            | 
           734 | 
           				sectionRemaining = line.token(";", 2).toLong();
  | 
        
        
            | 
            | 
           735 | 
           				Utils::String section = line.token(";", 1);
  | 
        
        
            | 
            | 
           736 | 
           				if ( !section.empty() )
  | 
        
        
            | 
            | 
           737 | 
           					list->pushBack(section, section);
  | 
        
        
            | 
            | 
           738 | 
           			}
  | 
        
        
            | 
            | 
           739 | 
           			else {
  | 
        
        
            | 
            | 
           740 | 
           				if ( singleEntry )
  | 
        
        
            | 
            | 
           741 | 
           					sectionRemaining -= (line.countToken(";") - 1);
  | 
        
        
            | 
            | 
           742 | 
           				else 
  | 
        
        
            | 
            | 
           743 | 
           					--sectionRemaining;
  | 
        
        
            | 
            | 
           744 | 
           			}
  | 
        
        
            | 
            | 
           745 | 
           		}
  | 
        
        
            | 
            | 
           746 | 
              | 
        
        
            | 
            | 
           747 | 
           		f.close();
  | 
        
        
            | 
            | 
           748 | 
           		f.remove();
  | 
        
        
            | 
            | 
           749 | 
           	}
  | 
        
        
            | 
            | 
           750 | 
              | 
        
        
            | 
            | 
           751 | 
           	return list;
  | 
        
        
            | 
            | 
           752 | 
           }
  | 
        
        
            | 
            | 
           753 | 
              | 
        
        
            | 
            | 
           754 | 
           void CVirtualFileSystem::_updateDummySections()
  | 
        
        
            | 
            | 
           755 | 
           {
  | 
        
        
            | 
            | 
           756 | 
           	DELETELIST(_lDummySections);
  | 
        
        
            | 
            | 
           757 | 
              | 
        
        
            | 
            | 
           758 | 
           	_lDummySections = _updateSectionList("Dummies", false);
  | 
        
        
            | 
            | 
           759 | 
              | 
        
        
            | 
            | 
           760 | 
           	if ( _lDummySections->empty() )
  | 
        
        
            | 
            | 
           761 | 
           	{
  | 
        
        
            | 
            | 
           762 | 
           		_lDummySections->pushBack("SDTYPE_ANIMATED", "SDTYPE_ANIMATED");
  | 
        
        
            | 
            | 
           763 | 
           		_lDummySections->pushBack("SDTYPE_DOCK", "SDTYPE_DOCK");
  | 
        
        
            | 
            | 
           764 | 
           		_lDummySections->pushBack("SDTYPE_DOORWAY", "SDTYPE_DOORWAY");
  | 
        
        
            | 
            | 
           765 | 
           		_lDummySections->pushBack("SDTYPE_GUN", "SDTYPE_GUN");
  | 
        
        
            | 
            | 
           766 | 
           		_lDummySections->pushBack("SDTYPE_CONNECTION", "SDTYPE_CONNECTION");
  | 
        
        
            | 
            | 
           767 | 
           	}
  | 
        
        
            | 
            | 
           768 | 
           }
  | 
        
        
            | 
            | 
           769 | 
              | 
        
        
            | 
            | 
           770 | 
           void CVirtualFileSystem::_updateBodiesSections()
  | 
        
        
            | 
            | 
           771 | 
           {
  | 
        
        
            | 
            | 
           772 | 
           	DELETELIST(_lBodiesSections);
  | 
        
        
            | 
            | 
           773 | 
              | 
        
        
            | 
            | 
           774 | 
           	_lBodiesSections = _updateSectionList("Bodies", true);
  | 
        
        
            | 
            | 
           775 | 
              | 
        
        
            | 
            | 
           776 | 
           	if ( _lBodiesSections->empty() )
  | 
        
        
            | 
            | 
           777 | 
           	{
  | 
        
        
            | 
            | 
           778 | 
           		_lBodiesSections->pushBack("SBTYPE_2D", "SBTYPE_2D");
  | 
        
        
            | 
            | 
           779 | 
           		_lBodiesSections->pushBack("SBTYPE_FACECAMERA", "SBTYPE_FACECAMERA");
  | 
        
        
            | 
            | 
           780 | 
           		_lBodiesSections->pushBack("SBTYPE_2D2", "SBTYPE_2D2");
  | 
        
        
            | 
            | 
           781 | 
           		_lBodiesSections->pushBack("SBTYPE_2DY", "SBTYPE_2DY");
  | 
        
        
            | 
            | 
           782 | 
           		_lBodiesSections->pushBack("SBTYPE_LOGO", "SBTYPE_LOGO");
  | 
        
        
            | 
            | 
           783 | 
           		_lBodiesSections->pushBack("SBTYPE_FC", "SBTYPE_FC");
  | 
        
        
            | 
            | 
           784 | 
           		_lBodiesSections->pushBack("SBTYPE_TURRET", "SBTYPE_TURRET");
  | 
        
        
            | 
            | 
           785 | 
           		_lBodiesSections->pushBack("SBTYPE_JET", "SBTYPE_JET");
  | 
        
        
            | 
            | 
           786 | 
           		_lBodiesSections->pushBack("SBTYPE_RADAR", "SBTYPE_RADAR");
  | 
        
        
            | 
            | 
           787 | 
           		_lBodiesSections->pushBack("SBTYPE_CONTAINER", "SBTYPE_CONTAINER");
  | 
        
        
            | 
            | 
           788 | 
           		_lBodiesSections->pushBack("SBTYPE_DISPLAY", "SBTYPE_DISPLAY");
  | 
        
        
            | 
            | 
           789 | 
           		_lBodiesSections->pushBack("SBTYPE_DOCKPOINT", "SBTYPE_DOCKPOINT");
  | 
        
        
            | 
            | 
           790 | 
           		_lBodiesSections->pushBack("SBTYPE_SMALLJET", "SBTYPE_SMALLJET");
  | 
        
        
            | 
            | 
           791 | 
           	}
  | 
        
        
            | 
            | 
           792 | 
           }
  | 
        
        
            | 
            | 
           793 | 
              | 
        
        
           | 114 | 
           cycrow | 
           794 | 
              | 
        
        
            | 
            | 
           795 | 
           /////////////////////////////////////////////////////////////////////////////////////////
  | 
        
        
            | 
            | 
           796 | 
           //	DEBUG Functions
  | 
        
        
            | 
            | 
           797 | 
              | 
        
        
            | 
            | 
           798 | 
              | 
        
        
            | 
            | 
           799 | 
           void CVirtualFileSystem::DEBUG_LogContents(const Utils::String &sFile)
  | 
        
        
            | 
            | 
           800 | 
           {
  | 
        
        
            | 
            | 
           801 | 
           	CFileIO File(sFile);
  | 
        
        
            | 
            | 
           802 | 
              | 
        
        
            | 
            | 
           803 | 
           	if ( File.startWrite() ) {
  | 
        
        
            | 
            | 
           804 | 
           		if ( m_pMap ) {
  | 
        
        
            | 
            | 
           805 | 
           			for(FileListItr itr = m_pMap->begin(); itr != m_pMap->end(); itr++) {
  | 
        
        
            | 
            | 
           806 | 
           				Utils::String line = itr->first + " => " + itr->second + "\r\n";
  | 
        
        
            | 
            | 
           807 | 
           				File.write(line.c_str(), line.length());
  | 
        
        
            | 
            | 
           808 | 
           			}
  | 
        
        
            | 
            | 
           809 | 
           		}
  | 
        
        
            | 
            | 
           810 | 
              | 
        
        
            | 
            | 
           811 | 
           		File.close();
  | 
        
        
            | 
            | 
           812 | 
           	}
  | 
        
        
            | 
            | 
           813 | 
           }
  | 
        
        
            | 
            | 
           814 | 
              | 
        
        
           | 35 | 
           cycrow | 
           815 | 
           } //NAMESPACE
  |