Subversion Repositories spk

Rev

Rev 129 | Rev 131 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 129 Rev 130
Line 43... Line 43...
43
	m_SHeader2.iFileCompression = SPKCOMPRESS_ZLIB;
43
	m_SHeader2.iFileCompression = SPKCOMPRESS_ZLIB;
44
	m_SHeader2.iDataCompression = SPKCOMPRESS_LZMA;
44
	m_SHeader2.iDataCompression = SPKCOMPRESS_LZMA;
45
	m_pParent = NULL;
45
	m_pParent = NULL;
46
	_changed();
46
	_changed();
47
	m_bUpdate = false;
47
	m_bUpdate = false;
-
 
48
	_bCombineFiles = false;
48
 
49
 
49
	ClearError();
50
	ClearError();
50
 
51
 
51
	m_iLoadError = 0;
52
	m_iLoadError = 0;
52
 
53
 
Line 198... Line 199...
198
	{
199
	{
199
		f->Data()->DeleteData();
200
		f->Data()->DeleteData();
200
	}
201
	}
201
}
202
}
202
 
203
 
-
 
204
Utils::String CBaseFile::getNameValidFile() const
-
 
205
{
-
 
206
	Utils::String name = this->name();
-
 
207
	name.removeChar(':');
-
 
208
	name.removeChar('/');
-
 
209
	name.removeChar('\\');
-
 
210
	name.removeChar('*');
-
 
211
	name.removeChar('?');
-
 
212
	name.removeChar('"');
-
 
213
	name.removeChar('<');
-
 
214
	name.removeChar('>');
-
 
215
	name.removeChar('|');
-
 
216
	return name;
-
 
217
}
203
CyString CBaseFile::GetNameValidFile ()
218
CyString CBaseFile::GetNameValidFile()
204
{
219
{
205
	CyString name = this->name();
220
	CyString name = this->name();
206
	name.RemoveChar ( ':' );
221
	name.RemoveChar ( ':' );
207
	name.RemoveChar ( '/' );
222
	name.RemoveChar ( '/' );
208
	name.RemoveChar ( '\\' );
223
	name.RemoveChar ( '\\' );
Line 227... Line 242...
227
		}
242
		}
228
	}
243
	}
229
}
244
}
230
 
245
 
231
bool CBaseFile::AnyFileType ( int type )
246
bool CBaseFile::AnyFileType ( int type )
232
{
247
{
233
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
248
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
234
	{
249
	{
235
		C_File *f = node->Data();
250
		C_File *f = node->Data();
236
		if ( f->GetFileType() == type )
251
		if ( f->GetFileType() == type )
237
			return true;
252
			return true;
238
	}
253
	}
239
 
254
 
240
	return false;
255
	return false;
241
}
256
}
242
 
257
 
243
void CBaseFile::AddFile ( C_File *file )
258
void CBaseFile::AddFile ( C_File *file )
244
{
259
{
245
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
260
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
246
	{
261
	{
247
		C_File *f = node->Data();
262
		C_File *f = node->Data();
248
		if ( f->GetFileType() != file->GetFileType() )
263
		if ( f->fileType() != file->fileType() )
249
			continue;
264
			continue;
250
		if ( f->GetName() != file->GetName () )
265
		if ( f->name() != file->name () )
251
			continue;
-
 
252
		if ( f->GetDir() != file->GetDir() )
-
 
253
			continue;
266
			continue;
254
		if ( f->game() != file->game() )
267
		if ( f->GetDir() != file->GetDir() )
255
			continue;
268
			continue;
-
 
269
		if ( f->game() != file->game() )
-
 
270
			continue;
256
 
271
 
257
		m_lFiles.remove(node, true);
272
		m_lFiles.remove(node, true);
258
		break;
273
		break;
259
	}
274
	}
260
 
275
 
261
	_addFile(file);
276
	_addFile(file);
262
}
277
}
263
 
278
 
264
C_File *CBaseFile::AddFile(CyString file, CyString dir, int type, int game)
279
C_File *CBaseFile::AddFile(CyString file, CyString dir, int type, int game)
265
{
280
{
266
	return addFile(file.ToString(), dir.ToString(), (FileType)type, game);
281
	return addFile(file.ToString(), dir.ToString(), (FileType)type, game);
267
}
282
}
268
C_File *CBaseFile::addFile(const Utils::String &file, const Utils::String &dir, FileType type, int game)
283
C_File *CBaseFile::addFile(const Utils::String &file, const Utils::String &dir, FileType type, int game)
269
{
284
{
270
	C_File *newfile = new C_File(file);
285
	C_File *newfile = new C_File(file);
271
	newfile->SetDir(dir);
286
	newfile->SetDir(dir);
272
	newfile->SetFileType(type);
287
	newfile->setFileType(type);
273
	newfile->setGame(game);
288
	newfile->setGame(game);
274
 
289
 
275
	// first check if the file already exists
290
	// first check if the file already exists
276
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
291
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
277
	{
292
	{
278
		C_File *f = node->Data();
293
		C_File *f = node->Data();
279
		if ( f->GetFileType() != newfile->GetFileType() )
294
		if ( f->fileType() != newfile->fileType() )
280
			continue;
295
			continue;
281
		if ( f->GetName() != newfile->GetName () )
296
		if ( f->name() != newfile->name () )
282
			continue;
297
			continue;
283
		if ( f->GetDir() != newfile->GetDir() )
298
		if ( f->GetDir() != newfile->GetDir() )
284
			continue;
299
			continue;
285
		if ( f->game() != newfile->game() )
300
		if (f->game() != newfile->game())
-
 
301
		{
-
 
302
			//same file, for different game, check if they are the same and combine them
-
 
303
			if (_bCombineFiles)
-
 
304
			{
-
 
305
				char *data = NULL;
-
 
306
				char *newData = NULL;
-
 
307
				size_t size = 0;
-
 
308
				size_t newSize = 0;
-
 
309
 
-
 
310
				if (f->GetData() && f->GetDataSize())
-
 
311
				{
-
 
312
					data = (char *)f->GetData();
-
 
313
					size = static_cast<size_t>(f->GetDataSize());
-
 
314
				}
-
 
315
				else if(f->isExternalFile())
-
 
316
					data = CFileIO(f->filePointer()).ReadToData(&size);
-
 
317
				if (newfile->GetData() && newfile->GetDataSize())
-
 
318
				{
-
 
319
					newData = (char *)newfile->GetData();
-
 
320
					newSize = static_cast<size_t>(newfile->GetDataSize());
-
 
321
				}
-
 
322
				else
-
 
323
					newData = CFileIO(newfile->filePointer()).ReadToData(&newSize);
-
 
324
 
-
 
325
				// compare bytes
-
 
326
				bool matched = false;
-
 
327
				if (size == newSize)
-
 
328
				{
-
 
329
					matched = true;
-
 
330
					for (unsigned long i = 0; i < size; ++i)
-
 
331
					{
-
 
332
						if (data[i] != newData[i])
-
 
333
						{
-
 
334
							matched = false;
-
 
335
							break;
-
 
336
						}
-
 
337
					}
-
 
338
				}
-
 
339
 
-
 
340
				if (data && !f->GetData())
-
 
341
					delete data;
-
 
342
				if (newData && !newfile->GetData())
-
 
343
					delete newData;
-
 
344
 
-
 
345
				if (matched)
-
 
346
				{
-
 
347
					if(!f->game() || f->game() == GAME_ALLNEW)
-
 
348
						newfile->setGame(0);
-
 
349
					else
-
 
350
						newfile->setGame(newfile->game() | f->game());
-
 
351
					m_lFiles.remove(node, true);
-
 
352
					break;
-
 
353
				}
-
 
354
			}
286
			continue;
355
			continue;
-
 
356
		}
287
 
357
 
288
		// must already exist, delete this one
358
		// must already exist, delete this one
289
		m_lFiles.remove(node, true);
359
		m_lFiles.remove(node, true);
290
		break;
360
		break;
291
	}
361
	}
Line 867... Line 937...
867
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
937
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
868
	{
938
	{
869
		C_File *fit = node->Data();
939
		C_File *fit = node->Data();
870
		// only do fake patchs
940
		// only do fake patchs
871
		if ( !fit->IsFakePatch() )
941
		if ( !fit->IsFakePatch() )
872
			continue;
942
			continue;
873
 
943
 
874
		// we should only have cat and dat files, but lets check just incase they have been added incorrectly
944
		// we should only have cat and dat files, but lets check just incase they have been added incorrectly
875
		if ( !fit->CheckFileExt ("cat") && !fit->CheckFileExt("dat") )
945
		if ( !fit->CheckFileExt ("cat") && !fit->CheckFileExt("dat") )
876
			continue;
946
			continue;
877
 
947
 
878
		// search for the name on the list
948
		// search for the name on the list
Line 882... Line 952...
882
			newname = opposite->data;
952
			newname = opposite->data;
883
		else
953
		else
884
		{
954
		{
885
			newname = CyString::Number((long)startfake).PadNumber(2);
955
			newname = CyString::Number((long)startfake).PadNumber(2);
886
			lPatches.PushBack(fit->GetBaseName(), newname);
956
			lPatches.PushBack(fit->GetBaseName(), newname);
887
		}
957
		}
888
 
958
 
889
		// rename the file
959
		// rename the file
890
		fit->FixOriginalName();
960
		fit->FixOriginalName();
891
		CLog::logf(CLog::Log_Install, 2, "Adjusting fake patch number, %s => %s", fit->GetNameDirectory(this).c_str(), (newname + "." + fit->GetFileExt()).c_str());
961
		CLog::logf(CLog::Log_Install, 2, "Adjusting fake patch number, %s => %s", fit->GetNameDirectory(this).c_str(), (newname + "." + fit->GetFileExt()).c_str());
892
		fit->SetName ( newname + "." + fit->GetFileExt() );
962
		fit->SetName ( newname + "." + fit->GetFileExt() );
Line 899... Line 969...
899
 
969
 
900
}
970
}
901
 
971
 
902
void CBaseFile::_install_renameText(CPackages *pPackages)
972
void CBaseFile::_install_renameText(CPackages *pPackages)
903
{
973
{
904
	int starttext = pPackages->FindNextTextFile();
974
	int starttext = pPackages->findNextTextFile();
905
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() ) {
975
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() ) {
906
		C_File *fit = node->Data();
976
		C_File *fit = node->Data();
907
		if ( !fit->IsAutoTextFile() )
977
		if ( !fit->isAutoTextFile() )
908
			continue;
978
			continue;
909
 
979
 
910
		CyString newname = SPK::FormatTextName(starttext, pPackages->GetLanguage(), (pPackages->GetCurrentGameFlags() & EXEFLAG_TCTEXT));
980
		Utils::String newname = SPK::FormatTextName(starttext, pPackages->GetLanguage(), (pPackages->GetCurrentGameFlags() & EXEFLAG_TCTEXT));
911
		fit->FixOriginalName();
981
		fit->FixOriginalName();
912
		CLog::logf(CLog::Log_Install, 2, "Adjusting text file, %s => %s", fit->GetNameDirectory(this).c_str(), (newname + "." + fit->GetFileExt()).c_str());
982
		CLog::logf(CLog::Log_Install, 2, "Adjusting text file, %s => %s", fit->getNameDirectory(this).c_str(), (newname + "." + fit->fileExt()).c_str());
913
		fit->SetName ( newname + ".&quot; + fit->GetFileExt() );
983
		fit->setName(newname + ".&quot; + fit->fileExt());
914
 
984
 
915
		++starttext;
985
		++starttext;
916
	}
986
	}
917
}
987
}
918
 
988
 
Line 985... Line 1055...
985
	return true;
1055
	return true;
986
}
1056
}
987
 
1057
 
988
Utils::String CBaseFile::_install_adjustFilepointer(C_File *pFile, bool bEnabled, const Utils::String &sDestination)
1058
Utils::String CBaseFile::_install_adjustFilepointer(C_File *pFile, bool bEnabled, const Utils::String &sDestination)
989
{
1059
{
990
	CyString filename = sDestination;
1060
	Utils::String filename = sDestination;
991
	if ( !filename.Empty() ) filename += "/";
1061
	if ( !filename.empty() ) filename += "/";
992
 
1062
 
993
	if ( (IsPatch()) && (pFile->GetFileType() == FILETYPE_MOD) )
1063
	if ( (IsPatch()) && (pFile->fileType() == FILETYPE_MOD) )
994
		pFile->SetDir ( CyString("Patch") );
1064
		pFile->SetDir ( CyString("Patch") );
995
 
1065
 
996
	if ( pFile->IsInMod() )
1066
	if ( pFile->IsInMod() )
997
	{
1067
	{
998
		if ( bEnabled )
1068
		if ( bEnabled )
999
			pFile->SetFilename(filename + pFile->GetInMod() + "::" + pFile->GetNameDirectory(this));
1069
			pFile->setFilename(filename + pFile->GetInMod().ToString() + "::" + pFile->getNameDirectory(this));
1000
		else
1070
		else
1001
			pFile->SetFilename(filename + "PluginManager/DisabledFiles.cat::" + pFile->GetNameDirectory(this));
1071
			pFile->setFilename(filename + "PluginManager/DisabledFiles.cat::" + pFile->getNameDirectory(this));
1002
	}
1072
	}
1003
	else
1073
	else
1004
		pFile->SetFilename ( filename + pFile->GetNameDirectory(this) );
1074
		pFile->setFilename ( filename + pFile->getNameDirectory(this) );
1005
 
1075
 
1006
	if ( !bEnabled )
1076
	if ( !bEnabled )
1007
	{
1077
	{
1008
		if ( !pFile->IsInMod() )
1078
		if ( !pFile->IsInMod() )
1009
		{
1079
		{
1010
			if ( pFile->IsFakePatch() )
1080
			if ( pFile->IsFakePatch() )
1011
				pFile->SetFilename ( filename + "PluginManager/Disabled/FakePatches/FakePatch_" + this->GetNameValidFile() + "_" + this->author() + "_" + pFile->GetName() );
1081
				pFile->setFilename ( filename + "PluginManager/Disabled/FakePatches/FakePatch_" + this->getNameValidFile() + "_" + this->author() + "_" + pFile->name() );
1012
			else if ( pFile->IsAutoTextFile() )
1082
			else if ( pFile->isAutoTextFile() )
1013
				pFile->SetFilename ( filename + "PluginManager/Disabled/TextFiles/Text_" + this->GetNameValidFile() + "_" + this->author() + "_" + pFile->GetName() );
1083
				pFile->setFilename ( filename + "PluginManager/Disabled/TextFiles/Text_" + this->getNameValidFile() + "_" + this->author() + "_" + pFile->name() );
1014
			else
1084
			else
1015
				pFile->SetFullDir ( filename + "PluginManager/Disabled/" + pFile->GetDirectory(this) );
1085
				pFile->SetFullDir ( filename + "PluginManager/Disabled/" + pFile->getDirectory(this) );
1016
		}
1086
		}
1017
		pFile->SetDisabled(true);
1087
		pFile->SetDisabled(true);
1018
	}
1088
	}
1019
 
1089
 
1020
	CLog::logf(CLog::Log_Install, 2, "Adjusting the file pointer to correct install destintation, %s", pFile->filePointer().c_str());
1090
	CLog::logf(CLog::Log_Install, 2, "Adjusting the file pointer to correct install destintation, %s", pFile->filePointer().c_str());
1021
 
1091
 
1022
	return filename.ToString();
1092
	return filename;
1023
}
1093
}
1024
 
1094
 
1025
C_File *CBaseFile::_install_checkFile(C_File *pFile, CyStringList *errorStr, bool *bDoFile, CLinkList<C_File> *pFileList)
1095
C_File *CBaseFile::_install_checkFile(C_File *pFile, CyStringList *errorStr, bool *bDoFile, CLinkList<C_File> *pFileList)
1026
{
1096
{
1027
	if ( !pFile->IsFakePatch() && pFile->GetFileType() != FILETYPE_README )
1097
	if ( !pFile->IsFakePatch() && pFile->GetFileType() != FILETYPE_README )
Line 1556... Line 1626...
1556
		return false;
1626
		return false;
1557
 
1627
 
1558
	C_File *file = new C_File();
1628
	C_File *file = new C_File();
1559
 
1629
 
1560
	if (dir.left(5).Compare("GAME_")) {
1630
	if (dir.left(5).Compare("GAME_")) {
1561
		file->setGame(1 << 31 | 1 << dir.token("_", 2).toInt());
1631
		unsigned int iGame = dir.token("_", 2).toInt();
-
 
1632
		if (!iGame)
-
 
1633
			file->setGame(0);
-
 
1634
		else
-
 
1635
			file->setGame(1 << 31 | 1 << iGame);
1562
		dir = Utils::String::Null();
1636
		dir = Utils::String::Null();
1563
	} 
1637
	} 
1564
	else if ( line.countToken(":") >= 9 ) 
1638
	else if ( line.countToken(":") >= 9 ) 
1565
	{
1639
	{
1566
		Utils::String game = line.token(":", 9);
1640
		Utils::String game = line.token(":", 9);
1567
		if (game.contains("_"))
1641
		if (game.contains("_"))
-
 
1642
		{
1568
			file->setGame(1 << 31 | 1 << game.token("_", 2).toInt());
1643
			unsigned int iGame = game.token("_", 2).toInt();
-
 
1644
			if (iGame)
-
 
1645
				file->setGame(1 << 31 | 1 << iGame);
-
 
1646
			else
-
 
1647
				file->setGame(0);
-
 
1648
		}
1569
		else
1649
		else
1570
		{
1650
		{
1571
			int iGame = game.toInt();
1651
			int iGame = game.toInt();
1572
			if (iGame & (1 << 31))
1652
			if (iGame & (1 << 31))
1573
				file->setGame(iGame);
1653
				file->setGame(iGame);
-
 
1654
			else if (!iGame)
-
 
1655
				file->setGame(0);
1574
			else
1656
			else
1575
				file->setGame(1 << 31 | 1 << iGame);
1657
				file->setGame(1 << 31 | 1 << iGame);
1576
		}
1658
		}
1577
	}
1659
	}
1578
 
1660
 
1579
	if (dir.Compare("NULL")) {
1661
	if (dir.Compare("NULL")) {
1580
		dir = Utils::String::Null();
1662
		dir = Utils::String::Null();
1581
	}
1663
	}
1582
 
1664
 
1583
	file->setFileType(type);
1665
	file->setFileType(type);
Line 1593... Line 1675...
1593
	_addFile(file, true);
1675
	_addFile(file, true);
1594
 
1676
 
1595
	return true;
1677
	return true;
1596
}
1678
}
1597
 
1679
 
1598
 
1680
 
1599
/*
1681
/*
1600
	Func:   ParseFiles
1682
	Func:   ParseFiles
1601
	Input:  String - values in one long line
1683
	Input:  String - values in one long line
1602
	Desc:   splits the files data into each line to read the data
1684
	Desc:   splits the files data into each line to read the data
1603
*/
1685
*/
1604
void CBaseFile::ReadFiles ( CyString values )
1686
void CBaseFile::ReadFiles ( CyString values )
1605
{
1687
{
1606
	int num = 0;
1688
	int num = 0;
1607
	CyString *lines = values.SplitToken ( '\n', &num );
1689
	CyString *lines = values.SplitToken ( '\n', &num );
1608
 
1690
 
1609
	for ( int i = 0; i < num; i++ )
1691
	for ( int i = 0; i < num; i++ )
1610
		ParseFilesLine ( lines[i] );
1692
		ParseFilesLine ( lines[i] );
1611
 
1693
 
1612
	CLEANSPLIT(lines, num)
1694
	CLEANSPLIT(lines, num)
1613
}
1695
}
1614
 
1696
 
1615
 
1697
 
1616
 
1698
 
1617
/*
1699
/*
1618
	Func:   ReadFile
1700
	Func:   ReadFile
1619
	Input:  filename - the name of the file to open and read
1701
	Input:  filename - the name of the file to open and read
1620
			readdata - If falses, dont read the files to memory, just read the headers and values
1702
			readdata - If falses, dont read the files to memory, just read the headers and values
1621
	Return: boolean - return ture if acceptable format
1703
	Return: boolean - return ture if acceptable format
1622
	Desc:   Opens and reads the spk file and loads all data into class
1704
	Desc:   Opens and reads the spk file and loads all data into class
1623
*/
1705
*/
1624
bool CBaseFile::ReadFile ( CyString filename, int readtype, CProgressInfo *progress )
1706
bool CBaseFile::ReadFile(CyString filename, int readtype, CProgressInfo *progress)
1625
{
1707
{
-
 
1708
	return readFile(filename.ToString(), readtype, progress);
-
 
1709
}
-
 
1710
bool CBaseFile::readFile(const Utils::String &filename, int readtype, CProgressInfo *progress)
-
 
1711
{
1626
	CFileIO File(filename.ToString());
1712
	CFileIO File(filename);
1627
	if ( !File.startRead() ) return false;
1713
	if ( !File.startRead() ) return false;
1628
 
1714
 
1629
	bool ret = this->readFile(File, readtype, progress);
1715
	bool ret = this->readFile(File, readtype, progress);
1630
	if ( ret ) this->setFilename(filename.ToString());
1716
	if ( ret ) this->setFilename(filename);
1631
 
1717
 
1632
	File.close();
1718
	File.close();
1633
	return ret;
1719
	return ret;
1634
}
1720
}
1635
 
1721
 
Line 1680... Line 1766...
1680
		if ( compr ) ReadValues ( CyString ((char *)compr) );
1766
		if ( compr ) ReadValues ( CyString ((char *)compr) );
1681
	}
1767
	}
1682
	// no compression
1768
	// no compression
1683
	else
1769
	else
1684
		ReadValues ( CyString ((char *)readData) );
1770
		ReadValues ( CyString ((char *)readData) );
1685
 
1771
 
1686
	delete []readData;
1772
	delete []readData;
1687
 
1773
 
1688
	return doneLen;
1774
	return doneLen;
1689
}
1775
}
1690
 
1776
 
1691
int CBaseFile::_read_FileHeader(CFileIO &File, int iReadType, int iMaxProgress, int iDoneLen, CProgressInfo *pProgress)
1777
int CBaseFile::_read_FileHeader(CFileIO &File, int iReadType, int iMaxProgress, int iDoneLen, CProgressInfo *pProgress)
1692
{
1778
{
Line 1800... Line 1886...
1800
 
1886
 
1801
	return true;
1887
	return true;
1802
}
1888
}
1803
 
1889
 
1804
bool CBaseFile::IsMod()
1890
bool CBaseFile::IsMod()
1805
{
1891
{
1806
	// check for any mod files that are not fake patchs
1892
	// check for any mod files that are not fake patchs
1807
	for ( CListNode<C_File> *fNode = m_lFiles.Front(); fNode; fNode = fNode->next() )
1893
	for ( CListNode<C_File> *fNode = m_lFiles.Front(); fNode; fNode = fNode->next() )
1808
	{
1894
	{
1809
		C_File *f = fNode->Data();
1895
		C_File *f = fNode->Data();
1810
		if ( f->GetFileType() != FILETYPE_MOD )
1896
		if ( f->GetFileType() != FILETYPE_MOD )
1811
			continue;
1897
			continue;
1812
 
1898
 
1813
		if ( !f->IsFakePatch() )
1899
		if ( !f->IsFakePatch() )
Line 1883... Line 1969...
1883
	values += Utils::String("EaseOfUse: ") + (long)easeOfUse() + "\n";
1969
	values += Utils::String("EaseOfUse: ") + (long)easeOfUse() + "\n";
1884
	values += Utils::String("Recommended: ") + (long)recommended() + "\n";
1970
	values += Utils::String("Recommended: ") + (long)recommended() + "\n";
1885
 
1971
 
1886
	for ( CListNode<SNames> *nNode = m_lNames.Front(); nNode; nNode = nNode->next() )
1972
	for ( CListNode<SNames> *nNode = m_lNames.Front(); nNode; nNode = nNode->next() )
1887
		values += Utils::String("ScriptName: ") + (long)nNode->Data()->iLanguage + ":" + nNode->Data()->sName + "\n";
1973
		values += Utils::String("ScriptName: ") + (long)nNode->Data()->iLanguage + ":" + nNode->Data()->sName + "\n";
1888
 
1974
 
1889
	for ( CListNode<SNeededLibrary> *libNode = m_lNeededLibrarys.Front(); libNode; libNode = libNode->next() ) {
1975
	for ( CListNode<SNeededLibrary> *libNode = m_lNeededLibrarys.Front(); libNode; libNode = libNode->next() ) {
1890
		SNeededLibrary *l = libNode->Data();
1976
		SNeededLibrary *l = libNode->Data();
1891
		values += (CyString("NeededLibrary: ") + l->sName + "||" + l->sAuthor + "||" + l->sMinVersion + "\n").ToString();
1977
		values += (CyString("NeededLibrary: ") + l->sName + "||" + l->sAuthor + "||" + l->sMinVersion + "\n").ToString();
1892
	}
1978
	}
1893
 
1979
 
Line 1966... Line 2052...
1966
	file.put(static_cast<unsigned char>(valueUncomprLen >> 16));
2052
	file.put(static_cast<unsigned char>(valueUncomprLen >> 16));
1967
	file.put(static_cast<unsigned char>(valueUncomprLen >> 8));
2053
	file.put(static_cast<unsigned char>(valueUncomprLen >> 8));
1968
	file.put(static_cast<unsigned char>(valueUncomprLen));
2054
	file.put(static_cast<unsigned char>(valueUncomprLen));
1969
	file.write(valueCompr, valueComprLen);
2055
	file.write(valueCompr, valueComprLen);
1970
	free ( valueCompr );
2056
	free ( valueCompr );
1971
 
2057
 
1972
	// now compress the files header
2058
	// now compress the files header
1973
	// create the files values
2059
	// create the files values
1974
	CyString files = CreateFilesLine ( true, progress );
2060
	CyString files = CreateFilesLine ( true, progress );
1975
 
2061
 
1976
	// compress the files values
2062
	// compress the files values
Line 2048... Line 2134...
2048
				data += writeSize;
2134
				data += writeSize;
2049
				remaining -= writeSize;
2135
				remaining -= writeSize;
2050
			}
2136
			}
2051
 
2137
 
2052
			if ( progress ) progress->IncDone((int)writeSize);
2138
			if ( progress ) progress->IncDone((int)writeSize);
2053
		}
2139
		}
2054
	}
2140
	}
2055
 
2141
 
2056
	_changed();
2142
	_changed();
2057
 
2143
 
2058
	return true;
2144
	return true;
2059
}
2145
}
Line 2171... Line 2257...
2171
		// extra, text, soundtrack, readmes and screen files do not require a modified game directly
2257
		// extra, text, soundtrack, readmes and screen files do not require a modified game directly
2172
		if ( (file->GetFileType() == FILETYPE_EXTRA) || (file->GetFileType() == FILETYPE_TEXT) || (file->GetFileType() == FILETYPE_SOUND) || (file->GetFileType() == FILETYPE_SCREEN) || (file->GetFileType() == FILETYPE_README) )
2258
		if ( (file->GetFileType() == FILETYPE_EXTRA) || (file->GetFileType() == FILETYPE_TEXT) || (file->GetFileType() == FILETYPE_SOUND) || (file->GetFileType() == FILETYPE_SCREEN) || (file->GetFileType() == FILETYPE_README) )
2173
			continue;
2259
			continue;
2174
		// mods and maps always need modified game
2260
		// mods and maps always need modified game
2175
		else if ( (file->GetFileType() == FILETYPE_MOD) || (file->GetFileType() == FILETYPE_MAP) )
2261
		else if ( (file->GetFileType() == FILETYPE_MOD) || (file->GetFileType() == FILETYPE_MAP) )
2176
		{
2262
		{
2177
			m_bSigned = false;
2263
			m_bSigned = false;
2178
			break;
2264
			break;
2179
		}
2265
		}
2180
 
2266
 
2181
		// else should be a script file, script or uninstall type
2267
		// else should be a script file, script or uninstall type
2182
		// all scripts must be signed, if any are not, then no signed status
2268
		// all scripts must be signed, if any are not, then no signed status
2183
		if ( !file->IsSigned () )
2269
		if ( !file->IsSigned () )
2184
		{
2270
		{
2185
			m_bSigned = false;
2271
			m_bSigned = false;
2186
			break;
2272
			break;
2187
		}
2273
		}
2188
	}
2274
	}
2189
 
2275
 
2190
	return m_bSigned;
2276
	return m_bSigned;
2191
}
2277
}
2192
 
2278
 
2193
 
2279
 
2194
bool CBaseFile::IsPackageNeeded(const Utils::String &scriptName, const Utils::String &author)
2280
bool CBaseFile::IsPackageNeeded(const Utils::String &scriptName, const Utils::String &author)
2195
{
2281
{
2196
	for ( CListNode<SNeededLibrary> *node = m_lNeededLibrarys.Front(); node; node = node->next() )
2282
	for ( CListNode<SNeededLibrary> *node = m_lNeededLibrarys.Front(); node; node = node->next() )
2197
	{
2283
	{
2198
		SNeededLibrary *l = node->Data();
2284
		SNeededLibrary *l = node->Data();
2199
		if ( l->sName.Compare(scriptName) && l->sAuthor.Compare(author) )
2285
		if ( l->sName.Compare(scriptName) && l->sAuthor.Compare(author) )
2200
			return true;
2286
			return true;
2201
	}
2287
	}
2202
 
2288
 
2203
	return false;
2289
	return false;
2204
}
2290
}
2205
 
2291
 
2206
SNeededLibrary *CBaseFile::FindPackageNeeded(const Utils::String &scriptName, const Utils::String &author)
2292
SNeededLibrary *CBaseFile::FindPackageNeeded(const Utils::String &scriptName, const Utils::String &author)
2207
{
2293
{
2208
	for ( CListNode<SNeededLibrary> *node = m_lNeededLibrarys.Front(); node; node = node->next() )
2294
	for ( CListNode<SNeededLibrary> *node = m_lNeededLibrarys.Front(); node; node = node->next() )
2209
	{
2295
	{
2210
		SNeededLibrary *l = node->Data();
2296
		SNeededLibrary *l = node->Data();
2211
		if ( l->sName.Compare(scriptName) && l->sAuthor.Compare(author) )
2297
		if ( l->sName.Compare(scriptName) && l->sAuthor.Compare(author) )
2212
			return l;
2298
			return l;
2213
	}
2299
	}
2214
 
2300
 
2215
	return NULL;
2301
	return NULL;
2216
}
2302
}
2217
 
2303
 
2218
void CBaseFile::RemoveFakePatchOrder(CyString scriptName, CyString author)
2304
void CBaseFile::RemoveFakePatchOrder(CyString scriptName, CyString author)
2219
{
2305
{
2220
	RemoveFakePatchOrder(true, scriptName, author);
2306
	RemoveFakePatchOrder(true, scriptName, author);
2221
	RemoveFakePatchOrder(false, scriptName, author);
2307
	RemoveFakePatchOrder(false, scriptName, author);
2222
}
2308
}
2223
void CBaseFile::RemoveFakePatchOrder(bool after, CyString scriptName, CyString author)
2309
void CBaseFile::RemoveFakePatchOrder(bool after, CyString scriptName, CyString author)
2224
{
2310
{
Line 2745... Line 2831...
2745
		{
2831
		{
2746
			this->AddNeededLibrary(spk->name(), spk->author(), spk->version());
2832
			this->AddNeededLibrary(spk->name(), spk->author(), spk->version());
2747
			delete spk;
2833
			delete spk;
2748
		}
2834
		}
2749
	}
2835
	}
2750
	else if ( sFirst.Compare("Icon") )
2836
	else if (sFirst.Compare("Icon"))
2751
	{
2837
	{
2752
		C_File *icon = new C_File(sRest.c_str());
2838
		C_File *icon = new C_File(sRest.c_str());
2753
		if ( icon->ReadFromFile() )
2839
		if ( icon->ReadFromFile() )
2754
			this->SetIcon(icon, CFileIO(sRest).GetFileExtension());
2840
			this->SetIcon(icon, CFileIO(sRest).GetFileExtension());
2755
	}
2841
	}
-
 
2842
	else if (sFirst.Compare("CombineGameFiles"))
-
 
2843
		_bCombineFiles = sRest.Compare("true") || sRest.Compare("yes") || sRest.toInt();
2756
	else
2844
	else
2757
	{
2845
	{
2758
		Utils::String checkType = sFirst;
2846
		Utils::String checkType = sFirst;
2759
		bool shared = false;
2847
		bool shared = false;
2760
		if ( checkType.left(6).Compare("Shared") )
2848
		if ( checkType.left(6).Compare("Shared") )
Line 2877... Line 2965...
2877
			Utils::String addon = gameAddons.findString(Utils::String::Number(foundGame));
2965
			Utils::String addon = gameAddons.findString(Utils::String::Number(foundGame));
2878
			if (!addon.empty())
2966
			if (!addon.empty())
2879
			{
2967
			{
2880
				Utils::String dir = C_File::GetDirectory(filetype, rest, this);
2968
				Utils::String dir = C_File::GetDirectory(filetype, rest, this);
2881
				Utils::String filename = rest;
2969
				Utils::String filename = rest;
2882
				if (CCatFile::IsAddonDir(dir))
2970
				if (CCatFile::IsAddonDir(dir) && !filename.contains(addon))
-
 
2971
				{
2883
					filename = filename.findReplace(dir + "/", addon + "/" + dir + "/");
2972
					filename = filename.findReplace(dir + "/", addon + "/" + dir + "/");
2884
 
-
 
2885
				file = this->AppendFile(filename, filetype, addGame, dir);
2973
					file = this->AppendFile(filename, filetype, addGame, dir);
-
 
2974
				}
2886
			}
2975
			}
2887
		}
2976
		}
2888
 
2977
 
2889
		if(!file)
2978
		if(!file)
2890
			file = this->AppendFile(rest, filetype, addGame, dir);
2979
			file = this->AppendFile(rest, filetype, addGame, dir);