Ejemplo n.º 1
0
/*!
	PAK Reader
*/
CPakReader::CPakReader(IReadFile* file, bool ignoreCase, bool ignorePaths)
: CFileList((file ? file->getFileName() : io::path("")), ignoreCase, ignorePaths), File(file)
{
#ifdef _DEBUG
	setDebugName("CPakReader");
#endif

	if (File)
	{
		File->grab();
		scanLocalHeader();
		sort();
	}
}
Ejemplo n.º 2
0
/*!
	NPK Reader
*/
CNPKReader::CNPKReader(IReadFile* file, bool ignoreCase, bool ignorePaths)
: CFileList((file ? file->getFileName() : io::path("")), ignoreCase, ignorePaths), File(file)
{
#ifdef _DEBUG
	setDebugName("CNPKReader");
#endif

	if (File)
	{
		File->grab();
		if (scanLocalHeader())
			sort();
		else
			os::Printer::log("Failed to load NPK archive.");
	}
}
Ejemplo n.º 3
0
CPakReader::CPakReader(IReadFile* file, bool ignoreCase, bool ignorePaths)
: File(file), IgnoreCase(ignoreCase), IgnorePaths(ignorePaths)
{
	#ifdef _DEBUG
	setDebugName("CPakReader");
	#endif

	if (File)
	{
		File->grab();

		// scan local headers
		scanLocalHeader();

		// prepare file index for binary search
		FileList.sort();
	}
}
Ejemplo n.º 4
0
/*!
	WAD Reader
*/
CWADReader::CWADReader(IReadFile* file, bool ignoreCase, bool ignorePaths)
: CFileList((file ? file->getFileName() : io::path("")), ignoreCase, ignorePaths), File(file)
{
	#ifdef _DEBUG
	setDebugName("CWADReader");
	#endif

	if (File)
	{
		File->grab();

		Base = File->getFileName();
		Base.replace ( '\\', '/' );

		// scan local headers
		scanLocalHeader();

		sort();
	}

#if 0
	for ( u32 i = 0; i < FileList.size(); ++i )
	{
		SWADFileEntry &e = FileList[i];
		char buf[128];
		snprintf ( buf, 128, "c:\\h2\\%s", e.wadFileName.c_str() );

		createDir ( buf );
		FILE * f = fopen ( buf, "wb" );
		if ( 0 == f )
			continue;

		u8 * mem = new u8 [ e.header.disksize ];
		File->seek ( e.header.filepos );
		File->read ( mem, e.header.disksize );
		fwrite ( mem, e.header.disksize, 1, f );
		delete [] mem;
		fclose ( f );
	}
#endif

}