mirror of
https://github.com/yuzu-emu/yuzu-android
synced 2024-12-23 03:41:22 -08:00
Add check for corrupted firmware files after install.
This commit is contained in:
parent
e31c926bf0
commit
cb2e312f13
@ -251,11 +251,12 @@ inline InstallResult InstallNCA(FileSys::VfsFilesystem& vfs, const std::string&
|
|||||||
* \param callback Callback to report the progress of the installation. The first size_t
|
* \param callback Callback to report the progress of the installation. The first size_t
|
||||||
* parameter is the total size of the installed contents and the second is the current progress. If
|
* parameter is the total size of the installed contents and the second is the current progress. If
|
||||||
* you return true to the callback, it will cancel the installation as soon as possible.
|
* you return true to the callback, it will cancel the installation as soon as possible.
|
||||||
|
* \param firmware_only Set to true to only scan system nand NCAs (firmware), post firmware install.
|
||||||
* \return A list of entries that failed to install. Returns an empty vector if successful.
|
* \return A list of entries that failed to install. Returns an empty vector if successful.
|
||||||
*/
|
*/
|
||||||
inline std::vector<std::string> VerifyInstalledContents(
|
inline std::vector<std::string> VerifyInstalledContents(
|
||||||
Core::System& system, FileSys::ManualContentProvider& provider,
|
Core::System& system, FileSys::ManualContentProvider& provider,
|
||||||
const std::function<bool(size_t, size_t)>& callback) {
|
const std::function<bool(size_t, size_t)>& callback, bool firmware_only = false) {
|
||||||
// Get content registries.
|
// Get content registries.
|
||||||
auto bis_contents = system.GetFileSystemController().GetSystemNANDContents();
|
auto bis_contents = system.GetFileSystemController().GetSystemNANDContents();
|
||||||
auto user_contents = system.GetFileSystemController().GetUserNANDContents();
|
auto user_contents = system.GetFileSystemController().GetUserNANDContents();
|
||||||
@ -264,7 +265,7 @@ inline std::vector<std::string> VerifyInstalledContents(
|
|||||||
if (bis_contents) {
|
if (bis_contents) {
|
||||||
content_providers.push_back(bis_contents);
|
content_providers.push_back(bis_contents);
|
||||||
}
|
}
|
||||||
if (user_contents) {
|
if (user_contents && !firmware_only) {
|
||||||
content_providers.push_back(user_contents);
|
content_providers.push_back(user_contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4248,7 +4248,7 @@ void GMainWindow::OnInstallFirmware() {
|
|||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QtProgressCallback(100, 20 + (int)(((float)(i) / (float)out.size()) * 80.0))) {
|
if (QtProgressCallback(100, 20 + (int)(((float)(i) / (float)out.size()) * 70.0))) {
|
||||||
success = false;
|
success = false;
|
||||||
cancelled = true;
|
cancelled = true;
|
||||||
break;
|
break;
|
||||||
@ -4268,6 +4268,27 @@ void GMainWindow::OnInstallFirmware() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Re-scan VFS for the newly placed firmware files.
|
||||||
|
system->GetFileSystemController().CreateFactories(*vfs);
|
||||||
|
|
||||||
|
auto VerifyFirmwareCallback = [&](size_t total_size, size_t processed_size) {
|
||||||
|
progress.setValue(90 + static_cast<int>((processed_size * 10) / total_size));
|
||||||
|
return progress.wasCanceled();
|
||||||
|
};
|
||||||
|
|
||||||
|
auto result =
|
||||||
|
ContentManager::VerifyInstalledContents(*system, *provider, VerifyFirmwareCallback, true);
|
||||||
|
|
||||||
|
if (result.size() > 0) {
|
||||||
|
const auto failed_names =
|
||||||
|
QString::fromStdString(fmt::format("{}", fmt::join(result, "\n")));
|
||||||
|
progress.close();
|
||||||
|
QMessageBox::critical(
|
||||||
|
this, tr("Firmware integrity verification failed!"),
|
||||||
|
tr("Verification failed for the following files:\n\n%1").arg(failed_names));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
progress.close();
|
progress.close();
|
||||||
OnCheckFirmwareDecryption();
|
OnCheckFirmwareDecryption();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user