Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CryptoBuffer [0x500]uint32
CryptoBuffer contains the crypto bytes for filename hashing
Functions ¶
func InitializeCryptoBuffer ¶
func InitializeCryptoBuffer()
InitializeCryptoBuffer initializes the crypto buffer
Types ¶
type BlockTableEntry ¶
type BlockTableEntry struct { FilePosition uint32 CompressedFileSize uint32 UncompressedFileSize uint32 Flags FileFlag // Local Stuff... FileName string EncryptionSeed uint32 }
BlockTableEntry represents an entry in the block table
func (BlockTableEntry) HasFlag ¶
func (v BlockTableEntry) HasFlag(flag FileFlag) bool
HasFlag returns true if the specified flag is present
type Data ¶
type Data struct { Magic [4]byte HeaderSize uint32 ArchiveSize uint32 FormatVersion uint16 BlockSize uint16 HashTableOffset uint32 BlockTableOffset uint32 HashTableEntries uint32 BlockTableEntries uint32 }
Data Represents a MPQ file
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 HashEntryMap ¶
type HashEntryMap struct {
// contains filtered or unexported fields
}
func (*HashEntryMap) Contains ¶
func (hem *HashEntryMap) Contains(fileName string) bool
func (*HashEntryMap) Find ¶
func (hem *HashEntryMap) Find(fileName string) (*HashTableEntry, bool)
func (*HashEntryMap) Insert ¶
func (hem *HashEntryMap) Insert(entry *HashTableEntry)
type HashTableEntry ¶
type HashTableEntry struct { NamePartA uint32 NamePartB uint32 Locale uint16 Platform uint16 BlockIndex uint32 }
HashTableEntry represents a hashed file entry in the MPQ file
type MPQ ¶
type MPQ struct { FileName string File *os.File HashEntryMap HashEntryMap BlockTableEntries []BlockTableEntry Data Data }
MPQ represents an MPQ archive
func (MPQ) FileExists ¶
func (MPQ) GetFileList ¶
GetFileList returns the list of files in this MPQ
type MpqFileRecord ¶
type Stream ¶
type Stream struct { MPQData MPQ BlockTableEntry BlockTableEntry FileName string EncryptionSeed uint32 BlockPositions []uint32 CurrentPosition uint32 CurrentData []byte CurrentBlockIndex uint32 BlockSize uint32 }
Stream represents a stream of data in an MPQ archive
func CreateStream ¶
func CreateStream(mpq MPQ, blockTableEntry BlockTableEntry, fileName string) (*Stream, error)
CreateStream creates an MPQ stream
Click to show internal directories.
Click to hide internal directories.