diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/frontend_common/content_manager.h | 5 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 23 |
2 files changed, 25 insertions, 3 deletions
diff --git a/src/frontend_common/content_manager.h b/src/frontend_common/content_manager.h index f3efe3465..c4e97a47b 100644 --- a/src/frontend_common/content_manager.h +++ b/src/frontend_common/content_manager.h | |||
| @@ -251,11 +251,12 @@ inline InstallResult InstallNCA(FileSys::VfsFilesystem& vfs, const std::string& | |||
| 251 | * \param callback Callback to report the progress of the installation. The first size_t | 251 | * \param callback Callback to report the progress of the installation. The first size_t |
| 252 | * parameter is the total size of the installed contents and the second is the current progress. If | 252 | * parameter is the total size of the installed contents and the second is the current progress. If |
| 253 | * you return true to the callback, it will cancel the installation as soon as possible. | 253 | * you return true to the callback, it will cancel the installation as soon as possible. |
| 254 | * \param firmware_only Set to true to only scan system nand NCAs (firmware), post firmware install. | ||
| 254 | * \return A list of entries that failed to install. Returns an empty vector if successful. | 255 | * \return A list of entries that failed to install. Returns an empty vector if successful. |
| 255 | */ | 256 | */ |
| 256 | inline std::vector<std::string> VerifyInstalledContents( | 257 | inline std::vector<std::string> VerifyInstalledContents( |
| 257 | Core::System& system, FileSys::ManualContentProvider& provider, | 258 | Core::System& system, FileSys::ManualContentProvider& provider, |
| 258 | const std::function<bool(size_t, size_t)>& callback) { | 259 | const std::function<bool(size_t, size_t)>& callback, bool firmware_only = false) { |
| 259 | // Get content registries. | 260 | // Get content registries. |
| 260 | auto bis_contents = system.GetFileSystemController().GetSystemNANDContents(); | 261 | auto bis_contents = system.GetFileSystemController().GetSystemNANDContents(); |
| 261 | auto user_contents = system.GetFileSystemController().GetUserNANDContents(); | 262 | auto user_contents = system.GetFileSystemController().GetUserNANDContents(); |
| @@ -264,7 +265,7 @@ inline std::vector<std::string> VerifyInstalledContents( | |||
| 264 | if (bis_contents) { | 265 | if (bis_contents) { |
| 265 | content_providers.push_back(bis_contents); | 266 | content_providers.push_back(bis_contents); |
| 266 | } | 267 | } |
| 267 | if (user_contents) { | 268 | if (user_contents && !firmware_only) { |
| 268 | content_providers.push_back(user_contents); | 269 | content_providers.push_back(user_contents); |
| 269 | } | 270 | } |
| 270 | 271 | ||
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index fc6f0d381..0d16bfd65 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -4248,7 +4248,7 @@ void GMainWindow::OnInstallFirmware() { | |||
| 4248 | success = false; | 4248 | success = false; |
| 4249 | } | 4249 | } |
| 4250 | 4250 | ||
| 4251 | if (QtProgressCallback(100, 20 + (int)(((float)(i) / (float)out.size()) * 80.0))) { | 4251 | if (QtProgressCallback(100, 20 + (int)(((float)(i) / (float)out.size()) * 70.0))) { |
| 4252 | success = false; | 4252 | success = false; |
| 4253 | cancelled = true; | 4253 | cancelled = true; |
| 4254 | break; | 4254 | break; |
| @@ -4268,6 +4268,27 @@ void GMainWindow::OnInstallFirmware() { | |||
| 4268 | return; | 4268 | return; |
| 4269 | } | 4269 | } |
| 4270 | 4270 | ||
| 4271 | // Re-scan VFS for the newly placed firmware files. | ||
| 4272 | system->GetFileSystemController().CreateFactories(*vfs); | ||
| 4273 | |||
| 4274 | auto VerifyFirmwareCallback = [&](size_t total_size, size_t processed_size) { | ||
| 4275 | progress.setValue(90 + static_cast<int>((processed_size * 10) / total_size)); | ||
| 4276 | return progress.wasCanceled(); | ||
| 4277 | }; | ||
| 4278 | |||
| 4279 | auto result = | ||
| 4280 | ContentManager::VerifyInstalledContents(*system, *provider, VerifyFirmwareCallback, true); | ||
| 4281 | |||
| 4282 | if (result.size() > 0) { | ||
| 4283 | const auto failed_names = | ||
| 4284 | QString::fromStdString(fmt::format("{}", fmt::join(result, "\n"))); | ||
| 4285 | progress.close(); | ||
| 4286 | QMessageBox::critical( | ||
| 4287 | this, tr("Firmware integrity verification failed!"), | ||
| 4288 | tr("Verification failed for the following files:\n\n%1").arg(failed_names)); | ||
| 4289 | return; | ||
| 4290 | } | ||
| 4291 | |||
| 4271 | progress.close(); | 4292 | progress.close(); |
| 4272 | OnCheckFirmwareDecryption(); | 4293 | OnCheckFirmwareDecryption(); |
| 4273 | } | 4294 | } |