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 ¶
var FileExtensions = [...]string{".BIN", ".ROM", ".A26", ".2k", ".4k", ".F8", ".F6", ".F4", ".2k+", ".4k+", ".F8+", ".F6+", ".F4+", ".FA", ".FE", ".E0", ".E7", ".3F", ".AR", ".DF", "3E", "3E+", ".DPC", ".DP+", ".WAV", ".MP3"}
FileExtensions is the list of file extensions that are recognised by the cartridgeloader package.
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 // // in the case of sound data (IsSoundData is true) then the hash is of the // original binary file not he decoded PCM data Hash string // copy of the loaded data. subsequence calls to Load() will return a copy // of this data Data []byte // does the Data field consist of sound (PCM) data IsSoundData bool // callback function when cartridge has been successfully inserted/loaded. // not all cartridge formats support this // // !!TODO: all cartridge formats to support OnLoaded() callback (for completeness) OnLoaded func(cart mapper.CartMapper) error }
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
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.