summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/main.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index e11833c5a..48d7833b2 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -31,6 +31,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual
31#include <QDialogButtonBox> 31#include <QDialogButtonBox>
32#include <QFileDialog> 32#include <QFileDialog>
33#include <QMessageBox> 33#include <QMessageBox>
34#include <QtConcurrent/QtConcurrent>
34#include <QtGui> 35#include <QtGui>
35#include <QtWidgets> 36#include <QtWidgets>
36#include <fmt/format.h> 37#include <fmt/format.h>
@@ -171,6 +172,57 @@ GMainWindow::GMainWindow()
171 .arg(Common::g_build_fullname, Common::g_scm_branch, Common::g_scm_desc)); 172 .arg(Common::g_build_fullname, Common::g_scm_branch, Common::g_scm_desc));
172 show(); 173 show();
173 174
175 // Gen keys if necessary
176 Core::Crypto::KeyManager keys{};
177 if (keys.BaseDeriveNecessary()) {
178 Core::Crypto::PartitionDataManager pdm{vfs->OpenDirectory(
179 FileUtil::GetUserPath(FileUtil::UserPath::SysDataDir), FileSys::Mode::Read)};
180
181 const auto function = [this, &keys, &pdm]() {
182 keys.PopulateFromPartitionData(pdm);
183 Service::FileSystem::CreateFactories(vfs);
184 keys.DeriveETicket(pdm);
185 };
186
187 std::vector<std::string> errors;
188
189 if (!pdm.HasFuses())
190 errors.push_back("Missing fuses - Cannot derive SBK");
191 if (!pdm.HasBoot0())
192 errors.push_back("Missing BOOT0 - Cannot derive master keys");
193 if (!pdm.HasPackage2())
194 errors.push_back("Missing BCPKG2-1-Normal-Main - Cannot derive general keys");
195 if (!pdm.HasProdInfo())
196 errors.push_back("Missing PRODINFO - Cannot derive title keys");
197
198 if (!errors.empty()) {
199 std::string error_str;
200 for (const auto& error : errors)
201 error_str += " - " + error + "\n";
202
203 QMessageBox::warning(
204 this, tr("Warning Missing Derivation Components"),
205 tr("The following are missing from your configuration that may hinder key "
206 "derivation. It will be attempted but may not complete.\n\n") +
207 QString::fromStdString(error_str));
208 }
209
210 QProgressDialog prog;
211 prog.setRange(0, 0);
212 prog.setLabelText(tr("Deriving keys...\nThis may take up to a minute depending \non your "
213 "system's performance."));
214 prog.setWindowTitle(tr("Deriving Keys"));
215
216 prog.show();
217
218 auto future = QtConcurrent::run(function);
219 while (!future.isFinished()) {
220 QCoreApplication::processEvents();
221 }
222
223 prog.close();
224 }
225
174 // Necessary to load titles from nand in gamelist. 226 // Necessary to load titles from nand in gamelist.
175 Service::FileSystem::CreateFactories(vfs); 227 Service::FileSystem::CreateFactories(vfs);
176 game_list->LoadCompatibilityList(); 228 game_list->LoadCompatibilityList();