Documentation
¶
Index ¶
- type Context
- func (c *Context) AllocateFile(suffix string) (string, error)
- func (c *Context) BuildInfo() *ah_bin.BuildInfo
- func (c *Context) Config() appconfig.Config
- func (c *Context) CreateFile(suffix string) (io.WriteCloser, error)
- func (c *Context) Ctx() context.Context
- func (c *Context) Exists(id stingray.FileID, typ stingray.DataType) bool
- func (c *Context) FileID() stingray.FileID
- func (c *Context) GuessFileArmorSet(fileID stingray.FileID) (datalib.ArmorSet, bool)
- func (c *Context) Hashes() map[stingray.Hash]string
- func (c *Context) LanguageMap() map[uint32]string
- func (c *Context) LookupHash(hash stingray.Hash) string
- func (c *Context) LookupString(id uint32) string
- func (c *Context) LookupThinHash(hash stingray.ThinHash) string
- func (c *Context) Open(id stingray.FileID, typ stingray.DataType) (io.ReadSeeker, error)
- func (c *Context) Read(id stingray.FileID, typ stingray.DataType) ([]byte, error)
- func (c *Context) Runner() *exec.Runner
- func (c *Context) SkinOverrideGroups() []datalib.UnitSkinOverrideGroup
- func (c *Context) ThinHashes() map[stingray.ThinHash]string
- func (c *Context) Warnf(format string, args ...any)
- func (c *Context) WeaponPaintSchemes() []datalib.WeaponCustomizableItem
- type ExtractFunc
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
AllocateFile is similar to Context.CreateFile, but you get to create the file yourself.
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) GuessFileArmorSet ¶ added in v0.6.17
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) LanguageMap ¶ added in v0.7.1
LanguageMap returns a map of localization strings.
func (*Context) LookupHash ¶ added in v0.6.0
LookupHash returns the cracked hash (if known), or the hex representation otherwise.
func (*Context) LookupString ¶ added in v0.7.1
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
LookupThinHash returns the cracked thin hash (if known), or the hex representation otherwise.
func (*Context) Open ¶ added in v0.6.17
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
Read reads the specified game file. NOTE THAT THIS WILL PREALLOCATE ALL FILE DATA; use Exists() to check if a file exists.
func (*Context) SkinOverrideGroups ¶ added in v0.7.1
func (c *Context) SkinOverrideGroups() []datalib.UnitSkinOverrideGroup
func (*Context) ThinHashes ¶ added in v0.4.0
ThinHashes returns a map of known thin hashes.
func (*Context) Warnf ¶ added in v0.4.2
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 ¶
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