summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar liamwhite2023-05-02 18:17:24 -0400
committerGravatar GitHub2023-05-02 18:17:24 -0400
commit494cc992eb2d29a25f4df61bfb92f713647f4d9a (patch)
treeddbfa0d25e5bf4658911daed4b9f508a72bbc2db
parentMerge pull request #10123 from Kelebek1/sample_mask (diff)
parentqt: warn on inoperable keys (diff)
downloadyuzu-494cc992eb2d29a25f4df61bfb92f713647f4d9a.tar.gz
yuzu-494cc992eb2d29a25f4df61bfb92f713647f4d9a.tar.xz
yuzu-494cc992eb2d29a25f4df61bfb92f713647f4d9a.zip
Merge pull request #10130 from liamwhite/keys
qt: warn on inoperable keys
-rw-r--r--src/yuzu/main.cpp33
-rw-r--r--src/yuzu/main.h1
2 files changed, 34 insertions, 0 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index b79409a68..ba9eece1d 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -27,6 +27,7 @@
27#include "configuration/configure_input.h" 27#include "configuration/configure_input.h"
28#include "configuration/configure_per_game.h" 28#include "configuration/configure_per_game.h"
29#include "configuration/configure_tas.h" 29#include "configuration/configure_tas.h"
30#include "core/file_sys/romfs_factory.h"
30#include "core/file_sys/vfs.h" 31#include "core/file_sys/vfs.h"
31#include "core/file_sys/vfs_real.h" 32#include "core/file_sys/vfs_real.h"
32#include "core/frontend/applets/cabinet.h" 33#include "core/frontend/applets/cabinet.h"
@@ -4171,6 +4172,8 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
4171 } 4172 }
4172 4173
4173 Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); 4174 Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance();
4175 bool all_keys_present{true};
4176
4174 if (keys.BaseDeriveNecessary()) { 4177 if (keys.BaseDeriveNecessary()) {
4175 Core::Crypto::PartitionDataManager pdm{vfs->OpenDirectory("", FileSys::Mode::Read)}; 4178 Core::Crypto::PartitionDataManager pdm{vfs->OpenDirectory("", FileSys::Mode::Read)};
4176 4179
@@ -4195,6 +4198,7 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
4195 errors += tr(" - Missing PRODINFO"); 4198 errors += tr(" - Missing PRODINFO");
4196 } 4199 }
4197 if (!errors.isEmpty()) { 4200 if (!errors.isEmpty()) {
4201 all_keys_present = false;
4198 QMessageBox::warning( 4202 QMessageBox::warning(
4199 this, tr("Derivation Components Missing"), 4203 this, tr("Derivation Components Missing"),
4200 tr("Encryption keys are missing. " 4204 tr("Encryption keys are missing. "
@@ -4222,11 +4226,40 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
4222 4226
4223 system->GetFileSystemController().CreateFactories(*vfs); 4227 system->GetFileSystemController().CreateFactories(*vfs);
4224 4228
4229 if (all_keys_present && !this->CheckSystemArchiveDecryption()) {
4230 LOG_WARNING(Frontend, "Mii model decryption failed");
4231 QMessageBox::warning(
4232 this, tr("System Archive Decryption Failed"),
4233 tr("Encryption keys failed to decrypt firmware. "
4234 "<br>Please follow <a href='https://yuzu-emu.org/help/quickstart/'>the yuzu "
4235 "quickstart guide</a> to get all your keys, firmware and "
4236 "games."));
4237 }
4238
4225 if (behavior == ReinitializeKeyBehavior::Warning) { 4239 if (behavior == ReinitializeKeyBehavior::Warning) {
4226 game_list->PopulateAsync(UISettings::values.game_dirs); 4240 game_list->PopulateAsync(UISettings::values.game_dirs);
4227 } 4241 }
4228} 4242}
4229 4243
4244bool GMainWindow::CheckSystemArchiveDecryption() {
4245 constexpr u64 MiiModelId = 0x0100000000000802;
4246
4247 auto bis_system = system->GetFileSystemController().GetSystemNANDContents();
4248 if (!bis_system) {
4249 // Not having system BIS files is not an error.
4250 return true;
4251 }
4252
4253 auto mii_nca = bis_system->GetEntry(MiiModelId, FileSys::ContentRecordType::Data);
4254 if (!mii_nca) {
4255 // Not having the Mii model is not an error.
4256 return true;
4257 }
4258
4259 // Return whether we are able to decrypt the RomFS of the Mii model.
4260 return mii_nca->GetRomFS().get() != nullptr;
4261}
4262
4230std::optional<u64> GMainWindow::SelectRomFSDumpTarget(const FileSys::ContentProvider& installed, 4263std::optional<u64> GMainWindow::SelectRomFSDumpTarget(const FileSys::ContentProvider& installed,
4231 u64 program_id) { 4264 u64 program_id) {
4232 const auto dlc_entries = 4265 const auto dlc_entries =
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 8b5c1d747..3bbc31ada 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -392,6 +392,7 @@ private:
392 void LoadTranslation(); 392 void LoadTranslation();
393 void OpenPerGameConfiguration(u64 title_id, const std::string& file_name); 393 void OpenPerGameConfiguration(u64 title_id, const std::string& file_name);
394 bool CheckDarkMode(); 394 bool CheckDarkMode();
395 bool CheckSystemArchiveDecryption();
395 396
396 QString GetTasStateDescription() const; 397 QString GetTasStateDescription() const;
397 bool CreateShortcut(const std::string& shortcut_path, const std::string& title, 398 bool CreateShortcut(const std::string& shortcut_path, const std::string& title,