pdef

package
v0.0.0-...-8e88d4a Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package pdef parses Titanfall 2 player data definitions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	Name string   `json:"name"`
	Type TypeInfo `json:"type"`
}

Field is a pdef entry.

type Pdef

type Pdef struct {
	Root   []Field             `json:"root"`
	Enum   map[string][]string `json:"enum"`
	Struct map[string][]Field  `json:"struct"`
}

Pdef describes the format of Titanfall 2 player data. Player data structures must not be recursive.

func ParsePdef

func ParsePdef(r io.Reader) (*Pdef, error)

ParsePdef parses the pdef from r. Most things are validated except for length limits.

func (Pdef) TypeSize

func (p Pdef) TypeSize(t TypeInfo) int

type TypeInfo

type TypeInfo struct {
	Int         *TypeInfoPrimitive   `json:"int,omitempty"`
	Bool        *TypeInfoPrimitive   `json:"bool,omitempty"`
	Float       *TypeInfoPrimitive   `json:"float,omitempty"`
	String      *TypeInfoString      `json:"string,omitempty"`
	Array       *TypeInfoArray       `json:"array,omitempty"`
	MappedArray *TypeInfoMappedArray `json:"mapped_array,omitempty"`
	Enum        *TypeInfoEnum        `json:"enum,omitempty"`
	Struct      *TypeInfoStruct      `json:"struct,omitempty"`
}

TypeInfo describes a type. Exactly one of these struct fields will be set.

type TypeInfoArray

type TypeInfoArray struct {
	Type   TypeInfo `json:"type"`
	Length int      `json:"length"`
}

TypeInfoArray is used for a fixed-length array.

type TypeInfoEnum

type TypeInfoEnum struct {
	Name string `json:"name"`
}

TypeInfoEnum refers to a defined enum.

type TypeInfoMappedArray

type TypeInfoMappedArray struct {
	Type TypeInfo `json:"type"`
	Enum string   `json:"enum"`
}

TypeInfoArray is used for a fixed-length array mapping from an enum.

type TypeInfoPrimitive

type TypeInfoPrimitive struct {
}

TypeInfoPrimitive is used for an unconfigurable type.

type TypeInfoString

type TypeInfoString struct {
	Length int `json:"length"`
}

TypeInfoString is used for fixed-length strings. Note that nothing stops arbitrary binary data from being stored in a string.

type TypeInfoStruct

type TypeInfoStruct struct {
	Name string `json:"name"`
}

TypeInfoEnum refers to a defined struct.

Directories

Path Synopsis
Command pdefgen generates a Go package to process r2 pdata from a pdef.
Command pdefgen generates a Go package to process r2 pdata from a pdef.

Jump to

Keyboard shortcuts

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