resource

package
v0.1.107 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 2 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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