763ee217d8
Former-commit-id: 50e5bb71a620ac138a880872ae1f13f1c0c0604c
58 lines
1.2 KiB
Rust
58 lines
1.2 KiB
Rust
pub mod arm7tdmi;
|
|
pub mod cartridge;
|
|
pub mod gpu;
|
|
pub mod sound;
|
|
pub mod sysbus;
|
|
pub use sysbus::SysBus;
|
|
pub mod interrupt;
|
|
pub mod iodev;
|
|
pub use interrupt::Interrupt;
|
|
pub use interrupt::IrqBitmask;
|
|
pub mod gba;
|
|
pub use gba::GameBoyAdvance;
|
|
pub mod dma;
|
|
pub mod keypad;
|
|
pub mod palette;
|
|
pub mod timer;
|
|
|
|
use crate::debugger;
|
|
|
|
use zip;
|
|
|
|
pub trait SyncedIoDevice {
|
|
fn step(&mut self, cycles: usize, sb: &mut SysBus, irqs: &mut IrqBitmask);
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub enum GBAError {
|
|
IO(::std::io::Error),
|
|
CpuError(arm7tdmi::CpuError),
|
|
DebuggerError(debugger::DebuggerError),
|
|
}
|
|
|
|
pub type GBAResult<T> = Result<T, GBAError>;
|
|
|
|
impl From<::std::io::Error> for GBAError {
|
|
fn from(err: ::std::io::Error) -> GBAError {
|
|
GBAError::IO(err)
|
|
}
|
|
}
|
|
|
|
impl From<arm7tdmi::CpuError> for GBAError {
|
|
fn from(err: arm7tdmi::CpuError) -> GBAError {
|
|
GBAError::CpuError(err)
|
|
}
|
|
}
|
|
|
|
impl From<debugger::DebuggerError> for GBAError {
|
|
fn from(err: debugger::DebuggerError) -> GBAError {
|
|
GBAError::DebuggerError(err)
|
|
}
|
|
}
|
|
|
|
impl From<zip::result::ZipError> for GBAError {
|
|
fn from(err: zip::result::ZipError) -> GBAError {
|
|
GBAError::IO(::std::io::Error::from(::std::io::ErrorKind::InvalidInput))
|
|
}
|
|
}
|