kobopatch

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(buf []byte) (patchfile.PatchSet, error)

Parse parses a PatchSet from a buf.

Types

type BaseAddress added in v0.15.1

type BaseAddress FlexAbsOffset

func (BaseAddress) ApplyTo added in v0.15.1

func (b BaseAddress) ApplyTo(pt *patchlib.Patcher, log func(string, ...interface{})) error

func (BaseAddress) MarshalYAML added in v0.15.1

func (b BaseAddress) MarshalYAML() (interface{}, error)

func (*BaseAddress) UnmarshalYAML added in v0.15.1

func (b *BaseAddress) UnmarshalYAML(n *yaml.Node) error

type Description added in v0.15.1

type Description string

type Enabled added in v0.15.1

type Enabled bool

type FindBaseAddressHex added in v0.15.1

type FindBaseAddressHex string

func (FindBaseAddressHex) ApplyTo added in v0.15.1

func (b FindBaseAddressHex) ApplyTo(pt *patchlib.Patcher, log func(string, ...interface{})) error

type FindBaseAddressString added in v0.15.1

type FindBaseAddressString string

func (FindBaseAddressString) ApplyTo added in v0.15.1

func (b FindBaseAddressString) ApplyTo(pt *patchlib.Patcher, log func(string, ...interface{})) error

type FindBaseAddressSymbol deprecated added in v0.15.1

type FindBaseAddressSymbol string

Deprecated: Use BaseAddress instead.

func (FindBaseAddressSymbol) ApplyTo added in v0.15.1

func (b FindBaseAddressSymbol) ApplyTo(pt *patchlib.Patcher, log func(string, ...interface{})) error

Deprecated

type FindReplaceString added in v0.15.1

type FindReplaceString struct {
	Find            string `yaml:"Find"`
	Replace         string `yaml:"Replace"`
	MustMatchLength bool   `yaml:"MustMatchLength,omitempty"`
}

func (FindReplaceString) ApplyTo added in v0.15.1

func (r FindReplaceString) ApplyTo(pt *patchlib.Patcher, log func(string, ...interface{})) error

type FindZlib added in v0.15.1

type FindZlib string

func (FindZlib) ApplyTo added in v0.15.1

func (b FindZlib) ApplyTo(pt *patchlib.Patcher, log func(string, ...interface{})) error

type FindZlibHash added in v0.15.1

type FindZlibHash string

func (FindZlibHash) ApplyTo added in v0.15.1

func (b FindZlibHash) ApplyTo(pt *patchlib.Patcher, log func(string, ...interface{})) error

type FlexAbsOffset added in v0.15.1

type FlexAbsOffset struct {
	Offset     *int32  `yaml:"Offset,omitempty"` // can be specified in place of this object
	Sym        *string `yaml:"Sym,omitempty"`
	SymPLT     *string `yaml:"SymPLT,omitempty"`
	SymPLTTail *string `yaml:"SymPLTTail,omitempty"`
	Inline     bool    `yaml:"-"`             // whether the Offset/Sym was inline
	Rel        *int32  `yaml:"Rel,omitempty"` // optional, gets added to the absolute offset found
}

FlexAbsOffset allows specifying an absolute offset with either a direct integer (absolute offset - Offset), string (normal symbol - Sym), or a field.

func (FlexAbsOffset) MarshalYAML added in v0.15.1

func (f FlexAbsOffset) MarshalYAML() (interface{}, error)

func (FlexAbsOffset) Resolve added in v0.15.1

func (f FlexAbsOffset) Resolve(p *patchlib.Patcher) (int32, error)

func (*FlexAbsOffset) UnmarshalYAML added in v0.15.1

func (f *FlexAbsOffset) UnmarshalYAML(n *yaml.Node) error

type Instruction added in v0.15.1

type Instruction struct {
	Enabled               *Enabled               `yaml:"Enabled,omitempty"`
	Description           *Description           `yaml:"Description,omitempty"`
	PatchGroup            *PatchGroup            `yaml:"PatchGroup,omitempty"`
	BaseAddress           *BaseAddress           `yaml:"BaseAddress,omitempty,flow"`
	FindBaseAddressHex    *FindBaseAddressHex    `yaml:"FindBaseAddressHex,omitempty"`
	FindBaseAddressString *FindBaseAddressString `yaml:"FindBaseAddressString,omitempty"`
	FindZlib              *FindZlib              `yaml:"FindZlib,omitempty"`
	FindZlibHash          *FindZlibHash          `yaml:"FindZlibHash,omitempty"`
	FindReplaceString     *FindReplaceString     `yaml:"FindReplaceString,omitempty"`
	ReplaceString         *ReplaceString         `yaml:"ReplaceString,omitempty"`
	ReplaceInt            *ReplaceInt            `yaml:"ReplaceInt,omitempty,flow"`
	ReplaceFloat          *ReplaceFloat          `yaml:"ReplaceFloat,omitempty,flow"`
	ReplaceBytes          *ReplaceBytes          `yaml:"ReplaceBytes,omitempty"`
	ReplaceZlib           *ReplaceZlib           `yaml:"ReplaceZlib,omitempty"`
	ReplaceZlibGroup      *ReplaceZlibGroup      `yaml:"ReplaceZlibGroup,omitempty"`
	FindBaseAddressSymbol *FindBaseAddressSymbol `yaml:"FindBaseAddressSymbol,omitempty"` // Deprecated: Use BaseAddress instead.
	ReplaceBytesAtSymbol  *ReplaceBytesAtSymbol  `yaml:"ReplaceBytesAtSymbol,omitempty"`  // Deprecated: Use ReplaceBytes.Base instead.
	ReplaceBytesNOP       *ReplaceBytesNOP       `yaml:"ReplaceBytesNOP,omitempty"`       // Deprecated: Use ReplaceBytes.ReplaceNOP instead.
	ReplaceBLX            *ReplaceBLX            `yaml:"ReplaceBLX,omitempty"`            // Deprecated: Use ReplaceBytes.FindInstBLX and ReplaceBytes.ReplaceInstBLX instead.
}

func (Instruction) ToSingleInstruction added in v0.15.1

func (i Instruction) ToSingleInstruction() interface{}

type InstructionNode added in v0.15.1

type InstructionNode map[string]yaml.Node

func (InstructionNode) Line added in v0.15.1

func (i InstructionNode) Line(def int) int

func (InstructionNode) ToInstruction added in v0.15.1

func (i InstructionNode) ToInstruction() (*Instruction, error)

type Patch added in v0.15.1

type Patch []*Instruction

type PatchGroup added in v0.15.1

type PatchGroup string

type PatchNode added in v0.15.1

type PatchNode []yaml.Node

func (*PatchNode) ToInstructionNodes added in v0.15.1

func (p *PatchNode) ToInstructionNodes() ([]InstructionNode, error)

func (*PatchNode) ToPatch added in v0.15.1

func (p *PatchNode) ToPatch() (Patch, error)

type PatchSet

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

func (*PatchSet) ApplyTo

func (ps *PatchSet) ApplyTo(pt *patchlib.Patcher) error

ApplyTo applies a PatchSet to a Patcher.

func (*PatchSet) SetEnabled

func (ps *PatchSet) SetEnabled(patch string, enabled bool) error

SetEnabled sets the Enabled state of a Patch in a PatchSet.

func (*PatchSet) SortedNames added in v0.15.1

func (ps *PatchSet) SortedNames() []string

SortedNames gets the names of patches sorted alphabetically.

func (*PatchSet) Validate

func (ps *PatchSet) Validate() error

Validate validates the PatchSet.

type PatchableInstruction added in v0.15.1

type PatchableInstruction interface {
	ApplyTo(*patchlib.Patcher, func(string, ...interface{})) error
}

type ReplaceBLX deprecated added in v0.15.1

type ReplaceBLX struct {
	Offset  int32  `yaml:"Offset,omitempty"`
	Find    uint32 `yaml:"Find"`
	Replace uint32 `yaml:"Replace"`
}

Deprecated: Use FindInstBLX and ReplaceInstBLX on ReplaceBytes instead.

func (ReplaceBLX) ApplyTo added in v0.15.1

func (r ReplaceBLX) ApplyTo(pt *patchlib.Patcher, log func(string, ...interface{})) error

Deprecated

type ReplaceBytes added in v0.15.1

type ReplaceBytes struct {
	Base    *FlexAbsOffset `yaml:"Base,omitempty,flow"` // if specified, Offset is based on this rather than the current offset
	Offset  int32          `yaml:"Offset,omitempty"`
	Find    []byte         `yaml:"Find,omitempty"`
	Replace []byte         `yaml:"Replace,omitempty"`
	// generators
	FindH          *string        `yaml:"FindH,omitempty"`
	ReplaceH       *string        `yaml:"ReplaceH,omitempty"`
	FindInstBLX    *FlexAbsOffset `yaml:"FindInstBLX,omitempty,flow"`
	ReplaceInstBLX *FlexAbsOffset `yaml:"ReplaceInstBLX,omitempty,flow"`
	FindInstBW     *FlexAbsOffset `yaml:"FindInstBW,omitempty,flow"`
	ReplaceInstBW  *FlexAbsOffset `yaml:"ReplaceInstBW,omitempty,flow"`
	ReplaceInstNOP *bool          `yaml:"ReplaceInstNOP,omitempty,flow"` // if specified, must be true
	FindBLX        *uint32        `yaml:"FindBLX,omitempty"`             // Deprecated: Use FindInstBLX instead.
	// special
	CheckOnly *bool `yaml:"CheckOnly,omitempty"` // if specified and true, it will only ensure the presence of the find string
}

func (ReplaceBytes) ApplyTo added in v0.15.1

func (r ReplaceBytes) ApplyTo(pt *patchlib.Patcher, log func(string, ...interface{})) (perr error)

type ReplaceBytesAtSymbol deprecated added in v0.15.1

type ReplaceBytesAtSymbol struct {
	Symbol   string  `yaml:"Symbol,omitempty"`
	Offset   int32   `yaml:"Offset,omitempty"`
	FindH    *string `yaml:"FindH,omitempty"`
	ReplaceH *string `yaml:"ReplaceH,omitempty"`
	FindBLX  *uint32 `yaml:"FindBLX,omitempty"`
	Find     []byte  `yaml:"Find,omitempty"`
	Replace  []byte  `yaml:"Replace,omitempty"`
}

Deprecated: Use Base on ReplaceBytes instead.

func (ReplaceBytesAtSymbol) ApplyTo added in v0.15.1

func (r ReplaceBytesAtSymbol) ApplyTo(pt *patchlib.Patcher, log func(string, ...interface{})) error

Deprecated

type ReplaceBytesNOP deprecated added in v0.15.1

type ReplaceBytesNOP struct {
	Offset  int32   `yaml:"Offset,omitempty"`
	FindH   *string `yaml:"FindH,omitempty"`
	FindBLX *uint32 `yaml:"FindBLX,omitempty"`
	Find    []byte  `yaml:"Find,omitempty"`
}

Deprecated: Use ReplaceInstNOP on ReplaceBytes instead.

func (ReplaceBytesNOP) ApplyTo added in v0.15.1

func (r ReplaceBytesNOP) ApplyTo(pt *patchlib.Patcher, log func(string, ...interface{})) error

Deprecated

type ReplaceFloat added in v0.15.1

type ReplaceFloat struct {
	Offset  int32   `yaml:"Offset,omitempty"`
	Find    float64 `yaml:"Find"`
	Replace float64 `yaml:"Replace"`
}

func (ReplaceFloat) ApplyTo added in v0.15.1

func (r ReplaceFloat) ApplyTo(pt *patchlib.Patcher, log func(string, ...interface{})) error

type ReplaceInt added in v0.15.1

type ReplaceInt struct {
	Offset  int32 `yaml:"Offset,omitempty"`
	Find    uint8 `yaml:"Find"`
	Replace uint8 `yaml:"Replace"`
}

func (ReplaceInt) ApplyTo added in v0.15.1

func (r ReplaceInt) ApplyTo(pt *patchlib.Patcher, log func(string, ...interface{})) error

type ReplaceString added in v0.15.1

type ReplaceString struct {
	Offset          int32  `yaml:"Offset,omitempty"`
	Find            string `yaml:"Find"`
	Replace         string `yaml:"Replace"`
	MustMatchLength bool   `yaml:"MustMatchLength,omitempty"`
}

func (ReplaceString) ApplyTo added in v0.15.1

func (r ReplaceString) ApplyTo(pt *patchlib.Patcher, log func(string, ...interface{})) error

type ReplaceZlib added in v0.15.1

type ReplaceZlib struct {
	Offset  int32  `yaml:"Offset,omitempty"`
	Find    string `yaml:"Find"`
	Replace string `yaml:"Replace"`
}

func (ReplaceZlib) ApplyTo added in v0.15.1

func (r ReplaceZlib) ApplyTo(pt *patchlib.Patcher, log func(string, ...interface{})) error

type ReplaceZlibGroup added in v0.15.1

type ReplaceZlibGroup struct {
	Offset       int32 `yaml:"Offset,omitempty"`
	Replacements []struct {
		Find    string `yaml:"Find"`
		Replace string `yaml:"Replace"`
	} `yaml:"Replacements"`
}

func (ReplaceZlibGroup) ApplyTo added in v0.15.1

func (r ReplaceZlibGroup) ApplyTo(pt *patchlib.Patcher, log func(string, ...interface{})) error

Jump to

Keyboard shortcuts

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