Refactor rustboyadvance-core crate directory structure
Former-commit-id: 1aad71d283f7ec5a0f0328f9b683f51e459ae56f Former-commit-id: 42bb30d300c17bace976d106f6da1aca8c0d7643
This commit is contained in:
parent
3ac1d57e04
commit
ef3f39defc
|
@ -2,7 +2,7 @@ use jni::objects::*;
|
||||||
use jni::sys::*;
|
use jni::sys::*;
|
||||||
use jni::JNIEnv;
|
use jni::JNIEnv;
|
||||||
|
|
||||||
use rustboyadvance_core::core::cartridge;
|
use rustboyadvance_core::cartridge;
|
||||||
|
|
||||||
fn parse_rom_header(env: &JNIEnv, barr: jbyteArray) -> cartridge::header::CartridgeHeader {
|
fn parse_rom_header(env: &JNIEnv, barr: jbyteArray) -> cartridge::header::CartridgeHeader {
|
||||||
let rom_data = env.convert_byte_array(barr).unwrap();
|
let rom_data = env.convert_byte_array(barr).unwrap();
|
||||||
|
|
|
@ -7,7 +7,7 @@ use std::time;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate clap;
|
extern crate clap;
|
||||||
|
|
||||||
use rustboyadvance_core::core::keypad;
|
use rustboyadvance_core::keypad;
|
||||||
use rustboyadvance_core::prelude::*;
|
use rustboyadvance_core::prelude::*;
|
||||||
use rustboyadvance_core::util::FpsCounter;
|
use rustboyadvance_core::util::FpsCounter;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use sdl2::keyboard::Keycode;
|
use sdl2::keyboard::Keycode;
|
||||||
|
|
||||||
use rustboyadvance_core::core::keypad as gba_keypad;
|
use rustboyadvance_core::keypad as gba_keypad;
|
||||||
use rustboyadvance_core::InputInterface;
|
use rustboyadvance_core::InputInterface;
|
||||||
|
|
||||||
use bit;
|
use bit;
|
||||||
|
|
|
@ -5,7 +5,7 @@ use sdl2::keyboard::Keycode;
|
||||||
use sdl2::messagebox::*;
|
use sdl2::messagebox::*;
|
||||||
use sdl2::pixels::Color;
|
use sdl2::pixels::Color;
|
||||||
use sdl2::rect::Rect;
|
use sdl2::rect::Rect;
|
||||||
use sdl2::render::{Texture, WindowCanvas};
|
use sdl2::render::WindowCanvas;
|
||||||
|
|
||||||
use sdl2::EventPump;
|
use sdl2::EventPump;
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ use audio::create_audio_player;
|
||||||
use input::create_input;
|
use input::create_input;
|
||||||
use video::{create_video_interface, SCREEN_HEIGHT, SCREEN_WIDTH};
|
use video::{create_video_interface, SCREEN_HEIGHT, SCREEN_WIDTH};
|
||||||
|
|
||||||
use rustboyadvance_core::core::cartridge::BackupType;
|
use rustboyadvance_core::cartridge::BackupType;
|
||||||
use rustboyadvance_core::prelude::*;
|
use rustboyadvance_core::prelude::*;
|
||||||
use rustboyadvance_core::util::spawn_and_run_gdb_server;
|
use rustboyadvance_core::util::spawn_and_run_gdb_server;
|
||||||
use rustboyadvance_core::util::FpsCounter;
|
use rustboyadvance_core::util::FpsCounter;
|
||||||
|
|
|
@ -3,7 +3,7 @@ use sdl2::rect::Rect;
|
||||||
use sdl2::render::{Texture, TextureCreator, WindowCanvas};
|
use sdl2::render::{Texture, TextureCreator, WindowCanvas};
|
||||||
use sdl2::video::WindowContext;
|
use sdl2::video::WindowContext;
|
||||||
|
|
||||||
use rustboyadvance_core::core::gpu::{DISPLAY_HEIGHT, DISPLAY_WIDTH};
|
use rustboyadvance_core::gpu::{DISPLAY_HEIGHT, DISPLAY_WIDTH};
|
||||||
use rustboyadvance_core::VideoInterface;
|
use rustboyadvance_core::VideoInterface;
|
||||||
|
|
||||||
pub const SCREEN_WIDTH: u32 = DISPLAY_WIDTH as u32;
|
pub const SCREEN_WIDTH: u32 = DISPLAY_WIDTH as u32;
|
||||||
|
|
|
@ -9,7 +9,7 @@ use js_sys::Float32Array;
|
||||||
use web_sys::AudioContext;
|
use web_sys::AudioContext;
|
||||||
use web_sys::CanvasRenderingContext2d;
|
use web_sys::CanvasRenderingContext2d;
|
||||||
|
|
||||||
use rustboyadvance_core::core::keypad as gba_keypad;
|
use rustboyadvance_core::keypad as gba_keypad;
|
||||||
use rustboyadvance_core::prelude::*;
|
use rustboyadvance_core::prelude::*;
|
||||||
use rustboyadvance_core::util::audio::AudioRingBuffer;
|
use rustboyadvance_core::util::audio::AudioRingBuffer;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ extern crate log;
|
||||||
|
|
||||||
use wasm_bindgen_console_logger::DEFAULT_LOGGER;
|
use wasm_bindgen_console_logger::DEFAULT_LOGGER;
|
||||||
|
|
||||||
use rustboyadvance_core::core::cartridge;
|
use rustboyadvance_core::cartridge;
|
||||||
|
|
||||||
pub mod emulator;
|
pub mod emulator;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ use crate::bit::BitIndex;
|
||||||
use super::{ArmFormat, ArmInstruction};
|
use super::{ArmFormat, ArmInstruction};
|
||||||
|
|
||||||
use super::{AluOpCode, ArmCond, ArmHalfwordTransferType};
|
use super::{AluOpCode, ArmCond, ArmHalfwordTransferType};
|
||||||
use crate::core::arm7tdmi::*;
|
use crate::arm7tdmi::*;
|
||||||
|
|
||||||
impl fmt::Display for ArmCond {
|
impl fmt::Display for ArmCond {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
@ -1,11 +1,11 @@
|
||||||
use crate::bit::BitIndex;
|
use crate::bit::BitIndex;
|
||||||
|
|
||||||
use super::super::alu::*;
|
use super::super::alu::*;
|
||||||
use crate::core::arm7tdmi::psr::RegPSR;
|
use crate::arm7tdmi::psr::RegPSR;
|
||||||
use crate::core::arm7tdmi::CpuAction;
|
use crate::arm7tdmi::CpuAction;
|
||||||
use crate::core::arm7tdmi::{Addr, Core, CpuMode, CpuState, REG_LR, REG_PC};
|
use crate::arm7tdmi::{Addr, Core, CpuMode, CpuState, REG_LR, REG_PC};
|
||||||
use crate::core::sysbus::SysBus;
|
use crate::sysbus::SysBus;
|
||||||
use crate::core::Bus;
|
use crate::Bus;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
|
@ -4,7 +4,7 @@ pub mod exec;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use super::alu::*;
|
use super::alu::*;
|
||||||
use crate::core::arm7tdmi::{Addr, InstructionDecoder};
|
use crate::arm7tdmi::{Addr, InstructionDecoder};
|
||||||
|
|
||||||
use crate::bit::BitIndex;
|
use crate::bit::BitIndex;
|
||||||
use crate::byteorder::{LittleEndian, ReadBytesExt};
|
use crate::byteorder::{LittleEndian, ReadBytesExt};
|
||||||
|
@ -367,8 +367,8 @@ impl ArmInstruction {
|
||||||
// /// All instructions constants were generated using an ARM assembler.
|
// /// All instructions constants were generated using an ARM assembler.
|
||||||
// mod tests {
|
// mod tests {
|
||||||
// use super::*;
|
// use super::*;
|
||||||
// use crate::core::arm7tdmi::*;
|
// use crate::arm7tdmi::*;
|
||||||
// use crate::core::sysbus::BoxedMemory;
|
// use crate::sysbus::BoxedMemory;
|
||||||
|
|
||||||
// #[test]
|
// #[test]
|
||||||
// fn swi() {
|
// fn swi() {
|
|
@ -25,8 +25,8 @@ use super::CpuAction;
|
||||||
use super::DecodedInstruction;
|
use super::DecodedInstruction;
|
||||||
use super::{arm::*, psr::RegPSR, thumb::ThumbInstruction, Addr, CpuMode, CpuState};
|
use super::{arm::*, psr::RegPSR, thumb::ThumbInstruction, Addr, CpuMode, CpuState};
|
||||||
|
|
||||||
use crate::core::bus::Bus;
|
use crate::bus::Bus;
|
||||||
use crate::core::sysbus::{MemoryAccessType::*, MemoryAccessWidth::*, SysBus};
|
use crate::sysbus::{MemoryAccessType::*, MemoryAccessWidth::*, SysBus};
|
||||||
|
|
||||||
use bit::BitIndex;
|
use bit::BitIndex;
|
||||||
use num::FromPrimitive;
|
use num::FromPrimitive;
|
|
@ -21,7 +21,7 @@ pub const REG_PC: usize = 15;
|
||||||
pub const REG_LR: usize = 14;
|
pub const REG_LR: usize = 14;
|
||||||
pub const REG_SP: usize = 13;
|
pub const REG_SP: usize = 13;
|
||||||
|
|
||||||
pub(self) use crate::core::Addr;
|
pub(self) use crate::Addr;
|
||||||
|
|
||||||
pub enum CpuAction {
|
pub enum CpuAction {
|
||||||
AdvancePC,
|
AdvancePC,
|
|
@ -5,7 +5,7 @@ use crate::bit::BitIndex;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
#[cfg(feature = "debugger")]
|
#[cfg(feature = "debugger")]
|
||||||
use crate::core::arm7tdmi::*;
|
use crate::arm7tdmi::*;
|
||||||
|
|
||||||
#[cfg(feature = "debugger")]
|
#[cfg(feature = "debugger")]
|
||||||
impl ThumbInstruction {
|
impl ThumbInstruction {
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::core::arm7tdmi::*;
|
use crate::arm7tdmi::*;
|
||||||
use crate::core::sysbus::SysBus;
|
use crate::sysbus::SysBus;
|
||||||
use crate::core::Bus;
|
use crate::Bus;
|
||||||
|
|
||||||
use crate::bit::BitIndex;
|
use crate::bit::BitIndex;
|
||||||
|
|
|
@ -321,8 +321,8 @@ impl ThumbInstruction {
|
||||||
// mod tests {
|
// mod tests {
|
||||||
// use super::super::Core;
|
// use super::super::Core;
|
||||||
// use super::*;
|
// use super::*;
|
||||||
// use crate::core::sysbus::BoxedMemory;
|
// use crate::sysbus::BoxedMemory;
|
||||||
// use crate::core::Bus;
|
// use crate::Bus;
|
||||||
|
|
||||||
// #[test]
|
// #[test]
|
||||||
// fn mov_low_reg() {
|
// fn mov_low_reg() {
|
|
@ -1,68 +0,0 @@
|
||||||
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 bus;
|
|
||||||
pub mod dma;
|
|
||||||
pub mod keypad;
|
|
||||||
pub mod timer;
|
|
||||||
pub use bus::*;
|
|
||||||
|
|
||||||
pub use super::{AudioInterface, InputInterface, VideoInterface};
|
|
||||||
|
|
||||||
#[cfg(feature = "debugger")]
|
|
||||||
use crate::debugger;
|
|
||||||
|
|
||||||
use zip;
|
|
||||||
|
|
||||||
use std::error::Error;
|
|
||||||
use std::fmt;
|
|
||||||
|
|
||||||
#[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))
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,12 +2,12 @@ use std::path::Path;
|
||||||
use std::sync::atomic::Ordering;
|
use std::sync::atomic::Ordering;
|
||||||
use std::time;
|
use std::time;
|
||||||
|
|
||||||
use crate::core::arm7tdmi::arm::ArmInstruction;
|
use crate::arm7tdmi::arm::ArmInstruction;
|
||||||
use crate::core::arm7tdmi::thumb::ThumbInstruction;
|
use crate::arm7tdmi::thumb::ThumbInstruction;
|
||||||
use crate::core::arm7tdmi::CpuState;
|
use crate::arm7tdmi::CpuState;
|
||||||
use crate::core::{Addr, Bus};
|
|
||||||
use crate::disass::Disassembler;
|
use crate::disass::Disassembler;
|
||||||
use crate::util::{read_bin_file, write_bin_file};
|
use crate::util::{read_bin_file, write_bin_file};
|
||||||
|
use crate::{Addr, Bus};
|
||||||
|
|
||||||
// use super::palette_view::create_palette_view;
|
// use super::palette_view::create_palette_view;
|
||||||
// use super::tile_view::create_tile_view;
|
// use super::tile_view::create_tile_view;
|
||||||
|
|
|
@ -6,8 +6,8 @@ use rustyline::Editor;
|
||||||
|
|
||||||
use colored::*;
|
use colored::*;
|
||||||
|
|
||||||
use super::core::GameBoyAdvance;
|
use super::GameBoyAdvance;
|
||||||
use super::core::{Addr, Bus};
|
use super::{Addr, Bus};
|
||||||
|
|
||||||
mod parser;
|
mod parser;
|
||||||
use parser::{parse_expr, DerefType, Expr, Value};
|
use parser::{parse_expr, DerefType, Expr, Value};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// use sdl2::rect::{Point, Rect};
|
// use sdl2::rect::{Point, Rect};
|
||||||
// use sdl2::render::Canvas;
|
// use sdl2::render::Canvas;
|
||||||
|
|
||||||
// use crate::core::palette::{Palette, Rgb15};
|
// use crate::palette::{Palette, Rgb15};
|
||||||
|
|
||||||
// const PALETTE_RECT_WIDTH: u32 = 20;
|
// const PALETTE_RECT_WIDTH: u32 = 20;
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
// use sdl2::rect::{Point, Rect};
|
// use sdl2::rect::{Point, Rect};
|
||||||
// use sdl2::render::Canvas;
|
// use sdl2::render::Canvas;
|
||||||
|
|
||||||
// use crate::core::gba::GameBoyAdvance;
|
// use crate::gba::GameBoyAdvance;
|
||||||
// use crate::core::gpu::PixelFormat;
|
// use crate::gpu::PixelFormat;
|
||||||
|
|
||||||
// fn draw_tile(
|
// fn draw_tile(
|
||||||
// gba: &GameBoyAdvance,
|
// gba: &GameBoyAdvance,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
use super::core::arm7tdmi::InstructionDecoder;
|
use super::arm7tdmi::InstructionDecoder;
|
||||||
use super::core::Addr;
|
use super::Addr;
|
||||||
|
|
||||||
pub struct Disassembler<'a, D>
|
pub struct Disassembler<'a, D>
|
||||||
where
|
where
|
||||||
|
|
|
@ -13,7 +13,7 @@ use super::iodev::*;
|
||||||
use super::sound::SoundController;
|
use super::sound::SoundController;
|
||||||
use super::sysbus::SysBus;
|
use super::sysbus::SysBus;
|
||||||
|
|
||||||
use super::super::{AudioInterface, InputInterface, VideoInterface};
|
use super::{AudioInterface, InputInterface, VideoInterface};
|
||||||
|
|
||||||
pub struct GameBoyAdvance {
|
pub struct GameBoyAdvance {
|
||||||
pub sysbus: Box<SysBus>,
|
pub sysbus: Box<SysBus>,
|
|
@ -1,9 +1,9 @@
|
||||||
use super::core::arm7tdmi::CpuState;
|
use super::arm7tdmi::CpuState;
|
||||||
use super::core::interrupt::*;
|
|
||||||
use super::core::iodev::IoDevices;
|
|
||||||
use super::core::sysbus::SysBus;
|
|
||||||
use super::core::Bus;
|
|
||||||
use super::core::GameBoyAdvance;
|
use super::core::GameBoyAdvance;
|
||||||
|
use super::interrupt::*;
|
||||||
|
use super::iodev::IoDevices;
|
||||||
|
use super::sysbus::SysBus;
|
||||||
|
use super::Bus;
|
||||||
|
|
||||||
use byteorder::{LittleEndian, ReadBytesExt};
|
use byteorder::{LittleEndian, ReadBytesExt};
|
||||||
use gdbstub::{Access, Target, TargetState};
|
use gdbstub::{Access, Target, TargetState};
|
||||||
|
|
|
@ -4,10 +4,10 @@ use std::rc::Rc;
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use super::super::VideoInterface;
|
|
||||||
use super::interrupt::IrqBitmask;
|
use super::interrupt::IrqBitmask;
|
||||||
use super::sysbus::{BoxedMemory, SysBus};
|
use super::sysbus::{BoxedMemory, SysBus};
|
||||||
use super::Bus;
|
use super::Bus;
|
||||||
|
use super::VideoInterface;
|
||||||
|
|
||||||
use crate::bitfield::Bit;
|
use crate::bitfield::Bit;
|
||||||
use crate::num::FromPrimitive;
|
use crate::num::FromPrimitive;
|
|
@ -6,7 +6,7 @@ use super::super::Rgb15;
|
||||||
|
|
||||||
use super::{utils, SCREEN_VIEWPORT};
|
use super::{utils, SCREEN_VIEWPORT};
|
||||||
|
|
||||||
use crate::core::Bus;
|
use crate::Bus;
|
||||||
|
|
||||||
impl Gpu {
|
impl Gpu {
|
||||||
pub(in super::super) fn render_mode3(&mut self, bg: usize) {
|
pub(in super::super) fn render_mode3(&mut self, bg: usize) {
|
|
@ -5,7 +5,7 @@ use super::super::Rgb15;
|
||||||
use super::super::{Gpu, PixelFormat, SCREEN_BLOCK_SIZE};
|
use super::super::{Gpu, PixelFormat, SCREEN_BLOCK_SIZE};
|
||||||
use super::{utils, ViewPort};
|
use super::{utils, ViewPort};
|
||||||
|
|
||||||
use crate::core::Bus;
|
use crate::Bus;
|
||||||
|
|
||||||
impl Gpu {
|
impl Gpu {
|
||||||
pub(in super::super) fn render_reg_bg(&mut self, bg: usize) {
|
pub(in super::super) fn render_reg_bg(&mut self, bg: usize) {
|
|
@ -23,10 +23,31 @@ extern crate log;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate hex_literal;
|
extern crate hex_literal;
|
||||||
|
|
||||||
|
use zip;
|
||||||
|
|
||||||
|
use std::error::Error;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
pub mod util;
|
pub mod util;
|
||||||
pub mod core;
|
pub mod arm7tdmi;
|
||||||
|
pub mod cartridge;
|
||||||
pub mod disass;
|
pub mod disass;
|
||||||
|
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 bus;
|
||||||
|
pub mod dma;
|
||||||
|
pub mod keypad;
|
||||||
|
pub mod timer;
|
||||||
|
pub use bus::*;
|
||||||
|
|
||||||
#[cfg(feature = "gdb")]
|
#[cfg(feature = "gdb")]
|
||||||
pub mod gdb;
|
pub mod gdb;
|
||||||
|
@ -55,18 +76,60 @@ pub trait AudioInterface {
|
||||||
|
|
||||||
pub trait InputInterface {
|
pub trait InputInterface {
|
||||||
fn poll(&mut self) -> u16 {
|
fn poll(&mut self) -> u16 {
|
||||||
core::keypad::KEYINPUT_ALL_RELEASED
|
keypad::KEYINPUT_ALL_RELEASED
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "debugger")]
|
||||||
|
#[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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
pub use super::core::arm7tdmi;
|
pub use super::arm7tdmi;
|
||||||
pub use super::core::cartridge::{Cartridge, GamepakBuilder};
|
pub use super::cartridge::{Cartridge, GamepakBuilder};
|
||||||
pub use super::core::gpu::{DISPLAY_HEIGHT, DISPLAY_WIDTH};
|
|
||||||
pub use super::core::Bus;
|
|
||||||
pub use super::core::{GBAError, GBAResult, GameBoyAdvance};
|
|
||||||
#[cfg(feature = "debugger")]
|
#[cfg(feature = "debugger")]
|
||||||
pub use super::debugger::Debugger;
|
pub use super::debugger::Debugger;
|
||||||
|
pub use super::gpu::{DISPLAY_HEIGHT, DISPLAY_WIDTH};
|
||||||
pub use super::util::{read_bin_file, write_bin_file};
|
pub use super::util::{read_bin_file, write_bin_file};
|
||||||
|
pub use super::Bus;
|
||||||
pub use super::{AudioInterface, InputInterface, StereoSample, VideoInterface};
|
pub use super::{AudioInterface, InputInterface, StereoSample, VideoInterface};
|
||||||
|
pub use super::{GBAError, GBAResult, GameBoyAdvance};
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ fn now() -> Instant {
|
||||||
instant::Instant::now()
|
instant::Instant::now()
|
||||||
}
|
}
|
||||||
|
|
||||||
use crate::core::GameBoyAdvance;
|
use crate::GameBoyAdvance;
|
||||||
#[cfg(feature = "gdb")]
|
#[cfg(feature = "gdb")]
|
||||||
use gdbstub;
|
use gdbstub;
|
||||||
#[cfg(feature = "gdb")]
|
#[cfg(feature = "gdb")]
|
||||||
|
|
Reference in a new issue