1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
mod cpsr;
mod cpu_mode;
mod gba;
mod instructions;
mod rom;
pub mod utils;

use alloc::boxed::Box;

/// Wrapper around the GBA emulator struct to prevent dereferencing the Box
/// Since it's too big for the stack
pub struct GBA {
  internal_gba: Box<gba::GBA>,
}
impl GBA {
  pub fn new(log_level: LogLevel, bios_file: core::option::Option<&[u8]>, print_fn:Option<fn(&str) -> ()>) -> Self {
    GBA { internal_gba: gba::GBA::new(log_level, bios_file, print_fn) }
  }
}
impl core::ops::Deref for GBA {
  type Target = gba::GBA;

  fn deref(&self) -> &Self::Target {
    &*self.internal_gba
  }
}
impl core::ops::DerefMut for GBA {
  fn deref_mut(&mut self) -> &mut Self::Target {
    &mut *self.internal_gba
  }
}

pub use gba::LogLevel;