Make the debugger into an optional build option.
This module is written purely and always breaks when changes are being made into the 'core' module, so as long as I don't use it, I don't feel like maintaining it. Former-commit-id: f5b18ba54a27d22e8a195dd0912ec9c8f29fa830
This commit is contained in:
parent
b00fbfb38c
commit
3687161b98
|
@ -18,6 +18,7 @@ pub use bus::*;
|
||||||
|
|
||||||
pub use super::{AudioInterface, InputInterface, VideoInterface};
|
pub use super::{AudioInterface, InputInterface, VideoInterface};
|
||||||
|
|
||||||
|
#[cfg(rba_with_debugger)]
|
||||||
use crate::debugger;
|
use crate::debugger;
|
||||||
|
|
||||||
use zip;
|
use zip;
|
||||||
|
@ -26,6 +27,7 @@ use zip;
|
||||||
pub enum GBAError {
|
pub enum GBAError {
|
||||||
IO(::std::io::Error),
|
IO(::std::io::Error),
|
||||||
CpuError(arm7tdmi::CpuError),
|
CpuError(arm7tdmi::CpuError),
|
||||||
|
#[cfg(rba_with_debugger)]
|
||||||
DebuggerError(debugger::DebuggerError),
|
DebuggerError(debugger::DebuggerError),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +45,7 @@ impl From<arm7tdmi::CpuError> for GBAError {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(rba_with_debugger)]
|
||||||
impl From<debugger::DebuggerError> for GBAError {
|
impl From<debugger::DebuggerError> for GBAError {
|
||||||
fn from(err: debugger::DebuggerError) -> GBAError {
|
fn from(err: debugger::DebuggerError) -> GBAError {
|
||||||
GBAError::DebuggerError(err)
|
GBAError::DebuggerError(err)
|
||||||
|
|
|
@ -30,9 +30,11 @@ extern crate zip;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
pub mod util;
|
pub mod util;
|
||||||
pub mod core;
|
pub mod core;
|
||||||
pub mod debugger;
|
|
||||||
pub mod disass;
|
pub mod disass;
|
||||||
|
|
||||||
|
#[cfg(rba_with_debugger)]
|
||||||
|
pub mod debugger;
|
||||||
|
|
||||||
pub trait VideoInterface {
|
pub trait VideoInterface {
|
||||||
fn render(&mut self, buffer: &[u32]);
|
fn render(&mut self, buffer: &[u32]);
|
||||||
}
|
}
|
||||||
|
@ -54,6 +56,7 @@ pub mod prelude {
|
||||||
pub use super::core::arm7tdmi;
|
pub use super::core::arm7tdmi;
|
||||||
pub use super::core::cartridge::Cartridge;
|
pub use super::core::cartridge::Cartridge;
|
||||||
pub use super::core::{GBAError, GBAResult, GameBoyAdvance};
|
pub use super::core::{GBAError, GBAResult, GameBoyAdvance};
|
||||||
|
#[cfg(rba_with_debugger)]
|
||||||
pub use super::debugger::Debugger;
|
pub use super::debugger::Debugger;
|
||||||
pub use super::util::read_bin_file;
|
pub use super::util::read_bin_file;
|
||||||
pub use super::{AudioInterface, InputInterface, VideoInterface};
|
pub use super::{AudioInterface, InputInterface, VideoInterface};
|
||||||
|
|
|
@ -31,6 +31,7 @@ fn main() {
|
||||||
let matches = clap::App::from_yaml(yaml).get_matches();
|
let matches = clap::App::from_yaml(yaml).get_matches();
|
||||||
|
|
||||||
let skip_bios = matches.occurrences_of("skip_bios") != 0;
|
let skip_bios = matches.occurrences_of("skip_bios") != 0;
|
||||||
|
|
||||||
let debug = matches.occurrences_of("debug") != 0;
|
let debug = matches.occurrences_of("debug") != 0;
|
||||||
|
|
||||||
let bios_path = Path::new(matches.value_of("bios").unwrap_or_default());
|
let bios_path = Path::new(matches.value_of("bios").unwrap_or_default());
|
||||||
|
@ -63,12 +64,21 @@ fn main() {
|
||||||
let mut event_pump = sdl_context.event_pump().unwrap();
|
let mut event_pump = sdl_context.event_pump().unwrap();
|
||||||
|
|
||||||
if debug {
|
if debug {
|
||||||
|
#[cfg(rba_with_debugger)]
|
||||||
|
{
|
||||||
gba.cpu.set_verbose(true);
|
gba.cpu.set_verbose(true);
|
||||||
let mut debugger = Debugger::new(gba);
|
let mut debugger = Debugger::new(gba);
|
||||||
println!("starting debugger...");
|
println!("starting debugger...");
|
||||||
debugger.repl(matches.value_of("script_file")).unwrap();
|
debugger.repl(matches.value_of("script_file")).unwrap();
|
||||||
println!("ending debugger...");
|
println!("ending debugger...");
|
||||||
} else {
|
return;
|
||||||
|
}
|
||||||
|
#[cfg(not(rba_with_debugger))]
|
||||||
|
{
|
||||||
|
panic!("Please compile me with cfg(rba_with_debugger)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let frame_time = time::Duration::new(0, 1_000_000_000u32 / 60);
|
let frame_time = time::Duration::new(0, 1_000_000_000u32 / 60);
|
||||||
loop {
|
loop {
|
||||||
let start_time = time::Instant::now();
|
let start_time = time::Instant::now();
|
||||||
|
@ -87,6 +97,18 @@ fn main() {
|
||||||
} => {
|
} => {
|
||||||
frame_limiter = true;
|
frame_limiter = true;
|
||||||
}
|
}
|
||||||
|
#[cfg(rba_with_debugger)]
|
||||||
|
Event::KeyUp {
|
||||||
|
keycode: Some(Keycode::F1),
|
||||||
|
..
|
||||||
|
} => {
|
||||||
|
let mut debugger = Debugger::new(gba);
|
||||||
|
println!("starting debugger...");
|
||||||
|
debugger.repl(matches.value_of("script_file")).unwrap();
|
||||||
|
gba = debugger.gba;
|
||||||
|
println!("ending debugger...");
|
||||||
|
break;
|
||||||
|
}
|
||||||
Event::KeyDown {
|
Event::KeyDown {
|
||||||
keycode: Some(keycode),
|
keycode: Some(keycode),
|
||||||
..
|
..
|
||||||
|
@ -123,4 +145,3 @@ fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
Reference in a new issue