[][src]Trait spectrusty_formats::snapshot::SnapshotLoader

pub trait SnapshotLoader {
    type Error: Into<Box<dyn Error + Send + Sync + 'static>>;
    pub fn select_model(
        &mut self,
        model: ComputerModel,
        extensions: Extensions,
        border: BorderColor,
        issue: ReadEarMode
    ) -> Result<(), Self::Error>;
pub fn read_into_memory<R: Read>(
        &mut self,
        range: MemoryRange,
        reader: R
    ) -> Result<(), ZxMemoryError>;
pub fn assign_cpu(&mut self, cpu: CpuModel);
pub fn set_clock(&mut self, tstates: FTs);
pub fn write_port(&mut self, port: u16, data: u8); pub fn select_joystick(&mut self, _joystick: JoystickModel) { ... }
pub fn setup_ay(
        &mut self,
        _choice: Ay3_891xDevice,
        _reg_selected: AyRegister,
        _reg_values: &[u8; 16]
    ) { ... }
pub fn interface1_rom_paged_in(&mut self) { ... }
pub fn plus_d_rom_paged_in(&mut self) { ... }
pub fn tr_dos_rom_paged_in(&mut self) { ... } }

Implement this trait to be able to load snapshot from files supported by this crate.

The method SnapshotLoader::select_model is always being called first. Then the other methods are being called in unspecified order. Not every method is always being called though. Some methods are not called when it makes no sense in the context of the loaded snapshot.

Associated Types

type Error: Into<Box<dyn Error + Send + Sync + 'static>>

The error type returned by the SnapshotLoader::select_model method.

Loading content...

Required methods

pub fn select_model(
    &mut self,
    model: ComputerModel,
    extensions: Extensions,
    border: BorderColor,
    issue: ReadEarMode
) -> Result<(), Self::Error>

Should create an instance of an emulated model from the given model and other arguments.

If the model can not be emulated this method should return an Err(Self::Error).

This method is always being called first, before any other methods in this trait.

pub fn read_into_memory<R: Read>(
    &mut self,
    range: MemoryRange,
    reader: R
) -> Result<(), ZxMemoryError>

Should read a memory chunk from the given reader source according to the specified range.

This method should not fail.

pub fn assign_cpu(&mut self, cpu: CpuModel)

Should attach an instance of the cpu.

This method should not fail.

pub fn set_clock(&mut self, tstates: FTs)

Should set the frame T-states clock to the value given in tstates.

This method should not fail.

pub fn write_port(&mut self, port: u16, data: u8)

Should emulate sending the data to the given port of the main chipset.

This method should not fail.

Loading content...

Provided methods

pub fn select_joystick(&mut self, _joystick: JoystickModel)

Should select the given joystick model if one is available.

This method should not fail. Default implementation does nothing.

pub fn setup_ay(
    &mut self,
    _choice: Ay3_891xDevice,
    _reg_selected: AyRegister,
    _reg_values: &[u8; 16]
)

Should attach the amulated instance of AY-3-891x sound processor and initialize it from the given arguments if one is available.

This method is called n-times if more than one AY chipset is attached and there are different register values for each of them.

This method should not fail. Default implementation does nothing.

pub fn interface1_rom_paged_in(&mut self)

Should page in the Interface 1 ROM if one is available.

This method should not fail. If an Interface 1 is not supported SnapshotLoader::select_model may return with an error if Extensions would indicate such support is being requested.

Panics

The default implementation always panics.

pub fn plus_d_rom_paged_in(&mut self)

Should page in the MGT +D ROM if one is available.

This method should not fail. If an MGT +D is not supported SnapshotLoader::select_model may return with an error if Extensions would indicate such support is being requested.

Panics

The default implementation always panics.

pub fn tr_dos_rom_paged_in(&mut self)

Should page in the TR-DOS ROM if one is available.

This method should not fail. If an TR-DOS is not supported SnapshotLoader::select_model may return with an error if Extensions would indicate such support is being requested.

Panics

The default implementation always panics.

Loading content...

Implementors

Loading content...