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>
|
2014-08-16 23:34:04 +00:00
|
|
|
#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
|
|
|
|
2014-08-16 23:34:04 +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.
|
2014-08-15 17:19:59 +00:00
|
|
|
if (!app->OpenTraceFile(FLAGS_trace_file, FLAGS_content_file)) {
|
2014-08-22 03:26:55 +00:00
|
|
|
PFATAL("Failed to open trace file");
|
2014-08-15 17:19:59 +00:00
|
|
|
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
|
|
|
|
|
2014-08-16 23:34:04 +00:00
|
|
|
DEFINE_ENTRY_POINT(L"xenia-debug", L"xenia-debug", xdb::main);
|