Save and load SRAM at all the right times
This commit is contained in:
+11
-2
@@ -1,4 +1,4 @@
|
||||
use std::{collections::HashSet, num::NonZero, sync::Arc, thread};
|
||||
use std::{collections::HashSet, num::NonZero, sync::Arc, thread, time::Duration};
|
||||
|
||||
use egui::{
|
||||
ahash::{HashMap, HashMapExt},
|
||||
@@ -15,7 +15,7 @@ use winit::{
|
||||
|
||||
use crate::{
|
||||
controller::ControllerManager,
|
||||
emulator::{EmulatorClient, SimId},
|
||||
emulator::{EmulatorClient, EmulatorCommand, SimId},
|
||||
input::MappingProvider,
|
||||
window::{AppWindow, GameWindow, InputWindow},
|
||||
};
|
||||
@@ -170,6 +170,15 @@ impl ApplicationHandler<UserEvent> for Application {
|
||||
viewport.window.request_redraw();
|
||||
}
|
||||
}
|
||||
|
||||
fn exiting(&mut self, _event_loop: &ActiveEventLoop) {
|
||||
let (sender, receiver) = oneshot::channel();
|
||||
if self.client.send_command(EmulatorCommand::Exit(sender)) {
|
||||
if let Err(err) = receiver.recv_timeout(Duration::from_secs(5)) {
|
||||
eprintln!("could not gracefully exit: {}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct Viewport {
|
||||
|
||||
Reference in New Issue
Block a user