mpq

package
v0.0.0-...-7f92c57 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package mpq provides an MPQ Asset and Source implementation for d2loader

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSource

func NewSource(sourcePath string) (asset.Source, error)

NewSource creates a new MPQ Source

Types

type Asset

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

Asset represents a file record within an MPQ archive

func (*Asset) Close

func (a *Asset) Close() (err error)

Close will seek the read position for the next read operation

func (*Asset) Data

func (a *Asset) Data() ([]byte, error)

Data returns the raw file data as a slice of bytes

func (*Asset) Path

func (a *Asset) Path() string

Path returns the sub-path (within the source) of this asset

func (*Asset) Read

func (a *Asset) Read(buf []byte) (n int, err error)

Read will read asset data into the given buffer

func (*Asset) Seek

func (a *Asset) Seek(offset int64, whence int) (n int64, err error)

Seek will seek the read position for the next read operation

func (*Asset) Source

func (a *Asset) Source() asset.Source

Source returns the source of this asset

func (*Asset) String

func (a *Asset) String() string

String returns the path

func (*Asset) Type

func (a *Asset) Type() types.AssetType

Type returns the asset type

type Source

type Source struct {
	MPQ d2interface.Archive
}

Source is an implementation of an asset source for MPQ archives

func (*Source) Exists

func (v *Source) Exists(subPath string) bool

Exists returns true if the file exists

func (*Source) Open

func (v *Source) Open(name string) (a io.ReadSeeker, err error)

Open attempts to open a file within the MPQ archive

func (*Source) Path

func (v *Source) Path() string

Path returns the path of the MPQ on the host filesystem

func (*Source) String

func (v *Source) String() string

String returns the path

Jump to

Keyboard shortcuts

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