summaryrefslogtreecommitdiff
path: root/src/core/core.cpp
diff options
context:
space:
mode:
authorGravatar TheKoopaKingdom2017-03-08 16:28:30 -0500
committerGravatar TheKoopaKingdom2017-06-02 18:27:56 -0400
commit1ecb322daa0e2521fe0e179e87889db9aaaf63b0 (patch)
tree6f8cc571b41a76c7ab93843472809bfc9121abb7 /src/core/core.cpp
parentFixed encrypted ROM error messages. (diff)
downloadyuzu-1ecb322daa0e2521fe0e179e87889db9aaaf63b0.tar.gz
yuzu-1ecb322daa0e2521fe0e179e87889db9aaaf63b0.tar.xz
yuzu-1ecb322daa0e2521fe0e179e87889db9aaaf63b0.zip
Added system for handling core errors in citra-qt.
Diffstat (limited to 'src/core/core.cpp')
-rw-r--r--src/core/core.cpp24
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
65System::ResultStatus System::SingleStep() { 65System::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");