xenia-canary/tools/xenia-debug/xenia-debug.cc

70 lines
1.9 KiB
C++
Raw Normal View History

2014-08-09 17:32:16 +00:00
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2014 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
#include <xdb/xdb.h>
2014-08-15 03:36:00 +00:00
#include <memory>
2014-08-09 17:32:16 +00:00
2014-08-15 03:36:00 +00:00
#include <gflags/gflags.h>
#include <poly/poly.h>
#include <third_party/wxWidgets/include/wx/wx.h>
2014-08-15 14:24:27 +00:00
#include <xdb/ui/xdb_app.h>
2014-08-09 17:32:16 +00:00
2014-08-15 06:53:10 +00:00
DEFINE_string(trace_file, "", "Trace file to load on startup.");
DEFINE_string(content_file, "",
"ISO/STFS/XEX file the specified trace_file should reference.");
2014-08-15 03:36:00 +00:00
namespace xdb {
2014-08-09 17:32:16 +00:00
2014-08-15 03:36:00 +00:00
int main(int argc, xechar_t** argv) {
2014-08-09 17:32:16 +00:00
// Create platform abstraction layer.
xe_pal_options_t pal_options;
xe_zero_struct(&pal_options, sizeof(pal_options));
2014-08-15 03:36:00 +00:00
if (xe_pal_init(pal_options)) {
XEFATAL("Failed to initialize PAL");
return 1;
}
2014-08-09 17:32:16 +00:00
2014-08-15 03:36:00 +00:00
wxInitializer init;
if (!init.IsOk()) {
XEFATAL("Failed to initialize wxWidgets");
return 1;
}
2014-08-09 17:32:16 +00:00
2014-08-15 03:36:00 +00:00
// App is auto-freed by wx.
2014-08-15 14:24:27 +00:00
auto app = new ui::XdbApp();
2014-08-15 03:36:00 +00:00
wxApp::SetInstance(app);
if (!wxEntryStart(0, nullptr)) {
XEFATAL("Failed to enter wxWidgets app");
return 1;
}
if (!app->OnInit()) {
XEFATAL("Failed to init app");
return 1;
2014-08-09 17:32:16 +00:00
}
2014-08-15 06:53:10 +00:00
if (!FLAGS_trace_file.empty()) {
// Trace file specified on command line.
app->OpenTraceFile(FLAGS_trace_file, FLAGS_content_file);
} else {
app->OpenEmpty();
}
2014-08-15 03:36:00 +00:00
app->OnRun();
int result_code = app->OnExit();
wxEntryCleanup();
2014-08-09 17:32:16 +00:00
return result_code;
}
2014-08-15 03:36:00 +00:00
} // namespace xdb
// TODO(benvanik): move main thunk into poly
// ehhh
XE_MAIN_WINDOW_THUNK(xdb::main, L"xenia-debug", "xenia-debug");