cartridgeloader

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2020 License: GPL-3.0, GPL-3.0 Imports: 8 Imported by: 4

Documentation

Overview

Package cartridgeloader is used to specify the data that is to be attached to the emulated VCS.

When the cartridge is ready to be loaded into the emulator, the Load() function should be used. The Load() function handles loading of data from a different sources. Currently on local-file and data over HTTP is supported.

As well as the filename, the Loader type allows the cartridge mapping to be specified, if required.

The simplest instance of the Loader type:

cl := cartridgeloader.Loader{
	Filename: "roms/Pitfall.bin",
}

It is preferred however that the NewLoader() function is used. The NewLoader() function will set the mapping field automatically according to the filename extension.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Loader

type Loader struct {

	// filename of cartridge to load.
	Filename string

	// empty string or "AUTO" indicates automatic fingerprinting
	Mapping string

	// expected hash of the loaded cartridge. empty string indicates that the
	// hash is unknown and need not be validated. after a load operation the
	// value will be the hash of the loaded data
	Hash string
	// contains filtered or unexported fields
}

Loader is used to specify the cartridge to use when Attach()ing to the VCS. it also permits the called to specify the mapping of the cartridge (if necessary. fingerprinting is pretty good)

func NewLoader added in v0.3.1

func NewLoader(filename string, mapping string) Loader

NewLoader is the preferred method of initialisation for the Loader type.

The mapping argument will be used to set the Mapping field, unless the argument is either "AUTO" or the empty string. In which case the file extension is used to set the field.

File extensions should be the same as the ID of the intended mapper, as defined in the cartridge package. The exception is the DPC+ format which requires the file extension "DP+"

File extensions ".BIN" and "A26" will set the Mapping field to "AUTO".

Alphabetic characters in file extensions can be in upper or lower case or a mixture of both.

func (Loader) HasLoaded

func (cl Loader) HasLoaded() bool

HasLoaded returns true if Load() has been successfully called

func (*Loader) Load

func (cl *Loader) Load() ([]byte, error)

Load the cartridge data and return as a byte array. Loader filenames with a valid schema will use that method to load the data. Currently supported schemes are HTTP and local files.

func (Loader) ShortName

func (cl Loader) ShortName() string

ShortName returns a shortened version of the CartridgeLoader filename

Jump to

Keyboard shortcuts

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