diff options
| author | 2024-02-18 07:38:47 +1100 | |
|---|---|---|
| committer | 2024-02-18 07:38:47 +1100 | |
| commit | 9eba64adce6d6d4af66d6335ba061e9df810892a (patch) | |
| tree | 6da47a105be8271e6d3c9f4d11c877674ceb80a5 /src | |
| parent | Merge branch 'yuzu-emu:master' into import-firmware (diff) | |
| download | yuzu-9eba64adce6d6d4af66d6335ba061e9df810892a.tar.gz yuzu-9eba64adce6d6d4af66d6335ba061e9df810892a.tar.xz yuzu-9eba64adce6d6d4af66d6335ba061e9df810892a.zip | |
Improve behavior when one or more firmware files can't be deleted.
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/main.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 58e23fc69..d3517b805 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -4187,7 +4187,7 @@ void GMainWindow::OnInstallFirmware() { | |||
| 4187 | 4187 | ||
| 4188 | LOG_INFO(Frontend, "Installing firmware from {}", firmware_source_location.toStdString()); | 4188 | LOG_INFO(Frontend, "Installing firmware from {}", firmware_source_location.toStdString()); |
| 4189 | 4189 | ||
| 4190 | // Check for a resonable number of .nca files (don't hardcode them, just see if there's some in there. | 4190 | // Check for a resonable number of .nca files (don't hardcode them, just see if there's some in there.) |
| 4191 | std::filesystem::path firmware_source_path = firmware_source_location.toStdString(); | 4191 | std::filesystem::path firmware_source_path = firmware_source_location.toStdString(); |
| 4192 | if (!Common::FS::IsDir(firmware_source_path)) { | 4192 | if (!Common::FS::IsDir(firmware_source_path)) { |
| 4193 | progress.close(); | 4193 | progress.close(); |
| @@ -4195,7 +4195,6 @@ void GMainWindow::OnInstallFirmware() { | |||
| 4195 | } | 4195 | } |
| 4196 | 4196 | ||
| 4197 | std::vector<std::filesystem::path> out; | 4197 | std::vector<std::filesystem::path> out; |
| 4198 | |||
| 4199 | const Common::FS::DirEntryCallable callback = [&out](const std::filesystem::directory_entry& entry) { | 4198 | const Common::FS::DirEntryCallable callback = [&out](const std::filesystem::directory_entry& entry) { |
| 4200 | if (entry.path().has_extension() && entry.path().extension() == ".nca") | 4199 | if (entry.path().has_extension() && entry.path().extension() == ".nca") |
| 4201 | out.emplace_back(entry.path()); | 4200 | out.emplace_back(entry.path()); |
| @@ -4215,11 +4214,15 @@ void GMainWindow::OnInstallFirmware() { | |||
| 4215 | 4214 | ||
| 4216 | // Locate and erase the content of nand/system/Content/registered/*.nca, if any. | 4215 | // Locate and erase the content of nand/system/Content/registered/*.nca, if any. |
| 4217 | auto sysnand_content_vdir = system->GetFileSystemController().GetSystemNANDContentDirectory(); | 4216 | auto sysnand_content_vdir = system->GetFileSystemController().GetSystemNANDContentDirectory(); |
| 4218 | if (sysnand_content_vdir->CleanSubdirectoryRecursive("registered")) { | 4217 | if (!sysnand_content_vdir->CleanSubdirectoryRecursive("registered")) { |
| 4219 | LOG_INFO(Frontend, | 4218 | progress.close(); |
| 4220 | "Cleaned nand/system/Content/registered folder in preparation for new firmware."); | 4219 | QMessageBox::critical(this, tr("Firmware install failed"), tr("Failed to delete one or more firmware file.")); |
| 4220 | return; | ||
| 4221 | } | 4221 | } |
| 4222 | 4222 | ||
| 4223 | LOG_INFO(Frontend, | ||
| 4224 | "Cleaned nand/system/Content/registered folder in preparation for new firmware."); | ||
| 4225 | |||
| 4223 | QtProgressCallback(100, 20); | 4226 | QtProgressCallback(100, 20); |
| 4224 | 4227 | ||
| 4225 | auto firmware_vdir = sysnand_content_vdir->GetDirectoryRelative("registered"); | 4228 | auto firmware_vdir = sysnand_content_vdir->GetDirectoryRelative("registered"); |
| @@ -4239,7 +4242,7 @@ void GMainWindow::OnInstallFirmware() { | |||
| 4239 | success = false; | 4242 | success = false; |
| 4240 | } | 4243 | } |
| 4241 | 4244 | ||
| 4242 | if (QtProgressCallback(100, 20 + (int)(((float)(i) / (float)out.size()) * 70.0))) | 4245 | if (QtProgressCallback(100, 20 + (int)(((float)(i) / (float)out.size()) * 80.0))) |
| 4243 | { | 4246 | { |
| 4244 | success = false; | 4247 | success = false; |
| 4245 | cancelled = true; | 4248 | cancelled = true; |