From 50825f82e9f04418fdefd56707ef2ec50cddd5ed Mon Sep 17 00:00:00 2001 From: Luke Date: Sat, 22 Jun 2024 14:23:24 -0700 Subject: [PATCH] fix: don't log/error when sending frames while paused --- tetanes/src/nes/emulation.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tetanes/src/nes/emulation.rs b/tetanes/src/nes/emulation.rs index 30e7798c..c6ca8c7d 100644 --- a/tetanes/src/nes/emulation.rs +++ b/tetanes/src/nes/emulation.rs @@ -887,7 +887,11 @@ impl State { when: Instant::now() + park_timeout, }); if self.control_deck.is_running() && self.run_state.paused() { - self.send_frame(); + // Only send a frame if there's space, which means the renderer consumed previous + // frames and may need the current buffer to redraw for e.g. resizing + if let Ok(mut frame) = self.frame_tx.try_send_ref() { + self.control_deck.frame_buffer_into(&mut frame); + } } thread::park_timeout(park_timeout); return;