diff options
Diffstat (limited to 'src/core/core.cpp')
| -rw-r--r-- | src/core/core.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 450e7566d..1861bfa9b 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -59,7 +59,7 @@ System::ResultStatus System::RunLoop(int tight_loop) { | |||
| 59 | HW::Update(); | 59 | HW::Update(); |
| 60 | Reschedule(); | 60 | Reschedule(); |
| 61 | 61 | ||
| 62 | return ResultStatus::Success; | 62 | return GetStatus(); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | System::ResultStatus System::SingleStep() { | 65 | System::ResultStatus System::SingleStep() { |
| @@ -73,11 +73,21 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file | |||
| 73 | LOG_CRITICAL(Core, "Failed to obtain loader for %s!", filepath.c_str()); | 73 | LOG_CRITICAL(Core, "Failed to obtain loader for %s!", filepath.c_str()); |
| 74 | return ResultStatus::ErrorGetLoader; | 74 | return ResultStatus::ErrorGetLoader; |
| 75 | } | 75 | } |
| 76 | boost::optional<u32> system_mode = boost::none; | ||
| 76 | 77 | ||
| 77 | boost::optional<u32> system_mode{app_loader->LoadKernelSystemMode()}; | 78 | Loader::ResultStatus load_result{app_loader->LoadKernelSystemMode(system_mode)}; |
| 78 | if (!system_mode) { | 79 | if (!system_mode) { |
| 79 | LOG_CRITICAL(Core, "Failed to determine system mode!"); | 80 | LOG_CRITICAL(Core, "Failed to determine system mode (Error %i)!", load_result); |
| 80 | return ResultStatus::ErrorSystemMode; | 81 | System::Shutdown(); |
| 82 | |||
| 83 | switch (load_result) { | ||
| 84 | case Loader::ResultStatus::ErrorEncrypted: | ||
| 85 | return ResultStatus::ErrorLoader_ErrorEncrypted; | ||
| 86 | case Loader::ResultStatus::ErrorInvalidFormat: | ||
| 87 | return ResultStatus::ErrorLoader_ErrorInvalidFormat; | ||
| 88 | default: | ||
| 89 | return ResultStatus::ErrorSystemMode; | ||
| 90 | } | ||
| 81 | } | 91 | } |
| 82 | 92 | ||
| 83 | ResultStatus init_result{Init(emu_window, system_mode.get())}; | 93 | ResultStatus init_result{Init(emu_window, system_mode.get())}; |
| @@ -87,7 +97,7 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file | |||
| 87 | return init_result; | 97 | return init_result; |
| 88 | } | 98 | } |
| 89 | 99 | ||
| 90 | const Loader::ResultStatus load_result{app_loader->Load()}; | 100 | load_result = app_loader->Load(); |
| 91 | if (Loader::ResultStatus::Success != load_result) { | 101 | if (Loader::ResultStatus::Success != load_result) { |
| 92 | LOG_CRITICAL(Core, "Failed to load ROM (Error %i)!", load_result); | 102 | LOG_CRITICAL(Core, "Failed to load ROM (Error %i)!", load_result); |
| 93 | System::Shutdown(); | 103 | System::Shutdown(); |
| @@ -101,6 +111,8 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file | |||
| 101 | return ResultStatus::ErrorLoader; | 111 | return ResultStatus::ErrorLoader; |
| 102 | } | 112 | } |
| 103 | } | 113 | } |
| 114 | // this->status will be used for errors while actually running the game | ||
| 115 | status = ResultStatus::Success; | ||
| 104 | return ResultStatus::Success; | 116 | return ResultStatus::Success; |
| 105 | } | 117 | } |
| 106 | 118 | ||
| @@ -142,7 +154,7 @@ System::ResultStatus System::Init(EmuWindow* emu_window, u32 system_mode) { | |||
| 142 | GDBStub::Init(); | 154 | GDBStub::Init(); |
| 143 | 155 | ||
| 144 | if (!VideoCore::Init(emu_window)) { | 156 | if (!VideoCore::Init(emu_window)) { |
| 145 | return ResultStatus::ErrorVideoCore; | 157 | return ResultStatus::ErrorOpenGL; |
| 146 | } | 158 | } |
| 147 | 159 | ||
| 148 | LOG_DEBUG(Core, "Initialized OK"); | 160 | LOG_DEBUG(Core, "Initialized OK"); |