Documentation
¶
Overview ¶
Package mpq contains the functions for handling MPQ files.
Index ¶
- type Block
- type DataStream
- type FileFlag
- type FileRecord
- type Hash
- type Header
- type MPQ
- func (mpq *MPQ) Close() error
- func (mpq *MPQ) Contains(filename string) bool
- func (mpq *MPQ) Listfile() ([]string, error)
- func (mpq *MPQ) Path() string
- func (mpq *MPQ) ReadFile(fileName string) ([]byte, error)
- func (mpq *MPQ) ReadFileStream(fileName string) (io.ReadSeekCloser, error)
- func (mpq *MPQ) ReadTextFile(fileName string) (string, error)
- func (mpq *MPQ) Size() uint32
- type PatchInfo
- type Stream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct {
FilePosition uint32
CompressedFileSize uint32
UncompressedFileSize uint32
Flags FileFlag
// Local Stuff...
FileName string
EncryptionSeed uint32
}
Block represents an entry in the block table
type DataStream ¶
type DataStream struct {
// contains filtered or unexported fields
}
DataStream represents a stream for MPQ data.
type FileFlag ¶
type FileFlag uint32
FileFlag represents flags for a file record in the MPQ archive
const ( // FileImplode - File is compressed using PKWARE Data compression library FileImplode FileFlag = 0x00000100 // FileCompress - File is compressed using combination of compression methods FileCompress FileFlag = 0x00000200 // FileEncrypted - The file is encrypted FileEncrypted FileFlag = 0x00010000 // FileFixKey - The decryption key for the file is altered according to the position of the file in the archive FileFixKey FileFlag = 0x00020000 // FilePatchFile - The file contains incremental patch for an existing file in base MPQ FilePatchFile FileFlag = 0x00100000 // FileSingleUnit - Instead of being divided to 0x1000-bytes blocks, the file is stored as single unit FileSingleUnit FileFlag = 0x01000000 // FileDeleteMarker - File is a deletion marker, indicating that the file no longer exists. This is used to allow patch // archives to delete files present in lower-priority archives in the search chain. The file usually // has length of 0 or 1 byte and its name is a hash FileDeleteMarker FileFlag = 0x02000000 // FileSectorCrc - File has checksums for each sector. Ignored if file is not compressed or imploded. FileSectorCrc FileFlag = 0x04000000 // FileExists - Set if file exists, reset when the file was deleted FileExists FileFlag = 0x80000000 )
type FileRecord ¶
FileRecord represents a file record in an MPQ
type Header ¶
type Header struct {
Magic [4]byte
HeaderSize uint32
ArchiveSize uint32
FormatVersion uint16
BlockSize uint16
HashTableOffset uint32
BlockTableOffset uint32
HashTableEntries uint32
BlockTableEntries uint32
}
Header Represents a MPQ file
type MPQ ¶
type MPQ struct {
// contains filtered or unexported fields
}
MPQ represents an MPQ archive
func (*MPQ) ReadFileStream ¶
func (mpq *MPQ) ReadFileStream(fileName string) (io.ReadSeekCloser, error)
ReadFileStream reads the mpq file data and returns a stream
func (*MPQ) ReadTextFile ¶
ReadTextFile reads a file and returns it as a string
type PatchInfo ¶
type PatchInfo struct {
Length uint32 // Length of patch info header, in bytes
Flags uint32 // Flags. 0x80000000 = MD5 (?)
DataSize uint32 // Uncompressed size of the patch file
MD5 [16]byte // MD5 of the entire patch file after decompression
}
PatchInfo represents patch info for the MPQ.
Click to show internal directories.
Click to hide internal directories.