2020-01-16 17:49:13 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate serde;
|
|
|
|
|
2020-05-20 23:01:23 +01:00
|
|
|
#[macro_use]
|
|
|
|
extern crate lazy_static;
|
|
|
|
|
2019-12-28 13:59:35 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate debug_stub_derive;
|
|
|
|
|
2019-06-30 20:31:16 +01:00
|
|
|
#[macro_use]
|
|
|
|
extern crate enum_primitive_derive;
|
2022-09-04 23:25:37 +01:00
|
|
|
|
2019-08-02 22:18:59 +01:00
|
|
|
#[macro_use]
|
|
|
|
extern crate bitfield;
|
2019-08-13 19:57:45 +01:00
|
|
|
#[macro_use]
|
|
|
|
extern crate bitflags;
|
2019-06-30 20:31:16 +01:00
|
|
|
|
2020-01-30 23:47:52 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate log;
|
|
|
|
|
2020-05-01 15:58:15 +01:00
|
|
|
#[macro_use]
|
|
|
|
extern crate hex_literal;
|
|
|
|
|
2020-11-06 10:38:41 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate smart_default;
|
|
|
|
|
2020-10-06 07:46:14 +01:00
|
|
|
extern crate cfg_if;
|
|
|
|
|
2020-05-01 16:13:00 +01:00
|
|
|
use std::error::Error;
|
|
|
|
use std::fmt;
|
|
|
|
|
2022-09-04 21:54:44 +01:00
|
|
|
pub use arm7tdmi;
|
2020-11-23 22:45:07 +00:00
|
|
|
pub use arm7tdmi::disass;
|
2020-10-18 01:00:02 +01:00
|
|
|
mod bios;
|
2020-05-01 16:13:00 +01:00
|
|
|
pub mod cartridge;
|
|
|
|
pub mod gpu;
|
2020-10-03 20:09:38 +01:00
|
|
|
mod sched;
|
2020-05-01 16:13:00 +01:00
|
|
|
pub mod sound;
|
|
|
|
pub mod sysbus;
|
|
|
|
pub use sysbus::SysBus;
|
|
|
|
pub mod interrupt;
|
|
|
|
pub mod iodev;
|
|
|
|
pub use interrupt::Interrupt;
|
2020-05-25 23:46:05 +01:00
|
|
|
pub use interrupt::SharedInterruptFlags;
|
2020-05-01 16:13:00 +01:00
|
|
|
pub mod gba;
|
|
|
|
pub use gba::GameBoyAdvance;
|
|
|
|
pub mod dma;
|
|
|
|
pub mod keypad;
|
2020-10-24 13:54:31 +01:00
|
|
|
mod mgba_debug;
|
2020-05-20 23:01:23 +01:00
|
|
|
pub(crate) mod overrides;
|
2022-09-14 23:21:11 +01:00
|
|
|
pub mod timer;
|
2019-12-04 23:15:49 +00:00
|
|
|
|
2020-01-12 23:11:58 +00:00
|
|
|
#[cfg(feature = "debugger")]
|
2019-12-29 21:37:23 +00:00
|
|
|
pub mod debugger;
|
|
|
|
|
2020-05-01 16:13:00 +01:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum GBAError {
|
|
|
|
IO(::std::io::Error),
|
|
|
|
CartridgeLoadError(String),
|
|
|
|
#[cfg(feature = "debugger")]
|
|
|
|
DebuggerError(debugger::DebuggerError),
|
|
|
|
}
|
|
|
|
|
|
|
|
impl fmt::Display for GBAError {
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
write!(f, "error: {:?}", self)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Error for GBAError {
|
|
|
|
fn description(&self) -> &str {
|
|
|
|
"emulator error"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub type GBAResult<T> = Result<T, GBAError>;
|
|
|
|
|
|
|
|
impl From<::std::io::Error> for GBAError {
|
|
|
|
fn from(err: ::std::io::Error) -> GBAError {
|
|
|
|
GBAError::IO(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(feature = "debugger")]
|
|
|
|
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))
|
2020-01-16 23:28:11 +00:00
|
|
|
}
|
2019-12-04 23:15:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub mod prelude {
|
2020-05-01 16:13:00 +01:00
|
|
|
pub use super::cartridge::{Cartridge, GamepakBuilder};
|
2020-01-12 23:11:58 +00:00
|
|
|
#[cfg(feature = "debugger")]
|
2019-12-04 23:15:49 +00:00
|
|
|
pub use super::debugger::Debugger;
|
2020-05-01 16:13:00 +01:00
|
|
|
pub use super::gpu::{DISPLAY_HEIGHT, DISPLAY_WIDTH};
|
2022-09-12 23:50:50 +01:00
|
|
|
pub use super::sound::interface::{
|
|
|
|
AudioInterface, DynAudioInterface, NullAudio, SimpleAudioInterface,
|
|
|
|
};
|
2020-05-01 16:13:00 +01:00
|
|
|
pub use super::{GBAError, GBAResult, GameBoyAdvance};
|
2022-09-14 23:21:11 +01:00
|
|
|
pub use arm7tdmi;
|
|
|
|
pub use arm7tdmi::memory::{Addr, BusIO, MemoryAccess, MemoryAccessWidth, MemoryInterface};
|
2022-09-04 21:54:44 +01:00
|
|
|
pub use rustboyadvance_utils::{read_bin_file, write_bin_file};
|
2019-12-04 23:15:49 +00:00
|
|
|
}
|