emulator

package
v0.0.0-...-77df42f Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command int

Command is a command that is sent to the emulator to control it.

const (
	// CommandPause pauses the emulator.
	CommandPause Command = iota
	// CommandResume resumes the emulator.
	CommandResume
	// CommandClose closes the emulator.
	CommandClose
	// CommandReset resets the emulator.
	CommandReset
	// CommandLoadROM loads a ROM into the emulator.
	CommandLoadROM
	// CommandLoadSave loads a save file into the emulator.
	CommandLoadSave
	// CommandSetSpeed sets the speed of the emulator.
	CommandSetSpeed
)

type CommandPacket

type CommandPacket struct {
	Command Command
	Data    []byte
}

CommandPacket is a command packet that is sent to the emulator to control it.

type ResponsePacket

type ResponsePacket struct {
	Command Command
	Data    []byte
	Error   error
}

ResponsePacket is a response packet that is sent from the emulator to the client.

type Save

type Save struct {
	Path string // the path to the save file
	// contains filtered or unexported fields
}

Save represents a save file.

func LoadSave

func LoadSave(cartTitle string) (*Save, error)

LoadSave loads the save file for the given cartridge title.

func NewSave

func NewSave(title string, ramSize uint) (*Save, error)

NewSave creates a new save file for the given cartridge title, and RAM size.

func (*Save) Bytes

func (s *Save) Bytes() []byte

Bytes returns the save file data.

func (*Save) Close

func (s *Save) Close() error

Close closes the save file by renaming the temporary file to the original file.

func (*Save) SetBytes

func (s *Save) SetBytes(b []byte) error

SetBytes sets the save file data.

type State

type State int

State represents the status of the emulator. It can be one of the following:

  • Running
  • Paused
const (
	// Running represents the status of the
	// emulator when it is running.
	Running State = iota
	// Paused represents the status of the
	// emulator when it is paused.
	Paused
	// Stopped represents the status of the
	// emulator when it is stopped.
	Stopped
)

func (State) IsPaused

func (s State) IsPaused() bool

func (State) IsRunning

func (s State) IsRunning() bool

func (State) IsStopped

func (s State) IsStopped() bool

func (State) String

func (s State) String() string

type Status

type Status int

Status represents the status of the emulator's CPU. It can be one of the following:

  • Execution
  • Halted
  • Errored
const (
	// Execution represents the status of the
	// CPU when it is executing instructions.
	Execution Status = iota
	// Halted represents the status of the
	// CPU when it has halted.
	Halted
	// Errored represents the status of the
	// CPU when it has encountered an unexpected
	// error.
	Errored
)

func (Status) IsErrored

func (s Status) IsErrored() bool

func (Status) IsExecuting

func (s Status) IsExecuting() bool

func (Status) IsHalted

func (s Status) IsHalted() bool

func (Status) String

func (s Status) String() string

Jump to

Keyboard shortcuts

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