sav

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const HeaderExpectedLength = 32

Total size (bytes).

View Source
const UserfileExpectedLength = 524288

Size of full file is always 524288 bytes (extra data are nulls).

Variables

This section is empty.

Functions

func Compress

func Compress(ct []byte) ([]byte, error)

Compress compresses with zlib.

func GetDataXMLFromUserfile

func GetDataXMLFromUserfile(f []byte) (string, error)

GetDataXMLFromUserfile extracts the XML data from a compressed userfile (a .sav that already has a valid header and the compressed data). It skips the header bytes.

Types

type Header struct {
	Version        uint32 // PC = 21.
	Size           uint32 // Size of the uncompressed data.
	CompressedSize uint32 // Size of the compressed data.
	UH1            uint32 // Always 860693325.
	UH2            uint32 // Always 0.
	UH3            uint32 // Always 860700740.
	Checksum       uint32 // Checksum of compressed save data (Bitwise not CRC32 Jam).
	UH4            uint32 // Always 1079398965.
}

func NewHeaderFromContents

func NewHeaderFromContents(ct []byte) (*Header, error)

NewHeader creates a new Header from the contents of a .sav userfile.

func (*Header) Print

func (h *Header) Print()

Print prints the Header structure for log debugging.

func (*Header) Serialize

func (h *Header) Serialize() ([]byte, error)

Serialize serializes a Header to []byte.

func (*Header) Validate

func (h *Header) Validate() error

Validate validates if the header has the expected content.

type Sav

type Sav struct {
	Header  Header
	DataXML string
}

Jump to

Keyboard shortcuts

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