Subversion Repositories spk

Rev

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

Rev 130 Rev 131
Line 100... Line 100...
100
##########################################################################################
100
##########################################################################################
101
##################                Base Class Functions                  ##################
101
##################                Base Class Functions                  ##################
102
##########################################################################################
102
##########################################################################################
103
*/
103
*/
104
 
104
 
-
 
105
const CLinkList<C_File> *CBaseFile::fileList() const
-
 
106
{
-
 
107
	return &m_lFiles;
-
 
108
}
105
CLinkList<C_File> *CBaseFile::fileList(int type) const
109
CLinkList<C_File> *CBaseFile::fileList(int type) const
106
{
110
{
107
	CLinkList<C_File> *list = new CLinkList<C_File>;
111
	CLinkList<C_File> *list = new CLinkList<C_File>;
108
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
112
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
109
	{
113
	{
110
		C_File *f = node->Data();
114
		C_File *f = node->Data();
111
		if ( f->GetFileType() == type )
115
		if ( f->GetFileType() == type )
112
			list->push_back(f);
116
			list->push_back(f);
113
	}
117
	}
114
 
118
 
115
	return list;
119
	return list;
Line 144... Line 148...
144
	int type = -1;
148
	int type = -1;
145
	for ( CListNode<C_File> *node = m_lFiles.Back(); node; node = node->prev() )
149
	for ( CListNode<C_File> *node = m_lFiles.Back(); node; node = node->prev() )
146
	{
150
	{
147
		C_File *f = node->Data();
151
		C_File *f = node->Data();
148
		if ( type == -1 )
152
		if ( type == -1 )
149
		{
153
		{
150
			if ( f == next )
154
			if ( f == next )
151
				type = f->GetFileType();
155
				type = f->GetFileType();
152
		}
156
		}
153
		else
157
		else
154
		{
158
		{
Line 237... Line 241...
237
		C_File *f = node->Data();
241
		C_File *f = node->Data();
238
		if ( f == oldFile )
242
		if ( f == oldFile )
239
		{
243
		{
240
			node->ChangeData(newFile);
244
			node->ChangeData(newFile);
241
			break;
245
			break;
242
		}
246
		}
243
	}
247
	}
244
}
248
}
245
 
249
 
246
bool CBaseFile::AnyFileType ( int type )
250
bool CBaseFile::AnyFileType ( int type )
247
{
251
{
248
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
252
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
Line 378... Line 382...
378
C_File *CBaseFile::AppendFile ( CyString file, int type, int game, CyString dir, CProgressInfo *progress )
382
C_File *CBaseFile::AppendFile ( CyString file, int type, int game, CyString dir, CProgressInfo *progress )
379
{
383
{
380
	C_File *newfile = AddFile ( file, dir, type, game );
384
	C_File *newfile = AddFile ( file, dir, type, game );
381
	if ( !newfile )
385
	if ( !newfile )
382
		return NULL;
386
		return NULL;
383
 
387
 
384
 
388
 
385
	// read the file into memory
389
	// read the file into memory
386
	if ( newfile->ReadFromFile () )
390
	if ( newfile->ReadFromFile () )
387
	{
391
	{
388
		// now compress the file
392
		// now compress the file
389
		if ( newfile->CompressData ( m_SHeader2.iDataCompression, progress ) )
393
		if ( newfile->CompressData ( m_SHeader2.iDataCompression, progress ) )
390
			return newfile;
394
			return newfile;
391
	}
395
	}
392
	else if ( newfile->GetLastError() == SPKERR_MALLOC )
396
	else if ( newfile->GetLastError() == SPKERR_MALLOC )
393
	{
397
	{
394
		if ( newfile->CompressFile ( progress ) )
398
		if ( newfile->CompressFile ( progress ) )
395
			return newfile;
399
			return newfile;
396
	}
400
	}
397
 
401
 
398
	m_lFiles.pop_back ();
402
	m_lFiles.pop_back ();
399
	delete newfile;
403
	delete newfile;
400
 
404
 
401
	return NULL;
405
	return NULL;
402
}
406
}
403
 
407
 
404
C_File *CBaseFile::FindFileAt ( int filetype, int pos )
408
C_File *CBaseFile::FindFileAt ( int filetype, int pos )
405
{
409
{
406
	int count = 0;
410
	int count = 0;
407
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
411
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
Line 421... Line 425...
421
 
425
 
422
C_File *CBaseFile::FindFile ( CyString filename, int type, CyString dir, int game )
426
C_File *CBaseFile::FindFile ( CyString filename, int type, CyString dir, int game )
423
{
427
{
424
	CyString lfile = filename.ToLower();
428
	CyString lfile = filename.ToLower();
425
	lfile = lfile.FindReplace ( "\\", "/" );
429
	lfile = lfile.FindReplace ( "\\", "/" );
426
 
430
 
427
	lfile = lfile.GetToken ( lfile.NumToken('/'), '/' );
431
	lfile = lfile.GetToken ( lfile.NumToken('/'), '/' );
428
 
432
 
429
	CListNode<C_File> *node = m_lFiles.Front();
433
	CListNode<C_File> *node = m_lFiles.Front();
430
	while ( node )
434
	while ( node )
431
	{
435
	{
432
		C_File *f = node->Data();
436
		C_File *f = node->Data();
433
		node = node->next();
437
		node = node->next();
434
 
438
 
435
		if ( type != f->GetFileType() )
439
		if ( type != f->GetFileType() )
436
			continue;
440
			continue;
Line 438... Line 442...
438
			continue;
442
			continue;
439
		if ( game != f->game() )
443
		if ( game != f->game() )
440
			continue;
444
			continue;
441
		if ( f->GetName().ToLower() == lfile )
445
		if ( f->GetName().ToLower() == lfile )
442
			return f;
446
			return f;
443
	}
447
	}
444
	return NULL;
448
	return NULL;
445
}
449
}
446
 
450
 
447
bool CBaseFile::RemoveFile ( CyString file, int type, CyString dir, int game )
451
bool CBaseFile::RemoveFile ( CyString file, int type, CyString dir, int game )
448
{
452
{
449
	C_File *f = FindFile (file, type, dir, game);
453
	C_File *f = FindFile (file, type, dir, game);
450
	if ( !f )
454
	if ( !f )
451
		return false;
455
		return false;
452
	return RemoveFile ( f );
456
	return RemoveFile ( f );
453
}
457
}
454
 
458
 
455
bool CBaseFile::RemoveFile ( C_File *file )
459
bool CBaseFile::RemoveFile ( C_File *file )
456
{
460
{
457
	int count = 0;
461
	int count = 0;
458
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
462
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
459
	{
463
	{
Line 461... Line 465...
461
		if ( f == file )
465
		if ( f == file )
462
			return RemoveFile ( count );
466
			return RemoveFile ( count );
463
		++count;
467
		++count;
464
	}
468
	}
465
	return false;
469
	return false;
466
}
470
}
467
 
471
 
468
bool CBaseFile::RemoveFile ( int pos )
472
bool CBaseFile::RemoveFile ( int pos )
469
{
473
{
470
	if ( (pos < 0) || (pos >= m_lFiles.size()) )
474
	if ( (pos < 0) || (pos >= m_lFiles.size()) )
471
		return false;
475
		return false;
472
 
476
 
473
	C_File *file = m_lFiles.Get ( pos );
477
	C_File *file = m_lFiles.Get ( pos );
474
	m_lFiles.erase ( pos + 1 );
478
	m_lFiles.erase ( pos + 1 );
475
 
479
 
476
	if ( file )
480
	if ( file )
477
		delete file;
481
		delete file;
478
 
482
 
479
	_changed();
483
	_changed();
480
 
484
 
481
	return true;
485
	return true;
482
}
486
}
483
 
487
 
484
 
488
 
485
void CBaseFile::removeAllFiles(FileType type, int game)
489
void CBaseFile::removeAllFiles(FileType type, int game)
486
{
490
{
487
	if ( m_lFiles.empty() )
491
	if ( m_lFiles.empty() )
488
		return;
492
		return;
489
 
493
 
Line 716... Line 720...
716
 
720
 
717
	if ( updateheader )
721
	if ( updateheader )
718
	{
722
	{
719
		m_SHeader2.iNumFiles = 0;
723
		m_SHeader2.iNumFiles = 0;
720
		m_SHeader2.lFullSize = 0;
724
		m_SHeader2.lFullSize = 0;
721
	}
725
	}
722
 
726
 
723
	if ( m_pIconFile )
727
	if ( m_pIconFile )
724
	{
728
	{
725
		// no data, read it from file
729
		// no data, read it from file
726
		if ( !m_pIconFile->GetData() )
730
		if ( !m_pIconFile->GetData() )
727
			m_pIconFile->ReadFromFile ();
731
			m_pIconFile->ReadFromFile ();
728
 
732
 
729
		// compress the file
733
		// compress the file
730
		if ( !m_pIconFile->CompressData ( m_SHeader2.iDataCompression, progress ) )
734
		if ( !m_pIconFile->CompressData ( m_SHeader2.iDataCompression, progress ) )
731
			m_pIconFile->SetDataCompression(SPKCOMPRESS_NONE);
735
			m_pIconFile->SetDataCompression(SPKCOMPRESS_NONE);
732
 
736
 
733
		line += CyString("Icon:") + (m_pIconFile->GetDataSize() + (long)4) + ":" + m_pIconFile->GetUncompressedDataSize() + ":" + (long)m_pIconFile->GetCompressionType() + ":" + m_sIconExt + "\n";
737
		line += CyString("Icon:") + (m_pIconFile->GetDataSize() + (long)4) + ":" + m_pIconFile->GetUncompressedDataSize() + ":" + (long)m_pIconFile->GetCompressionType() + ":" + m_sIconExt + "\n";
734
		if ( updateheader )
738
		if ( updateheader )
735
		{
739
		{
736
			++m_SHeader2.iNumFiles;
740
			++m_SHeader2.iNumFiles;
737
			m_SHeader2.lFullSize += (m_pIconFile->GetDataSize() + 4);
741
			m_SHeader2.lFullSize += (m_pIconFile->GetDataSize() + 4);
738
		}
742
		}
739
	}
743
	}
740
 
744
 
741
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
745
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
742
	{
746
	{
743
		C_File *file = node->Data();
747
		C_File *file = node->Data();
Line 757... Line 761...
757
			}
761
			}
758
		}
762
		}
759
 
763
 
760
		if ( !file->GetData() )
764
		if ( !file->GetData() )
761
			continue;
765
			continue;
762
 
766
 
763
		// compress the file
767
		// compress the file
764
		if ( !file->CompressData ( m_SHeader2.iDataCompression, progress ) )
768
		if ( !file->CompressData ( m_SHeader2.iDataCompression, progress ) )
765
		{
769
		{
766
			file->SetDataCompression(SPKCOMPRESS_NONE);
770
			file->SetDataCompression(SPKCOMPRESS_NONE);
767
			file->SetUncompressedDataSize(file->GetDataSize());
771
			file->SetUncompressedDataSize(file->GetDataSize());
768
		}
772
		}
769
 
773
 
770
		CyString command = GetFileTypeString ( file->GetFileType() );
774
		CyString command = GetFileTypeString ( file->GetFileType() );
771
		if ( command.Empty() )
775
		if ( command.Empty() )
772
			continue;
776
			continue;
773
 
777
 
774
		if ( file->IsShared() )
778
		if ( file->IsShared() )
Line 858... Line 862...
858
	delete File;
862
	delete File;
859
	return true;
863
	return true;
860
}
864
}
861
 
865
 
862
CFileIO *CBaseFile::_startRead()
866
CFileIO *CBaseFile::_startRead()
863
{
867
{
864
	// no file to read from
868
	// no file to read from
865
	if ( this->filename().empty() ) return NULL;
869
	if ( this->filename().empty() ) return NULL;
866
 
870
 
867
	// now open the file
871
	// now open the file
868
	CFileIO *File = new CFileIO(this->filename());
872
	CFileIO *File = new CFileIO(this->filename());
Line 1995... Line 1999...
1995
*/
1999
*/
1996
bool CBaseFile::WriteFile ( CyString filename, CProgressInfo *progress )
2000
bool CBaseFile::WriteFile ( CyString filename, CProgressInfo *progress )
1997
{
2001
{
1998
	CFileIO File(filename);
2002
	CFileIO File(filename);
1999
	if ( File.startWrite() ) return WriteData(File, progress);
2003
	if ( File.startWrite() ) return WriteData(File, progress);
2000
	return false;
2004
	return false;
2001
}
2005
}
2002
 
2006
 
2003
bool CBaseFile::WriteHeader(CFileIO &file, int valueheader, int valueComprLen)
2007
bool CBaseFile::WriteHeader(CFileIO &file, int valueheader, int valueComprLen)
2004
{
2008
{
2005
	return file.write("BaseCycrow;%.2f;%d;%d\n", FILEVERSION, valueheader, valueComprLen);
2009
	return file.write("BaseCycrow;%.2f;%d;%d\n", FILEVERSION, valueheader, valueComprLen);
2006
}
2010
}
Line 2079... Line 2083...
2079
		}
2083
		}
2080
	}
2084
	}
2081
 
2085
 
2082
	// if unable to compress, store it as plain text
2086
	// if unable to compress, store it as plain text
2083
	if ( !compressed )
2087
	if ( !compressed )
2084
	{
2088
	{
2085
		fileComprLen = fileUncomprLen;
2089
		fileComprLen = fileUncomprLen;
2086
		fileCompr = (unsigned char *)calloc((unsigned int)fileComprLen, 1);
2090
		fileCompr = (unsigned char *)calloc((unsigned int)fileComprLen, 1);
2087
		memcpy ( fileCompr, files.c_str(), fileComprLen );
2091
		memcpy ( fileCompr, files.c_str(), fileComprLen );
2088
		fileheader = SPKCOMPRESS_NONE;
2092
		fileheader = SPKCOMPRESS_NONE;
2089
	}
2093
	}
Line 2140... Line 2144...
2140
	}
2144
	}
2141
 
2145
 
2142
	_changed();
2146
	_changed();
2143
 
2147
 
2144
	return true;
2148
	return true;
2145
}
2149
}
-
 
2150
 
-
 
2151
 
-
 
2152
bool CBaseFile::ExtractFile(C_File *file, CyString dir, bool includedir, CProgressInfo *progress)
-
 
2153
{
-
 
2154
	return extractFile(file, dir.ToString(), includedir, progress);
-
 
2155
}
-
 
2156
bool CBaseFile::extractFile(C_File *file, const Utils::String &dir, bool includedir, CProgressInfo *progress)
-
 
2157
{
-
 
2158
	if (ReadFileToMemory(file))
-
 
2159
	{
-
 
2160
		// now finally, uncompress the file
-
 
2161
		long len = 0;
-
 
2162
		unsigned char *data = file->UncompressData(&len, progress);
-
 
2163
		if (!data)
-
 
2164
		{
-
 
2165
			// attempt a file decompress
-
 
2166
			if (file->GetCompressionType() == SPKCOMPRESS_7ZIP)
-
 
2167
			{
-
 
2168
				if (file->UncompressToFile(dir, this, includedir, progress))
-
 
2169
					return true;
-
 
2170
			}
-
 
2171
			return false;
-
 
2172
		}
-
 
2173
 
-
 
2174
		if (!file->writeToDir(dir, this, includedir, Utils::String::Null(), data, len))
-
 
2175
			return false;
2146
 
2176
 
-
 
2177
		return true;
2147
 
2178
 
-
 
2179
	}
-
 
2180
	else
-
 
2181
		return false;
-
 
2182
}
2148
bool CBaseFile::ExtractFile ( C_File *file, CyString dir, bool includedir, CProgressInfo *progress )
2183
bool CBaseFile::extractFile(C_File *file, const Utils::String &dir, unsigned int game, const Utils::CStringList &gameAddons, bool includedir, CProgressInfo *progress)
2149
{
2184
{
2150
	if ( ReadFileToMemory ( file ) )
2185
	if (ReadFileToMemory(file))
2151
	{
2186
	{
-
 
2187
		CDirIO Dir(dir);
-
 
2188
		Utils::String addonDir;
-
 
2189
		if (file->isFileInAddon())
-
 
2190
		{
-
 
2191
			int addonGame = file->getForSingleGame();
-
 
2192
			if (!addonGame) addonGame = game;
-
 
2193
 
-
 
2194
			if (addonGame > 0)
-
 
2195
				addonDir = gameAddons.findString(Utils::String::Number(addonGame));
-
 
2196
		}
-
 
2197
 
-
 
2198
		if (!addonDir.empty())
-
 
2199
			Dir.cd(addonDir);
-
 
2200
 
-
 
2201
		// create directory first
-
 
2202
		Dir.create(file->getDirectory(this));
-
 
2203
 
2152
		// now finally, uncompress the file
2204
		// now finally, uncompress the file
2153
		long len = 0;
2205
		long len = 0;
2154
		unsigned char *data = file->UncompressData ( &len, progress );
2206
		unsigned char *data = file->UncompressData(&len, progress);
2155
		if ( !data )
2207
		if (!data)
2156
		{
2208
		{
2157
			// attempt a file decompress
2209
			// attempt a file decompress
2158
			if ( file->GetCompressionType() == SPKCOMPRESS_7ZIP )
2210
			if (file->GetCompressionType() == SPKCOMPRESS_7ZIP)
2159
			{
2211
			{
2160
				if ( file->UncompressToFile ( dir, this, includedir, progress ) )
2212
				if (file->UncompressToFile(Dir.dir(), this, includedir, progress))
2161
					return true;
2213
					return true;
2162
			}
2214
			}
2163
			return false;
2215
			return false;
2164
		}
2216
		}
2165
 
2217
 
2166
		if ( !file->writeToDir(dir.ToString(), this, includedir, Utils::String::Null(), data, len) )
2218
		if (!file->writeToDir(Dir.dir(), this, includedir, Utils::String::Null(), data, len))
2167
			return false;
2219
			return false;
2168
 
2220
 
2169
		return true;
2221
		return true;
2170
 
2222
 
2171
	}
2223
	}
2172
	else
2224
	else
2173
		return false;
2225
		return false;
2174
}
2226
}
2175
 
2227
 
2176
bool CBaseFile::ExtractFile ( int filenum, CyString dir, bool includedir, CProgressInfo *progress )
2228
bool CBaseFile::ExtractFile(int filenum, CyString dir, bool includedir, CProgressInfo *progress)
-
 
2229
{
-
 
2230
	// invalid valus
-
 
2231
	if (filenum < 0)
-
 
2232
		return false;
-
 
2233
	// out of range
-
 
2234
	if (filenum > m_lFiles.size())
-
 
2235
		return false;
-
 
2236
 
-
 
2237
	// get the file pointer
-
 
2238
	C_File *file = m_lFiles.Get(filenum);
-
 
2239
	return extractFile(file, dir.ToString(), includedir, progress);
-
 
2240
}
-
 
2241
 
-
 
2242
bool CBaseFile::extractFile(int filenum, const Utils::String &dir, unsigned int game, const Utils::CStringList &gameAddons, bool includedir, CProgressInfo *progress)
-
 
2243
{
-
 
2244
	// invalid valus
-
 
2245
	if (filenum < 0)
-
 
2246
		return false;
-
 
2247
	// out of range
-
 
2248
	if (filenum > m_lFiles.size())
-
 
2249
		return false;
-
 
2250
 
-
 
2251
	// get the file pointer
-
 
2252
	C_File *file = m_lFiles.Get(filenum);
-
 
2253
	return extractFile(file, dir, game, gameAddons, includedir, progress);
-
 
2254
}
-
 
2255
 
-
 
2256
bool CBaseFile::extractFile(int filenum, const Utils::String &dir, bool includedir, CProgressInfo *progress)
2177
{
2257
{
2178
	// invalid valus
2258
	// invalid valus
2179
	if ( filenum < 0 )
2259
	if (filenum < 0)
2180
		return false;
2260
		return false;
2181
	// out of range
2261
	// out of range
2182
	if ( filenum > m_lFiles.size() )
2262
	if (filenum > m_lFiles.size())
2183
		return false;
2263
		return false;
2184
 
2264
 
2185
	// get the file pointer
2265
	// get the file pointer
2186
	C_File *file = m_lFiles.Get ( filenum );
2266
	C_File *file = m_lFiles.Get(filenum);
2187
	return ExtractFile ( file, dir, includedir, progress );
2267
	return ExtractFile(file, dir, includedir, progress);
2188
}
2268
}
2189
 
2269
 
2190
bool CBaseFile::extractAll(const Utils::String &dir, int game, const Utils::CStringList &gameAddons, bool includedir, CProgressInfo *progress)
2270
bool CBaseFile::extractAll(const Utils::String &dir, int game, const Utils::CStringList &gameAddons, bool includedir, CProgressInfo *progress)
2191
{
2271
{
2192
	// no file to read from
2272
	// no file to read from
Line 2583... Line 2663...
2583
		}
2663
		}
2584
 
2664
 
2585
		bool done = false;
2665
		bool done = false;
2586
		if ( wildcard )
2666
		if ( wildcard )
2587
		{
2667
		{
2588
			Utils::String base = f->Data()->GetBaseName().ToString();
2668
			Utils::String base = f->Data()->baseName();
2589
			if ( f->Data()->GetFileType() == FILETYPE_SCRIPT )
2669
			if ( f->Data()->fileType() == FILETYPE_SCRIPT )
2590
			{
2670
			{
2591
				if ( base.token(".", 1).Compare("plugin") || base.token(".", 1).Compare("lib") )
2671
				if ( base.token(".", 1).Compare("plugin") || base.token(".", 1).Compare("lib") )
2592
				{
2672
				{
2593
					name += f->Data()->GetDirectory(this).ToString() + "/" + base.tokens(".", 1, 2) + ".*";
2673
					name += f->Data()->getDirectory(this) + "/" + base.tokens(".", 1, 2) + ".*";
2594
					done = true;
2674
					done = true;
2595
				}
2675
				}
2596
				else if ( base.token(".", 1).Compare("al") && !base.token(".", 2).Compare("plugin") )
2676
				else if ( base.token(".", 1).Compare("al") && !base.token(".", 2).Compare("plugin") )
2597
				{
2677
				{
2598
					name += f->Data()->GetDirectory(this).ToString() + "/" + base.tokens(".", 1, 2) + ".*";
2678
					name += f->Data()->getDirectory(this) + "/" + base.tokens(".", 1, 2) + ".*";
2599
					done = true;
2679
					done = true;
2600
				}
2680
				}
2601
			}
2681
			}
2602
			else if ( f->Data()->GetFileType() == FILETYPE_TEXT )
2682
			else if ( f->Data()->fileType() == FILETYPE_TEXT )
2603
			{
2683
			{
2604
				if ( base.contains("-L") )
2684
				if ( base.contains("-L") )
2605
				{
2685
				{
2606
					name += f->Data()->GetDirectory(this).ToString() + "/" + base.token("-L", 1) + "-L*";
2686
					name += f->Data()->getDirectory(this) + "/" + base.token("-L", 1) + "-L*";
2607
					done = true;
2687
					done = true;
2608
				}
2688
				}
2609
				else
2689
				else
2610
				{
2690
				{
2611
					name += f->Data()->GetDirectory(this).ToString() + "/*" + base.right(4) + ".*";
2691
					name += f->Data()->getDirectory(this) + "/*" + base.right(4) + ".*";
2612
					done = true;
2692
					done = true;
2613
				}
2693
				}
2614
			}
2694
			}
2615
		}
2695
		}
2616
 
2696
 
2617
		if ( !done )
2697
		if ( !done )
2618
			name += f->Data()->GetNameDirectory(this).ToString();
2698
			name += f->Data()->getNameDirectory(this);
2619
 
2699
 
2620
		if ( !f->Data()->GetDir().Empty() )
2700
		if ( !f->Data()->dir().empty() )
2621
		{
2701
		{
2622
			name += "|";
2702
			name += "|";
2623
			name += f->Data()->GetDir().ToString();
2703
			name += f->Data()->dir();
2624
		}
2704
		}
2625
		Utils::String s = "GAME ";
2705
		Utils::String s = "GAME ";
2626
		if (!f->Data()->game() || f->Data()->game() == GAME_ALLNEW)
2706
		if (!f->Data()->game() || f->Data()->game() == GAME_ALLNEW)
2627
			s += CBaseFile::ConvertGameToString(f->Data()->game());
2707
			s += CBaseFile::ConvertGameToString(f->Data()->game());
2628
		else
2708
		else
Line 2742... Line 2822...
2742
	else
2822
	else
2743
		Found->iVersion = version;
2823
		Found->iVersion = version;
2744
	_changed();
2824
	_changed();
2745
}
2825
}
2746
 
2826
 
-
 
2827
Utils::String CBaseFile::_replaceFilename(const Utils::String &fname)
-
 
2828
{
-
 
2829
	Utils::String filename = fname;
-
 
2830
	Utils::String cdate = this->creationDate().findReplace("/", ".").remove(' ');
-
 
2831
	if (filename.isin("$AUTOSAVE"))
-
 
2832
	{
-
 
2833
		if (this->GetType() == TYPE_XSP)
-
 
2834
			filename = filename.findReplace("$AUTOSAVE", "$NAME-V$VERSION-$CDATE.xsp");
-
 
2835
		else
-
 
2836
			filename = filename.findReplace("$AUTOSAVE", "$NAME-V$VERSION-$CDATE.spk");
-
 
2837
	}
-
 
2838
	filename = filename.findReplace("$NAME", this->name().remove(' '));
-
 
2839
	filename = filename.findReplace("$AUTHOR", this->author().remove(' '));
-
 
2840
	filename = filename.findReplace("$DATE", cdate);
-
 
2841
	filename = filename.findReplace("$CDATE", cdate);
-
 
2842
	filename = filename.findReplace("$VERSION", this->version());
-
 
2843
 
-
 
2844
	return filename;
-
 
2845
}
2747
bool CBaseFile::LoadPackageData(const Utils::String &sFirst, const Utils::String &sRest, const Utils::String &sMainGame, Utils::CStringList &otherGames, Utils::CStringList &gameAddons)
2846
bool CBaseFile::LoadPackageData(const Utils::String &sFirst, const Utils::String &sRest, const Utils::String &sMainGame, Utils::CStringList &otherGames, Utils::CStringList &gameAddons)
2748
{
2847
{
2749
	if ( sFirst.Compare("Name") )					this->setName(sRest);
2848
	if ( sFirst.Compare("Name") )					this->setName(sRest);
2750
	else if ( sFirst.Compare("Author") )			this->setAuthor(sRest);
2849
	else if ( sFirst.Compare("Author") )			this->setAuthor(sRest);
2751
	else if ( sFirst.Compare("ScriptName") )
2850
	else if ( sFirst.Compare("ScriptName") )
Line 2763... Line 2862...
2763
		else if ( sRest.Compare("Normal") )			this->setPluginType(PLUGIN_NORMAL);
2862
		else if ( sRest.Compare("Normal") )			this->setPluginType(PLUGIN_NORMAL);
2764
		else if ( sRest.Compare("Stable") )			this->setPluginType(PLUGIN_STABLE);
2863
		else if ( sRest.Compare("Stable") )			this->setPluginType(PLUGIN_STABLE);
2765
		else if ( sRest.Compare("Experimental") )	this->setPluginType(PLUGIN_EXPERIMENTAL);
2864
		else if ( sRest.Compare("Experimental") )	this->setPluginType(PLUGIN_EXPERIMENTAL);
2766
		else if ( sRest.Compare("Cheat") )			this->setPluginType(PLUGIN_CHEAT);
2865
		else if ( sRest.Compare("Cheat") )			this->setPluginType(PLUGIN_CHEAT);
2767
		else if ( sRest.Compare("Mod") )			this->setPluginType(PLUGIN_MOD);
2866
		else if ( sRest.Compare("Mod") )			this->setPluginType(PLUGIN_MOD);
2768
	}
2867
	}
2769
	// new version
2868
	// new version
2770
	else if ( sFirst.Compare("GenerateUpdateFile") )
2869
	else if ( sFirst.Compare("GenerateUpdateFile") )
2771
		m_bAutoGenerateUpdateFile = true;
2870
		m_bAutoGenerateUpdateFile = true;
2772
	else if ( sFirst.Compare("Game") )
2871
	else if ( sFirst.Compare("Game") )
2773
	{
2872
	{
2774
		Utils::String sGame = sRest.token(" ", 1);
2873
		Utils::String sGame = sRest.token(" ", 1);
2775
		this->AddGameCompatability(CBaseFile::GetGameFromString(sGame), sRest.token(" ", 2));
2874
		this->AddGameCompatability(CBaseFile::GetGameFromString(sGame), sRest.token(" ", 2));
2776
	}
2875
	}
2777
	else if ( sFirst.Compare("Description") )		this->setDescription(sRest);
2876
	else if ( sFirst.Compare("Description") )		this->setDescription(sRest);
2778
	else if ( sFirst.Compare("AutoSave") || sFirst.Compare("AutoExport") || sFirst.Compare("AutoRarExport") || sFirst.Compare("AutoZipExport") )
2877
	else if ( sFirst.Compare("AutoSave") || sFirst.Compare("AutoExport") || sFirst.Compare("AutoRarExport") || sFirst.Compare("AutoZipExport") )
2779
	{
2878
	{
2780
		Utils::String filename = sRest;
2879
		Utils::String filename = _replaceFilename(sRest);
2781
		Utils::String cdate = this->creationDate().findReplace("/", ".").remove(' ');
-
 
2782
		if ( filename.isin("$AUTOSAVE") )
-
 
2783
		{
-
 
2784
			if ( this->GetType() == TYPE_XSP )
-
 
2785
				filename = filename.findReplace("$AUTOSAVE", "$NAME-V$VERSION-$CDATE.xsp");
-
 
2786
			else
-
 
2787
				filename = filename.findReplace("$AUTOSAVE", "$NAME-V$VERSION-$CDATE.spk");
-
 
2788
		}
-
 
2789
		filename = filename.findReplace("$NAME", this->name().remove(' '));
-
 
2790
		filename = filename.findReplace("$AUTHOR", this->author().remove(' '));
-
 
2791
		filename = filename.findReplace("$DATE", cdate);
-
 
2792
		filename = filename.findReplace("$CDATE", cdate);
-
 
2793
		filename = filename.findReplace("$VERSION", this->version());
-
 
2794
 
2880
 
2795
		if ( sFirst.Compare("AutoZipExport") || sFirst.Compare("AutoExport") )
2881
		if ( sFirst.Compare("AutoZipExport") || sFirst.Compare("AutoExport") )
2796
			this->setExportFilename(CFileIO(filename).ChangeFileExtension("zip").ToString());
2882
			this->setExportFilename(CFileIO(filename).changeFileExtension("zip"));
2797
		else if ( sFirst.Compare("AutoRarExport") )
2883
		else if ( sFirst.Compare("AutoRarExport") )
2798
			this->setExportFilename(CFileIO(filename).ChangeFileExtension("rar").ToString());
2884
			this->setExportFilename(CFileIO(filename).changeFileExtension("rar"));
2799
		else
2885
		else
2800
			this->setFilename(filename);
2886
			this->setFilename(filename);
2801
	}
2887
	}
2802
	else if ( sFirst.Compare("WebSite") )		this->setWebSite(sRest);
2888
	else if ( sFirst.Compare("WebSite") )		this->setWebSite(sRest);
2803
	else if ( sFirst.Compare("ForumLink") || sFirst.Compare("Forum") ) this->setForumLink(sRest);
2889
	else if ( sFirst.Compare("ForumLink") || sFirst.Compare("Forum") ) this->setForumLink(sRest);
Line 2839... Line 2925...
2839
		if ( icon->ReadFromFile() )
2925
		if ( icon->ReadFromFile() )
2840
			this->SetIcon(icon, CFileIO(sRest).GetFileExtension());
2926
			this->SetIcon(icon, CFileIO(sRest).GetFileExtension());
2841
	}
2927
	}
2842
	else if (sFirst.Compare("CombineGameFiles"))
2928
	else if (sFirst.Compare("CombineGameFiles"))
2843
		_bCombineFiles = sRest.Compare("true") || sRest.Compare("yes") || sRest.toInt();
2929
		_bCombineFiles = sRest.Compare("true") || sRest.Compare("yes") || sRest.toInt();
-
 
2930
	else if (sFirst.Compare("ExportZip"))
-
 
2931
	{
-
 
2932
		Utils::String ext = "zip";
-
 
2933
		Utils::String game = sRest.word(1);
-
 
2934
		Utils::String file = _replaceFilename(CFileIO(sRest.words(2)).fullFilename());
-
 
2935
		if (game.contains("|"))
-
 
2936
		{
-
 
2937
			int max;
-
 
2938
			Utils::String *games = game.tokenise("|", &max);
-
 
2939
			if (games)
-
 
2940
			{
-
 
2941
				for (int i = 0; i < max; ++i)
-
 
2942
				{
-
 
2943
					unsigned int g = CBaseFile::GetGameFromString(games[i]);
-
 
2944
					Utils::String filename = CFileIO(file).dir() + "/" + CFileIO(file).baseName() + "_" + CBaseFile::ConvertGameToString(g) + "." + ext;
-
 
2945
					this->addAutoExport(g, filename);
-
 
2946
				}
-
 
2947
				CLEANSPLIT(games, max);
-
 
2948
			}
-
 
2949
		}
-
 
2950
		else
-
 
2951
		{
-
 
2952
			unsigned int g = CBaseFile::GetGameFromString(game);
-
 
2953
			Utils::String filename = CFileIO(file).dir() + "/" + CFileIO(file).baseName() + "_" + CBaseFile::ConvertGameToString(g) + "." + ext;
-
 
2954
			this->addAutoExport(g, filename);
-
 
2955
		}
-
 
2956
	}
-
 
2957
	else if (sFirst.Compare("Extract"))
-
 
2958
	{
-
 
2959
		Utils::String game = sRest.word(1);
-
 
2960
		Utils::String dir = CDirIO(sRest.words(2)).dir();
-
 
2961
		if (game.contains("|"))
-
 
2962
		{
-
 
2963
			int max;
-
 
2964
			Utils::String *games = game.tokenise("|", &max);
-
 
2965
			if (games)
-
 
2966
			{
-
 
2967
				for(int i = 0; i < max; ++i)
-
 
2968
					this->addAutoExtract(CBaseFile::GetGameFromString(games[i]), dir);
-
 
2969
				CLEANSPLIT(games, max);
-
 
2970
			}
-
 
2971
		}
-
 
2972
		else
-
 
2973
			this->addAutoExtract(CBaseFile::GetGameFromString(game), dir);
-
 
2974
	}
2844
	else
2975
	else
2845
	{
2976
	{
2846
		Utils::String checkType = sFirst;
2977
		Utils::String checkType = sFirst;
2847
		bool shared = false;
2978
		bool shared = false;
2848
		if ( checkType.left(6).Compare("Shared") )
2979
		if ( checkType.left(6).Compare("Shared") )
2849
		{
2980
		{
2850
			checkType = sFirst.right(-6);
2981
			checkType = sFirst.right(-6);
2851
			shared = true;
2982
			shared = true;
2852
		}
2983
		}
2853
 
2984
 
2854
		// now check type name
2985
		// now check type name
Line 2882... Line 3013...
2882
					game |= 1 << g;
3013
					game |= 1 << g;
2883
			}
3014
			}
2884
			CLEANSPLIT(games, max);
3015
			CLEANSPLIT(games, max);
2885
		}
3016
		}
2886
		else
3017
		else
-
 
3018
		{
2887
			game = 1 << CBaseFile::GetGameFromString(gameStr);
3019
			unsigned int g = CBaseFile::GetGameFromString(gameStr);
-
 
3020
			if (g)
-
 
3021
				game = 1 << g;
-
 
3022
		}
2888
		rest = rest.tokens(" ", 3);
3023
		rest = rest.tokens(" ", 3);
2889
	}
3024
	}
2890
	if (game)
3025
	if (game)
2891
		game |= 1 << 31;
3026
		game |= 1 << 31;
2892
 
3027
 
Line 2978... Line 3113...
2978
		if(!file)
3113
		if(!file)
2979
			file = this->AppendFile(rest, filetype, addGame, dir);
3114
			file = this->AppendFile(rest, filetype, addGame, dir);
2980
 
3115
 
2981
		if (file)
3116
		if (file)
2982
			file->SetShared(shared);
3117
			file->SetShared(shared);
2983
	}
3118
	}
2984
}
3119
}
2985
 
3120
 
2986
 
3121
 
2987
CyString CBaseFile::GetFullFileSizeString() { return SPK::GetSizeString ( this->GetFullFileSize() ); }
3122
CyString CBaseFile::GetFullFileSizeString() { return SPK::GetSizeString ( this->GetFullFileSize() ); }
2988
 
3123
 
2989
// used for a multiple spk file
3124
// used for a multiple spk file
2990
unsigned char *CBaseFile::CreateData(size_t *size, CProgressInfo *progress)
3125
unsigned char *CBaseFile::CreateData(size_t *size, CProgressInfo *progress)
2991
{
3126
{
2992
	if ( this->WriteFile("temp.dat", progress) ) {
3127
	if ( this->WriteFile("temp.dat", progress) ) {
2993
		CFileIO File("temp.dat");
3128
		CFileIO File("temp.dat");
2994
		File.setAutoDelete(true);
3129
		File.setAutoDelete(true);
2995
		return File.readAll(size);
3130
		return File.readAll(size);
2996
	}
3131
	}
2997
	return NULL;
3132
	return NULL;
2998
}
3133
}
2999
 
3134
 
3000
 
3135
 
3001
void CBaseFile::ConvertNormalMod(C_File *f, CyString to)
3136
void CBaseFile::ConvertNormalMod(C_File *f, CyString to)
3002
{
3137
{
3003
	C_File *match = this->FindMatchingMod(f);
3138
	C_File *match = this->FindMatchingMod(f);
3004
	if ( match )
3139
	if ( match )
Line 3006... Line 3141...
3006
		// file link
3141
		// file link
3007
		if ( !match->GetData() )
3142
		if ( !match->GetData() )
3008
			match->ReadFromFile();
3143
			match->ReadFromFile();
3009
		match->ChangeBaseName(to);
3144
		match->ChangeBaseName(to);
3010
	}
3145
	}
3011
 
3146
 
3012
	// file link
3147
	// file link
3013
	if ( !f->GetData() )
3148
	if ( !f->GetData() )
3014
		f->ReadFromFile();
3149
		f->ReadFromFile();
3015
 
3150
 
3016
	f->ChangeBaseName(to);
3151
	f->ChangeBaseName(to);
Line 3023... Line 3158...
3023
		to = CyString("0000-L") + f->GetBaseName().GetToken("-L", 2, 2);
3158
		to = CyString("0000-L") + f->GetBaseName().GetToken("-L", 2, 2);
3024
	else if ( f->GetBaseName().IsIn("-l") )
3159
	else if ( f->GetBaseName().IsIn("-l") )
3025
		to = CyString("0000-L") + f->GetBaseName().GetToken("-l", 2, 2);
3160
		to = CyString("0000-L") + f->GetBaseName().GetToken("-l", 2, 2);
3026
	else
3161
	else
3027
		to = f->GetBaseName().Left(-4) + "0000";
3162
		to = f->GetBaseName().Left(-4) + "0000";
3028
 
3163
 
3029
	// file link
3164
	// file link
3030
	if ( !f->GetData() )
3165
	if ( !f->GetData() )
3031
		f->ReadFromFile();
3166
		f->ReadFromFile();
3032
 
3167
 
3033
	f->ChangeBaseName(to);
3168
	f->ChangeBaseName(to);
3034
 
3169
 
3035
}
3170
}
3036
 
3171
 
3037
void CBaseFile::ConvertFakePatch(C_File *f)
3172
void CBaseFile::ConvertFakePatch(C_File *f)
Line 3039... Line 3174...
3039
	// find next available fake patch
3174
	// find next available fake patch
3040
	int num = 0;
3175
	int num = 0;
3041
 
3176
 
3042
	bool found = true;
3177
	bool found = true;
3043
	while ( found )
3178
	while ( found )
3044
	{
3179
	{
3045
		++num;
3180
		++num;
3046
		found = false;
3181
		found = false;
3047
		CyString find = CyString::Number(num).PadNumber(2);
3182
		CyString find = CyString::Number(num).PadNumber(2);
3048
		for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
3183
		for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
3049
		{
3184
		{
Line 3063... Line 3198...
3063
	C_File *match = this->FindMatchingMod(f);
3198
	C_File *match = this->FindMatchingMod(f);
3064
 
3199
 
3065
	// file link
3200
	// file link
3066
	if ( !f->GetData() )
3201
	if ( !f->GetData() )
3067
		f->ReadFromFile();
3202
		f->ReadFromFile();
3068
 
3203
 
3069
	f->ChangeBaseName(to);
3204
	f->ChangeBaseName(to);
3070
	if ( match )
3205
	if ( match )
3071
	{
3206
	{
3072
		// file link
3207
		// file link
3073
		if ( !match->GetData() )
3208
		if ( !match->GetData() )
Line 3075... Line 3210...
3075
		match->ChangeBaseName(to);
3210
		match->ChangeBaseName(to);
3076
	}
3211
	}
3077
}
3212
}
3078
 
3213
 
3079
C_File *CBaseFile::FindMatchingMod(C_File *f)
3214
C_File *CBaseFile::FindMatchingMod(C_File *f)
3080
{
3215
{
3081
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
3216
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
3082
	{
3217
	{
3083
		if ( node->Data()->GetFileType() != FILETYPE_MOD )
3218
		if ( node->Data()->GetFileType() != FILETYPE_MOD )
3084
			continue;
3219
			continue;
3085
		 
3220
		 
3086
		if ( f->GetFileExt().Compare(node->Data()->GetFileExt()) )
3221
		if ( f->GetFileExt().Compare(node->Data()->GetFileExt()) )
3087
			continue;
3222
			continue;
3088
 
3223
 
3089
		if ( f->GetBaseName().Compare(node->Data()->GetBaseName()) )
3224
		if ( f->GetBaseName().Compare(node->Data()->GetBaseName()) )
3090
			return node->Data();
3225
			return node->Data();
3091
	}
3226
	}
3092
 
3227
 
3093
	return NULL;
3228
	return NULL;
3094
}
3229
}
3095
 
3230
 
3096
void CBaseFile::RenameFile(C_File *f, CyString baseName)
3231
void CBaseFile::RenameFile(C_File *f, CyString baseName)
3097
{
3232
{
Line 3099... Line 3234...
3099
	{
3234
	{
3100
		C_File *match = this->FindMatchingMod(f);
3235
		C_File *match = this->FindMatchingMod(f);
3101
		if ( match )
3236
		if ( match )
3102
			match->ChangeBaseName(baseName);
3237
			match->ChangeBaseName(baseName);
3103
	}
3238
	}
3104
 
3239
 
3105
	// need to edit the file
3240
	// need to edit the file
3106
if (f->GetFileType() == FILETYPE_SCRIPT || f->GetFileType() == FILETYPE_UNINSTALL)
3241
if (f->GetFileType() == FILETYPE_SCRIPT || f->GetFileType() == FILETYPE_UNINSTALL)
3107
f->RenameScript(baseName);
3242
f->RenameScript(baseName);
3108
 
3243
 
3109
f->ChangeBaseName(baseName);
3244
f->ChangeBaseName(baseName);
Line 3111... Line 3246...
3111
 
3246
 
3112
CyString CBaseFile::CreateUpdateFile(CyString dir)
3247
CyString CBaseFile::CreateUpdateFile(CyString dir)
3113
{
3248
{
3114
	CyString file = this->GetNameValidFile() + "_" + this->author() + ".dat";
3249
	CyString file = this->GetNameValidFile() + "_" + this->author() + ".dat";
3115
	file.RemoveChar(' ');
3250
	file.RemoveChar(' ');
3116
 
3251
 
3117
	CyStringList write;
3252
	CyStringList write;
3118
	write.PushBack(CyString("Package: ") + this->name());
3253
	write.PushBack(CyString("Package: ") + this->name());
3119
	write.PushBack(CyString("Author: ") + this->author());
3254
	write.PushBack(CyString("Author: ") + this->author());
3120
	write.PushBack(CyString("Version: ") + this->version());
3255
	write.PushBack(CyString("Version: ") + this->version());
3121
	write.PushBack(CyString("File: ") + CFileIO(this->filename()).filename());
3256
	write.PushBack(CyString("File: ") + CFileIO(this->filename()).filename());
3122
 
3257
 
3123
	CFileIO File(dir + "/" + file);
3258
	CFileIO File(dir + "/" + file);
3124
	if (File.WriteFile(&write))
3259
	if (File.WriteFile(&write))
3125
		return File.fullFilename();
3260
		return File.fullFilename();
3126
	return NullString;
3261
	return NullString;
3127
}
3262
}
3128
 
3263
 
3129
CyString CBaseFile::ErrorString(int error, CyString errorStr)
3264
CyString CBaseFile::ErrorString(int error, CyString errorStr)
3130
{
3265
{
3131
	if (error == SPKERR_NONE) return NullString;
3266
	if (error == SPKERR_NONE) return NullString;
3132
 
3267
 
Line 3134... Line 3269...
3134
 
3269
 
3135
	switch (error)
3270
	switch (error)
3136
	{
3271
	{
3137
	case SPKERR_MALLOC:
3272
	case SPKERR_MALLOC:
3138
		err = "Memory Failed";
3273
		err = "Memory Failed";
3139
		break;
3274
		break;
3140
	case SPKERR_FILEOPEN:
3275
	case SPKERR_FILEOPEN:
3141
		err = "Failed to open file";
3276
		err = "Failed to open file";
3142
		break;
3277
		break;
3143
	case SPKERR_FILEREAD:
3278
	case SPKERR_FILEREAD:
3144
		err = "Failed to read file";
3279
		err = "Failed to read file";
3145
		break;
3280
		break;
3146
	case SPKERR_UNCOMPRESS:
3281
	case SPKERR_UNCOMPRESS:
3147
		err = "Failed to Uncompress";
3282
		err = "Failed to Uncompress";
3148
		break;
3283
		break;
3149
	case SPKERR_WRITEFILE:
3284
	case SPKERR_WRITEFILE:
3150
		err = "Failed to write file";
3285
		err = "Failed to write file";
3151
		break;
3286
		break;
3152
	case SPKERR_CREATEDIRECTORY:
3287
	case SPKERR_CREATEDIRECTORY:
3153
		err = "Failed to create directory";
3288
		err = "Failed to create directory";
3154
		break;
3289
		break;
3155
	case SPKERR_FILEMISMATCH:
3290
	case SPKERR_FILEMISMATCH:
3156
		err = "File count mismatch";
3291
		err = "File count mismatch";
Line 3164... Line 3299...
3164
			err += " (";
3299
			err += " (";
3165
			err += errorStr + ")";
3300
			err += errorStr + ")";
3166
		}
3301
		}
3167
		return err;
3302
		return err;
3168
	}
3303
	}
3169
 
3304
 
3170
	return CyString((long)error);
3305
	return CyString((long)error);
3171
}
3306
}
3172
 
3307
 
3173
bool CBaseFile::SaveToArchive(CyString filename, int game, const CGameExe *exes, CProgressInfo *progress)
3308
bool CBaseFile::SaveToArchive(CyString filename, int game, const CGameExe *exes, CProgressInfo *progress)
3174
{
3309
{
-
 
3310
	return saveToArchive(filename.ToString(), game, exes, progress);
-
 
3311
}
-
 
3312
bool CBaseFile::saveToArchive(const Utils::String &filename, int game, const CGameExe *exes, CProgressInfo *progress)
-
 
3313
{
-
 
3314
	CDirIO Dir(CFileIO(filename).dir());
-
 
3315
	if (!Dir.exists())
-
 
3316
		Dir.create();
-
 
3317
 
3175
	TCHAR buf[5000];
3318
	TCHAR buf[5000];
3176
	wsprintf(buf, L"%hs", filename.c_str());
3319
	wsprintf(buf, L"%hs", filename.c_str());
3177
 
3320
 
3178
	HZIP hz = CreateZip(buf, 0);
3321
	HZIP hz = CreateZip(buf, 0);
3179
	if (!hz) return false;
3322
	if (!hz) return false;
Line 3193... Line 3336...
3193
				continue;
3336
				continue;
3194
			// extracting for all games, so ignore files that have a game set
3337
			// extracting for all games, so ignore files that have a game set
3195
			if (!game && node->Data()->game() && node->Data()->game() != GAME_ALLNEW)
3338
			if (!game && node->Data()->game() && node->Data()->game() != GAME_ALLNEW)
3196
				continue;
3339
				continue;
3197
		}
3340
		}
3198
		Utils::String fname = node->Data()->GetNameDirectory(this).ToString();
3341
		Utils::String fname = node->Data()->getNameDirectory(this);
3199
 
3342
 
3200
		// use the addon directory
3343
		// use the addon directory
3201
		if (node->Data()->isFileInAddon() && exes)
3344
		if (node->Data()->isFileInAddon() && exes)
3202
		{
3345
		{
3203
			unsigned int whatGame = game;
3346
			unsigned int whatGame = game;