diff options
Diffstat (limited to 'src/citra_qt')
-rw-r--r-- | src/citra_qt/bootmanager.cpp | 2 | ||||
-rw-r--r-- | src/citra_qt/configure_general.cpp | 2 | ||||
-rw-r--r-- | src/citra_qt/configure_graphics.cpp | 2 | ||||
-rw-r--r-- | src/citra_qt/configure_system.cpp | 2 | ||||
-rw-r--r-- | src/citra_qt/main.cpp | 81 |
5 files changed, 30 insertions, 59 deletions
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index c7eb2aafc..5e8ae3066 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -60,7 +60,7 @@ void EmuThread::run() { } // Shutdown the core emulation - System::Shutdown(); + Core::System::GetInstance().Shutdown(); #if MICROPROFILE_ENABLED MicroProfileOnThreadExit(); diff --git a/src/citra_qt/configure_general.cpp b/src/citra_qt/configure_general.cpp index 27139fb30..f576f6f7a 100644 --- a/src/citra_qt/configure_general.cpp +++ b/src/citra_qt/configure_general.cpp @@ -14,7 +14,7 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent) ui->setupUi(this); this->setConfiguration(); - ui->toggle_cpu_jit->setEnabled(!System::IsPoweredOn()); + ui->toggle_cpu_jit->setEnabled(!Core::System::GetInstance().IsPoweredOn()); } ConfigureGeneral::~ConfigureGeneral() {} diff --git a/src/citra_qt/configure_graphics.cpp b/src/citra_qt/configure_graphics.cpp index 36f10c8d7..1e6f7f880 100644 --- a/src/citra_qt/configure_graphics.cpp +++ b/src/citra_qt/configure_graphics.cpp @@ -13,7 +13,7 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent) ui->setupUi(this); this->setConfiguration(); - ui->toggle_vsync->setEnabled(!System::IsPoweredOn()); + ui->toggle_vsync->setEnabled(!Core::System::GetInstance().IsPoweredOn()); } ConfigureGraphics::~ConfigureGraphics() {} diff --git a/src/citra_qt/configure_system.cpp b/src/citra_qt/configure_system.cpp index 873d314ec..545261c01 100644 --- a/src/citra_qt/configure_system.cpp +++ b/src/citra_qt/configure_system.cpp @@ -24,7 +24,7 @@ ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui:: ConfigureSystem::~ConfigureSystem() {} void ConfigureSystem::setConfiguration() { - enabled = !System::IsPoweredOn(); + enabled = !Core::System::GetInstance().IsPoweredOn(); if (!enabled) { ReadSystemSettings(); diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index e16d3196c..0c7723b0a 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -274,7 +274,7 @@ void GMainWindow::OnDisplayTitleBars(bool show) { } } -bool GMainWindow::InitializeSystem(u32 system_mode) { +bool GMainWindow::LoadROM(const std::string& filename) { // Shutdown previous session if the emu thread is still active... if (emu_thread != nullptr) ShutdownGame(); @@ -284,79 +284,50 @@ bool GMainWindow::InitializeSystem(u32 system_mode) { if (!gladLoadGL()) { QMessageBox::critical(this, tr("Error while starting Citra!"), - tr("Failed to initialize the video core!\n\n" - "Please ensure that your GPU supports OpenGL 3.3 and that you " - "have the latest graphics driver.")); + tr("Failed to initialize the video core!\n\n" + "Please ensure that your GPU supports OpenGL 3.3 and that you " + "have the latest graphics driver.")); return false; } - // Initialize the core emulation - System::Result system_result = System::Init(render_window, system_mode); - if (System::Result::Success != system_result) { - switch (system_result) { - case System::Result::ErrorInitVideoCore: - QMessageBox::critical(this, tr("Error while starting Citra!"), - tr("Failed to initialize the video core!\n\n" - "Please ensure that your GPU supports OpenGL 3.3 and that you " - "have the latest graphics driver.")); - break; + Core::System& system{ Core::System::GetInstance() }; - default: - QMessageBox::critical(this, tr("Error while starting Citra!"), - tr("Unknown error (please check the log)!")); - break; - } - return false; - } - return true; -} + const Core::System::ResultStatus result{ system.Load(render_window, filename) }; -bool GMainWindow::LoadROM(const std::string& filename) { - std::unique_ptr<Loader::AppLoader> app_loader = Loader::GetLoader(filename); - if (!app_loader) { - LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!", filename.c_str()); - QMessageBox::critical(this, tr("Error while loading ROM!"), - tr("The ROM format is not supported.")); - return false; - } - - boost::optional<u32> system_mode = app_loader->LoadKernelSystemMode(); - if (!system_mode) { - LOG_CRITICAL(Frontend, "Failed to load ROM!"); - QMessageBox::critical(this, tr("Error while loading ROM!"), - tr("Could not determine the system mode.")); - return false; - } - - if (!InitializeSystem(system_mode.get())) - return false; + if (result != Core::System::ResultStatus::Success) { + switch (result) { + case Core::System::ResultStatus::ErrorGetLoader: + LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!", filename.c_str()); + QMessageBox::critical(this, tr("Error while loading ROM!"), + tr("The ROM format is not supported.")); + break; - Loader::ResultStatus result = app_loader->Load(); - if (Loader::ResultStatus::Success != result) { - System::Shutdown(); - LOG_CRITICAL(Frontend, "Failed to load ROM!"); + case Core::System::ResultStatus::ErrorSystemMode: + LOG_CRITICAL(Frontend, "Failed to load ROM!"); + QMessageBox::critical(this, tr("Error while loading ROM!"), + tr("Could not determine the system mode.")); + break; - switch (result) { - case Loader::ResultStatus::ErrorEncrypted: { + case Core::System::ResultStatus::ErrorLoader_ErrorEncrypted: + { // Build the MessageBox ourselves to have clickable link QMessageBox popup_error; popup_error.setTextFormat(Qt::RichText); popup_error.setWindowTitle(tr("Error while loading ROM!")); popup_error.setText( tr("The game that you are trying to load must be decrypted before being used with " - "Citra.<br/><br/>" - "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>")); + "Citra.<br/><br/>" + "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>")); popup_error.setIcon(QMessageBox::Critical); popup_error.exec(); break; } - case Loader::ResultStatus::ErrorInvalidFormat: + case Core::System::ResultStatus::ErrorLoader_ErrorInvalidFormat: QMessageBox::critical(this, tr("Error while loading ROM!"), - tr("The ROM format is not supported.")); + tr("The ROM format is not supported.")); break; - case Loader::ResultStatus::Error: default: QMessageBox::critical(this, tr("Error while loading ROM!"), tr("Unknown error!")); |