Support playing roms by dragging into window

This commit is contained in:
2026-08-15 00:18:39 -04:00
parent 4f3dc85bb4
commit 1d4c6c9e88
3 changed files with 19 additions and 1 deletions
+11
View File
@@ -1,5 +1,6 @@
use std::{
ops::{Deref, DerefMut},
path::PathBuf,
sync::{Arc, Mutex, atomic::AtomicBool, mpsc},
time::Duration,
};
@@ -214,6 +215,10 @@ impl GameWindow {
self.handle_event(viewport_id, |window| window.handle_gamepad_event(event))
}
pub fn handle_dropped_file(&mut self, viewport_id: ViewportId, path: PathBuf) -> bool {
self.handle_event(viewport_id, |window| window.handle_dropped_file(path))
}
fn handle_event<F, R>(&mut self, viewport_id: ViewportId, cb: F) -> R
where
F: FnOnce(&mut dyn AppWindow) -> R,
@@ -765,6 +770,12 @@ impl AppWindow for GameWindow {
}
self.file_picker.set_window(args.window);
}
fn handle_dropped_file(&mut self, path: PathBuf) -> bool {
self.client
.send_command(EmulatorCommand::LoadGame(self.sim_id, path));
true
}
}
impl Drop for GameWindow {