Subversion Repositories spk

Rev

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

Rev 210 Rev 213
Line 915... Line 915...
915
			if ( id )
915
			if ( id )
916
				opened = true;
916
				opened = true;
917
		}
917
		}
918
 
918
 
919
		if ( !opened ) {
919
		if ( !opened ) {
920
			CLog::log(CLog::Log_IO, 1, "Unable to uncompress file, exiting...");
920
			CLog::log(CLog::Log_IO, 1, L"Unable to uncompress file, exiting...");
921
			return false;
921
			return false;
922
		}
922
		}
923
 
923
 
924
		CLog::log(CLog::Log_IO, 1, "* Reading file into memory...");
924
		CLog::log(CLog::Log_IO, 1, L"* Reading file into memory...");
925
		// get file length
925
		// get file length
926
		fseek ( id, 0, SEEK_END );
926
		fseek ( id, 0, SEEK_END );
927
		len = ftell ( id );
927
		len = ftell ( id );
928
		
928
		
929
		// move back to beginning
929
		// move back to beginning
Line 935... Line 935...
935
 
935
 
936
		newlen = len;
936
		newlen = len;
937
	}
937
	}
938
	else
938
	else
939
	{
939
	{
940
		CLog::log(CLog::Log_IO, 1, "* Reading file into memory...");
940
		CLog::log(CLog::Log_IO, 1, L"* Reading file into memory...");
941
		// get file length
941
		// get file length
942
		fseek ( id, 0, SEEK_END );
942
		fseek ( id, 0, SEEK_END );
943
		len = ftell ( id );
943
		len = ftell ( id );
944
		
944
		
945
		// move back to beginning
945
		// move back to beginning
Line 948... Line 948...
948
		// read the data from file into memory
948
		// read the data from file into memory
949
		data = new unsigned char[len + 1];
949
		data = new unsigned char[len + 1];
950
		fread ( data, sizeof(unsigned char), len, id );
950
		fread ( data, sizeof(unsigned char), len, id );
951
 
951
 
952
		// uncompress the file (currently only 7zip compression)
952
		// uncompress the file (currently only 7zip compression)
953
		CLog::log(CLog::Log_IO, 1, "* Uncompressing file...");
953
		CLog::log(CLog::Log_IO, 1, L"* Uncompressing file...");
954
		newlen = len;
954
		newlen = len;
955
	#ifdef _INCLUDE7ZIP
955
	#ifdef _INCLUDE7ZIP
956
		uncomprData = LZMADecodeData ( data, len, newlen, progress );
956
		uncomprData = LZMADecodeData ( data, len, newlen, progress );
957
	#else
957
	#else
958
		uncomprData = LZMADecode_C ( (unsigned char *)data, len, (size_t*)&newlen, NULL );
958
		uncomprData = LZMADecode_C ( (unsigned char *)data, len, (size_t*)&newlen, NULL );
Line 1210... Line 1210...
1210
	int len;
1210
	int len;
1211
	unsigned char *uncomprData = this->_convert_uncompressFile(sOldFilename, &len);
1211
	unsigned char *uncomprData = this->_convert_uncompressFile(sOldFilename, &len);
1212
 
1212
 
1213
	// uncomressed failed
1213
	// uncomressed failed
1214
	if ( !uncomprData ) {
1214
	if ( !uncomprData ) {
1215
		CLog::log(CLog::Log_IO, 1, "Error: Unable to uncompress the file");
1215
		CLog::log(CLog::Log_IO, 1, L"Error: Unable to uncompress the file");
1216
		return false;
1216
		return false;
1217
	}
1217
	}
1218
 
1218
 
1219
	// now we can read the data
1219
	// now we can read the data
1220
	unsigned char *d = uncomprData;
1220
	unsigned char *d = uncomprData;
Line 1224... Line 1224...
1224
	//SMultiSpkFile *cur_mspk = NULL;
1224
	//SMultiSpkFile *cur_mspk = NULL;
1225
 
1225
 
1226
	int numscripts = 0, curscript = 0;
1226
	int numscripts = 0, curscript = 0;
1227
	float fVersion = 1;
1227
	float fVersion = 1;
1228
 
1228
 
1229
	CLog::log(CLog::Log_IO, 1, "* Reading spk data...");
1229
	CLog::log(CLog::Log_IO, 1, L"* Reading spk data...");
1230
	while ( d )
1230
	while ( d )
1231
	{
1231
	{
1232
		// read the next line
1232
		// read the next line
1233
		d = str.readToEndOfLine(d);
1233
		d = str.readToEndOfLine(d);
1234
		if ( !d || d[0] == 0 ) {
1234
		if ( !d || d[0] == 0 ) {