Improve flow of command-line debugging

This commit is contained in:
2025-01-05 11:24:59 -05:00
parent d6eb8ec7ef
commit 6fd8d8f5cf
5 changed files with 40 additions and 8 deletions
+12
View File
@@ -92,6 +92,7 @@ pub struct EmulatorBuilder {
state: Arc<Atomic<EmulatorState>>,
audio_on: Arc<[AtomicBool; 2]>,
linked: Arc<AtomicBool>,
start_paused: bool,
}
impl EmulatorBuilder {
@@ -107,6 +108,7 @@ impl EmulatorBuilder {
state: Arc::new(Atomic::new(EmulatorState::Paused)),
audio_on: Arc::new([AtomicBool::new(true), AtomicBool::new(true)]),
linked: Arc::new(AtomicBool::new(false)),
start_paused: false,
};
let client = EmulatorClient {
queue,
@@ -125,6 +127,13 @@ impl EmulatorBuilder {
}
}
pub fn start_paused(self, paused: bool) -> Self {
Self {
start_paused: paused,
..self
}
}
pub fn build(self) -> Result<Emulator> {
let mut emulator = Emulator::new(
self.commands,
@@ -136,6 +145,9 @@ impl EmulatorBuilder {
if let Some(path) = self.rom {
emulator.load_cart(SimId::Player1, &path)?;
}
if self.start_paused {
emulator.pause_sims()?;
}
Ok(emulator)
}
}