texheaders is a Go package for reading and writing
DayZ/Arma texHeaders.bin files.
It supports two main flows:
- decode/encode
texHeaders.binfrom/to streams or files; - build
texHeaders.binfrom a list of source texture files (.paa).
go get github.com/woozymasta/texheadersf, err := texheaders.ReadFile("testdata/texHeaders.bin")
if err != nil {
return err
}
fmt.Println(f.Version, len(f.Textures))if err := texheaders.WriteFile("out.bin", f); err != nil {
return err
}baseDir := "P:/modsource"
b := texheaders.NewBuilder(texheaders.BuildOptions{
BaseDir: baseDir,
LowercasePaths: true,
BackslashPaths: true,
})
if err := b.AppendMany(
"P:/modsource/data/test_co.paa",
"P:/modsource/data/test_nohq.paa",
); err != nil {
return err
}
if err := b.WriteFile("P:/modsource/texHeaders.bin"); err != nil {
return err
}b := texheaders.NewBuilder(texheaders.BuildOptions{SkipInvalid: true})
_ = b.Append("ok_co.paa")
_ = b.Append("not_texture.txt")
f, err := b.Build()
if err != nil {
return err
}
for _, issue := range b.Issues() {
fmt.Println(issue.Path, issue.Error)
}
_ = fBuilder stores TextureEntry.PAAFile as normalized relative path:
- relative to
BuildOptions.BaseDirwhen possible; - lowercase by default;
- backslash separators by default.
BuildOptions.Workers controls build parallelism:
0or1: serial build (default, no worker overhead);>1: explicit worker count;texheaders.WorkersAuto(-1): auto mode based onGOMAXPROCS/4, rounded down to nearest power of two and capped by input file count.
.pacsource input is currently not supported (ErrPACUnsupported).
Current target is structural compatibility with official output. Exact byte parity is best-effort and depends on source metadata/tooling differences.