core

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2018 License: BSD-3-Clause Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// HD is the data location for often-accessed files
	HD = DataLocation("hd")
	// CD is the data location for remaining files
	CD = DataLocation("cd")
)

Variables

View Source
var Releases = []*ReleaseDesc{&dosHdDemo, &dosCdDemo, &dosHdRelease, &dosCdRelease}

Releases contains all the release descriptions known to Hacker.

Functions

func DataFiles

func DataFiles(release *ReleaseDesc) (hdFiles, cdFiles []string)

DataFiles maps over the provided release description and returns the names of the data files per file location

Types

type DataLocation

type DataLocation string

DataLocation specifies where data files are stored

func (DataLocation) String

func (location DataLocation) String() string

type DataNode

type DataNode interface {
	// Parent returns the parent node or nil if none known.
	Parent() DataNode
	// Children returns all currently available DataNodes from this node.
	Children() []DataNode
	// Info returns human readable information about this node.
	Info() string
	// ID returns the identification for this node. The returned value must be
	// the same by which the parent resolves this node.
	ID() string
	// Resolve returns a DataNode this node knows for the given ID.
	Resolve(string) DataNode
	// Data returns the data of the given node or nil if no data available.
	Data() []byte
	// UnknownData returns a byte array similar to Data(), but with known data
	// cleared to be 0x00.
	UnknownData() []byte
}

DataNode represents a container with data.

func NewObjectPropertiesDataNode

func NewObjectPropertiesDataNode(parentNode DataNode, name string,
	provider objprop.Provider, classes []objprop.ClassDescriptor, consumerFactory func() objprop.Consumer) DataNode

func NewResourceDataNode

func NewResourceDataNode(parentNode DataNode, name string,
	provider chunk.Provider, consumerFactory func() chunk.Consumer) DataNode

func NewTexturePropertiesDataNode

func NewTexturePropertiesDataNode(parentNode DataNode, name string,
	provider textprop.Provider, consumerFactory textpropConsumerFactory) DataNode

type FileDataNodeProvider

type FileDataNodeProvider interface {
	// Provide tries to resolve and return a DataNode for the given file.
	Provide(parent DataNode, filePath, fileName string) DataNode
}

FileDataNodeProvider is for providing a file specific data node

type FileDesc

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

FileDesc is a description of a specific data file

type Hacker

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

Hacker is the main entry point for the hacker logic.

func NewHacker

func NewHacker(style styling.Style) *Hacker

NewHacker returns a hacker instance to work with.

func (*Hacker) ChangeDirectory

func (hacker *Hacker) ChangeDirectory(path string) (result string)

ChangeDirectory changes the currently active node

func (*Hacker) CurrentDirectory

func (hacker *Hacker) CurrentDirectory() string

CurrentDirectory returns the absolute path to the current directory in string form

func (*Hacker) Diff

func (hacker *Hacker) Diff(source string) (result string)

func (*Hacker) Dump

func (hacker *Hacker) Dump() (result string)

func (*Hacker) Info

func (hacker *Hacker) Info() string

Info returns the status of the current node

func (*Hacker) Load

func (hacker *Hacker) Load(path1, path2 string) string

Load tries to load the data files from the two given directories. The second directory is optional.

func (*Hacker) Put

func (hacker *Hacker) Put(offset uint32, data []byte) (result string)

func (*Hacker) Save

func (hacker *Hacker) Save() (result string)

Save re-encodes all loaded data and overwrites the corresponding files.

type MaskingCoder

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

func NewMaskingCoder

func NewMaskingCoder(data []byte) *MaskingCoder

func (*MaskingCoder) CodeByte

func (coder *MaskingCoder) CodeByte(value *byte)

func (*MaskingCoder) CodeBytes

func (coder *MaskingCoder) CodeBytes(value []byte)

func (*MaskingCoder) CodeUint16

func (coder *MaskingCoder) CodeUint16(value *uint16)

func (*MaskingCoder) CodeUint24

func (coder *MaskingCoder) CodeUint24(value *uint32)

func (*MaskingCoder) CodeUint32

func (coder *MaskingCoder) CodeUint32(value *uint32)

type ReleaseDesc

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

ReleaseDesc is a description of a certain release

func FindRelease

func FindRelease(hdFiles, cdFiles []string) (release *ReleaseDesc)

FindRelease tries to determine which release the two sets of files represent. Returns nil if none found.

type Table

type Table interface {
	Size() int
	Entry(index int) interface{}
}

Jump to

Keyboard shortcuts

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