Subversion Repositories spk

Rev

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

Rev 279 Rev 281
Line 9562... Line 9562...
9562
		archive = new CSpkFile(); // converting to a spk file
9562
		archive = new CSpkFile(); // converting to a spk file
9563
 
9563
 
9564
	GetZipItem(hz, -1, &ze);
9564
	GetZipItem(hz, -1, &ze);
9565
	int numitems = ze.index;
9565
	int numitems = ze.index;
9566
 
9566
 
-
 
9567
	std::set<unsigned int> games;
-
 
9568
 
9567
	bool error = false;
9569
	bool error = false;
9568
	for ( int zi = 0; zi < numitems; zi++ )
9570
	for ( int zi = 0; zi < numitems; zi++ )
9569
	{
9571
	{
9570
		ZIPENTRY ze;
9572
		ZIPENTRY ze;
9571
		if ( GetZipItem(hz, zi, &ze) != Z_OK )
9573
		if ( GetZipItem(hz, zi, &ze) != Z_OK )
Line 9613... Line 9615...
9613
			if (!dir.empty())
9615
			if (!dir.empty())
9614
			{
9616
			{
9615
				Utils::WString first = dir.token(L"/", 1);
9617
				Utils::WString first = dir.token(L"/", 1);
9616
				int g = m_gameExe.findAddonType(first);
9618
				int g = m_gameExe.findAddonType(first);
9617
				if (g != -1)
9619
				if (g != -1)
-
 
9620
				{
9618
					game = g + 1;
9621
					game = g + 1;
-
 
9622
					games.insert(game);
-
 
9623
				}
9619
			}
9624
			}
9620
 
9625
 
-
 
9626
			// TODO: Check if an existing file exists with a different game
9621
			if ( type == -1 )
9627
			if ( type == -1 )
9622
				f = archive->addFile(filename, dir, FILETYPE_EXTRA, 1 << game);
9628
				f = archive->addFile(filename, dir, FILETYPE_EXTRA, game > 0 ? 1 << game : 0);
9623
			else
9629
			else
9624
				f = archive->addFile(filename, extradir, static_cast<FileType>(type), 1 << game);
9630
				f = archive->addFile(filename, extradir, static_cast<FileType>(type), game > 0 ? 1 << game : 0);
9625
 
9631
 
9626
			if ( f )
9632
			if (f)
-
 
9633
			{
-
 
9634
				if (!game && f->isFileInAddon())
-
 
9635
					games.insert(1);
-
 
9636
 
9627
				f->SetData((const unsigned char *)iBuf, ze.unc_size);
9637
				f->SetData((const unsigned char*)iBuf, ze.unc_size);
-
 
9638
			}
9628
			else
9639
			else
9629
				delete[] iBuf;
9640
				delete[] iBuf;
9630
		}
9641
		}
9631
	}
9642
	}
9632
 
9643
 
Line 9635... Line 9646...
9635
	if ( error )
9646
	if ( error )
9636
	{
9647
	{
9637
		delete archive;
9648
		delete archive;
9638
		archive = NULL;
9649
		archive = NULL;
9639
	}
9650
	}
-
 
9651
 
-
 
9652
	// if there is only one game, then set all the files to "All Games"
-
 
9653
	//if (games.size() <= 1)
-
 
9654
	{
-
 
9655
		for (auto itr = archive->fileList().Front(); itr; itr = itr->next())
-
 
9656
			itr->Data()->setGame(0);
-
 
9657
	}
-
 
9658
 
9640
	return archive;
9659
	return archive;
9641
}
9660
}
9642
 
9661
 
9643
CBaseFile *CPackages::createFromArchive(const Utils::WString &filename, bool toInstall) const
9662
CBaseFile *CPackages::createFromArchive(const Utils::WString &filename, bool toInstall) const
9644
{
9663
{