From df5b75694f5abde94ccf05fa6c7a557b1ba9079b Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Fri, 27 Jul 2018 23:55:23 -0400 Subject: Remove files that are not used --- src/yuzu/main.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/yuzu/main.cpp') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index be38cfa9b..d3523e6ac 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include "common/common_paths.h" #include "common/logging/backend.h" #include "common/logging/filter.h" @@ -88,6 +89,19 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { ui.setupUi(this); statusBar()->hide(); + // Initialize keys + std::string keys_dir = FileUtil::GetHactoolConfigurationPath(); + if (Settings::values.use_dev_keys) { + Crypto::keys.SetValidationMode(true); + if (FileUtil::Exists(keys_dir + DIR_SEP + "dev.keys")) + Crypto::keys.LoadFromFile(keys_dir + DIR_SEP + "dev.keys", false); + } else { + if (FileUtil::Exists(keys_dir + DIR_SEP + "prod.keys")) + Crypto::keys.LoadFromFile(keys_dir + DIR_SEP + "prod.keys", false); + } + if (FileUtil::Exists(keys_dir + DIR_SEP + "title.keys")) + Crypto::keys.LoadFromFile(keys_dir + DIR_SEP + "title.keys", true); + default_theme_paths = QIcon::themeSearchPaths(); UpdateUITheme(); -- cgit v1.2.3 From 239a3113e4c6a53a2c7b12e67a0f21afae24b0aa Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Sat, 28 Jul 2018 21:39:42 -0400 Subject: Make XCI comply to review and style guidelines --- src/yuzu/main.cpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'src/yuzu/main.cpp') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index d3523e6ac..c274e5e2b 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -13,7 +13,6 @@ #include #include #include -#include #include "common/common_paths.h" #include "common/logging/backend.h" #include "common/logging/filter.h" @@ -24,6 +23,7 @@ #include "common/scope_exit.h" #include "common/string_util.h" #include "core/core.h" +#include "core/crypto/key_manager.h" #include "core/gdbstub/gdbstub.h" #include "core/loader/loader.h" #include "core/settings.h" @@ -89,19 +89,6 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { ui.setupUi(this); statusBar()->hide(); - // Initialize keys - std::string keys_dir = FileUtil::GetHactoolConfigurationPath(); - if (Settings::values.use_dev_keys) { - Crypto::keys.SetValidationMode(true); - if (FileUtil::Exists(keys_dir + DIR_SEP + "dev.keys")) - Crypto::keys.LoadFromFile(keys_dir + DIR_SEP + "dev.keys", false); - } else { - if (FileUtil::Exists(keys_dir + DIR_SEP + "prod.keys")) - Crypto::keys.LoadFromFile(keys_dir + DIR_SEP + "prod.keys", false); - } - if (FileUtil::Exists(keys_dir + DIR_SEP + "title.keys")) - Crypto::keys.LoadFromFile(keys_dir + DIR_SEP + "title.keys", true); - default_theme_paths = QIcon::themeSearchPaths(); UpdateUITheme(); -- cgit v1.2.3 From 187d8e215fb157edaa9f3976bebba9a9a7ed103d Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Mon, 30 Jul 2018 12:46:23 -0400 Subject: Use more descriptive error codes and messages --- src/yuzu/main.cpp | 51 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 10 deletions(-) (limited to 'src/yuzu/main.cpp') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index c274e5e2b..5bdf41ea4 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -425,18 +425,49 @@ bool GMainWindow::LoadROM(const QString& filename) { tr("Could not determine the system mode.")); break; - case Core::System::ResultStatus::ErrorLoader_ErrorEncrypted: { + case Core::System::ResultStatus::ErrorLoader_ErrorMissingKeys: { + const auto reg_found = Core::Crypto::KeyManager::KeyFileExists(false); + const auto title_found = Core::Crypto::KeyManager::KeyFileExists(true); + + std::string file_text; + + if (!reg_found && !title_found) { + file_text = "A proper key file (prod.keys, dev.keys, or title.keys) could not be " + "found. You will need to dump your keys from your switch to continue."; + } else if (reg_found && title_found) { + file_text = + "Both key files were found in your config directory, but the correct key could" + "not be found. You may be missing a titlekey or general key, depending on " + "the game."; + } else if (reg_found) { + file_text = + "The regular keys file (prod.keys/dev.keys) was found in your config, but the " + "titlekeys file (title.keys) was not. You are either missing the correct " + "titlekey or missing a general key required to decrypt the game."; + } else { + file_text = "The title keys file (title.keys) was found in your config, but " + "the regular keys file (prod.keys/dev.keys) was not. Unfortunately, " + "having the titlekey is not enough, you need additional general keys " + "to properly decrypt the game. You should double-check to make sure " + "your keys are correct."; + } + + QMessageBox::critical( + this, tr("Error while loading ROM!"), + tr(("The game you are trying to load is encrypted and the required keys to load " + "the game could not be found in your configuration. " + + file_text + " Please refer to How to Dump Keys for help.") + .c_str())); + break; + } + case Core::System::ResultStatus::ErrorLoader_ErrorDecrypting: { QMessageBox::critical( this, tr("Error while loading ROM!"), - tr("The game that you are trying to load must be decrypted before being used with " - "yuzu. A real Switch is required.

" - "For more information on dumping and decrypting games, please see the following " - "wiki pages: ")); + tr("There was a general error while decrypting the game. This means that the keys " + "necessary were found, but were either incorrect, the game itself was not a " + "valid game or the game uses an unhandled cryptographic scheme. Please refer to " + "How to Dump Keys to double check that you have the correct " + "keys.")); break; } case Core::System::ResultStatus::ErrorLoader_ErrorInvalidFormat: -- cgit v1.2.3 From 0497bb5528f62f9e3db887988f0f93b4a1653a42 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Mon, 30 Jul 2018 22:04:51 -0400 Subject: Fix merge conflicts with opus and update docs --- src/yuzu/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/yuzu/main.cpp') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 5bdf41ea4..34d4f0754 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -456,7 +456,7 @@ bool GMainWindow::LoadROM(const QString& filename) { this, tr("Error while loading ROM!"), tr(("The game you are trying to load is encrypted and the required keys to load " "the game could not be found in your configuration. " + - file_text + " Please refer to How to Dump Keys for help.") + file_text + " Please refer to the yuzu wiki for help.") .c_str())); break; } @@ -465,8 +465,8 @@ bool GMainWindow::LoadROM(const QString& filename) { this, tr("Error while loading ROM!"), tr("There was a general error while decrypting the game. This means that the keys " "necessary were found, but were either incorrect, the game itself was not a " - "valid game or the game uses an unhandled cryptographic scheme. Please refer to " - "How to Dump Keys to double check that you have the correct " + "valid game or the game uses an unhandled cryptographic scheme. Please double " + "check that you have the correct " "keys.")); break; } -- cgit v1.2.3