From 3ac13d0cf254427e467c53255e9ccbfe8d5354bd Mon Sep 17 00:00:00 2001 From: Simon Gellis Date: Mon, 14 Jul 2025 19:33:36 -0400 Subject: [PATCH] Use sync file dialog for screenshots --- src/window/game.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/window/game.rs b/src/window/game.rs index c987e3e..a62c995 100644 --- a/src/window/game.rs +++ b/src/window/game.rs @@ -311,12 +311,11 @@ impl GameWindow { self.client .send_command(EmulatorCommand::Screenshot(self.sim_id, tx)); let bytes = rx.await.context("Could not take screenshot")?; - let file = rfd::AsyncFileDialog::new() + let file = rfd::FileDialog::new() .add_filter("PNG images", &["png"]) .set_file_name("screenshot.png") - .save_file() - .await; - let Some(file) = file else { + .save_file(); + let Some(path) = file else { return Ok(None); }; if bytes.len() != 384 * 224 * 2 { @@ -328,10 +327,8 @@ impl GameWindow { let y = (index / 2) / 384; screencap.put_pixel(x as u32, y as u32, image::Luma([pixel])); } - screencap - .save(&file.path()) - .context("Could not save screenshot")?; - Ok(Some(file.path().display().to_string())) + screencap.save(&path).context("Could not save screenshot")?; + Ok(Some(path.display().to_string())) } fn show_options_menu(&mut self, ctx: &Context, ui: &mut Ui) {