Merge pull request #1528 from MerryMage/citra-shutdown
citra: Shutdown cleanly if ROM load fails
This commit is contained in:
commit
9a627aa30b
@ -19,6 +19,8 @@
|
|||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/logging/backend.h"
|
#include "common/logging/backend.h"
|
||||||
#include "common/logging/filter.h"
|
#include "common/logging/filter.h"
|
||||||
|
#include "common/make_unique.h"
|
||||||
|
#include "common/scope_exit.h"
|
||||||
|
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
#include "core/system.h"
|
#include "core/system.h"
|
||||||
@ -64,6 +66,7 @@ int main(int argc, char **argv) {
|
|||||||
Log::SetFilter(&log_filter);
|
Log::SetFilter(&log_filter);
|
||||||
|
|
||||||
MicroProfileOnThreadCreate("EmuThread");
|
MicroProfileOnThreadCreate("EmuThread");
|
||||||
|
SCOPE_EXIT({ MicroProfileShutdown(); });
|
||||||
|
|
||||||
if (boot_filename.empty()) {
|
if (boot_filename.empty()) {
|
||||||
LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified");
|
LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified");
|
||||||
@ -76,12 +79,13 @@ int main(int argc, char **argv) {
|
|||||||
GDBStub::ToggleServer(Settings::values.use_gdbstub);
|
GDBStub::ToggleServer(Settings::values.use_gdbstub);
|
||||||
GDBStub::SetServerPort(static_cast<u32>(Settings::values.gdbstub_port));
|
GDBStub::SetServerPort(static_cast<u32>(Settings::values.gdbstub_port));
|
||||||
|
|
||||||
EmuWindow_SDL2* emu_window = new EmuWindow_SDL2;
|
std::unique_ptr<EmuWindow_SDL2> emu_window = Common::make_unique<EmuWindow_SDL2>();
|
||||||
|
|
||||||
VideoCore::g_hw_renderer_enabled = Settings::values.use_hw_renderer;
|
VideoCore::g_hw_renderer_enabled = Settings::values.use_hw_renderer;
|
||||||
VideoCore::g_shader_jit_enabled = Settings::values.use_shader_jit;
|
VideoCore::g_shader_jit_enabled = Settings::values.use_shader_jit;
|
||||||
|
|
||||||
System::Init(emu_window);
|
System::Init(emu_window.get());
|
||||||
|
SCOPE_EXIT({ System::Shutdown(); });
|
||||||
|
|
||||||
Loader::ResultStatus load_result = Loader::LoadFile(boot_filename);
|
Loader::ResultStatus load_result = Loader::LoadFile(boot_filename);
|
||||||
if (Loader::ResultStatus::Success != load_result) {
|
if (Loader::ResultStatus::Success != load_result) {
|
||||||
@ -93,11 +97,5 @@ int main(int argc, char **argv) {
|
|||||||
Core::RunLoop();
|
Core::RunLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
System::Shutdown();
|
|
||||||
|
|
||||||
delete emu_window;
|
|
||||||
|
|
||||||
MicroProfileShutdown();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user