macos gui: handle fallible

This commit is contained in:
Alex Janka 2024-06-16 11:53:00 +10:00
parent 24bcdd1bb6
commit 861b8c2996
2 changed files with 22 additions and 3 deletions

View file

@ -301,7 +301,14 @@ impl CacaoWindowManager {
if state {
let is_running = self.is_emulator_running();
if is_running {
let new_layer_window = new_layer_window(self);
let new_layer_window: Sender<RendererMessage<[u8; 4]>> =
match new_layer_window(self) {
Ok(t) => t,
Err(e) => {
log::error!("couldn't create tile window: {e:?}");
return;
}
};
if let Some(ref handles) = self.handles {
handles
.sender
@ -316,7 +323,13 @@ impl CacaoWindowManager {
if state {
let is_running = self.is_emulator_running();
if is_running {
let new_tile_window = new_tile_window(self);
let new_tile_window = match new_tile_window(self) {
Ok(t) => t,
Err(e) => {
log::error!("couldn't create tile window: {e:?}");
return;
}
};
if let Some(ref handles) = self.handles {
handles
.sender

View file

@ -170,7 +170,13 @@ impl Dispatcher for TwincUiApp {
let (output, stream) = audio::create_output(false);
let mut window_manager = self.current_game.write().unwrap();
window_manager.update_handles(sender, stream);
let mut core = frontend_common::run(prepared, &mut *window_manager, output);
let mut core = match frontend_common::run(prepared, &mut *window_manager, output) {
Ok(c) => c,
Err(e) => {
log::error!("couldn't create emulator core: {e:?}");
return;
}
};
let handle = std::thread::Builder::new()
.name(String::from("EmuCore"))
.spawn(move || loop {