UI hacking.

This commit is contained in:
Ben Vanik
2014-12-20 13:54:55 -08:00
parent c1df273600
commit d839359b4a
28 changed files with 1235 additions and 714 deletions

View File

@@ -20,7 +20,7 @@
#include <xenia/kernel/modules.h>
#include <xenia/kernel/fs/filesystem.h>
#include <xenia/memory.h>
#include <xenia/ui/window.h>
#include <xenia/ui/main_window.h>
namespace xe {
@@ -33,7 +33,7 @@ using namespace xe::kernel::fs;
using namespace xe::ui;
Emulator::Emulator(const std::wstring& command_line)
: command_line_(command_line), main_window_(nullptr) {}
: command_line_(command_line) {}
Emulator::~Emulator() {
// Note that we delete things in the reverse order they were initialized.
@@ -43,10 +43,6 @@ Emulator::~Emulator() {
ev->type = xdb::protocol::EventType::PROCESS_EXIT;
}
if (main_window_) {
main_window_->Close();
}
debug_agent_.reset();
xam_.reset();
@@ -66,11 +62,20 @@ Emulator::~Emulator() {
processor_.reset();
export_resolver_.reset();
// Kill the window last, as until the graphics system/etc is dead it's needed.
main_window_.reset();
}
X_STATUS Emulator::Setup() {
X_STATUS result = X_STATUS_UNSUCCESSFUL;
// Create the main window. Other parts will hook into this.
main_window_ = std::make_unique<ui::MainWindow>();
if (!main_window_->Initialize()) {
return result;
}
debug_agent_.reset(new DebugAgent(this));
result = debug_agent_->Initialize();
if (result) {
@@ -141,16 +146,6 @@ X_STATUS Emulator::Setup() {
return result;
}
void Emulator::set_main_window(Window* window) {
assert_null(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 std::wstring& path) {
// We create a virtual filesystem pointing to its directory and symlink
// that to the game filesystem.