Documentation
¶
Overview ¶
Package v2 reads TA: Kingdoms HPI archives (version 0x00020000). Unlike the Total Annihilation v1 format, the directory and name blocks live at arbitrary offsets near the tail of the file, each optionally wrapped in a single SQSH chunk, and file payloads are stored without the v1 XOR cipher.
Index ¶
- type Reader
- func (r *Reader) Close() error
- func (r *Reader) Find(path string) *common.Entry
- func (r *Reader) Header() *common.Header
- func (r *Reader) List() []string
- func (r *Reader) Open(path string) (io.ReadCloser, error)
- func (r *Reader) OpenEntry(entry *common.Entry) (io.ReadCloser, error)
- func (r *Reader) Root() *common.Entry
- func (r *Reader) Version() uint32
- func (r *Reader) Walk(fn func(*common.Entry) error) error
- type Writer
- type WriterEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader reads a TA: Kingdoms (v2) HPI archive.
A Reader is not safe for concurrent use: every read seeks the shared file handle, so callers serving an archive to multiple goroutines must serialize access.
func (*Reader) Header ¶
Header returns the archive header. Only Marker and Version are populated for v2 archives; the v1-style directory fields are zero.
func (*Reader) Open ¶
func (r *Reader) Open(path string) (io.ReadCloser, error)
Open opens a file from the archive by path.
type Writer ¶
type Writer struct {
CompressionLevel int // zlib level (0–9); 0 means default
CompressionMethod uint8 // common.CompressionNone or common.CompressionZLib (default)
// contains filtered or unexported fields
}
Writer builds a TA: Kingdoms (v2) HPI archive. Unlike v1 there is no XOR cipher; each file is stored either raw or as a single zlib-compressed SQSH chunk, and the directory and name blocks are written uncompressed.
func CreateWriter ¶
CreateWriter creates a new v2 HPI archive at the given path, defaulting to zlib compression.
func (*Writer) AddDirectory ¶
AddDirectory recursively adds every file under dirPath, rooted at archivePath inside the archive.
func (*Writer) AddFileFromBytes ¶
AddFileFromBytes adds a file from an in-memory byte slice.
type WriterEntry ¶
WriterEntry holds a file's metadata and payload for writing into an archive.