diff options
author | Subv <subv2112@gmail.com> | 2016-11-20 02:40:04 +0100 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2016-11-20 02:40:04 +0100 |
commit | 1323ab2f5f1627b39e48b6f970ad8208fa7af71e (patch) | |
tree | 6b3257864d76a4cdd3d8bb9847e55a2a51ff7573 /src/citra | |
parent | Merge pull request #2172 from jroweboy/fix-mingw (diff) | |
download | yuzu-1323ab2f5f1627b39e48b6f970ad8208fa7af71e.tar yuzu-1323ab2f5f1627b39e48b6f970ad8208fa7af71e.tar.gz yuzu-1323ab2f5f1627b39e48b6f970ad8208fa7af71e.tar.bz2 yuzu-1323ab2f5f1627b39e48b6f970ad8208fa7af71e.tar.lz yuzu-1323ab2f5f1627b39e48b6f970ad8208fa7af71e.tar.xz yuzu-1323ab2f5f1627b39e48b6f970ad8208fa7af71e.tar.zst yuzu-1323ab2f5f1627b39e48b6f970ad8208fa7af71e.zip |
Diffstat (limited to '')
-rw-r--r-- | src/citra/citra.cpp | 15 | ||||
-rw-r--r-- | src/citra_qt/main.cpp | 24 | ||||
-rw-r--r-- | src/citra_qt/main.h | 7 |
3 files changed, 33 insertions, 13 deletions
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp index e47375f88..c742be231 100644 --- a/src/citra/citra.cpp +++ b/src/citra/citra.cpp @@ -129,16 +129,23 @@ int main(int argc, char** argv) { std::unique_ptr<EmuWindow_SDL2> emu_window = std::make_unique<EmuWindow_SDL2>(); - System::Init(emu_window.get()); - SCOPE_EXIT({ System::Shutdown(); }); - std::unique_ptr<Loader::AppLoader> loader = Loader::GetLoader(boot_filename); if (!loader) { LOG_CRITICAL(Frontend, "Failed to obtain loader for %s!", boot_filename.c_str()); return -1; } - Loader::ResultStatus load_result = loader->Load(); + u32 system_mode; + Loader::ResultStatus load_result = loader->LoadKernelSystemMode(system_mode); + if (Loader::ResultStatus::Success != load_result) { + LOG_CRITICAL(Frontend, "Failed to load ROM (Error %i)!", load_result); + return -1; + } + + System::Init(emu_window.get(), system_mode); + SCOPE_EXIT({ System::Shutdown(); }); + + load_result = loader->Load(); if (Loader::ResultStatus::Success != load_result) { LOG_CRITICAL(Frontend, "Failed to load ROM (Error %i)!", load_result); return -1; diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 0bf9f48d6..9589da4ba 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -253,7 +253,7 @@ void GMainWindow::OnDisplayTitleBars(bool show) { } } -bool GMainWindow::InitializeSystem() { +bool GMainWindow::InitializeSystem(u32 system_mode) { // Shutdown previous session if the emu thread is still active... if (emu_thread != nullptr) ShutdownGame(); @@ -270,7 +270,7 @@ bool GMainWindow::InitializeSystem() { } // Initialize the core emulation - System::Result system_result = System::Init(render_window); + System::Result system_result = System::Init(render_window, system_mode); if (System::Result::Success != system_result) { switch (system_result) { case System::Result::ErrorInitVideoCore: @@ -299,8 +299,21 @@ bool GMainWindow::LoadROM(const std::string& filename) { return false; } + u32 system_mode; + Loader::ResultStatus load_result = app_loader->LoadKernelSystemMode(system_mode); + if (Loader::ResultStatus::Success != load_result) { + LOG_CRITICAL(Frontend, "Failed to load ROM!", load_result); + QMessageBox::critical(this, tr("Error while loading ROM!"), + tr("Could not determine the system mode.")); + return false; + } + + if (!InitializeSystem(system_mode)) + return false; + Loader::ResultStatus result = app_loader->Load(); if (Loader::ResultStatus::Success != result) { + System::Shutdown(); LOG_CRITICAL(Frontend, "Failed to load ROM!"); switch (result) { @@ -338,14 +351,9 @@ void GMainWindow::BootGame(const std::string& filename) { LOG_INFO(Frontend, "Citra starting..."); StoreRecentFile(filename); // Put the filename on top of the list - if (!InitializeSystem()) + if (!LoadROM(filename)) return; - if (!LoadROM(filename)) { - System::Shutdown(); - return; - } - // Create and start the emulation thread emu_thread = std::make_unique<EmuThread>(render_window); emit EmulationStarting(emu_thread.get()); diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index 82eb90aae..f87178227 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -60,7 +60,12 @@ signals: void EmulationStopping(); private: - bool InitializeSystem(); + /** + * Initializes the emulation system. + * @param system_mode The system mode with which to intialize the kernel. + * @returns Whether the system was properly initialized. + */ + bool InitializeSystem(u32 system_mode); bool LoadROM(const std::string& filename); void BootGame(const std::string& filename); void ShutdownGame(); |