ietools

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2018 License: BSD-2-Clause Imports: 4 Imported by: 2

README

Go-Infinity-Tools

GoDoc

About

go-infinity-tools provides functionality to access and modify structured or textual resource types commonly found in Infinity Engine games, such as Baldur's Gate or Icewind Dale.

The package is written in Go. It currently provides three sub-packages: buffers, pvrz and tables.

Package ietools contains several helpful constants and functions that are used by the sub-packages. External dependencies: golang.org/x/text/encoding/charmap.

Package buffers contains a set of functions for reading, creating or modifying structured resources. It is loosely based on a subset of functions provided by WeiDU. The package has no external dependencies.

Package pvrz implements a high-level PVR/PVRZ texture manager. External dependencies: github.com/InfinityTools/squish (see go-squish for more information).

Package tables allows you to read and modify table-like content in text format, such as 2DA or IDS. Functionality has also been inspired by WeiDU. External dependencies: golang.org/x/text/encoding/charmap.

Building

go-infinity-tools package path is github.com/InfinityTools/ietools. Main package and each sub-package can be built via go build.

You may have to specify additional options, e.g. via CGO_LDFLAGS environment variable, to compile the pvrz package.

Documentation

For ietools docs, see https://godoc.org/github.com/InfinityTools/go-ietools .

For buffers docs, see https://godoc.org/github.com/InfinityTools/go-ietools/buffers .

For pvrz docs, see https://godoc.org/github.com/InfinityTools/go-ietools/pvrz .

For tables docs, see https://godoc.org/github.com/InfinityTools/go-ietools/tables .

License

go-infinity-tools and all sub-packages are released under the BSD 2-clause license. See LICENSE for more details.

Documentation

Overview

Package ietools provides a collection of types, constants and functions inspired by WeiDU.

More specific functionality can be found in the respective sub-packages:

  • package buffers: Functions and types for manipulating data buffers.
  • package pvrz: Functions and types for handling pvr/pvrz data.
  • package tables: Functions and types for table-related operations.

Index

Constants

View Source
const (
	// Helps addressing single bits in a numeric value
	BIT0  = 0x00000001
	BIT1  = 0x00000002
	BIT2  = 0x00000004
	BIT3  = 0x00000008
	BIT4  = 0x00000010
	BIT5  = 0x00000020
	BIT6  = 0x00000040
	BIT7  = 0x00000080
	BIT8  = 0x00000100
	BIT9  = 0x00000200
	BIT10 = 0x00000400
	BIT11 = 0x00000800
	BIT12 = 0x00001000
	BIT13 = 0x00002000
	BIT14 = 0x00004000
	BIT15 = 0x00008000
	BIT16 = 0x00010000
	BIT17 = 0x00020000
	BIT18 = 0x00040000
	BIT19 = 0x00080000
	BIT20 = 0x00100000
	BIT21 = 0x00200000
	BIT22 = 0x00400000
	BIT23 = 0x00800000
	BIT24 = 0x01000000
	BIT25 = 0x02000000
	BIT26 = 0x04000000
	BIT27 = 0x08000000
	BIT28 = 0x10000000
	BIT29 = 0x20000000
	BIT30 = 0x40000000
	BIT31 = 0x80000000
)
View Source
const (
	PATH_SEPARATOR = "/"
	NEWLINE        = "\n"
)

Variables

View Source
var (
	ErrOffsetOutOfRange = errors.New("Offset out of range")
	ErrIllegalArguments = errors.New("Illegal arguments specified")
)

Potential errors in addition to default Go package errors.

Functions

func AnsiToUtf8

func AnsiToUtf8(buffer []byte, cm *charmap.Charmap) (string, error)

AnsiToUtf8 converts an ANSI-encoded byte array into an UTF-8 string with the provided character map. Provide a nil charmap to assume Windows-1252 encoding.

func AssembleFilePath

func AssembleFilePath(dir, name, ext string) string

AssembleFilePath returns a fully qualified path string based on the given path elements.

func SplitFilePath

func SplitFilePath(filepath string) (dir, name, ext string)

SplitFilePath splits the given path string and returns file path, base name and extension as separate values.

Trailing path separators are stripped from the directory string, except for the root directory. Empty directory is returned as ".". Name returns the last path element regardless of whether it points to a file or folder. Ext returns the name part after the last period (.). Ext may be empty. Period is not included in either name or ext.

func Utf8ToAnsi

func Utf8ToAnsi(text string, cm *charmap.Charmap) ([]byte, error)

Utf8ToAnsi converts an UTF-8 string into a byte array of the specified ANSI encoding. Provide a nil charmap to convert to Windows-1252 encoding.

Types

This section is empty.

Directories

Path Synopsis
Package buffers provides a collection of types, constants and functions for manipulating data buffers, inspired by WeiDU's set of functions.
Package buffers provides a collection of types, constants and functions for manipulating data buffers, inspired by WeiDU's set of functions.
Package pvrz provides functionality to deal with data of the PVR and PVRZ formats.
Package pvrz provides functionality to deal with data of the PVR and PVRZ formats.
Package tables provides functions for dealing with table-like structures, such as used by 2DA or IDS resource types.
Package tables provides functions for dealing with table-like structures, such as used by 2DA or IDS resource types.

Jump to

Keyboard shortcuts

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