Documentation
¶
Overview ¶
Package vpk provides a reader for the Valve PacK archive format.
Index ¶
Constants ¶
View Source
const (
// Magic is the "magic number" that every VPK directory must start with.
Magic = 0x55aa1234
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChunkHash ¶
type ChunkHash struct { ArchiveIndex uint32 StartingOffset uint32 Count uint32 MD5Checksum [16]byte }
ChunkHash is a hash of an arbitrary section of a VPK archive set.
type DataChunk ¶
type DataChunk struct { // A zero based index of the archive this file's data is contained in. // If 0x7fff, the data follows the directory. ArchiveIndex uint16 // If ArchiveIndex is 0x7fff, the offset of the file data relative to // the end of the directory (see the header for more details). // // Otherwise, the offset of the data from the start of the specified // archive. EntryOffset uint32 // If zero, the entire file is stored in the preload data. // Otherwise, the number of bytes stored starting at EntryOffset. EntryLength uint32 }
DataChunk is the location of a file's data.
type DirEntry ¶
type DirEntry struct { // A 32bit CRC of the file's data. CRC uint32 // The number of bytes contained in the index file. MetadataBytes uint16 // The location of the contents of this file (minimum of 1 element). DataLocation []DataChunk }
DirEntry is the raw VPK directory data.
type File ¶
type File struct { Dir string Base string Ext string DirEntry Metadata []byte // contains filtered or unexported fields }
File is metadata about a single file entry in a VPK.
type Header ¶
type Header struct { // Must be equal to the Magic constant in this package. Magic uint32 // VPK file format version. Version uint32 // The size, in bytes, of the directory tree. TreeSize uint32 }
Header is the VPK version 1 file format header.
type Header2 ¶
type Header2 struct { // How many bytes of file content are stored in this VPK file. EmbeddedChunkSize uint32 // The size, in bytes, of the section containing MD5 checksums // for external archive content. ChunkHashesSize uint32 // The size, in bytes, of the section containing MD5 checksums // for content in this file (should always be 48). SelfHashesSize uint32 // The size, in bytes, of the section containing the public key // and signature. SignatureSize uint32 }
Header2 is the additional data that follows Header in VPK version 2.
type Opener ¶
type Opener struct {
// contains filtered or unexported fields
}
Opener caches file handles for a VPK.
func (*Opener) Close ¶
Close closes all files that the Opener has opened, and returns the first error encountered.
func (*Opener) ReadArchive ¶
ReadArchive reads the VPK archive tree for this Opener.
Click to show internal directories.
Click to hide internal directories.