gorez

package module
v0.0.0-...-1e6077b Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2023 License: MIT Imports: 6 Imported by: 0

README

gorez

A LithTech REZ file parser/extractor written in Go.

Usage

See example.go in the example subdirectory.

go run example.go

License

MIT

Documentation

Index

Constants

View Source
const REZEntryDirHeaderSize = int64(unsafe.Sizeof(REZEntryDirHeader{})) // 12

Variables

This section is empty.

Functions

This section is empty.

Types

type REZEntryDirHeader

type REZEntryDirHeader struct {
	Pos  uint32
	Size uint32
	Time uint32
}

type REZEntryDirInfo

type REZEntryDirInfo struct {
	REZEntryDirHeader
	DirName     string
	DirFullName string // RootDir + DirName + Backslash
	DataSize    int64
}

type REZEntryFileInfo

type REZEntryFileInfo struct {
	REZEntryRezHeader
	FileName     string
	FileExt      string
	FileFullName string // RootDir + FileName + Extension
	DataSize     int64
}

type REZEntryRezHeader

type REZEntryRezHeader struct {
	Pos     uint32
	Size    uint32
	Time    uint32
	ID      uint32
	Type    [4]byte // Reversed file extension
	NumKeys uint32
}

type REZFile

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

func NewREZFile

func NewREZFile(filename string) *REZFile

func (*REZFile) Close

func (rf *REZFile) Close() error

func (*REZFile) Dirs

func (rf *REZFile) Dirs() []*REZEntryDirInfo

func (*REZFile) Extract

func (rf *REZFile) Extract(outputDir string) (count int, errors []error)

func (*REZFile) ExtractFile

func (rf *REZFile) ExtractFile(fileInfo *REZEntryFileInfo, destFile string) error

func (*REZFile) Filename

func (rf *REZFile) Filename() string

func (*REZFile) Files

func (rf *REZFile) Files() []*REZEntryFileInfo

func (*REZFile) Header

func (rf *REZFile) Header() *REZMainHeader

func (*REZFile) Open

func (rf *REZFile) Open() error

func (*REZFile) Read

func (rf *REZFile) Read() (err error)

func (*REZFile) Size

func (rf *REZFile) Size() int64

type REZMainHeader

type REZMainHeader struct {
	Sign               [127]byte // Sign
	FileFormatVersion  uint32    // File format version
	RootDirPos         uint32    // Position of the root directory structure in the file
	RootDirSize        uint32    // Size of root directory
	RootDirTime        uint32    // Time Root dir was last updated
	NextWritePos       uint32    // Position of first directory in the file
	Time               uint32    // Time resource file was last updated
	LargestKeyAry      uint32    // Size of the largest key array in the resource file
	LargestDirNameSize uint32    // Size of the largest directory name in the resource file (including 0 terminator)
	LargestRezNameSize uint32    // Size of the largest resource name in the resource file (including 0 terminator)
	LargestCommentSize uint32    // Size of the largest comment in the resource file (including 0 terminator)
	IsSorted           byte      // If 0 then data is not sorted if 1 then it is sorted
}

Taken from rezmgr.cpp

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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