key_manager: Reduce spam from ticket database load attempts.

This commit is contained in:
Steveice10 2023-08-26 12:59:35 -07:00
parent 8440e2664d
commit 59810437a0
2 changed files with 17 additions and 11 deletions

View file

@ -1189,25 +1189,30 @@ void KeyManager::DeriveETicket(PartitionDataManager& data,
}
void KeyManager::PopulateTickets() {
if (!common_tickets.empty() && !personal_tickets.empty()) {
if (ticket_databases_loaded) {
return;
}
ticket_databases_loaded = true;
std::vector<Ticket> tickets;
const auto system_save_e1_path =
Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/80000000000000e1";
const Common::FS::IOFile save_e1{system_save_e1_path, Common::FS::FileAccessMode::Read,
Common::FS::FileType::BinaryFile};
if (Common::FS::Exists(system_save_e1_path)) {
const Common::FS::IOFile save_e1{system_save_e1_path, Common::FS::FileAccessMode::Read,
Common::FS::FileType::BinaryFile};
const auto blob1 = GetTicketblob(save_e1);
tickets.insert(tickets.end(), blob1.begin(), blob1.end());
}
const auto system_save_e2_path =
Common::FS::GetYuzuPath(Common::FS::YuzuPath::NANDDir) / "system/save/80000000000000e2";
const Common::FS::IOFile save_e2{system_save_e2_path, Common::FS::FileAccessMode::Read,
Common::FS::FileType::BinaryFile};
auto tickets = GetTicketblob(save_e1);
const auto blob2 = GetTicketblob(save_e2);
tickets.insert(tickets.end(), blob2.begin(), blob2.end());
if (Common::FS::Exists(system_save_e2_path)) {
const Common::FS::IOFile save_e2{system_save_e2_path, Common::FS::FileAccessMode::Read,
Common::FS::FileType::BinaryFile};
const auto blob2 = GetTicketblob(save_e2);
tickets.insert(tickets.end(), blob2.begin(), blob2.end());
}
for (const auto& ticket : tickets) {
AddTicket(ticket);

View file

@ -304,6 +304,7 @@ private:
// Map from rights ID to ticket
std::map<u128, Ticket> common_tickets;
std::map<u128, Ticket> personal_tickets;
bool ticket_databases_loaded = false;
std::array<std::array<u8, 0xB0>, 0x20> encrypted_keyblobs{};
std::array<std::array<u8, 0x90>, 0x20> keyblobs{};