diff options
| author | Ben Vanik <ben.vanik@gmail.com> | 2014-08-16 17:58:33 -0700 |
|---|---|---|
| committer | Ben Vanik <ben.vanik@gmail.com> | 2014-08-16 17:58:33 -0700 |
| commit | f2a9fa3bf9e68ad0bd3e95d1afa553eeeb9cc094 (patch) | |
| tree | 93ae98995dbdd4310cc1d7012775829b628ca07e /tools | |
| parent | 187d0ad2772be088460ecfa3774a1f2360069f94 (diff) | |
XECOUNT to countof.
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/xenia-run/xenia-run.cc | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/tools/xenia-run/xenia-run.cc b/tools/xenia-run/xenia-run.cc index 51a6dcb3f..6c2c38802 100644 --- a/tools/xenia-run/xenia-run.cc +++ b/tools/xenia-run/xenia-run.cc @@ -17,13 +17,9 @@ using namespace xe; DEFINE_string(target, "", "Specifies the target .xex or .iso to execute."); int xenia_run(std::vector<std::wstring>& args) { - int result_code = 1; - Profiler::Initialize(); Profiler::ThreadEnter("main"); - Emulator* emulator = NULL; - // Grab path from the flag or unnamed argument. if (!FLAGS_target.size() && args.size() < 2) { google::ShowUsageWithFlags("xenia-run"); @@ -45,15 +41,17 @@ int xenia_run(std::vector<std::wstring>& args) { // Create platform abstraction layer. xe_pal_options_t pal_options; xe_zero_struct(&pal_options, sizeof(pal_options)); - XEEXPECTZERO(xe_pal_init(pal_options)); + if (xe_pal_init(pal_options)) { + XELOGE("Failed to initialize PAL"); + return 1; + } // Create the emulator. - emulator = new Emulator(L""); - XEEXPECTNOTNULL(emulator); + auto emulator = std::make_unique<Emulator>(L""); X_STATUS result = emulator->Setup(); if (XFAILED(result)) { XELOGE("Failed to setup emulator: %.8X", result); - XEFAIL(); + return 1; } // Launch based on file type. @@ -72,18 +70,13 @@ int xenia_run(std::vector<std::wstring>& args) { } if (XFAILED(result)) { XELOGE("Failed to launch target: %.8X", result); - XEFAIL(); + return 1; } - result_code = 0; -XECLEANUP: - delete emulator; - if (result_code) { - XEFATAL("Failed to launch emulator: %d", result_code); - } + emulator.reset(); Profiler::Dump(); Profiler::Shutdown(); - return result_code; + return 0; } DEFINE_ENTRY_POINT(L"xenia-run", L"xenia-run some.xex", xenia_run); |
