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

64 lines
1.7 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/main.h>
2014-08-15 03:36:00 +00:00
#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
int main(std::vector<std::wstring>& args) {
2014-08-15 03:36:00 +00:00
wxInitializer init;
if (!init.IsOk()) {
2014-08-22 03:26:55 +00:00
PFATAL("Failed to initialize wxWidgets");
2014-08-15 03:36:00 +00:00
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)) {
2014-08-22 03:26:55 +00:00
PFATAL("Failed to enter wxWidgets app");
2014-08-15 03:36:00 +00:00
return 1;
}
if (!app->OnInit()) {
2014-08-22 03:26:55 +00:00
PFATAL("Failed to init app");
2014-08-15 03:36:00 +00:00
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.
if (!app->OpenTraceFile(FLAGS_trace_file, FLAGS_content_file)) {
2014-08-22 03:26:55 +00:00
PFATAL("Failed to open trace file");
return 1;
}
2014-08-15 06:53:10 +00:00
} 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
DEFINE_ENTRY_POINT(L"xenia-debug", L"xenia-debug", xdb::main);