summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Andrew Pilley2024-02-18 07:41:24 +1100
committerGravatar Andrew Pilley2024-02-18 07:41:24 +1100
commit59ede32f8e0f528d96ade4da8f0c79ccda1cc4e8 (patch)
treeb0253d78db46856b8d099bc0ccc1af7b3344ae56 /src
parentImprove behavior when one or more firmware files can't be deleted. (diff)
downloadyuzu-59ede32f8e0f528d96ade4da8f0c79ccda1cc4e8.tar.gz
yuzu-59ede32f8e0f528d96ade4da8f0c79ccda1cc4e8.tar.xz
yuzu-59ede32f8e0f528d96ade4da8f0c79ccda1cc4e8.zip
cleanup by clang-format.
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/main.cpp36
1 files changed, 21 insertions, 15 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index d3517b805..79741e721 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -4161,13 +4161,15 @@ void GMainWindow::OnInstallFirmware() {
4161 4161
4162 // Check for installed keys, error out, suggest restart? 4162 // Check for installed keys, error out, suggest restart?
4163 if (!ContentManager::AreKeysPresent()) { 4163 if (!ContentManager::AreKeysPresent()) {
4164 QMessageBox::information(this, tr("Keys not installed"), 4164 QMessageBox::information(
4165 tr("Install decryption keys and restart yuzu before attempting to install firmware.")); 4165 this, tr("Keys not installed"),
4166 tr("Install decryption keys and restart yuzu before attempting to install firmware."));
4166 return; 4167 return;
4167 } 4168 }
4168 4169
4169 QString firmware_source_location = QFileDialog::getExistingDirectory(this, 4170 QString firmware_source_location =
4170 tr("Select Dumped Firmware Source Location"), QString::fromStdString(""), QFileDialog::ShowDirsOnly); 4171 QFileDialog::getExistingDirectory(this, tr("Select Dumped Firmware Source Location"),
4172 QString::fromStdString(""), QFileDialog::ShowDirsOnly);
4171 if (firmware_source_location.isEmpty()) { 4173 if (firmware_source_location.isEmpty()) {
4172 return; 4174 return;
4173 } 4175 }
@@ -4187,7 +4189,8 @@ void GMainWindow::OnInstallFirmware() {
4187 4189
4188 LOG_INFO(Frontend, "Installing firmware from {}", firmware_source_location.toStdString()); 4190 LOG_INFO(Frontend, "Installing firmware from {}", firmware_source_location.toStdString());
4189 4191
4190 // Check for a resonable number of .nca files (don't hardcode them, just see if there's some in there.) 4192 // Check for a resonable number of .nca files (don't hardcode them, just see if there's some in
4193 // there.)
4191 std::filesystem::path firmware_source_path = firmware_source_location.toStdString(); 4194 std::filesystem::path firmware_source_path = firmware_source_location.toStdString();
4192 if (!Common::FS::IsDir(firmware_source_path)) { 4195 if (!Common::FS::IsDir(firmware_source_path)) {
4193 progress.close(); 4196 progress.close();
@@ -4195,12 +4198,13 @@ void GMainWindow::OnInstallFirmware() {
4195 } 4198 }
4196 4199
4197 std::vector<std::filesystem::path> out; 4200 std::vector<std::filesystem::path> out;
4198 const Common::FS::DirEntryCallable callback = [&out](const std::filesystem::directory_entry& entry) { 4201 const Common::FS::DirEntryCallable callback =
4199 if (entry.path().has_extension() && entry.path().extension() == ".nca") 4202 [&out](const std::filesystem::directory_entry& entry) {
4200 out.emplace_back(entry.path()); 4203 if (entry.path().has_extension() && entry.path().extension() == ".nca")
4204 out.emplace_back(entry.path());
4201 4205
4202 return true; 4206 return true;
4203 }; 4207 };
4204 4208
4205 QtProgressCallback(100, 10); 4209 QtProgressCallback(100, 10);
4206 4210
@@ -4216,7 +4220,8 @@ void GMainWindow::OnInstallFirmware() {
4216 auto sysnand_content_vdir = system->GetFileSystemController().GetSystemNANDContentDirectory(); 4220 auto sysnand_content_vdir = system->GetFileSystemController().GetSystemNANDContentDirectory();
4217 if (!sysnand_content_vdir->CleanSubdirectoryRecursive("registered")) { 4221 if (!sysnand_content_vdir->CleanSubdirectoryRecursive("registered")) {
4218 progress.close(); 4222 progress.close();
4219 QMessageBox::critical(this, tr("Firmware install failed"), tr("Failed to delete one or more firmware file.")); 4223 QMessageBox::critical(this, tr("Firmware install failed"),
4224 tr("Failed to delete one or more firmware file."));
4220 return; 4225 return;
4221 } 4226 }
4222 4227
@@ -4234,7 +4239,8 @@ void GMainWindow::OnInstallFirmware() {
4234 i++; 4239 i++;
4235 auto firmware_src_vfile = 4240 auto firmware_src_vfile =
4236 vfs->OpenFile(firmware_src_path.generic_string(), FileSys::OpenMode::Read); 4241 vfs->OpenFile(firmware_src_path.generic_string(), FileSys::OpenMode::Read);
4237 auto firmware_dst_vfile = firmware_vdir->CreateFileRelative(firmware_src_path.filename().string()); 4242 auto firmware_dst_vfile =
4243 firmware_vdir->CreateFileRelative(firmware_src_path.filename().string());
4238 4244
4239 if (!VfsRawCopy(firmware_src_vfile, firmware_dst_vfile)) { 4245 if (!VfsRawCopy(firmware_src_vfile, firmware_dst_vfile)) {
4240 LOG_ERROR(Frontend, "Failed to copy firmware file {} to {} in registered folder!", 4246 LOG_ERROR(Frontend, "Failed to copy firmware file {} to {} in registered folder!",
@@ -4242,8 +4248,7 @@ void GMainWindow::OnInstallFirmware() {
4242 success = false; 4248 success = false;
4243 } 4249 }
4244 4250
4245 if (QtProgressCallback(100, 20 + (int)(((float)(i) / (float)out.size()) * 80.0))) 4251 if (QtProgressCallback(100, 20 + (int)(((float)(i) / (float)out.size()) * 80.0))) {
4246 {
4247 success = false; 4252 success = false;
4248 cancelled = true; 4253 cancelled = true;
4249 break; 4254 break;
@@ -4258,7 +4263,8 @@ void GMainWindow::OnInstallFirmware() {
4258 } else if (cancelled) { 4263 } else if (cancelled) {
4259 progress.close(); 4264 progress.close();
4260 QMessageBox::warning(this, tr("Firmware install failed"), 4265 QMessageBox::warning(this, tr("Firmware install failed"),
4261 tr("Firmware installation cancelled, firmware may be in bad state, restart yuzu or re-install firmware.")); 4266 tr("Firmware installation cancelled, firmware may be in bad state, "
4267 "restart yuzu or re-install firmware."));
4262 return; 4268 return;
4263 } 4269 }
4264 4270