helper

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

helper is helper functions used for commonly used functions

Index

Constants

This section is empty.

Variables

View Source
var Version string

Functions

func ByteCompareTest added in v1.4.302

func ByteCompareTest(src []byte, dst []byte) error

ByteCompareTest compares two byte arrays, and returns an error if they are not equal. This was made for testing

func Compare added in v1.4.265

func Compare(val, val2 interface{}) error

func Deflate

func Deflate(in []byte) ([]byte, error)

Deflate takes a byte slice and compresses it down

func DirTest added in v1.4.302

func DirTest() string

TestDir returns a testing directory

func DmSpriteDefTagParse added in v1.4.265

func DmSpriteDefTagParse(isChr bool, tag string) (string, error)

func FilenameCRC32

func FilenameCRC32(name string) uint32

FilenameCRC32 returns the CRC of a file's name

func GenerateCRC16

func GenerateCRC16(data []byte) (checksum uint16, err error)

GenerateCRC16 places a checksum on the last 2 bytes of writer

func GenerateCRC32

func GenerateCRC32(data []byte) (checksum uint32, err error)

GenerateCRC32 places a checksum on the last 4 bytes of writer

func Inflate

func Inflate(in []byte, size int) ([]byte, error)

func MaterialTagParse added in v1.4.265

func MaterialTagParse(isChr bool, tag string) (string, error)

MaterialTagParse checks if the material tag represents a variation material and returns a prefix if applicable.

func Pluralize

func Pluralize(in int) string

func ReadStringHash

func ReadStringHash(hash []byte) string

func RegexpMatch added in v1.4.265

func RegexpMatch(key string, pattern string, search string) ([]string, error)

QuickParse parses a key using a pattern, removing first element (the matched line)

func RenderMethodInt added in v1.4.302

func RenderMethodInt(in string) uint32

func RenderMethodStr added in v1.4.302

func RenderMethodStr(in uint32) string

func TrackAnimationParse added in v1.4.265

func TrackAnimationParse(isChr bool, tag string) (animationTag string, modelTag string)

TrackAnimationParse parses the tag and returns the animation and model codes

func Validate

func Validate(data []byte) error

Validate returns nil if data has a valid CRC checksum

func Write

func Write(data []byte, w io.Writer) error

Write simply writes a CRC to the provided writer

func WriteString

func WriteString(w io.Writer, in string) error

WriteString is used to write a CString (zero terminated) to w

func WriteStringHash

func WriteStringHash(hash string) []byte

Types

type ByteSeekerTest added in v1.4.302

type ByteSeekerTest struct {
	io.Seeker
	*bytes.Buffer
	// contains filtered or unexported fields
}

ByteSeekerTest is used primarily for tag systems in tests, it isn't efficient otherwise

func NewByteSeekerTest added in v1.4.302

func NewByteSeekerTest() *ByteSeekerTest

func (*ByteSeekerTest) Bytes added in v1.4.302

func (b *ByteSeekerTest) Bytes() []byte

func (*ByteSeekerTest) Cap added in v1.4.302

func (b *ByteSeekerTest) Cap() int

func (*ByteSeekerTest) Len added in v1.4.302

func (b *ByteSeekerTest) Len() int

func (*ByteSeekerTest) Read added in v1.4.302

func (b *ByteSeekerTest) Read(p []byte) (n int, err error)

func (*ByteSeekerTest) ReadByte added in v1.4.302

func (b *ByteSeekerTest) ReadByte() (c byte, err error)

func (*ByteSeekerTest) ReadFrom added in v1.4.302

func (b *ByteSeekerTest) ReadFrom(r io.Reader) (n int64, err error)

func (*ByteSeekerTest) ReadRune added in v1.4.302

func (b *ByteSeekerTest) ReadRune() (r rune, size int, err error)

func (*ByteSeekerTest) ReadString added in v1.4.302

func (b *ByteSeekerTest) ReadString(delim byte) (line string, err error)

func (*ByteSeekerTest) Reset added in v1.4.302

func (b *ByteSeekerTest) Reset()

func (*ByteSeekerTest) Seek added in v1.4.302

func (b *ByteSeekerTest) Seek(offset int64, whence int) (int64, error)

func (*ByteSeekerTest) Write added in v1.4.302

func (b *ByteSeekerTest) Write(p []byte) (n int, err error)

func (*ByteSeekerTest) WriteByte added in v1.4.302

func (b *ByteSeekerTest) WriteByte(c byte) error

func (*ByteSeekerTest) WriteString added in v1.4.302

func (b *ByteSeekerTest) WriteString(s string) (n int, err error)

type FragmentReadWriter added in v1.4.302

type FragmentReadWriter interface {
	FragmentReader
	FragmentWriter
}

FragmentReadWriter is used to read a fragment in wld format

type FragmentReader added in v1.4.302

type FragmentReader interface {
	Read(w io.ReadSeeker, isNewWorld bool) error
	FragCode() int
	NameRef() int32
}

type FragmentWriter added in v1.4.302

type FragmentWriter interface {
	Write(w io.Writer, isNewWorld bool) error
}

FragmentWriter2 is used to write a fragment in wld format

Jump to

Keyboard shortcuts

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