recorder

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 recorder handles recording and playback of input through the VCS input system. See input package.

To keep things simple, recording gameplay will use the VCS in it's normalised state. Future versions of the recorder fileformat will support localised preferences.

Index

Constants

This section is empty.

Variables

View Source
var NotAPlaybackFile = errors.New("not a playback file")

sentinal errors for IsPlaybackFile()

View Source
var PlaybackHashError = errors.New("unexpected input")

sentinal error returned by GetPlayback() if a hash error is encountered.

View Source
var UnsupportedVersion = errors.New("unsupported version")

Functions

func IsPlaybackFile

func IsPlaybackFile(filename string) error

IsPlaybackFile return nil if file is a playback file and is a supported version. If file is not a playback file then the sentinal error NotAPlaybackFile is returned.

Recognised playback files but where the version is unspported will result in an UnsupportedVersion error.

Types

type Playback

type Playback struct {
	Cartridge string
	Hash      string
	TVSpec    string
	// contains filtered or unexported fields
}

Playback is used to reperform the user input recorded in a previously recorded file. It implements the ports.Playback interface.

func NewPlayback

func NewPlayback(transcript string) (*Playback, error)

NewPlayback is the preferred method of implementation for the Playback type.

The returned playback must be attached to the VCS input system (with AttachToVCSInput() function) for it it to be useful.

The integrityCheck flag should be true in most instances.

func (*Playback) AttachToVCSInput added in v0.16.0

func (plb *Playback) AttachToVCSInput(vcs *hardware.VCS) error

AttachToVCSInput attaches the playback instance (an implementation of the playback interface) to all the input system of the VCS.

Note that the VCS instance will be normalised as a result of this call.

func (Playback) EndFrame

func (plb Playback) EndFrame() (bool, error)

EndFrame returns true if emulation has gone past the last frame of the playback.

func (*Playback) GetPlayback added in v0.7.1

func (plb *Playback) GetPlayback() (ports.TimedInputEvent, error)

GetPlayback returns an event and source PortID for an event occurring at the current TV frame/scanline/clock.

func (Playback) String

func (plb Playback) String() string

type Recorder

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

Recorder transcribes user input to a file. The recorded file is intended for future playback. The Recorder type implements the ports.EventRecorder interface.

func NewRecorder

func NewRecorder(transcript string, vcs *hardware.VCS) (*Recorder, error)

NewRecorder is the preferred method of implementation for the FileRecorder type. Note that attaching of the Recorder to all the ports of the VCS (including the panel) is implicit in this function call.

Note that the VCS instance will be normalised as a result of this call.

func (*Recorder) End

func (rec *Recorder) End() error

End flushes all remaining events to the output file and closes it.

func (*Recorder) RecordEvent

func (rec *Recorder) RecordEvent(inp ports.TimedInputEvent) error

RecordEvent implements the ports.EventRecorder interface.

Jump to

Keyboard shortcuts

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