extractor

package
v0.7.35 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearChildNodesFromScene added in v0.7.16

func ClearChildNodesFromScene(ctx *Context, doc *gltf.Document)

Blender throws a hissy fit if a node is reachable from multiple places in a scene, so we need to remove child nodes from the scene before saving.

func GetDocument added in v0.7.26

func GetDocument(ctx *Context, inDoc *gltf.Document) *gltf.Document

func SaveDocument added in v0.7.27

func SaveDocument(ctx *Context, doc *gltf.Document, stingrayFormat, fileFormat string) error

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,
	attachmentSlots map[stingray.Hash]enum.WeaponCustomizationSlot,
	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),
	statusf 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) ArmorSets added in v0.4.0

func (c *Context) ArmorSets() []datalib.ArmorSet

func (*Context) AttachmentSlots added in v0.7.30

func (c *Context) AttachmentSlots() map[stingray.Hash]enum.WeaponCustomizationSlot

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) OverrideMaterial added in v0.7.27

func (c *Context) OverrideMaterial(slot stingray.ThinHash, original stingray.Hash) stingray.Hash

Transparently return the override for a slot if it exists, otherwise return the original

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) RootFileID added in v0.7.16

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

RootFileID gets the ID of the root file to be extracted.

func (*Context) Runner added in v0.3.0

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

Runner gets the runner.

func (*Context) SelectedArchives added in v0.7.23

func (c *Context) SelectedArchives() []stingray.Hash

func (*Context) SkinOverrideGroups added in v0.7.1

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

func (*Context) Statusf added in v0.7.16

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

Statusf logs a user-visible info message. Use this to display progress in long running extractions

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

func (*Context) WithFileID added in v0.7.16

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

Returns a copy of the context with the fileID changed

func (*Context) WithMaterialOverrides added in v0.7.27

func (c *Context) WithMaterialOverrides(newOverrides map[stingray.ThinHash]stingray.Hash) *Context

Returns a copy of the context with different material overrides

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

type Object added in v0.7.16

type Object interface {
	Path() stingray.Hash
	Position() mgl32.Vec3
	SetPosition(mgl32.Vec3)
	Rotation() mgl32.Vec4
	SetRotation(mgl32.Vec4)
	Scale() mgl32.Vec3
	SetScale(mgl32.Vec3)
	ToGLTF() (mgl32.Vec3, mgl32.Vec4, mgl32.Vec3)
}

Jump to

Keyboard shortcuts

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