Game Development Reference
In-Depth Information
std::string FName = Arch_FixFileName( VirtualName );
MemRawFile* File = new MemRawFile();
File->SetFileName( VirtualName );
File->SetVirtualFileName( VirtualName );
const void* DataPtr = FReader->GetFileData( FName );
uint64 FileSize = FReader->GetFileSize( FName );
File->CreateFromManagedBuffer( DataPtr, FileSize );
return File;
}
Check if a speciied ile exists inside this archive mount point:
virtual bool FileExists(
const std::string& VirtualName ) const
{
return
FReader->FileExists(Arch_FixFileName(VirtualName));
}
virtual std::string MapName(
const std::string& VirtualName ) const
{ return VirtualName; }
private:
clPtr<ArchiveReader> FReader;
};
The ArchiveReader class takes care of the memory management and returns a ready-to-
use instance of MemRawFile .
See also
F Decompressing iles from the .zip archives
F Chapter 5 , Cross-platform Audio Streaming
Decompressing iles from the .zip archives
We have the Enumerate_ZIP() function to iterate through individual iles inside a .zip
archive, and now it is time to extract its contents.
Getting ready
This code uses the same set of fopen() -like functions from the previous recipe.
 
Search WWH ::




Custom Search