From 2a7f3de1c3d1df69c7e8272f46b4164450b024a3 Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Wed, 15 Jan 2014 07:31:21 -0800 Subject: [PATCH] Moving shutdown logic to Emulator. --- src/xenia/emulator.cc | 10 ++++++++++ src/xenia/emulator.h | 2 +- src/xenia/gpu/d3d11/d3d11_window.cc | 1 - src/xenia/gpu/graphics_system.cc | 3 --- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/xenia/emulator.cc b/src/xenia/emulator.cc index cee4ca853..6288e1f74 100644 --- a/src/xenia/emulator.cc +++ b/src/xenia/emulator.cc @@ -145,6 +145,16 @@ XECLEANUP: return result; } +void Emulator::set_main_window(Window* window) { + XEASSERTNULL(main_window_); + main_window_ = window; + + window->closed.AddListener([](UIEvent& e) { + // TODO(benvanik): call module API to kill? this is a bad shutdown. + exit(1); + }); +} + X_STATUS Emulator::LaunchXexFile(const xechar_t* path) { // We create a virtual filesystem pointing to its directory and symlink // that to the game filesystem. diff --git a/src/xenia/emulator.h b/src/xenia/emulator.h index 7a713651a..bd1d0c74e 100644 --- a/src/xenia/emulator.h +++ b/src/xenia/emulator.h @@ -39,7 +39,7 @@ public: const xechar_t* command_line() const { return command_line_; } ui::Window* main_window() const { return main_window_; } - void set_main_window(ui::Window* window) { main_window_ = window; } + void set_main_window(ui::Window* window); Memory* memory() const { return memory_; } diff --git a/src/xenia/gpu/d3d11/d3d11_window.cc b/src/xenia/gpu/d3d11/d3d11_window.cc index 54b98ad75..1723b6d6e 100644 --- a/src/xenia/gpu/d3d11/d3d11_window.cc +++ b/src/xenia/gpu/d3d11/d3d11_window.cc @@ -30,7 +30,6 @@ D3D11Window::D3D11Window( swap_chain_ = 0; render_target_view_ = 0; - // TODO(benvanik): move to emulator main window setter. closing.AddListener([](UIEvent& e) { xe_run_loop_quit(e.window()->run_loop()); }); diff --git a/src/xenia/gpu/graphics_system.cc b/src/xenia/gpu/graphics_system.cc index 53f8b24ca..f36af1c2f 100644 --- a/src/xenia/gpu/graphics_system.cc +++ b/src/xenia/gpu/graphics_system.cc @@ -92,9 +92,6 @@ void GraphicsSystem::ThreadStart() { running_ = false; xe_run_loop_release(run_loop); - - // TODO(benvanik): call module API to kill? this is a bad shutdown. - exit(1); } void GraphicsSystem::Initialize() {