2014-04-08 21:25:53 -03:00
|
|
|
// Copyright 2014 Citra Emulator Project
|
2014-12-17 02:38:14 -03:00
|
|
|
// Licensed under GPLv2 or any later version
|
2014-04-08 21:25:53 -03:00
|
|
|
// Refer to the license.txt file included.
|
2013-08-29 23:35:09 -04:00
|
|
|
|
2015-06-20 16:34:41 -03:00
|
|
|
#include <string>
|
2014-10-28 04:36:00 -03:00
|
|
|
|
2015-05-06 04:06:12 -03:00
|
|
|
#include "common/logging/log.h"
|
2014-10-28 04:36:00 -03:00
|
|
|
#include "common/logging/backend.h"
|
2014-12-06 19:00:08 -03:00
|
|
|
#include "common/logging/filter.h"
|
2013-08-29 23:35:09 -04:00
|
|
|
|
2014-10-27 18:18:28 -03:00
|
|
|
#include "core/settings.h"
|
2014-04-08 21:15:08 -03:00
|
|
|
#include "core/system.h"
|
|
|
|
#include "core/core.h"
|
2014-06-16 18:03:13 -04:00
|
|
|
#include "core/loader/loader.h"
|
2013-08-29 23:35:09 -04:00
|
|
|
|
2014-09-12 21:06:13 -03:00
|
|
|
#include "citra/config.h"
|
2014-04-08 21:15:08 -03:00
|
|
|
#include "citra/emu_window/emu_window_glfw.h"
|
2013-08-29 23:35:09 -04:00
|
|
|
|
2015-05-19 01:21:33 -03:00
|
|
|
#include "video_core/video_core.h"
|
|
|
|
|
2013-08-29 23:35:09 -04:00
|
|
|
/// Application entry point
|
2015-05-06 22:59:59 -03:00
|
|
|
int main(int argc, char **argv) {
|
2014-12-06 19:00:08 -03:00
|
|
|
Log::Filter log_filter(Log::Level::Debug);
|
2015-03-06 15:15:02 -03:00
|
|
|
Log::SetFilter(&log_filter);
|
2013-09-17 23:57:59 -03:00
|
|
|
|
2014-05-04 18:47:42 -04:00
|
|
|
if (argc < 2) {
|
2014-12-05 22:53:49 -03:00
|
|
|
LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified");
|
2014-06-18 18:58:09 -04:00
|
|
|
return -1;
|
2014-05-04 18:47:42 -04:00
|
|
|
}
|
2014-05-17 11:59:18 -04:00
|
|
|
|
2014-09-12 21:06:13 -03:00
|
|
|
Config config;
|
2014-12-06 19:00:08 -03:00
|
|
|
log_filter.ParseFilterString(Settings::values.log_filter);
|
2014-11-19 05:49:13 -03:00
|
|
|
|
2014-06-18 18:58:09 -04:00
|
|
|
std::string boot_filename = argv[1];
|
|
|
|
EmuWindow_GLFW* emu_window = new EmuWindow_GLFW;
|
|
|
|
|
2015-05-19 01:21:33 -03:00
|
|
|
VideoCore::g_hw_renderer_enabled = Settings::values.use_hw_renderer;
|
|
|
|
|
2014-06-18 18:58:09 -04:00
|
|
|
System::Init(emu_window);
|
2014-03-31 23:25:55 -03:00
|
|
|
|
2014-09-12 21:06:13 -03:00
|
|
|
Loader::ResultStatus load_result = Loader::LoadFile(boot_filename);
|
|
|
|
if (Loader::ResultStatus::Success != load_result) {
|
2014-12-05 22:53:49 -03:00
|
|
|
LOG_CRITICAL(Frontend, "Failed to load ROM (Error %i)!", load_result);
|
2014-06-18 18:58:09 -04:00
|
|
|
return -1;
|
2014-03-31 23:25:55 -03:00
|
|
|
}
|
2014-04-07 01:53:47 -03:00
|
|
|
|
2014-10-15 22:48:02 -03:00
|
|
|
while (emu_window->IsOpen()) {
|
2014-08-29 23:24:32 -04:00
|
|
|
Core::RunLoop();
|
|
|
|
}
|
2013-08-29 23:35:09 -04:00
|
|
|
|
2015-01-04 00:04:17 -03:00
|
|
|
System::Shutdown();
|
|
|
|
|
2014-03-31 23:25:55 -03:00
|
|
|
delete emu_window;
|
2013-08-29 23:35:09 -04:00
|
|
|
|
2014-05-17 11:59:18 -04:00
|
|
|
return 0;
|
2013-08-29 23:35:09 -04:00
|
|
|
}
|