Subversion Repositories spk

Rev

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

Rev 182 Rev 196
Line 408... Line 408...
408
			start += (size + 1);
408
			start += (size + 1);
409
		}
409
		}
410
		else if ( first.Compare("SceneFile") )
410
		else if ( first.Compare("SceneFile") )
411
		{
411
		{
412
			Utils::String file = rest.tokens(" ", 3);
412
			Utils::String file = rest.tokens(" ", 3);
413
			m_pSceneFile = this->addFile(CFileIO(file).filename(), CFileIO(file).dir(), FILETYPE_SHIPSCENE);
413
			m_pSceneFile = this->addFile(CFileIO(file).filenameStr(), CFileIO(file).dir().toString(), FILETYPE_SHIPSCENE);
414
			m_pSceneFile->SetCreationTime((long)rest.token(" ", 1));
414
			m_pSceneFile->SetCreationTime((long)rest.token(" ", 1));
415
			m_pSceneFile->ReadFromData((char *)(compr + pos), rest.token(" ", 2));
415
			m_pSceneFile->ReadFromData((char *)(compr + pos), rest.token(" ", 2));
416
 
416
 
417
			start += m_pSceneFile->GetDataSize();
417
			start += m_pSceneFile->GetDataSize();
418
		}
418
		}
419
		else if ( first.Compare("CockpitFile") )
419
		else if ( first.Compare("CockpitFile") )
420
		{
420
		{
421
			Utils::String file = rest.tokens(" ", 3);
421
			Utils::String file = rest.tokens(" ", 3);
422
			m_pCockpitFile = this->addFile(CFileIO(file).filename(), CFileIO(file).dir(), FILETYPE_COCKPITSCENE);
422
			m_pCockpitFile = this->addFile(CFileIO(file).filenameStr(), CFileIO(file).dir().toString(), FILETYPE_COCKPITSCENE);
423
			m_pCockpitFile->SetCreationTime((long)rest.token(" ", 1));
423
			m_pCockpitFile->SetCreationTime((long)rest.token(" ", 1));
424
			m_pCockpitFile->ReadFromData((char *)(compr + pos), rest.token(" ", 2));
424
			m_pCockpitFile->ReadFromData((char *)(compr + pos), rest.token(" ", 2));
425
 
425
 
426
			start += m_pCockpitFile->GetDataSize();
426
			start += m_pCockpitFile->GetDataSize();
427
		}
427
		}
428
		else if ( first.Compare("Model") )
428
		else if ( first.Compare("Model") )
429
		{
429
		{
430
			Utils::String file = rest.tokens(" ", 3);
430
			Utils::String file = rest.tokens(" ", 3);
431
			C_File *newFile= this->addFile(CFileIO(file).filename(), CFileIO(file).dir(), FILETYPE_SHIPMODEL);
431
			C_File *newFile= this->addFile(CFileIO(file).filenameStr(), CFileIO(file).dir().toString(), FILETYPE_SHIPMODEL);
432
			newFile->SetCreationTime((long)rest.token(" ", 1));
432
			newFile->SetCreationTime((long)rest.token(" ", 1));
433
			newFile->ReadFromData((char *)(compr + pos), rest.token(" ", 2));
433
			newFile->ReadFromData((char *)(compr + pos), rest.token(" ", 2));
434
 
434
 
435
			start += (newFile->GetDataSize() + 1);
435
			start += (newFile->GetDataSize() + 1);
436
		}
436
		}
Line 455... Line 455...
455
				newFile = new C_File(file);
455
				newFile = new C_File(file);
456
				special = 3;
456
				special = 3;
457
			}
457
			}
458
			else
458
			else
459
			{
459
			{
460
				newFile = this->addFile(CFileIO(file).filename(), CFileIO(file).dir(), FILETYPE_SHIPOTHER);
460
				newFile = this->addFile(CFileIO(file).filenameStr(), CFileIO(file).dir().toString(), FILETYPE_SHIPOTHER);
461
				newFile->SetCreationTime((long)rest.token(" ", 1));
461
				newFile->SetCreationTime((long)rest.token(" ", 1));
462
			}
462
			}
463
			newFile->ReadFromData((char *)(compr + pos), rest.token(" ", 2));
463
			newFile->ReadFromData((char *)(compr + pos), rest.token(" ", 2));
464
			start += (newFile->GetDataSize() + 1);
464
			start += (newFile->GetDataSize() + 1);
465
 
465
 
Line 2040... Line 2040...
2040
			data = f->BobDecompile(&size);
2040
			data = f->BobDecompile(&size);
2041
			if ( !data || !size ) {
2041
			if ( !data || !size ) {
2042
				// search for the pbd or bod files that match and use them instead
2042
				// search for the pbd or bod files that match and use them instead
2043
				Utils::String file;
2043
				Utils::String file;
2044
 
2044
 
2045
				file = CFileIO(f->getNameDirectory(NULL)).changeFileExtension("pbd");
2045
				file = CFileIO(f->getNameDirectory(NULL)).changeFileExtension(L"pbd").toString();
2046
				file = pVfs->ExtractGameFile(file, CPackages::tempDirectory() + "tmp.tmp");
2046
				file = pVfs->ExtractGameFile(file, CPackages::tempDirectory() + "tmp.tmp");
2047
	
2047
	
2048
				if ( file.empty() ) {
2048
				if ( file.empty() ) {
2049
					file = CFileIO(f->getNameDirectory(NULL)).changeFileExtension("bod");
2049
					file = CFileIO(f->getNameDirectory(NULL)).changeFileExtension(L"bod").toString();
2050
					file = pVfs->ExtractGameFile(file, CPackages::tempDirectory() + "tmp.tmp");
2050
					file = pVfs->ExtractGameFile(file, CPackages::tempDirectory() + "tmp.tmp");
2051
				}
2051
				}
2052
 
2052
 
2053
				if ( !file.empty() ) {
2053
				if ( !file.empty() ) {
2054
					CFileIO File(file);
2054
					CFileIO File(file);
Line 2088... Line 2088...
2088
	}
2088
	}
2089
 
2089
 
2090
	for(auto itr = lTextures.begin(); itr != lTextures.end(); itr++)
2090
	for(auto itr = lTextures.begin(); itr != lTextures.end(); itr++)
2091
	{
2091
	{
2092
		CFileIO F((*itr)->str);
2092
		CFileIO F((*itr)->str);
2093
		if ( F.isFileExtension("fx") ) {
2093
		if ( F.isFileExtension(L"fx") ) {
2094
			/*
2094
			/*
2095
			if ( !pVfs->extractGameFileToPackage(this, "shader\\1_1\\" + Utils::String(node->str.ToString()), FILETYPE_SHIPOTHER) )
2095
			if ( !pVfs->extractGameFileToPackage(this, "shader\\1_1\\" + Utils::String(node->str.ToString()), FILETYPE_SHIPOTHER) )
2096
				pVfs->extractGameFileToPackage(this, "shader\\1_1\\" + CFileIO(node->str.ToString()).ChangeFileExtension("fb").ToString(), FILETYPE_SHIPOTHER);
2096
				pVfs->extractGameFileToPackage(this, "shader\\1_1\\" + CFileIO(node->str.ToString()).ChangeFileExtension("fb").ToString(), FILETYPE_SHIPOTHER);
2097
			if ( !pVfs->extractGameFileToPackage(this, "shader\\1_4\\" + Utils::String(node->str.ToString()), FILETYPE_SHIPOTHER) )
2097
			if ( !pVfs->extractGameFileToPackage(this, "shader\\1_4\\" + Utils::String(node->str.ToString()), FILETYPE_SHIPOTHER) )
2098
				pVfs->extractGameFileToPackage(this, "shader\\1_4\\" + CFileIO(node->str.ToString()).ChangeFileExtension("fb").ToString(), FILETYPE_SHIPOTHER);
2098
				pVfs->extractGameFileToPackage(this, "shader\\1_4\\" + CFileIO(node->str.ToString()).ChangeFileExtension("fb").ToString(), FILETYPE_SHIPOTHER);
Line 2114... Line 2114...
2114
				continue;
2114
				continue;
2115
 
2115
 
2116
			if ( pVfs->extractGameFileToPackage(this, "dds\\" + (*itr)->str + ".dds", FILETYPE_SHIPOTHER) )
2116
			if ( pVfs->extractGameFileToPackage(this, "dds\\" + (*itr)->str + ".dds", FILETYPE_SHIPOTHER) )
2117
				continue;
2117
				continue;
2118
 
2118
 
2119
			if ( pVfs->extractGameFileToPackage(this, "dds\\" + Utils::String(F.changeFileExtension("dds")), FILETYPE_SHIPOTHER) )
2119
			if ( pVfs->extractGameFileToPackage(this, "dds\\" + Utils::String(F.changeFileExtension(L"dds").toString()), FILETYPE_SHIPOTHER) )
2120
				continue;
2120
				continue;
2121
 
2121
 
2122
			if ( pVfs->extractGameFileToPackage(this, "textures\\" + (*itr)->str, FILETYPE_SHIPOTHER) )
2122
			if ( pVfs->extractGameFileToPackage(this, "textures\\" + (*itr)->str, FILETYPE_SHIPOTHER) )
2123
				continue;
2123
				continue;
2124
 
2124
 
Line 2126... Line 2126...
2126
				continue;
2126
				continue;
2127
 
2127
 
2128
			if ( pVfs->extractGameFileToPackage(this, "textures\\" + (*itr)->str + ".jpg", FILETYPE_SHIPOTHER) )
2128
			if ( pVfs->extractGameFileToPackage(this, "textures\\" + (*itr)->str + ".jpg", FILETYPE_SHIPOTHER) )
2129
				continue;
2129
				continue;
2130
 
2130
 
2131
			if ( pVfs->extractGameFileToPackage(this, "textures\\" + Utils::String(F.changeFileExtension("jpg")), FILETYPE_SHIPOTHER) )
2131
			if ( pVfs->extractGameFileToPackage(this, "textures\\" + Utils::String(F.changeFileExtension(L"jpg").toString()), FILETYPE_SHIPOTHER) )
2132
				continue;
2132
				continue;
2133
		}
2133
		}
2134
	}
2134
	}
2135
}
2135
}
2136
 
2136
 
2137
bool CXspFile::AddTextFromFile(const Utils::String &sFile, int textId)
2137
bool CXspFile::AddTextFromFile(const Utils::String &sFile, int textId)
2138
{
2138
{
2139
	Utils::String file = sFile;
2139
	Utils::String file = sFile;
2140
 
2140
 
2141
	bool remove = false;
2141
	bool remove = false;
2142
	if ( CFileIO(file).isFileExtension("pck") )
2142
	if ( CFileIO(file).isFileExtension(L"pck") )
2143
	{
2143
	{
2144
		C_File F;
2144
		C_File F;
2145
		F.setFilename(file);
2145
		F.setFilename(file);
2146
		F.UnPCKFile();
2146
		F.UnPCKFile();
2147
		if (F.writeToFile(CPackages::tempDirectory() + "tmp.dat"))
2147
		if (F.writeToFile(CPackages::tempDirectory() + "tmp.dat"))