extractor

package
v0.7.14 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context added in v0.3.0

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

Context is what's passed to the extractor when extracting the file. The most useful methods are Context.FileID, Context.Open and Context.CreateFile.

A context should only be used once.

func NewContext added in v0.6.17

func NewContext(
	ctx context.Context,
	fileID stingray.FileID,
	hashes map[stingray.Hash]string,
	thinHashes map[stingray.ThinHash]string,
	armorSets map[stingray.Hash]datalib.ArmorSet,
	skinOverrideGroups []datalib.UnitSkinOverrideGroup,
	weaponPaintSchemes []datalib.WeaponCustomizableItem,
	gameBuildInfo *ah_bin.BuildInfo,
	languageMap map[uint32]string,
	dataDir *stingray.DataDir,
	runner *exec.Runner,
	config appconfig.Config,
	outPath string,
	selectedArchives []stingray.Hash,
	warnf func(format string, args ...any),
) (_ *Context, getFiles func() []string)

NewContext creates a new Context.

getFiles can be called when the extractor is done to obtain a list of output files.

func (*Context) AllocateFile added in v0.3.1

func (c *Context) AllocateFile(suffix string) (string, error)

AllocateFile is similar to Context.CreateFile, but you get to create the file yourself.

func (*Context) BuildInfo added in v0.7.13

func (c *Context) BuildInfo() *ah_bin.BuildInfo

func (*Context) Config added in v0.3.0

func (c *Context) Config() appconfig.Config

Config gets the current extractor config.

func (*Context) CreateFile added in v0.3.0

func (c *Context) CreateFile(suffix string) (io.WriteCloser, error)

CreateFile creates an output file. Suffix is appended to the source file name/hash and should be unique to the output format. Call WriteCloser.Close() when done.

func (*Context) Ctx added in v0.3.1

func (c *Context) Ctx() context.Context

Ctx gets the cancellation context.

func (*Context) Exists added in v0.6.17

func (c *Context) Exists(id stingray.FileID, typ stingray.DataType) bool

Exists checks if the given file exists.

func (*Context) FileID added in v0.6.17

func (c *Context) FileID() stingray.FileID

FileID gets the ID of the current file to be extracted.

func (*Context) GuessFileArmorSet added in v0.6.17

func (c *Context) GuessFileArmorSet(fileID stingray.FileID) (datalib.ArmorSet, bool)

GuessFileArmorSet uses the selected archives (-t option) to guess which armor set the given file is meant to belong to.

TODO: We might want to take a different approach to this, since we can never truly be sure the archive/armor set ID is correct.

func (*Context) Hashes added in v0.4.0

func (c *Context) Hashes() map[stingray.Hash]string

Hashes returns a map of known hashes.

func (*Context) LanguageMap added in v0.7.1

func (c *Context) LanguageMap() map[uint32]string

LanguageMap returns a map of localization strings.

func (*Context) LookupHash added in v0.6.0

func (c *Context) LookupHash(hash stingray.Hash) string

LookupHash returns the cracked hash (if known), or the hex representation otherwise.

func (*Context) LookupString added in v0.7.1

func (c *Context) LookupString(id uint32) string

LookupString returns the localized string for an ID or the hex representation if the ID is not present.

func (*Context) LookupThinHash added in v0.6.17

func (c *Context) LookupThinHash(hash stingray.ThinHash) string

LookupThinHash returns the cracked thin hash (if known), or the hex representation otherwise.

func (*Context) Open added in v0.6.17

func (c *Context) Open(id stingray.FileID, typ stingray.DataType) (io.ReadSeeker, error)

Open opens the specified game file. NOTE THAT THIS WILL PREALLOCATE ALL FILE DATA; use Exists() to check if a file exists.

func (*Context) Read added in v0.7.1

func (c *Context) Read(id stingray.FileID, typ stingray.DataType) ([]byte, error)

Read reads the specified game file. NOTE THAT THIS WILL PREALLOCATE ALL FILE DATA; use Exists() to check if a file exists.

func (*Context) Runner added in v0.3.0

func (c *Context) Runner() *exec.Runner

Runner gets the runner.

func (*Context) SkinOverrideGroups added in v0.7.1

func (c *Context) SkinOverrideGroups() []datalib.UnitSkinOverrideGroup

func (*Context) ThinHashes added in v0.4.0

func (c *Context) ThinHashes() map[stingray.ThinHash]string

ThinHashes returns a map of known thin hashes.

func (*Context) Warnf added in v0.4.2

func (c *Context) Warnf(format string, args ...any)

Warnf logs a user-visible warning message. Use this when an error occurred, but extraction can continue.

func (*Context) WeaponPaintSchemes added in v0.7.2

func (c *Context) WeaponPaintSchemes() []datalib.WeaponCustomizableItem

type ExtractFunc

type ExtractFunc func(ctx *Context) error

func ExtractFuncRaw added in v0.1.7

func ExtractFuncRaw(extension string) ExtractFunc

func ExtractFuncRawCombined added in v0.5.6

func ExtractFuncRawCombined(extension string) ExtractFunc

func ExtractFuncRawSingleType added in v0.5.6

func ExtractFuncRawSingleType(extension string, typ stingray.DataType) ExtractFunc

Jump to

Keyboard shortcuts

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