summaryrefslogtreecommitdiffstats
path: root/src/yuzu/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/yuzu/main.cpp')
-rw-r--r--src/yuzu/main.cpp436
1 files changed, 73 insertions, 363 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 3c562e3b2..782bcbb61 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -35,8 +35,8 @@
#include "configuration/configure_per_game.h"
#include "configuration/configure_tas.h"
#include "core/file_sys/romfs_factory.h"
-#include "core/file_sys/vfs.h"
-#include "core/file_sys/vfs_real.h"
+#include "core/file_sys/vfs/vfs.h"
+#include "core/file_sys/vfs/vfs_real.h"
#include "core/frontend/applets/cabinet.h"
#include "core/frontend/applets/controller.h"
#include "core/frontend/applets/general_frontend.h"
@@ -47,6 +47,7 @@
#include "core/hle/service/am/applet_oe.h"
#include "core/hle/service/am/applets/applets.h"
#include "core/hle/service/set/system_settings_server.h"
+#include "frontend_common/content_manager.h"
#include "hid_core/frontend/emulated_controller.h"
#include "hid_core/hid_core.h"
#include "yuzu/multiplayer/state.h"
@@ -55,7 +56,7 @@
// These are wrappers to avoid the calls to CreateDirectory and CreateFile because of the Windows
// defines.
static FileSys::VirtualDir VfsFilesystemCreateDirectoryWrapper(
- const FileSys::VirtualFilesystem& vfs, const std::string& path, FileSys::Mode mode) {
+ const FileSys::VirtualFilesystem& vfs, const std::string& path, FileSys::OpenMode mode) {
return vfs->CreateDirectory(path, mode);
}
@@ -422,7 +423,7 @@ GMainWindow::GMainWindow(std::unique_ptr<QtConfig> config_, bool has_broken_vulk
RemoveCachedContents();
// Gen keys if necessary
- OnReinitializeKeys(ReinitializeKeyBehavior::NoWarning);
+ OnCheckFirmwareDecryption();
game_list->LoadCompatibilityList();
game_list->PopulateAsync(UISettings::values.game_dirs);
@@ -1573,8 +1574,6 @@ void GMainWindow::ConnectMenuEvents() {
connect(multiplayer_state, &MultiplayerState::SaveConfig, this, &GMainWindow::OnSaveConfig);
// Tools
- connect_menu(ui->action_Rederive, std::bind(&GMainWindow::OnReinitializeKeys, this,
- ReinitializeKeyBehavior::Warning));
connect_menu(ui->action_Load_Album, &GMainWindow::OnAlbum);
connect_menu(ui->action_Load_Cabinet_Nickname_Owner,
[this]() { OnCabinet(Service::NFP::CabinetMode::StartNicknameAndOwnerSettings); });
@@ -1881,7 +1880,7 @@ bool GMainWindow::SelectAndSetCurrentUser(
void GMainWindow::ConfigureFilesystemProvider(const std::string& filepath) {
// Ensure all NCAs are registered before launching the game
- const auto file = vfs->OpenFile(filepath, FileSys::Mode::Read);
+ const auto file = vfs->OpenFile(filepath, FileSys::OpenMode::Read);
if (!file) {
return;
}
@@ -2275,7 +2274,7 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
open_target = tr("Save Data");
const auto nand_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir);
auto vfs_nand_dir =
- vfs->OpenDirectory(Common::FS::PathToUTF8String(nand_dir), FileSys::Mode::Read);
+ vfs->OpenDirectory(Common::FS::PathToUTF8String(nand_dir), FileSys::OpenMode::Read);
if (has_user_save) {
// User save data
@@ -2476,10 +2475,8 @@ void GMainWindow::OnGameListRemoveInstalledEntry(u64 program_id, InstalledEntryT
}
void GMainWindow::RemoveBaseContent(u64 program_id, InstalledEntryType type) {
- const auto& fs_controller = system->GetFileSystemController();
- const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(program_id) ||
- fs_controller.GetSDMCContents()->RemoveExistingEntry(program_id);
-
+ const auto res =
+ ContentManager::RemoveBaseContent(system->GetFileSystemController(), program_id);
if (res) {
QMessageBox::information(this, tr("Successfully Removed"),
tr("Successfully removed the installed base game."));
@@ -2491,11 +2488,7 @@ void GMainWindow::RemoveBaseContent(u64 program_id, InstalledEntryType type) {
}
void GMainWindow::RemoveUpdateContent(u64 program_id, InstalledEntryType type) {
- const auto update_id = program_id | 0x800;
- const auto& fs_controller = system->GetFileSystemController();
- const auto res = fs_controller.GetUserNANDContents()->RemoveExistingEntry(update_id) ||
- fs_controller.GetSDMCContents()->RemoveExistingEntry(update_id);
-
+ const auto res = ContentManager::RemoveUpdate(system->GetFileSystemController(), program_id);
if (res) {
QMessageBox::information(this, tr("Successfully Removed"),
tr("Successfully removed the installed update."));
@@ -2506,22 +2499,7 @@ void GMainWindow::RemoveUpdateContent(u64 program_id, InstalledEntryType type) {
}
void GMainWindow::RemoveAddOnContent(u64 program_id, InstalledEntryType type) {
- u32 count{};
- const auto& fs_controller = system->GetFileSystemController();
- const auto dlc_entries = system->GetContentProvider().ListEntriesFilter(
- FileSys::TitleType::AOC, FileSys::ContentRecordType::Data);
-
- for (const auto& entry : dlc_entries) {
- if (FileSys::GetBaseTitleID(entry.title_id) == program_id) {
- const auto res =
- fs_controller.GetUserNANDContents()->RemoveExistingEntry(entry.title_id) ||
- fs_controller.GetSDMCContents()->RemoveExistingEntry(entry.title_id);
- if (res) {
- ++count;
- }
- }
- }
-
+ const size_t count = ContentManager::RemoveAllDLC(*system, program_id);
if (count == 0) {
QMessageBox::warning(this, GetGameListErrorRemoving(type),
tr("There are no DLC installed for this title."));
@@ -2675,7 +2653,7 @@ void GMainWindow::RemoveCustomConfiguration(u64 program_id, const std::string& g
void GMainWindow::RemoveCacheStorage(u64 program_id) {
const auto nand_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir);
auto vfs_nand_dir =
- vfs->OpenDirectory(Common::FS::PathToUTF8String(nand_dir), FileSys::Mode::Read);
+ vfs->OpenDirectory(Common::FS::PathToUTF8String(nand_dir), FileSys::OpenMode::Read);
const auto cache_storage_path = FileSys::SaveDataFactory::GetFullPath(
{}, vfs_nand_dir, FileSys::SaveDataSpaceId::NandUser, FileSys::SaveDataType::CacheStorage,
@@ -2695,7 +2673,8 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
"cancelled the operation."));
};
- const auto loader = Loader::GetLoader(*system, vfs->OpenFile(game_path, FileSys::Mode::Read));
+ const auto loader =
+ Loader::GetLoader(*system, vfs->OpenFile(game_path, FileSys::OpenMode::Read));
if (loader == nullptr) {
failed();
return;
@@ -2739,7 +2718,7 @@ void GMainWindow::OnGameListDumpRomFS(u64 program_id, const std::string& game_pa
const FileSys::PatchManager pm{title_id, system->GetFileSystemController(), installed};
auto romfs = pm.PatchRomFS(base_nca.get(), base_romfs, type, packed_update_raw, false);
- const auto out = VfsFilesystemCreateDirectoryWrapper(vfs, path, FileSys::Mode::ReadWrite);
+ const auto out = VfsFilesystemCreateDirectoryWrapper(vfs, path, FileSys::OpenMode::ReadWrite);
if (out == nullptr) {
failed();
@@ -2806,16 +2785,6 @@ void GMainWindow::OnGameListVerifyIntegrity(const std::string& game_path) {
QMessageBox::warning(this, tr("Integrity verification couldn't be performed!"),
tr("File contents were not checked for validity."));
};
- const auto Failed = [this] {
- QMessageBox::critical(this, tr("Integrity verification failed!"),
- tr("File contents may be corrupt."));
- };
-
- const auto loader = Loader::GetLoader(*system, vfs->OpenFile(game_path, FileSys::Mode::Read));
- if (loader == nullptr) {
- NotImplemented();
- return;
- }
QProgressDialog progress(tr("Verifying integrity..."), tr("Cancel"), 0, 100, this);
progress.setWindowModality(Qt::WindowModal);
@@ -2823,30 +2792,25 @@ void GMainWindow::OnGameListVerifyIntegrity(const std::string& game_path) {
progress.setAutoClose(false);
progress.setAutoReset(false);
- const auto QtProgressCallback = [&](size_t processed_size, size_t total_size) {
- if (progress.wasCanceled()) {
- return false;
- }
-
+ const auto QtProgressCallback = [&](size_t total_size, size_t processed_size) {
progress.setValue(static_cast<int>((processed_size * 100) / total_size));
- return true;
+ return progress.wasCanceled();
};
- const auto status = loader->VerifyIntegrity(QtProgressCallback);
- if (progress.wasCanceled() ||
- status == Loader::ResultStatus::ErrorIntegrityVerificationNotImplemented) {
+ const auto result = ContentManager::VerifyGameContents(*system, game_path, QtProgressCallback);
+ progress.close();
+ switch (result) {
+ case ContentManager::GameVerificationResult::Success:
+ QMessageBox::information(this, tr("Integrity verification succeeded!"),
+ tr("The operation completed successfully."));
+ break;
+ case ContentManager::GameVerificationResult::Failed:
+ QMessageBox::critical(this, tr("Integrity verification failed!"),
+ tr("File contents may be corrupt."));
+ break;
+ case ContentManager::GameVerificationResult::NotImplemented:
NotImplemented();
- return;
- }
-
- if (status == Loader::ResultStatus::ErrorIntegrityVerificationFailed) {
- Failed();
- return;
}
-
- progress.close();
- QMessageBox::information(this, tr("Integrity verification succeeded!"),
- tr("The operation completed successfully."));
}
void GMainWindow::OnGameListCopyTID(u64 program_id) {
@@ -3052,7 +3016,7 @@ void GMainWindow::OnGameListCreateShortcut(u64 program_id, const std::string& ga
system->GetContentProvider()};
const auto control = pm.GetControlMetadata();
const auto loader =
- Loader::GetLoader(*system, vfs->OpenFile(game_path, FileSys::Mode::Read));
+ Loader::GetLoader(*system, vfs->OpenFile(game_path, FileSys::OpenMode::Read));
game_title = fmt::format("{:016X}", program_id);
if (control.first != nullptr) {
game_title = control.first->GetApplicationName();
@@ -3290,12 +3254,21 @@ void GMainWindow::OnMenuInstallToNAND() {
install_progress->setLabelText(
tr("Installing file \"%1\"...").arg(QFileInfo(file).fileName()));
- QFuture<InstallResult> future;
- InstallResult result;
+ QFuture<ContentManager::InstallResult> future;
+ ContentManager::InstallResult result;
if (file.endsWith(QStringLiteral("nsp"), Qt::CaseInsensitive)) {
-
- future = QtConcurrent::run([this, &file] { return InstallNSP(file); });
+ const auto progress_callback = [this](size_t size, size_t progress) {
+ emit UpdateInstallProgress();
+ if (install_progress->wasCanceled()) {
+ return true;
+ }
+ return false;
+ };
+ future = QtConcurrent::run([this, &file, progress_callback] {
+ return ContentManager::InstallNSP(*system, *vfs, file.toStdString(),
+ progress_callback);
+ });
while (!future.isFinished()) {
QCoreApplication::processEvents();
@@ -3311,16 +3284,16 @@ void GMainWindow::OnMenuInstallToNAND() {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
switch (result) {
- case InstallResult::Success:
+ case ContentManager::InstallResult::Success:
new_files.append(QFileInfo(file).fileName());
break;
- case InstallResult::Overwrite:
+ case ContentManager::InstallResult::Overwrite:
overwritten_files.append(QFileInfo(file).fileName());
break;
- case InstallResult::Failure:
+ case ContentManager::InstallResult::Failure:
failed_files.append(QFileInfo(file).fileName());
break;
- case InstallResult::BaseInstallAttempted:
+ case ContentManager::InstallResult::BaseInstallAttempted:
failed_files.append(QFileInfo(file).fileName());
detected_base_install = true;
break;
@@ -3354,96 +3327,7 @@ void GMainWindow::OnMenuInstallToNAND() {
ui->action_Install_File_NAND->setEnabled(true);
}
-InstallResult GMainWindow::InstallNSP(const QString& filename) {
- const auto qt_raw_copy = [this](const FileSys::VirtualFile& src,
- const FileSys::VirtualFile& dest, std::size_t block_size) {
- if (src == nullptr || dest == nullptr) {
- return false;
- }
- if (!dest->Resize(src->GetSize())) {
- return false;
- }
-
- std::vector<u8> buffer(CopyBufferSize);
-
- for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) {
- if (install_progress->wasCanceled()) {
- dest->Resize(0);
- return false;
- }
-
- emit UpdateInstallProgress();
-
- const auto read = src->Read(buffer.data(), buffer.size(), i);
- dest->Write(buffer.data(), read, i);
- }
- return true;
- };
-
- std::shared_ptr<FileSys::NSP> nsp;
- if (filename.endsWith(QStringLiteral("nsp"), Qt::CaseInsensitive)) {
- nsp = std::make_shared<FileSys::NSP>(
- vfs->OpenFile(filename.toStdString(), FileSys::Mode::Read));
- if (nsp->IsExtractedType()) {
- return InstallResult::Failure;
- }
- } else {
- return InstallResult::Failure;
- }
-
- if (nsp->GetStatus() != Loader::ResultStatus::Success) {
- return InstallResult::Failure;
- }
- const auto res = system->GetFileSystemController().GetUserNANDContents()->InstallEntry(
- *nsp, true, qt_raw_copy);
- switch (res) {
- case FileSys::InstallResult::Success:
- return InstallResult::Success;
- case FileSys::InstallResult::OverwriteExisting:
- return InstallResult::Overwrite;
- case FileSys::InstallResult::ErrorBaseInstall:
- return InstallResult::BaseInstallAttempted;
- default:
- return InstallResult::Failure;
- }
-}
-
-InstallResult GMainWindow::InstallNCA(const QString& filename) {
- const auto qt_raw_copy = [this](const FileSys::VirtualFile& src,
- const FileSys::VirtualFile& dest, std::size_t block_size) {
- if (src == nullptr || dest == nullptr) {
- return false;
- }
- if (!dest->Resize(src->GetSize())) {
- return false;
- }
-
- std::vector<u8> buffer(CopyBufferSize);
-
- for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) {
- if (install_progress->wasCanceled()) {
- dest->Resize(0);
- return false;
- }
-
- emit UpdateInstallProgress();
-
- const auto read = src->Read(buffer.data(), buffer.size(), i);
- dest->Write(buffer.data(), read, i);
- }
- return true;
- };
-
- const auto nca =
- std::make_shared<FileSys::NCA>(vfs->OpenFile(filename.toStdString(), FileSys::Mode::Read));
- const auto id = nca->GetStatus();
-
- // Game updates necessary are missing base RomFS
- if (id != Loader::ResultStatus::Success &&
- id != Loader::ResultStatus::ErrorMissingBKTRBaseRomFS) {
- return InstallResult::Failure;
- }
-
+ContentManager::InstallResult GMainWindow::InstallNCA(const QString& filename) {
const QStringList tt_options{tr("System Application"),
tr("System Archive"),
tr("System Application Update"),
@@ -3464,7 +3348,7 @@ InstallResult GMainWindow::InstallNCA(const QString& filename) {
if (!ok || index == -1) {
QMessageBox::warning(this, tr("Failed to Install"),
tr("The title type you selected for the NCA is invalid."));
- return InstallResult::Failure;
+ return ContentManager::InstallResult::Failure;
}
// If index is equal to or past Game, add the jump in TitleType.
@@ -3478,15 +3362,15 @@ InstallResult GMainWindow::InstallNCA(const QString& filename) {
auto* registered_cache = is_application ? fs_controller.GetUserNANDContents()
: fs_controller.GetSystemNANDContents();
- const auto res = registered_cache->InstallEntry(*nca, static_cast<FileSys::TitleType>(index),
- true, qt_raw_copy);
- if (res == FileSys::InstallResult::Success) {
- return InstallResult::Success;
- } else if (res == FileSys::InstallResult::OverwriteExisting) {
- return InstallResult::Overwrite;
- } else {
- return InstallResult::Failure;
- }
+ const auto progress_callback = [this](size_t size, size_t progress) {
+ emit UpdateInstallProgress();
+ if (install_progress->wasCanceled()) {
+ return true;
+ }
+ return false;
+ };
+ return ContentManager::InstallNCA(*vfs, filename.toStdString(), *registered_cache,
+ static_cast<FileSys::TitleType>(index), progress_callback);
}
void GMainWindow::OnMenuRecentFile() {
@@ -4221,10 +4105,6 @@ void GMainWindow::OnOpenYuzuFolder() {
}
void GMainWindow::OnVerifyInstalledContents() {
- // Declare sizes.
- size_t total_size = 0;
- size_t processed_size = 0;
-
// Initialize a progress dialog.
QProgressDialog progress(tr("Verifying integrity..."), tr("Cancel"), 0, 100, this);
progress.setWindowModality(Qt::WindowModal);
@@ -4232,93 +4112,25 @@ void GMainWindow::OnVerifyInstalledContents() {
progress.setAutoClose(false);
progress.setAutoReset(false);
- // Declare a list of file names which failed to verify.
- std::vector<std::string> failed;
-
// Declare progress callback.
- auto QtProgressCallback = [&](size_t nca_processed, size_t nca_total) {
- if (progress.wasCanceled()) {
- return false;
- }
- progress.setValue(static_cast<int>(((processed_size + nca_processed) * 100) / total_size));
- return true;
+ auto QtProgressCallback = [&](size_t total_size, size_t processed_size) {
+ progress.setValue(static_cast<int>((processed_size * 100) / total_size));
+ return progress.wasCanceled();
};
- // Get content registries.
- auto bis_contents = system->GetFileSystemController().GetSystemNANDContents();
- auto user_contents = system->GetFileSystemController().GetUserNANDContents();
-
- std::vector<FileSys::RegisteredCache*> content_providers;
- if (bis_contents) {
- content_providers.push_back(bis_contents);
- }
- if (user_contents) {
- content_providers.push_back(user_contents);
- }
-
- // Get associated NCA files.
- std::vector<FileSys::VirtualFile> nca_files;
-
- // Get all installed IDs.
- for (auto nca_provider : content_providers) {
- const auto entries = nca_provider->ListEntriesFilter();
-
- for (const auto& entry : entries) {
- auto nca_file = nca_provider->GetEntryRaw(entry.title_id, entry.type);
- if (!nca_file) {
- continue;
- }
-
- total_size += nca_file->GetSize();
- nca_files.push_back(std::move(nca_file));
- }
- }
-
- // Using the NCA loader, determine if all NCAs are valid.
- for (auto& nca_file : nca_files) {
- Loader::AppLoader_NCA nca_loader(nca_file);
-
- auto status = nca_loader.VerifyIntegrity(QtProgressCallback);
- if (progress.wasCanceled()) {
- break;
- }
- if (status != Loader::ResultStatus::Success) {
- FileSys::NCA nca(nca_file);
- const auto title_id = nca.GetTitleId();
- std::string title_name = "unknown";
-
- const auto control = provider->GetEntry(FileSys::GetBaseTitleID(title_id),
- FileSys::ContentRecordType::Control);
- if (control && control->GetStatus() == Loader::ResultStatus::Success) {
- const FileSys::PatchManager pm{title_id, system->GetFileSystemController(),
- *provider};
- const auto [nacp, logo] = pm.ParseControlNCA(*control);
- if (nacp) {
- title_name = nacp->GetApplicationName();
- }
- }
-
- if (title_id > 0) {
- failed.push_back(
- fmt::format("{} ({:016X}) ({})", nca_file->GetName(), title_id, title_name));
- } else {
- failed.push_back(fmt::format("{} (unknown)", nca_file->GetName()));
- }
- }
-
- processed_size += nca_file->GetSize();
- }
-
+ const std::vector<std::string> result =
+ ContentManager::VerifyInstalledContents(*system, *provider, QtProgressCallback);
progress.close();
- if (failed.size() > 0) {
- auto failed_names = QString::fromStdString(fmt::format("{}", fmt::join(failed, "\n")));
+ if (result.empty()) {
+ QMessageBox::information(this, tr("Integrity verification succeeded!"),
+ tr("The operation completed successfully."));
+ } else {
+ const auto failed_names =
+ QString::fromStdString(fmt::format("{}", fmt::join(result, "\n")));
QMessageBox::critical(
this, tr("Integrity verification failed!"),
tr("Verification failed for the following files:\n\n%1").arg(failed_names));
- } else {
- QMessageBox::information(this, tr("Integrity verification succeeded!"),
- tr("The operation completed successfully."));
}
}
@@ -4737,122 +4549,20 @@ void GMainWindow::OnMouseActivity() {
}
}
-void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
- if (behavior == ReinitializeKeyBehavior::Warning) {
- const auto res = QMessageBox::information(
- this, tr("Confirm Key Rederivation"),
- tr("You are about to force rederive all of your keys. \nIf you do not know what "
- "this "
- "means or what you are doing, \nthis is a potentially destructive action. "
- "\nPlease "
- "make sure this is what you want \nand optionally make backups.\n\nThis will "
- "delete "
- "your autogenerated key files and re-run the key derivation module."),
- QMessageBox::StandardButtons{QMessageBox::Ok, QMessageBox::Cancel});
-
- if (res == QMessageBox::Cancel)
- return;
-
- const auto keys_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::KeysDir);
-
- Common::FS::RemoveFile(keys_dir / "prod.keys_autogenerated");
- Common::FS::RemoveFile(keys_dir / "console.keys_autogenerated");
- Common::FS::RemoveFile(keys_dir / "title.keys_autogenerated");
- }
-
- Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance();
- bool all_keys_present{true};
-
- if (keys.BaseDeriveNecessary()) {
- Core::Crypto::PartitionDataManager pdm{vfs->OpenDirectory("", FileSys::Mode::Read)};
-
- const auto function = [this, &keys, &pdm] {
- keys.PopulateFromPartitionData(pdm);
-
- system->GetFileSystemController().CreateFactories(*vfs);
- keys.DeriveETicket(pdm, system->GetContentProvider());
- };
-
- QString errors;
- if (!pdm.HasFuses()) {
- errors += tr("Missing fuses");
- }
- if (!pdm.HasBoot0()) {
- errors += tr(" - Missing BOOT0");
- }
- if (!pdm.HasPackage2()) {
- errors += tr(" - Missing BCPKG2-1-Normal-Main");
- }
- if (!pdm.HasProdInfo()) {
- errors += tr(" - Missing PRODINFO");
- }
- if (!errors.isEmpty()) {
- all_keys_present = false;
- QMessageBox::warning(
- this, tr("Derivation Components Missing"),
- tr("Encryption keys are missing. "
- "<br>Please follow <a href='https://yuzu-emu.org/help/quickstart/'>the yuzu "
- "quickstart guide</a> to get all your keys, firmware and "
- "games.<br><br><small>(%1)</small>")
- .arg(errors));
- }
-
- QProgressDialog prog(this);
- prog.setRange(0, 0);
- prog.setLabelText(tr("Deriving keys...\nThis may take up to a minute depending \non your "
- "system's performance."));
- prog.setWindowTitle(tr("Deriving Keys"));
-
- prog.show();
-
- auto future = QtConcurrent::run(function);
- while (!future.isFinished()) {
- QCoreApplication::processEvents();
- }
-
- prog.close();
- }
-
+void GMainWindow::OnCheckFirmwareDecryption() {
system->GetFileSystemController().CreateFactories(*vfs);
-
- if (all_keys_present && !this->CheckSystemArchiveDecryption()) {
- LOG_WARNING(Frontend, "Mii model decryption failed");
+ if (!ContentManager::AreKeysPresent()) {
QMessageBox::warning(
- this, tr("System Archive Decryption Failed"),
- tr("Encryption keys failed to decrypt firmware. "
+ this, tr("Derivation Components Missing"),
+ tr("Encryption keys are missing. "
"<br>Please follow <a href='https://yuzu-emu.org/help/quickstart/'>the yuzu "
"quickstart guide</a> to get all your keys, firmware and "
"games."));
}
-
SetFirmwareVersion();
-
- if (behavior == ReinitializeKeyBehavior::Warning) {
- game_list->PopulateAsync(UISettings::values.game_dirs);
- }
-
UpdateMenuState();
}
-bool GMainWindow::CheckSystemArchiveDecryption() {
- constexpr u64 MiiModelId = 0x0100000000000802;
-
- auto bis_system = system->GetFileSystemController().GetSystemNANDContents();
- if (!bis_system) {
- // Not having system BIS files is not an error.
- return true;
- }
-
- auto mii_nca = bis_system->GetEntry(MiiModelId, FileSys::ContentRecordType::Data);
- if (!mii_nca) {
- // Not having the Mii model is not an error.
- return true;
- }
-
- // Return whether we are able to decrypt the RomFS of the Mii model.
- return mii_nca->GetRomFS().get() != nullptr;
-}
-
bool GMainWindow::CheckFirmwarePresence() {
constexpr u64 MiiEditId = static_cast<u64>(Service::AM::Applets::AppletProgramId::MiiEdit);