summaryrefslogtreecommitdiff
path: root/src/core/core.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/core.cpp')
-rw-r--r--src/core/core.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 1861bfa9b..2a9664cb4 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -3,6 +3,9 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <memory> 5#include <memory>
6#include <utility>
7
8#include <boost/optional.hpp>
6 9
7#include "audio_core/audio_core.h" 10#include "audio_core/audio_core.h"
8#include "common/logging/log.h" 11#include "common/logging/log.h"
@@ -26,6 +29,7 @@ namespace Core {
26/*static*/ System System::s_instance; 29/*static*/ System System::s_instance;
27 30
28System::ResultStatus System::RunLoop(int tight_loop) { 31System::ResultStatus System::RunLoop(int tight_loop) {
32 this->status = ResultStatus::Success;
29 if (!cpu_core) { 33 if (!cpu_core) {
30 return ResultStatus::ErrorNotInitialized; 34 return ResultStatus::ErrorNotInitialized;
31 } 35 }
@@ -73,14 +77,14 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file
73 LOG_CRITICAL(Core, "Failed to obtain loader for %s!", filepath.c_str()); 77 LOG_CRITICAL(Core, "Failed to obtain loader for %s!", filepath.c_str());
74 return ResultStatus::ErrorGetLoader; 78 return ResultStatus::ErrorGetLoader;
75 } 79 }
76 boost::optional<u32> system_mode = boost::none; 80 std::pair<boost::optional<u32>, Loader::ResultStatus> system_mode =
81 app_loader->LoadKernelSystemMode();
77 82
78 Loader::ResultStatus load_result{app_loader->LoadKernelSystemMode(system_mode)}; 83 if (system_mode.second != Loader::ResultStatus::Success) {
79 if (!system_mode) { 84 LOG_CRITICAL(Core, "Failed to determine system mode (Error %i)!", system_mode.second);
80 LOG_CRITICAL(Core, "Failed to determine system mode (Error %i)!", load_result);
81 System::Shutdown(); 85 System::Shutdown();
82 86
83 switch (load_result) { 87 switch (system_mode.second) {
84 case Loader::ResultStatus::ErrorEncrypted: 88 case Loader::ResultStatus::ErrorEncrypted:
85 return ResultStatus::ErrorLoader_ErrorEncrypted; 89 return ResultStatus::ErrorLoader_ErrorEncrypted;
86 case Loader::ResultStatus::ErrorInvalidFormat: 90 case Loader::ResultStatus::ErrorInvalidFormat:
@@ -90,15 +94,15 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file
90 } 94 }
91 } 95 }
92 96
93 ResultStatus init_result{Init(emu_window, system_mode.get())}; 97 ResultStatus init_result{Init(emu_window, system_mode.first.get())};
94 if (init_result != ResultStatus::Success) { 98 if (init_result != ResultStatus::Success) {
95 LOG_CRITICAL(Core, "Failed to initialize system (Error %i)!", init_result); 99 LOG_CRITICAL(Core, "Failed to initialize system (Error %i)!", init_result);
96 System::Shutdown(); 100 System::Shutdown();
97 return init_result; 101 return init_result;
98 } 102 }
99 103
100 load_result = app_loader->Load(); 104 Loader::ResultStatus load_result = app_loader->Load();
101 if (Loader::ResultStatus::Success != load_result) { 105 if (load_result != Loader::ResultStatus::Success) {
102 LOG_CRITICAL(Core, "Failed to load ROM (Error %i)!", load_result); 106 LOG_CRITICAL(Core, "Failed to load ROM (Error %i)!", load_result);
103 System::Shutdown(); 107 System::Shutdown();
104 108
@@ -154,7 +158,7 @@ System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) {
154 GDBStub::Init(); 158 GDBStub::Init();
155 159
156 if (!VideoCore::Init(emu_window)) { 160 if (!VideoCore::Init(emu_window)) {
157 return ResultStatus::ErrorOpenGL; 161 return ResultStatus::ErrorVideoCore;
158 } 162 }
159 163
160 LOG_DEBUG(Core, "Initialized OK"); 164 LOG_DEBUG(Core, "Initialized OK");