macro

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package macro implements an input system that processes instructions from a macro script.

The first line of the macro must be the string "gopher2600macro".

The macro language is very simple and does not implement any flow control except basic loops.

DO loopCt [loopName]
	...
LOOP

The 'loopName' parameter is optional. When a loop is named the current counter value can be referenced as a variable in some contexts (currently, this is the SCREENSHOT instruction only).

Loops can be nested.

The WAIT instruction will pause the execution of the macro for the specified number of frames. If no value is given for this the number of frames defaults to 60.

There are instructions that give basic control over the emulation (only left player joystick control and some panel operaitons).

LEFT, RIGHT, UP, DOWN, CENTRE, FIRE, NOFIRE, SELECT, RESET

There is also an instruction to initiate a screenshot. The macro system is therefore useful to automate the collation of screenshots in a repeatable manner.

SCREENSHOT [filename suffix]

The filename suffix parameter is optional. Without it the screenshot will be given the default but unique filename.

If the filename suffix parameter is given then the name of the screenshot will be the name of the cartridge plus the suffix. Spaces will be replaced with underscores.

In the context of the screenshot instruction, variables can referenced with the % symbol. For example, if a loop has been given the name "ct", then the following screenshot command could be written:

SCREENSHOT %ct

Any errors in a macro script will result in a log entry and the termination of the macro execution.

Lines can be commented by prefixing the line with two dashes (--). Leading and trailing white space is ignored.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Emulation

type Emulation interface {
	UserInput() chan userinput.Event
	VCS() *hardware.VCS
}

type GUI

type GUI interface {
	SetFeature(request gui.FeatureReq, args ...gui.FeatureReqData) error
}

type Input

type Input interface {
	PushEvent(ports.InputEvent) error
}

type Macro

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

Macro is a type that allows control of an emulation from a series of instructions

func NewMacro

func NewMacro(filename string, emulation Emulation, input Input, tv TV, gui GUI) (*Macro, error)

NewMacro is the preferred method of initialisation for the Macro type

func (*Macro) NewFrame

func (mcr *Macro) NewFrame(frameInfo television.FrameInfo) error

NewFrame implements the television.FrameTrigger interface

func (*Macro) Quit

func (mcr *Macro) Quit()

Quit forces a running macro (ie. one that has been triggered) to end. Does nothing is macro is not currently running

func (*Macro) Reset added in v0.25.0

func (mcr *Macro) Reset()

Reset restarts the macro

func (*Macro) Run

func (mcr *Macro) Run()

Run a macro to completion

type TV

type TV interface {
	AddFrameTrigger(f television.FrameTrigger)
	GetFrameInfo() television.FrameInfo
}

Jump to

Keyboard shortcuts

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