diff options
| author | 2017-06-02 17:03:38 -0400 | |
|---|---|---|
| committer | 2017-06-02 18:40:39 -0400 | |
| commit | f008b22e3b2baa7720ea65c320fe49929a53bad7 (patch) | |
| tree | 24a15888dd6ebc515a09eaf00623fa23e2d4665d /src | |
| parent | Fixed wiki URLs. (diff) | |
| download | yuzu-f008b22e3b2baa7720ea65c320fe49929a53bad7.tar.gz yuzu-f008b22e3b2baa7720ea65c320fe49929a53bad7.tar.xz yuzu-f008b22e3b2baa7720ea65c320fe49929a53bad7.zip | |
Addressed Bunnei's review comments, and made some other tweaks:
- Deleted GetStatus() because it wasn't used anywhere outside of Core::System.
- Fixed design flaw where the message bar status could be set despite the game being stopped.
Diffstat (limited to 'src')
| -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 | |||
| 663 | switch (result) { | 663 | switch (result) { |
| 664 | case Core::System::ResultStatus::ErrorSystemFiles: { | 664 | case Core::System::ResultStatus::ErrorSystemFiles: { |
| 665 | QString message = "Citra was unable to locate a 3DS system archive"; | 665 | QString message = "Citra was unable to locate a 3DS system archive"; |
| 666 | if (details != std::string()) | 666 | if (!details.empty()) { |
| 667 | message.append(tr(": %1. ").arg(details.c_str())); | 667 | message.append(tr(": %1. ").arg(details.c_str())); |
| 668 | else | 668 | } else { |
| 669 | message.append(". "); | 669 | message.append(". "); |
| 670 | } | ||
| 670 | message.append(common_message); | 671 | message.append(common_message); |
| 671 | 672 | ||
| 672 | answer = QMessageBox::question(this, tr("System Archive Not Found"), message, | 673 | answer = QMessageBox::question(this, tr("System Archive Not Found"), message, |
| @@ -698,11 +699,15 @@ void GMainWindow::OnCoreError(Core::System::ResultStatus result, std::string det | |||
| 698 | } | 699 | } |
| 699 | 700 | ||
| 700 | if (answer == QMessageBox::Yes) { | 701 | if (answer == QMessageBox::Yes) { |
| 701 | if (emu_thread != nullptr) | 702 | if (emu_thread) { |
| 702 | ShutdownGame(); | 703 | ShutdownGame(); |
| 704 | } | ||
| 703 | } else { | 705 | } else { |
| 704 | message_label->setText(status_message); | 706 | // Only show the message if the game is still running. |
| 705 | message_label->setVisible(true); | 707 | if (emu_thread) { |
| 708 | message_label->setText(status_message); | ||
| 709 | message_label->setVisible(true); | ||
| 710 | } | ||
| 706 | } | 711 | } |
| 707 | } | 712 | } |
| 708 | 713 | ||
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 { | |||
| 26 | /*static*/ System System::s_instance; | 26 | /*static*/ System System::s_instance; |
| 27 | 27 | ||
| 28 | System::ResultStatus System::RunLoop(int tight_loop) { | 28 | System::ResultStatus System::RunLoop(int tight_loop) { |
| 29 | this->status = ResultStatus::Success; | 29 | status = ResultStatus::Success; |
| 30 | if (!cpu_core) { | 30 | if (!cpu_core) { |
| 31 | return ResultStatus::ErrorNotInitialized; | 31 | return ResultStatus::ErrorNotInitialized; |
| 32 | } | 32 | } |
| @@ -60,7 +60,7 @@ System::ResultStatus System::RunLoop(int tight_loop) { | |||
| 60 | HW::Update(); | 60 | HW::Update(); |
| 61 | Reschedule(); | 61 | Reschedule(); |
| 62 | 62 | ||
| 63 | return GetStatus(); | 63 | return status; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | System::ResultStatus System::SingleStep() { | 66 | System::ResultStatus System::SingleStep() { |
| @@ -99,8 +99,8 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file | |||
| 99 | return init_result; | 99 | return init_result; |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | Loader::ResultStatus load_result = app_loader->Load(); | 102 | const Loader::ResultStatus load_result{app_loader->Load()}; |
| 103 | if (load_result != Loader::ResultStatus::Success) { | 103 | if (Loader::ResultStatus::Success != load_result) { |
| 104 | LOG_CRITICAL(Core, "Failed to load ROM (Error %i)!", load_result); | 104 | LOG_CRITICAL(Core, "Failed to load ROM (Error %i)!", load_result); |
| 105 | System::Shutdown(); | 105 | System::Shutdown(); |
| 106 | 106 | ||
| @@ -113,9 +113,8 @@ System::ResultStatus System::Load(EmuWindow* emu_window, const std::string& file | |||
| 113 | return ResultStatus::ErrorLoader; | 113 | return ResultStatus::ErrorLoader; |
| 114 | } | 114 | } |
| 115 | } | 115 | } |
| 116 | // this->status will be used for errors while actually running the game | ||
| 117 | status = ResultStatus::Success; | 116 | status = ResultStatus::Success; |
| 118 | return ResultStatus::Success; | 117 | return status; |
| 119 | } | 118 | } |
| 120 | 119 | ||
| 121 | void System::PrepareReschedule() { | 120 | 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: | |||
| 108 | PerfStats perf_stats; | 108 | PerfStats perf_stats; |
| 109 | FrameLimiter frame_limiter; | 109 | FrameLimiter frame_limiter; |
| 110 | 110 | ||
| 111 | ResultStatus GetStatus() { | 111 | void SetStatus(ResultStatus new_status, const char* details = nullptr) { |
| 112 | return status; | ||
| 113 | } | ||
| 114 | |||
| 115 | void SetStatus(ResultStatus new_status, std::string details = std::string()) { | ||
| 116 | status = new_status; | 112 | status = new_status; |
| 117 | status_details = details; | 113 | if (details) { |
| 114 | status_details = details; | ||
| 115 | } | ||
| 118 | } | 116 | } |
| 119 | 117 | ||
| 120 | std::string GetStatusDetails() { | 118 | const std::string& GetStatusDetails() const { |
| 121 | return status_details; | 119 | return status_details; |
| 122 | } | 120 | } |
| 123 | 121 | ||
| @@ -147,8 +145,8 @@ private: | |||
| 147 | 145 | ||
| 148 | static System s_instance; | 146 | static System s_instance; |
| 149 | 147 | ||
| 150 | ResultStatus status; | 148 | ResultStatus status = ResultStatus::Success; |
| 151 | std::string status_details; | 149 | std::string status_details = ""; |
| 152 | }; | 150 | }; |
| 153 | 151 | ||
| 154 | inline ARM_Interface& CPU() { | 152 | 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& | |||
| 42 | 42 | ||
| 43 | if (!file->IsOpen()) { | 43 | if (!file->IsOpen()) { |
| 44 | // High Title ID of the archive: The category (https://3dbrew.org/wiki/Title_list). | 44 | // High Title ID of the archive: The category (https://3dbrew.org/wiki/Title_list). |
| 45 | const u32 shared_data_archive = 0x0004009B; | 45 | constexpr u32 shared_data_archive = 0x0004009B; |
| 46 | const u32 system_data_archive = 0x000400DB; | 46 | constexpr u32 system_data_archive = 0x000400DB; |
| 47 | 47 | ||
| 48 | // Low Title IDs. | 48 | // Low Title IDs. |
| 49 | const u32 mii_data = 0x00010202; | 49 | constexpr u32 mii_data = 0x00010202; |
| 50 | const u32 region_manifest = 0x00010402; | 50 | constexpr u32 region_manifest = 0x00010402; |
| 51 | const u32 ng_word_list = 0x00010302; | 51 | constexpr u32 ng_word_list = 0x00010302; |
| 52 | 52 | ||
| 53 | LOG_DEBUG(Service_FS, "Full Path: %s. Category: 0x%X. Path: 0x%X.", path.DebugStr().c_str(), | 53 | LOG_DEBUG(Service_FS, "Full Path: %s. Category: 0x%X. Path: 0x%X.", path.DebugStr().c_str(), |
| 54 | high, low); | 54 | high, low); |
| @@ -60,7 +60,7 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_NCCH::Open(const Path& | |||
| 60 | "Mii data"); | 60 | "Mii data"); |
| 61 | } else if (low == region_manifest) { | 61 | } else if (low == region_manifest) { |
| 62 | LOG_ERROR(Service_FS, | 62 | LOG_ERROR(Service_FS, |
| 63 | "Failed to get a handle for shared data archive: region manifes"); | 63 | "Failed to get a handle for shared data archive: region manifest."); |
| 64 | Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorSystemFiles, | 64 | Core::System::GetInstance().SetStatus(Core::System::ResultStatus::ErrorSystemFiles, |
| 65 | "Region manifest"); | 65 | "Region manifest"); |
| 66 | } | 66 | } |
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 | |||
| 257 | LOG_TRACE(Service_FS, "Opening archive with id code 0x%08X", id_code); | 257 | LOG_TRACE(Service_FS, "Opening archive with id code 0x%08X", id_code); |
| 258 | 258 | ||
| 259 | auto itr = id_code_map.find(id_code); | 259 | auto itr = id_code_map.find(id_code); |
| 260 | if (itr == id_code_map.end()) | 260 | if (itr == id_code_map.end()) { |
| 261 | return FileSys::ERROR_NOT_FOUND; | 261 | return FileSys::ERROR_NOT_FOUND; |
| 262 | } | ||
| 262 | 263 | ||
| 263 | CASCADE_RESULT(std::unique_ptr<ArchiveBackend> res, itr->second->Open(archive_path)); | 264 | CASCADE_RESULT(std::unique_ptr<ArchiveBackend> res, itr->second->Open(archive_path)); |
| 264 | 265 | ||
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: | |||
| 101 | * Loads the system mode that this application needs. | 101 | * Loads the system mode that this application needs. |
| 102 | * This function defaults to 2 (96MB allocated to the application) if it can't read the | 102 | * This function defaults to 2 (96MB allocated to the application) if it can't read the |
| 103 | * information. | 103 | * information. |
| 104 | * @returns a pair of Optional with the kernel system mode and ResultStatus. | 104 | * @returns A pair with the optional system mode, and and the status. |
| 105 | */ | 105 | */ |
| 106 | virtual std::pair<boost::optional<u32>, ResultStatus> LoadKernelSystemMode() { | 106 | virtual std::pair<boost::optional<u32>, ResultStatus> LoadKernelSystemMode() { |
| 107 | // 96MB allocated to the application. | 107 | // 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: | |||
| 179 | 179 | ||
| 180 | /** | 180 | /** |
| 181 | * Loads the Exheader and returns the system mode for this application. | 181 | * Loads the Exheader and returns the system mode for this application. |
| 182 | * @returns a pair of Optional with the kernel system mode and ResultStatus | 182 | * @returns A pair with the optional system mode, and and the status. |
| 183 | */ | 183 | */ |
| 184 | std::pair<boost::optional<u32>, ResultStatus> LoadKernelSystemMode() override; | 184 | std::pair<boost::optional<u32>, ResultStatus> LoadKernelSystemMode() override; |
| 185 | 185 | ||