manifest

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package manifest provides types and functions for working with EVR manifest files.

Index

Constants

View Source
const (
	// DefaultCompressionLevel is the compression level used for building packages.
	DefaultCompressionLevel = zstd.BestSpeed

	// MaxPackageSize is the maximum size of a single package file.
	MaxPackageSize = math.MaxInt32
)
View Source
const (
	HeaderSize = 192 // Fixed header size:
	//   4 (PackageCount) + 4 (Unk1) + 8 (Unk2)
	// + SectionSize (FrameContents) + 16 bytes padding
	// + SectionSize (Metadata)      + 16 bytes padding
	// + SectionSize (Frames)
	SectionSize      = 48 // 6 * 8 bytes (Section has 6 uint64 fields)
	FrameContentSize = 32 // 8 + 8 + 4 + 4 + 4 + 4 bytes
	FileMetadataSize = 40 // 5 * 8 bytes
	FrameSize        = 16 // 4 * 4 bytes
)

Binary sizes for manifest structures

Variables

This section is empty.

Functions

func ScanFiles

func ScanFiles(inputDir string) ([][]ScannedFile, error)

ScanFiles walks the input directory and returns files grouped by chunk number. The directory structure is expected to be: <inputDir>/<chunkNum>/<typeSymbol>/<fileSymbol>

func WriteFile

func WriteFile(path string, m *Manifest) error

WriteFile writes a manifest to a file.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder constructs packages and manifests from a set of files.

func NewBuilder

func NewBuilder(outputDir, packageName string) *Builder

NewBuilder creates a new package builder.

func (*Builder) Build

func (b *Builder) Build(fileGroups [][]ScannedFile) (*Manifest, error)

Build creates a package and manifest from the given file groups.

func (*Builder) SetCompressionLevel

func (b *Builder) SetCompressionLevel(level int)

SetCompressionLevel sets the compression level for the builder.

type ExtractOption

type ExtractOption func(*extractConfig)

ExtractOption configures extraction behavior.

func WithDecimalNames

func WithDecimalNames(decimal bool) ExtractOption

WithDecimalNames uses decimal format for filenames instead of hex.

func WithPreserveGroups

func WithPreserveGroups(preserve bool) ExtractOption

WithPreserveGroups preserves frame grouping in output directory structure.

type FileMetadata

type FileMetadata struct {
	TypeSymbol int64 // File type identifier
	FileSymbol int64 // File identifier
	Unk1       int64 // Unknown - game launches with 0
	Unk2       int64 // Unknown - game launches with 0
	AssetType  int64 // Asset type identifier
}

FileMetadata contains additional file metadata.

type Frame

type Frame struct {
	PackageIndex   uint32 // Package file index
	Offset         uint32 // Byte offset within package
	CompressedSize uint32 // Compressed frame size
	Length         uint32 // Decompressed frame size
}

Frame describes a compressed data frame within a package.

type FrameContent

type FrameContent struct {
	TypeSymbol int64  // File type identifier
	FileSymbol int64  // File identifier
	FrameIndex uint32 // Index into Frames array
	DataOffset uint32 // Byte offset within decompressed frame
	Size       uint32 // File size in bytes
	Alignment  uint32 // Alignment (can be set to 1)
}

FrameContent describes a file within a frame.

type Header struct {
	PackageCount  uint32
	Unk1          uint32 // Unknown - 524288 on latest builds
	Unk2          uint64 // Unknown - 0 on latest builds
	FrameContents Section

	Metadata Section

	Frames Section
	// contains filtered or unexported fields
}

Header contains manifest metadata and section information.

type Manifest

type Manifest struct {
	Header        Header
	FrameContents []FrameContent
	Metadata      []FileMetadata
	Frames        []Frame
}

Manifest represents a parsed EVR manifest file.

func ReadFile

func ReadFile(path string) (*Manifest, error)

ReadFile reads and parses a manifest from a file.

func (*Manifest) BinarySize

func (m *Manifest) BinarySize() int

BinarySize returns the total binary size of the manifest.

func (*Manifest) EncodeTo

func (m *Manifest) EncodeTo(buf []byte)

EncodeTo writes the manifest to the given buffer. The buffer must be at least BinarySize() bytes.

func (*Manifest) FileCount

func (m *Manifest) FileCount() int

FileCount returns the number of files in this manifest.

func (*Manifest) MarshalBinary

func (m *Manifest) MarshalBinary() ([]byte, error)

MarshalBinary encodes a manifest to binary data. Pre-allocates buffer for better performance.

func (*Manifest) PackageCount

func (m *Manifest) PackageCount() int

PackageCount returns the number of packages referenced by this manifest.

func (*Manifest) UnmarshalBinary

func (m *Manifest) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes a manifest from binary data. Uses direct decoding for better performance.

type Package

type Package struct {
	// contains filtered or unexported fields
}

Package represents a multi-part package file set.

func OpenPackage

func OpenPackage(manifest *Manifest, basePath string) (*Package, error)

OpenPackage opens a multi-part package from the given base path. The path should be the package name without the _N suffix.

func (*Package) Close

func (p *Package) Close() error

Close closes all package files.

func (*Package) Extract

func (p *Package) Extract(outputDir string, opts ...ExtractOption) error

Extract extracts all files from the package to the output directory.

func (*Package) Manifest

func (p *Package) Manifest() *Manifest

Manifest returns the associated manifest.

type ScannedFile

type ScannedFile struct {
	TypeSymbol int64
	FileSymbol int64
	Path       string
	Size       uint32
}

ScannedFile represents a file scanned from an input directory for building packages.

type Section

type Section struct {
	Length       uint64 // Total byte length of section
	Unk1         uint64 // Unknown - 0 on latest builds
	Unk2         uint64 // Unknown - 4294967296 on latest builds
	ElementSize  uint64 // Byte size of single entry
	Count        uint64 // Number of elements
	ElementCount uint64 // Number of elements (can differ from Count)
}

Section describes a section within the manifest.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL