lsf

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LSFSignature = [4]byte{0x4C, 0x53, 0x4F, 0x46}

Functions

func ReadLSF

func ReadLSF(r io.ReadSeeker) (lsgo.Resource, error)

func ReadLSFAttribute

func ReadLSFAttribute(r io.ReadSeeker, name string, dt lsgo.DataType, length uint, version lsgo.FileVersion, engineVersion uint32) (lsgo.NodeAttribute, error)

func ReadNames

func ReadNames(r io.ReadSeeker) ([][]string, error)

extract to lsf package

func ReadNode

func ReadNode(r io.ReadSeeker, valueStart int64, ni NodeInfo, names [][]string, attributeInfo []AttributeInfo, version lsgo.FileVersion, engineVersion uint32) (lsgo.Node, error)

func ReadRegions

func ReadRegions(r io.ReadSeeker, valueStart int64, names [][]string, nodeInfo []NodeInfo, attributeInfo []AttributeInfo, version lsgo.FileVersion, engineVersion uint32) ([]*lsgo.Node, error)

Types

type AttributeEntry

type AttributeEntry struct {
	Long bool

	// (16-bit MSB: index into name hash table, 16-bit LSB: offset in hash chain)
	NameHashTableIndex uint32

	// 26-bit MSB: Length of this attribute
	TypeAndLength uint32

	// Note: These indexes are assigned seemingly arbitrarily, and are not necessarily indices into the node list
	NodeIndex int32

	// Note: These indexes are assigned seemingly arbitrarily, and are not necessarily indices into the node list
	NextAttributeIndex int32

	// Absolute position of attribute value in the value stream
	Offset uint32
}

attribute extension in the LSF file

func (AttributeEntry) Len

func (ae AttributeEntry) Len() int

Length of this attribute

func (AttributeEntry) NameIndex

func (ae AttributeEntry) NameIndex() int

Index into name hash table

func (AttributeEntry) NameOffset

func (ae AttributeEntry) NameOffset() int

Offset in hash chain

func (*AttributeEntry) Read

func (ae *AttributeEntry) Read(r io.ReadSeeker) error

func (AttributeEntry) TypeID

func (ae AttributeEntry) TypeID() lsgo.DataType

Type of this attribute (see NodeAttribute.DataType)

type AttributeInfo

type AttributeInfo struct {
	V2 bool

	// Index into name hash table
	NameIndex int

	// Offset in hash chain
	NameOffset int

	// Type of this attribute (see NodeAttribute.DataType)
	TypeID lsgo.DataType

	// Length of this attribute
	Length uint

	// Absolute position of attribute data in the values section
	DataOffset uint

	// (-1: this is the last attribute)
	NextAttributeIndex int
}

type LSFHeader

type LSFHeader struct {
	// LSOF file signature
	Signature [4]byte

	// Version of the LSOF file D:OS EE is version 1/2, D:OS 2 is version 3
	Version lsgo.FileVersion

	// Possibly version number? (major, minor, rev, build)
	EngineVersion uint32

	// Total uncompressed size of the string hash table
	StringsUncompressedSize uint32

	// Compressed size of the string hash table
	StringsSizeOnDisk uint32

	// Total uncompressed size of the node list
	NodesUncompressedSize uint32

	// Compressed size of the node list
	NodesSizeOnDisk uint32

	// Total uncompressed size of the attribute list
	AttributesUncompressedSize uint32

	// Compressed size of the attribute list
	AttributesSizeOnDisk uint32

	// Total uncompressed size of the raw value buffer
	ValuesUncompressedSize uint32

	// Compressed size of the raw value buffer
	ValuesSizeOnDisk uint32

	// Uses the same format as packages (see BinUtils.MakeCompressionFlags)
	CompressionFlags byte

	// Possibly unused, always 0
	Unknown2 byte
	Unknown3 uint16

	// Extended node/attribute format indicator, 0 for V2, 0/1 for V3
	Extended uint32
}

func (LSFHeader) IsCompressed

func (lsfh LSFHeader) IsCompressed() bool

func (*LSFHeader) Read

func (lsfh *LSFHeader) Read(r io.ReadSeeker) error

type NodeEntry

type NodeEntry struct {
	Long bool

	// (16-bit MSB: index into name hash table, 16-bit LSB: offset in hash chain)
	NameHashTableIndex uint32

	// (-1: node has no attributes)
	FirstAttributeIndex int32

	// (-1: this node is a root region)
	ParentIndex int32

	// (-1: this is the last node)
	NextSiblingIndex int32
}

func (NodeEntry) NameIndex

func (ne NodeEntry) NameIndex() int

func (NodeEntry) NameOffset

func (ne NodeEntry) NameOffset() int

func (*NodeEntry) Read

func (ne *NodeEntry) Read(r io.ReadSeeker) error

type NodeInfo

type NodeInfo struct {

	// (-1: this node is a root region)
	ParentIndex int

	// Index into name hash table
	NameIndex int

	// Offset in hash chain
	NameOffset int

	// (-1: node has no attributes)
	FirstAttributeIndex int
}

Processed node information for a node in the LSF file

Jump to

Keyboard shortcuts

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