diff options
author | bunnei <bunneidev@gmail.com> | 2017-06-02 22:24:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-02 22:24:29 -0400 |
commit | 81449f025a190cd9f931d73cf959ddbfebff497a (patch) | |
tree | 24a15888dd6ebc515a09eaf00623fa23e2d4665d /src/core/core.cpp | |
parent | 4857eb441bbe7ba1637838c9e5158f0801f40730 (diff) | |
parent | f008b22e3b2baa7720ea65c320fe49929a53bad7 (diff) |
Merge pull request #2611 from TheKoopaKingdom/missing-file-dialogs
Display QMessageBox Dialogs For Errors
Diffstat (limited to 'src/core/core.cpp')
-rw-r--r-- | src/core/core.cpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 450e7566d..5429bcb26 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -3,7 +3,7 @@ // Refer to the license.txt file included. #include <memory> - +#include <utility> #include "audio_core/audio_core.h" #include "common/logging/log.h" #include "core/arm/arm_interface.h" @@ -26,6 +26,7 @@ namespace Core { /*static*/ System System::s_instance; System::ResultStatus System::RunLoop(int tight_loop) { + status = ResultStatus::Success; if (!cpu_core) { return ResultStatus::ErrorNotInitialized; } @@ -59,7 +60,7 @@ System::ResultStatus System::RunLoop(int tight_loop) { HW::Update(); Reschedule(); - return ResultStatus::Success; + return status; } System::ResultStatus System::SingleStep() { @@ -73,14 +74,25 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file LOG_CRITICAL(Core, "Failed to obtain loader for %s!", filepath.c_str()); return ResultStatus::ErrorGetLoader; } + std::pair<boost::optional<u32>, Loader::ResultStatus> system_mode = + app_loader->LoadKernelSystemMode(); + + if (system_mode.second != Loader::ResultStatus::Success) { + LOG_CRITICAL(Core, "Failed to determine system mode (Error %i)!", + static_cast<int>(system_mode.second)); + System::Shutdown(); - boost::optional<u32> system_mode{app_loader->LoadKernelSystemMode()}; - if (!system_mode) { - LOG_CRITICAL(Core, "Failed to determine system mode!"); - return ResultStatus::ErrorSystemMode; + switch (system_mode.second) { + case Loader::ResultStatus::ErrorEncrypted: + return ResultStatus::ErrorLoader_ErrorEncrypted; + case Loader::ResultStatus::ErrorInvalidFormat: + return ResultStatus::ErrorLoader_ErrorInvalidFormat; + default: + return ResultStatus::ErrorSystemMode; + } } - ResultStatus init_result{Init(emu_window, system_mode.get())}; + ResultStatus init_result{Init(emu_window, system_mode.first.get())}; if (init_result != ResultStatus::Success) { LOG_CRITICAL(Core, "Failed to initialize system (Error %i)!", init_result); System::Shutdown(); @@ -101,7 +113,8 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file return ResultStatus::ErrorLoader; } } - return ResultStatus::Success; + status = ResultStatus::Success; + return status; } void System::PrepareReschedule() { |