summaryrefslogtreecommitdiffstats
path: root/src/citra/citra.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/citra/citra.cpp')
-rw-r--r--src/citra/citra.cpp38
1 files changed, 15 insertions, 23 deletions
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp
index 3114a71db..99c096ac7 100644
--- a/src/citra/citra.cpp
+++ b/src/citra/citra.cpp
@@ -33,7 +33,6 @@
#include "core/gdbstub/gdbstub.h"
#include "core/loader/loader.h"
#include "core/settings.h"
-#include "core/system.h"
#include "video_core/video_core.h"
static void PrintHelp(const char* argv0) {
@@ -64,7 +63,7 @@ int main(int argc, char** argv) {
return -1;
}
#endif
- std::string boot_filename;
+ std::string filepath;
static struct option long_options[] = {
{"gdbport", required_argument, 0, 'g'},
@@ -97,9 +96,9 @@ int main(int argc, char** argv) {
}
} else {
#ifdef _WIN32
- boot_filename = Common::UTF16ToUTF8(argv_w[optind]);
+ filepath = Common::UTF16ToUTF8(argv_w[optind]);
#else
- boot_filename = argv[optind];
+ filepath = argv[optind];
#endif
optind++;
}
@@ -115,7 +114,7 @@ int main(int argc, char** argv) {
MicroProfileOnThreadCreate("EmuThread");
SCOPE_EXIT({ MicroProfileShutdown(); });
- if (boot_filename.empty()) {
+ if (filepath.empty()) {
LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified");
return -1;
}
@@ -127,32 +126,25 @@ int main(int argc, char** argv) {
Settings::values.use_gdbstub = use_gdbstub;
Settings::Apply();
- std::unique_ptr<EmuWindow_SDL2> emu_window = std::make_unique<EmuWindow_SDL2>();
+ std::unique_ptr<EmuWindow_SDL2> emu_window{std::make_unique<EmuWindow_SDL2>()};
- std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(boot_filename);
- if (!loader) {
- LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!", boot_filename.c_str());
- return -1;
- }
-
- boost::optional<u32> system_mode = loader->LoadKernelSystemMode();
+ Core::System& system{Core::System::GetInstance()};
- if (!system_mode) {
- LOG_CRITICAL(Frontend, "Failed to load ROM (Could not determine system mode)!");
- return -1;
- }
+ SCOPE_EXIT({ system.Shutdown(); });
- System::Init(emu_window.get(), system_mode.get());
- SCOPE_EXIT({ System::Shutdown(); });
+ const Core::System::ResultStatus load_result{system.Load(emu_window.get(), filepath)};
- Loader::ResultStatus load_result = loader->Load();
- if (Loader::ResultStatus::Success != load_result) {
- LOG_CRITICAL(Frontend, "Failed to load ROM (Error %i)!", load_result);
+ switch (load_result) {
+ case Core::System::ResultStatus::ErrorGetLoader:
+ LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!", filepath.c_str());
+ return -1;
+ case Core::System::ResultStatus::ErrorLoader:
+ LOG_CRITICAL(Frontend, "Failed to load ROM!");
return -1;
}
while (emu_window->IsOpen()) {
- Core::RunLoop();
+ system.RunLoop();
}
return 0;