diff options
author | TheKoopaKingdom <thekoopakingdom@gmail.com> | 2017-06-02 23:03:38 +0200 |
---|---|---|
committer | TheKoopaKingdom <thekoopakingdom@gmail.com> | 2017-06-03 00:40:39 +0200 |
commit | f008b22e3b2baa7720ea65c320fe49929a53bad7 (patch) | |
tree | 24a15888dd6ebc515a09eaf00623fa23e2d4665d | |
parent | Fixed wiki URLs. (diff) | |
download | yuzu-f008b22e3b2baa7720ea65c320fe49929a53bad7.tar yuzu-f008b22e3b2baa7720ea65c320fe49929a53bad7.tar.gz yuzu-f008b22e3b2baa7720ea65c320fe49929a53bad7.tar.bz2 yuzu-f008b22e3b2baa7720ea65c320fe49929a53bad7.tar.lz yuzu-f008b22e3b2baa7720ea65c320fe49929a53bad7.tar.xz yuzu-f008b22e3b2baa7720ea65c320fe49929a53bad7.tar.zst yuzu-f008b22e3b2baa7720ea65c320fe49929a53bad7.zip |
-rw-r--r-- | src/citra_qt/main.cpp | 15 | ||||
-rw-r--r-- | src/core/core.cpp | 11 | ||||
-rw-r--r-- | src/core/core.h | 16 | ||||
-rw-r--r-- | src/core/file_sys/archive_ncch.cpp | 12 | ||||
-rw-r--r-- | src/core/hle/service/fs/archive.cpp | 3 | ||||
-rw-r--r-- | src/core/loader/loader.h | 2 | ||||
-rw-r--r-- | src/core/loader/ncch.h | 2 |
7 files changed, 32 insertions, 29 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index c899e075f..4f5b2ddab 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -663,10 +663,11 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det switch (result) { case Core::System::ResultStatus::ErrorSystemFiles: { QString message = "Citra was unable to locate a 3DS system archive"; - if (details != std::string()) + if (!details.empty()) { message.append(tr(": %1. ").arg(details.c_str())); - else + } else { message.append(". "); + } message.append(common_message); answer = QMessageBox::question(this, tr("System Archive Not Found"), message, @@ -698,11 +699,15 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det } if (answer == QMessageBox::Yes) { - if (emu_thread != nullptr) + if (emu_thread) { ShutdownGame(); + } } else { - message_label->setText(status_message); - message_label->setVisible(true); + // Only show the message if the game is still running. + if (emu_thread) { + message_label->setText(status_message); + message_label->setVisible(true); + } } } diff --git a/src/core/core.cpp b/src/core/core.cpp index 2456d8aa2..5429bcb26 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -26,7 +26,7 @@ namespace Core { /*static*/ System System::s_instance; System::ResultStatus System::RunLoop(int tight_loop) { - this->status = ResultStatus::Success; + status = ResultStatus::Success; if (!cpu_core) { return ResultStatus::ErrorNotInitialized; } @@ -60,7 +60,7 @@ System::ResultStatus System::RunLoop(int tight_loop) { HW::Update(); Reschedule(); - return GetStatus(); + return status; } System::ResultStatus System::SingleStep() { @@ -99,8 +99,8 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file return init_result; } - Loader::ResultStatus load_result = app_loader->Load(); - if (load_result != Loader::ResultStatus::Success) { + const Loader::ResultStatus load_result{app_loader->Load()}; + if (Loader::ResultStatus::Success != load_result) { LOG_CRITICAL(Core, "Failed to load ROM (Error %i)!", load_result); System::Shutdown(); @@ -113,9 +113,8 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file return ResultStatus::ErrorLoader; } } - // this->status will be used for errors while actually running the game status = ResultStatus::Success; - return ResultStatus::Success; + return status; } void System::PrepareReschedule() { diff --git a/src/core/core.h b/src/core/core.h index 6e555f954..4e3b6b409 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -108,16 +108,14 @@ public: PerfStats perf_stats; FrameLimiter frame_limiter; - ResultStatus GetStatus() { - return status; - } - - void SetStatus(ResultStatus new_status, std::string details = std::string()) { + void SetStatus(ResultStatus new_status, const char* details = nullptr) { status = new_status; - status_details = details; + if (details) { + status_details = details; + } } - std::string GetStatusDetails() { + const std::string& GetStatusDetails() const { return status_details; } @@ -147,8 +145,8 @@ private: static System s_instance; - ResultStatus status; - std::string status_details; + ResultStatus status = ResultStatus::Success; + std::string status_details = ""; }; inline ARM_Interface& CPU() { diff --git a/src/core/file_sys/archive_ncch.cpp b/src/core/file_sys/archive_ncch.cpp index ad59c053e..6d9007731 100644 --- a/src/core/file_sys/archive_ncch.cpp +++ b/src/core/file_sys/archive_ncch.cpp @@ -42,13 +42,13 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_NCCH::Open(const Path& if (!file->IsOpen()) { // High Title ID of the archive: The category (https://3dbrew.org/wiki/Title_list). - const u32 shared_data_archive = 0x0004009B; - const u32 system_data_archive = 0x000400DB; + constexpr u32 shared_data_archive = 0x0004009B; + constexpr u32 system_data_archive = 0x000400DB; // Low Title IDs. - const u32 mii_data = 0x00010202; - const u32 region_manifest = 0x00010402; - const u32 ng_word_list = 0x00010302; + constexpr u32 mii_data = 0x00010202; + constexpr u32 region_manifest = 0x00010402; + constexpr u32 ng_word_list = 0x00010302; LOG_DEBUG(Service_FS, "Full Path: %s. Category: 0x%X. Path: 0x%X.", path.DebugStr().c_str(), high, low); @@ -60,7 +60,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_NCCH::Open(const Path& "Mii data"); } else if (low == region_manifest) { LOG_ERROR(Service_FS, - "Failed to get a handle for shared data archive: region manifes"); + "Failed to get a handle for shared data archive: region manifest."); Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorSystemFiles, "Region manifest"); } diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 40d52f54b..21929e966 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -257,8 +257,9 @@ ResultVal<ArchiveHandle> OpenArchive(ArchiveIdCode id_code, FileSys::Path& archi LOG_TRACE(Service_FS, "Opening archive with id code 0x%08X", id_code); auto itr = id_code_map.find(id_code); - if (itr == id_code_map.end()) + if (itr == id_code_map.end()) { return FileSys::ERROR_NOT_FOUND; + } CASCADE_RESULT(std::unique_ptr<ArchiveBackend> res, itr->second->Open(archive_path)); diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index adb3ffdcf..48bbf687d 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h @@ -101,7 +101,7 @@ public: * Loads the system mode that this application needs. * This function defaults to 2 (96MB allocated to the application) if it can't read the * information. - * @returns a pair of Optional with the kernel system mode and ResultStatus. + * @returns A pair with the optional system mode, and and the status. */ virtual std::pair<boost::optional<u32>, ResultStatus> LoadKernelSystemMode() { // 96MB allocated to the application. diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h index 507da7550..0ebd47fd5 100644 --- a/src/core/loader/ncch.h +++ b/src/core/loader/ncch.h @@ -179,7 +179,7 @@ public: /** * Loads the Exheader and returns the system mode for this application. - * @returns a pair of Optional with the kernel system mode and ResultStatus + * @returns A pair with the optional system mode, and and the status. */ std::pair<boost::optional<u32>, ResultStatus> LoadKernelSystemMode() override; |