bundle

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecompressIndexBundle

func DecompressIndexBundle(data []byte) ([]byte, error)

func DiscoverRequiredBundles

func DiscoverRequiredBundles(cache *cache.Cache, patch string, languages []string, tables []string) ([]string, error)

func FNVHashPath

func FNVHashPath(path string) uint64

FNVHashPath computes FNV-1a hash with "++" suffix for legacy PoE (≤3.21.2)

func GetBundleSet added in v1.1.0

func GetBundleSet(index Index, tables, languages []string) map[string]bool

func MurmurHash64A

func MurmurHash64A(data []byte, seed uint64) uint64

MurmurHash64A implements the 64-bit MurmurHash2 algorithm as used by modern PoE (≥3.21.2) Reference: https://github.com/poe-tool-dev/poe-dat-viewer/blob/main/lib/src/utils/murmur2.ts

func MurmurHashPath

func MurmurHashPath(path string) uint64

MurmurHashPath computes MurmurHash64A of a lowercase path string with seed 0x1337b33f

func NewLoader

func NewLoader(lower fs.FS) (*bundleFS, error)

func OpenBundle

func OpenBundle(r io.ReaderAt) (*bundle, error)

Types

type Bundle

type Bundle interface {
	// Read returns the entire contents of the bundle decompressed
	Read() ([]byte, error)
	// Size returns the uncompressed size of the bundle
	Size() int64
	// ReadAt reads data from a specific offset in the decompressed bundle
	ReadAt(p []byte, off int64) (int, error)
}

Bundle represents an opened bundle that can be read from

type BundleManager added in v1.1.0

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

BundleManager provides a high-level API for accessing bundle files

func NewBundleManager added in v1.1.0

func NewBundleManager(cacheDir, patch string) (*BundleManager, error)

NewBundleManager creates a new bundle manager

func (*BundleManager) Close added in v1.1.0

func (m *BundleManager) Close() error

Close closes the manager and releases resources

func (*BundleManager) FileExists added in v1.1.0

func (m *BundleManager) FileExists(path string) bool

FileExists checks if a file exists in the bundle, trying language-specific paths as needed

func (*BundleManager) GetFile added in v1.1.0

func (m *BundleManager) GetFile(path string) ([]byte, error)

GetFile reads the entire contents of a file from the bundle, trying language-specific paths as needed

func (*BundleManager) SetLanguages added in v1.1.0

func (m *BundleManager) SetLanguages(languages []string)

SetLanguages configures the languages to search for files

type BytesReaderAt added in v1.1.0

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

func (*BytesReaderAt) ReadAt added in v1.1.0

func (r *BytesReaderAt) ReadAt(p []byte, off int64) (int, error)

type FileLocation

type FileLocation struct {
	BundleName string
	Offset     uint32
	Size       uint32
}

FileLocation contains information about where a file is located in the bundle system

type Index

type Index interface {
	// GetFileInfo returns information about a file, including which bundle contains it
	GetFileInfo(path string) (*FileLocation, error)
	// ListBundles returns all bundle names in the index
	ListBundles() []string
	// ListFiles returns all file paths in the index
	ListFiles() []string
}

Index represents a bundle index that can be used to find files and bundles

func LoadIndex

func LoadIndex(data []byte) (Index, error)

LoadIndex parses index data and returns an Index interface

Jump to

Keyboard shortcuts

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