diff options
| author | 2016-03-15 04:15:30 +0000 | |
|---|---|---|
| committer | 2016-03-15 04:15:30 +0000 | |
| commit | 9a627aa30b16542eb64115a83dc075055dbabaf4 (patch) | |
| tree | f4f643f83e52a0043b8ffd1b9d43336ae2bc92a3 /src | |
| parent | Merge pull request #1409 from JamePeng/Reorganize-NDM (diff) | |
| parent | citra: Shutdown cleanly if ROM load fails (diff) | |
| download | yuzu-9a627aa30b16542eb64115a83dc075055dbabaf4.tar.gz yuzu-9a627aa30b16542eb64115a83dc075055dbabaf4.tar.xz yuzu-9a627aa30b16542eb64115a83dc075055dbabaf4.zip | |
Merge pull request #1528 from MerryMage/citra-shutdown
citra: Shutdown cleanly if ROM load fails
Diffstat (limited to 'src')
| -rw-r--r-- | src/citra/citra.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp index 415b98a05..40e40f192 100644 --- a/src/citra/citra.cpp +++ b/src/citra/citra.cpp | |||
| @@ -19,6 +19,8 @@ | |||
| 19 | #include "common/logging/log.h" | 19 | #include "common/logging/log.h" |
| 20 | #include "common/logging/backend.h" | 20 | #include "common/logging/backend.h" |
| 21 | #include "common/logging/filter.h" | 21 | #include "common/logging/filter.h" |
| 22 | #include "common/make_unique.h" | ||
| 23 | #include "common/scope_exit.h" | ||
| 22 | 24 | ||
| 23 | #include "core/settings.h" | 25 | #include "core/settings.h" |
| 24 | #include "core/system.h" | 26 | #include "core/system.h" |
| @@ -64,6 +66,7 @@ int main(int argc, char **argv) { | |||
| 64 | Log::SetFilter(&log_filter); | 66 | Log::SetFilter(&log_filter); |
| 65 | 67 | ||
| 66 | MicroProfileOnThreadCreate("EmuThread"); | 68 | MicroProfileOnThreadCreate("EmuThread"); |
| 69 | SCOPE_EXIT({ MicroProfileShutdown(); }); | ||
| 67 | 70 | ||
| 68 | if (boot_filename.empty()) { | 71 | if (boot_filename.empty()) { |
| 69 | LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified"); | 72 | LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified"); |
| @@ -76,12 +79,13 @@ int main(int argc, char **argv) { | |||
| 76 | GDBStub::ToggleServer(Settings::values.use_gdbstub); | 79 | GDBStub::ToggleServer(Settings::values.use_gdbstub); |
| 77 | GDBStub::SetServerPort(static_cast<u32>(Settings::values.gdbstub_port)); | 80 | GDBStub::SetServerPort(static_cast<u32>(Settings::values.gdbstub_port)); |
| 78 | 81 | ||
| 79 | EmuWindow_SDL2* emu_window = new EmuWindow_SDL2; | 82 | std::unique_ptr<EmuWindow_SDL2> emu_window = Common::make_unique<EmuWindow_SDL2>(); |
| 80 | 83 | ||
| 81 | VideoCore::g_hw_renderer_enabled = Settings::values.use_hw_renderer; | 84 | VideoCore::g_hw_renderer_enabled = Settings::values.use_hw_renderer; |
| 82 | VideoCore::g_shader_jit_enabled = Settings::values.use_shader_jit; | 85 | VideoCore::g_shader_jit_enabled = Settings::values.use_shader_jit; |
| 83 | 86 | ||
| 84 | System::Init(emu_window); | 87 | System::Init(emu_window.get()); |
| 88 | SCOPE_EXIT({ System::Shutdown(); }); | ||
| 85 | 89 | ||
| 86 | Loader::ResultStatus load_result = Loader::LoadFile(boot_filename); | 90 | Loader::ResultStatus load_result = Loader::LoadFile(boot_filename); |
| 87 | if (Loader::ResultStatus::Success != load_result) { | 91 | if (Loader::ResultStatus::Success != load_result) { |
| @@ -93,11 +97,5 @@ int main(int argc, char **argv) { | |||
| 93 | Core::RunLoop(); | 97 | Core::RunLoop(); |
| 94 | } | 98 | } |
| 95 | 99 | ||
| 96 | System::Shutdown(); | ||
| 97 | |||
| 98 | delete emu_window; | ||
| 99 | |||
| 100 | MicroProfileShutdown(); | ||
| 101 | |||
| 102 | return 0; | 100 | return 0; |
| 103 | } | 101 | } |