mirror of
https://github.com/transistorfet/moa.git
synced 2024-11-21 19:30:52 +00:00
Fixed occasional error with debug, and modified frame swapper
This commit is contained in:
parent
f08c4fc4a9
commit
825331df39
@ -92,6 +92,10 @@ impl FrameSwapper {
|
||||
pub fn to_boxed(swapper: FrameSwapper) -> Box<dyn WindowUpdater> {
|
||||
Box::new(swapper)
|
||||
}
|
||||
|
||||
pub fn swap(&mut self) {
|
||||
std::mem::swap(&mut self.current.lock().unwrap().bitmap, &mut self.previous.lock().unwrap().bitmap);
|
||||
}
|
||||
}
|
||||
|
||||
impl WindowUpdater for FrameSwapper {
|
||||
@ -104,8 +108,6 @@ impl WindowUpdater for FrameSwapper {
|
||||
}
|
||||
|
||||
fn update_frame(&mut self, width: u32, _height: u32, bitmap: &mut [u32]) {
|
||||
std::mem::swap(&mut self.current.lock().unwrap().bitmap, &mut self.previous.lock().unwrap().bitmap);
|
||||
|
||||
if let Ok(frame) = self.previous.lock() {
|
||||
for y in 0..frame.height {
|
||||
for x in 0..frame.width {
|
||||
|
@ -652,6 +652,7 @@ impl Steppable for Ym7101 {
|
||||
system.get_interrupt_controller().set(true, 6, 30)?;
|
||||
}
|
||||
|
||||
self.swapper.swap();
|
||||
let mut frame = self.swapper.current.lock().unwrap();
|
||||
self.state.draw_frame(&mut frame);
|
||||
|
||||
|
@ -154,7 +154,9 @@ impl System {
|
||||
if self.debug_enabled.get() {
|
||||
let top = self.event_queue[self.event_queue.len() - 1].device.clone();
|
||||
if top.borrow_mut().as_debuggable().map(|debug| debug.debugging_enabled()).unwrap_or(false) {
|
||||
self.debugger.borrow_mut().run_debugger(&self, top.clone()).unwrap();
|
||||
if let Err(err) = self.debugger.borrow_mut().run_debugger(&self, top.clone()) {
|
||||
println!("Error: {:?}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user