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