2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Improve behavior when one or more firmware files can't be deleted.

This commit is contained in:
Andrew Pilley 2024-02-18 07:38:47 +11:00
parent e2e0916100
commit 9eba64adce

View file

@ -4187,7 +4187,7 @@ void GMainWindow::OnInstallFirmware() {
LOG_INFO(Frontend, "Installing firmware from {}", firmware_source_location.toStdString()); LOG_INFO(Frontend, "Installing firmware from {}", firmware_source_location.toStdString());
// Check for a resonable number of .nca files (don't hardcode them, just see if there's some in there. // Check for a resonable number of .nca files (don't hardcode them, just see if there's some in there.)
std::filesystem::path firmware_source_path = firmware_source_location.toStdString(); std::filesystem::path firmware_source_path = firmware_source_location.toStdString();
if (!Common::FS::IsDir(firmware_source_path)) { if (!Common::FS::IsDir(firmware_source_path)) {
progress.close(); progress.close();
@ -4195,7 +4195,6 @@ void GMainWindow::OnInstallFirmware() {
} }
std::vector<std::filesystem::path> out; std::vector<std::filesystem::path> out;
const Common::FS::DirEntryCallable callback = [&out](const std::filesystem::directory_entry& entry) { const Common::FS::DirEntryCallable callback = [&out](const std::filesystem::directory_entry& entry) {
if (entry.path().has_extension() && entry.path().extension() == ".nca") if (entry.path().has_extension() && entry.path().extension() == ".nca")
out.emplace_back(entry.path()); out.emplace_back(entry.path());
@ -4215,10 +4214,14 @@ void GMainWindow::OnInstallFirmware() {
// Locate and erase the content of nand/system/Content/registered/*.nca, if any. // Locate and erase the content of nand/system/Content/registered/*.nca, if any.
auto sysnand_content_vdir = system->GetFileSystemController().GetSystemNANDContentDirectory(); auto sysnand_content_vdir = system->GetFileSystemController().GetSystemNANDContentDirectory();
if (sysnand_content_vdir->CleanSubdirectoryRecursive("registered")) { if (!sysnand_content_vdir->CleanSubdirectoryRecursive("registered")) {
progress.close();
QMessageBox::critical(this, tr("Firmware install failed"), tr("Failed to delete one or more firmware file."));
return;
}
LOG_INFO(Frontend, LOG_INFO(Frontend,
"Cleaned nand/system/Content/registered folder in preparation for new firmware."); "Cleaned nand/system/Content/registered folder in preparation for new firmware.");
}
QtProgressCallback(100, 20); QtProgressCallback(100, 20);
@ -4239,7 +4242,7 @@ void GMainWindow::OnInstallFirmware() {
success = false; success = false;
} }
if (QtProgressCallback(100, 20 + (int)(((float)(i) / (float)out.size()) * 70.0))) if (QtProgressCallback(100, 20 + (int)(((float)(i) / (float)out.size()) * 80.0)))
{ {
success = false; success = false;
cancelled = true; cancelled = true;