Help us shape the future of Go! Take the 2026 Go Developer Survey

resource

package
v0.1.31 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package resource reads and writes the container of a Source 2 compiled resource, such as a .vxml_c layout or a .vents_c entity lump: a header and a table of tagged blocks, each holding one part of the resource.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Find

func Find(blocks []Block, tag string) ([]byte, bool)

Find returns the contents of the first block tagged tag, and whether there is one.

func ReadBlock

func ReadBlock(resource []byte, tag string) ([]byte, error)

ReadBlock reads the contents of the block tagged tag from a resource.

func Write

func Write(version uint16, blocks []Block) ([]byte, error)

Write encodes blocks as a resource of the given type version, each block on a 16-byte boundary after the table, as the resource compiler places them.

Types

type Block

type Block struct {
	// Tag is the block's four-letter tag, such as "DATA" or "RED2".
	Tag string
	// Data is the block's contents.
	Data []byte
}

Block is one tagged part of a resource, such as its DATA block.

func Read

func Read(resource []byte) ([]Block, error)

Read returns the blocks of a resource in table order. Each block's Data aliases resource.

Jump to

Keyboard shortcuts

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