repdecoder

package
v1.12.9 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package repdecoder implements decoding StarCraft Brood War replay files (*.rep).

SC BW replays are basically divided into 2 types:

- modern (starting from 1.18)

- legacy (pre 1.18)

The type detection and utilization of the proper decoder is automatic and transparent to the package user.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMismatchedSection is returned by Decoder.Section() if the section size is not the expected one
	ErrMismatchedSection = errors.New("mismatched section")

	// ErrNoMoreSections is returned by Decoder.NewSection() if there are no more sections.
	ErrNoMoreSections = errors.New("no more sections")
)

Functions

This section is empty.

Types

type Decoder

type Decoder interface {
	// RepFormat returns the replay format
	RepFormat() RepFormat

	// NewSection must be called between sections.
	// ErrNoMoreSections is returned if the replay has no more sections.
	NewSection() error

	// Section decodes a section of the given size.
	Section(size int32) (data []byte, sectionID int32, err error)

	// Close closes the decoder, releases any associated resources.
	io.Closer
}

Decoder wraps a Section method for decoding a section of a given size.

func New

func New(repData []byte) Decoder

New creates a new Decoder that reads and decompresses data from the given byte slice.

func NewFromFile

func NewFromFile(name string) (d Decoder, err error)

NewFromFile creates a new Decoder that reads and decompresses data form a file.

type RepFormat added in v1.7.3

type RepFormat int

RepFormat identifies the replay format

const (
	RepFormatUnknown   RepFormat = iota // Unknown replay format
	RepFormatLegacy                     // Legacy replay format (pre 1.18)
	RepFormatModern                     // Modern replay format (1.18 - 1.20)
	RepFormatModern121                  // Modern 1.21 replay format (starting from 1.21)
)

Possible values of repFormat

Jump to

Keyboard shortcuts

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