summaryrefslogtreecommitdiff
path: root/src/citra_qt/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/citra_qt/main.cpp')
-rw-r--r--src/citra_qt/main.cpp50
1 files changed, 38 insertions, 12 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index d2ba3f9db..21f4e3a80 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -248,17 +248,32 @@ void GMainWindow::OnDisplayTitleBars(bool show)
248 } 248 }
249} 249}
250 250
251void GMainWindow::BootGame(const std::string& filename) { 251bool GMainWindow::InitializeSystem() {
252 LOG_INFO(Frontend, "Citra starting...");
253
254 // Shutdown previous session if the emu thread is still active... 252 // Shutdown previous session if the emu thread is still active...
255 if (emu_thread != nullptr) 253 if (emu_thread != nullptr)
256 ShutdownGame(); 254 ShutdownGame();
257 255
258 // Initialize the core emulation 256 // Initialize the core emulation
259 System::Init(render_window); 257 System::Result system_result = System::Init(render_window);
258 if (System::Result::Success != system_result) {
259 switch (system_result) {
260 case System::Result::ErrorInitVideoCore:
261 QMessageBox::critical(this, tr("Error while starting Citra!"),
262 tr("Failed to initialize the video core!\n\n"
263 "Please ensure that your GPU supports OpenGL 3.3 and that you have the latest graphics driver."));
264 break;
265
266 default:
267 QMessageBox::critical(this, tr("Error while starting Citra!"),
268 tr("Unknown error (please check the log)!"));
269 break;
270 }
271 return false;
272 }
273 return true;
274}
260 275
261 // Load the game 276bool GMainWindow::LoadROM(const std::string& filename) {
262 Loader::ResultStatus result = Loader::LoadFile(filename); 277 Loader::ResultStatus result = Loader::LoadFile(filename);
263 if (Loader::ResultStatus::Success != result) { 278 if (Loader::ResultStatus::Success != result) {
264 LOG_CRITICAL(Frontend, "Failed to load ROM!"); 279 LOG_CRITICAL(Frontend, "Failed to load ROM!");
@@ -269,26 +284,37 @@ void GMainWindow::BootGame(const std::string& filename) {
269 // Build the MessageBox ourselves to have clickable link 284 // Build the MessageBox ourselves to have clickable link
270 QMessageBox popup_error; 285 QMessageBox popup_error;
271 popup_error.setTextFormat(Qt::RichText); 286 popup_error.setTextFormat(Qt::RichText);
272 popup_error.setWindowTitle(tr("Error while loading ROM !")); 287 popup_error.setWindowTitle(tr("Error while loading ROM!"));
273 popup_error.setText(tr("The ROM is probably encrypted !<br/><br/>" 288 popup_error.setText(tr("The game that you are trying to load must be decrypted before being used with Citra.<br/><br/>"
274 "Please check: <a href='https://github.com/citra-emu/citra/wiki/Dumping-Game-Cartridges'>https://github.com/citra-emu/citra/wiki/Dumping-Game-Cartridges</a>")); 289 "For more information on dumping and decrypting games, please see: <a href='https://citra-emu.org/wiki/Dumping-Game-Cartridges'>https://citra-emu.org/wiki/Dumping-Game-Cartridges</a>"));
275 popup_error.setIcon(QMessageBox::Critical); 290 popup_error.setIcon(QMessageBox::Critical);
276 popup_error.exec(); 291 popup_error.exec();
277 break; 292 break;
278 } 293 }
279 case Loader::ResultStatus::ErrorInvalidFormat: 294 case Loader::ResultStatus::ErrorInvalidFormat:
280 QMessageBox::critical(this, tr("Error while loading ROM !"), 295 QMessageBox::critical(this, tr("Error while loading ROM!"),
281 tr("The ROM format is not supported.")); 296 tr("The ROM format is not supported."));
282 break; 297 break;
283 case Loader::ResultStatus::Error: 298 case Loader::ResultStatus::Error:
284 299
285 default: 300 default:
286 QMessageBox::critical(this, tr("Error while loading ROM !"), 301 QMessageBox::critical(this, tr("Error while loading ROM!"),
287 tr("Unknown error !")); 302 tr("Unknown error!"));
288 break; 303 break;
289 } 304 }
290 return; 305 return false;
291 } 306 }
307 return true;
308}
309
310void GMainWindow::BootGame(const std::string& filename) {
311 LOG_INFO(Frontend, "Citra starting...");
312
313 if (!InitializeSystem())
314 return;
315
316 if (!LoadROM(filename))
317 return;
292 318
293 // Create and start the emulation thread 319 // Create and start the emulation thread
294 emu_thread = Common::make_unique<EmuThread>(render_window); 320 emu_thread = Common::make_unique<EmuThread>(render_window);