stingray

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

"triad" describes a storage unit used in the game files. It consists of a "main" file (no extension), a "stream" file (.stream), and a "GPU" file (.gpu_resources). The stream and GPU files are optional.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataDir

type DataDir struct {
	Files map[FileID]*File
}

func OpenDataDir

func OpenDataDir(dirPath string) (*DataDir, error)

type DataType

type DataType int
const (
	DataMain DataType = iota
	DataStream
	DataGPU
	NumDataType
)

func (DataType) String

func (t DataType) String() string

type File

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

func (*File) Exists

func (f *File) Exists(typ DataType) bool

func (*File) Open

func (f *File) Open(typ DataType) (io.ReadSeekCloser, error)

Call Close() on returned reader when done.

type FileData

type FileData struct {
	ID           FileID
	MainOffset   uint64
	StreamOffset uint64
	GPUOffset    uint64
	Unk00        [16]byte
	MainSize     uint32
	StreamSize   uint32
	GPUSize      uint32
	Signature    [8]byte // == packetSignature or packetSignatureAlt, purpose unknown
	Index        uint32
}

type FileID

type FileID struct {
	Name Hash
	Type Hash
}

type Hash

type Hash struct{ Value uint64 }

func Sum64

func Sum64(b []byte) Hash

Murmur64a hash

func (Hash) String

func (h Hash) String() string

func (Hash) StringEndian added in v0.1.7

func (h Hash) StringEndian(endian binary.ByteOrder) string

func (Hash) Thin added in v0.1.6

func (h Hash) Thin() ThinHash

type HeaderData

type HeaderData struct {
	MagicNum [4]byte // 0x11 0x00 0x00 0xF0
	NumTypes uint32
	NumFiles uint32

	Unk00          [20]byte
	ApproxMainSize uint64 // aligned by 256 / weirdly offset
	ApproxGPUSize  uint64 // aligned by 256 / weirdly offset
	Unk01          [24]byte
}

Unk means the data's purpose is unknown.

type ThinHash

type ThinHash struct{ Value uint32 }

func (ThinHash) String added in v0.1.6

func (h ThinHash) String() string

func (ThinHash) StringEndian added in v0.1.7

func (h ThinHash) StringEndian(endian binary.ByteOrder) string

type Triad

type Triad struct {
	MainPath   string
	StreamPath string // optional
	GPUpath    string // optional
	Header     HeaderData
	Types      []TypeData
	Files      []FileData
}

A triad consists of a main file, a stream file and a GPU resource file. The stream file and GPU resource file are optional.

func OpenTriad

func OpenTriad(mainPath string) (*Triad, error)

func (*Triad) HasDataType

func (tr *Triad) HasDataType(typ DataType) bool

func (*Triad) HasFile

func (tr *Triad) HasFile(fileIndex int, typ DataType) (bool, error)

func (*Triad) OpenFile

func (tr *Triad) OpenFile(fileIndex int, typ DataType) (io.ReadSeekCloser, error)

Call Close() on returned reader when done.

type TypeData

type TypeData struct {
	Unk00     uint32
	Unk01     uint32
	Name      Hash
	Count     uint32
	Unk02     uint32
	Signature [8]byte // == packetSignature or packetSignatureAlt, purpose unknown
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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