diff options
| -rw-r--r-- | src/yuzu/main.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index ec27361d5..16fa92e2c 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -18,6 +18,8 @@ | |||
| 18 | #include <sys/socket.h> | 18 | #include <sys/socket.h> |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | #include <boost/container/flat_set.hpp> | ||
| 22 | |||
| 21 | // VFS includes must be before glad as they will conflict with Windows file api, which uses defines. | 23 | // VFS includes must be before glad as they will conflict with Windows file api, which uses defines. |
| 22 | #include "applets/qt_amiibo_settings.h" | 24 | #include "applets/qt_amiibo_settings.h" |
| 23 | #include "applets/qt_controller.h" | 25 | #include "applets/qt_controller.h" |
| @@ -4649,8 +4651,8 @@ bool GMainWindow::CheckFirmwarePresence() { | |||
| 4649 | 4651 | ||
| 4650 | bool GMainWindow::SelectRomFSDumpTarget(const FileSys::ContentProvider& installed, u64 program_id, | 4652 | bool GMainWindow::SelectRomFSDumpTarget(const FileSys::ContentProvider& installed, u64 program_id, |
| 4651 | u64* selected_title_id, u8* selected_content_record_type) { | 4653 | u64* selected_title_id, u8* selected_content_record_type) { |
| 4652 | using ContentInfo = std::pair<FileSys::TitleType, FileSys::ContentRecordType>; | 4654 | using ContentInfo = std::tuple<u64, FileSys::TitleType, FileSys::ContentRecordType>; |
| 4653 | boost::container::flat_map<u64, ContentInfo> available_title_ids; | 4655 | boost::container::flat_set<ContentInfo> available_title_ids; |
| 4654 | 4656 | ||
| 4655 | const auto RetrieveEntries = [&](FileSys::TitleType title_type, | 4657 | const auto RetrieveEntries = [&](FileSys::TitleType title_type, |
| 4656 | FileSys::ContentRecordType record_type) { | 4658 | FileSys::ContentRecordType record_type) { |
| @@ -4658,12 +4660,14 @@ bool GMainWindow::SelectRomFSDumpTarget(const FileSys::ContentProvider& installe | |||
| 4658 | for (const auto& entry : entries) { | 4660 | for (const auto& entry : entries) { |
| 4659 | if (FileSys::GetBaseTitleID(entry.title_id) == program_id && | 4661 | if (FileSys::GetBaseTitleID(entry.title_id) == program_id && |
| 4660 | installed.GetEntry(entry)->GetStatus() == Loader::ResultStatus::Success) { | 4662 | installed.GetEntry(entry)->GetStatus() == Loader::ResultStatus::Success) { |
| 4661 | available_title_ids[entry.title_id] = {title_type, record_type}; | 4663 | available_title_ids.insert({entry.title_id, title_type, record_type}); |
| 4662 | } | 4664 | } |
| 4663 | } | 4665 | } |
| 4664 | }; | 4666 | }; |
| 4665 | 4667 | ||
| 4666 | RetrieveEntries(FileSys::TitleType::Application, FileSys::ContentRecordType::Program); | 4668 | RetrieveEntries(FileSys::TitleType::Application, FileSys::ContentRecordType::Program); |
| 4669 | RetrieveEntries(FileSys::TitleType::Application, FileSys::ContentRecordType::HtmlDocument); | ||
| 4670 | RetrieveEntries(FileSys::TitleType::Application, FileSys::ContentRecordType::LegalInformation); | ||
| 4667 | RetrieveEntries(FileSys::TitleType::AOC, FileSys::ContentRecordType::Data); | 4671 | RetrieveEntries(FileSys::TitleType::AOC, FileSys::ContentRecordType::Data); |
| 4668 | 4672 | ||
| 4669 | if (available_title_ids.empty()) { | 4673 | if (available_title_ids.empty()) { |
| @@ -4674,10 +4678,14 @@ bool GMainWindow::SelectRomFSDumpTarget(const FileSys::ContentProvider& installe | |||
| 4674 | 4678 | ||
| 4675 | if (available_title_ids.size() > 1) { | 4679 | if (available_title_ids.size() > 1) { |
| 4676 | QStringList list; | 4680 | QStringList list; |
| 4677 | for (auto& [title_id, content_info] : available_title_ids) { | 4681 | for (auto& [title_id, title_type, record_type] : available_title_ids) { |
| 4678 | const auto hex_title_id = QString::fromStdString(fmt::format("{:X}", title_id)); | 4682 | const auto hex_title_id = QString::fromStdString(fmt::format("{:X}", title_id)); |
| 4679 | if (content_info.first == FileSys::TitleType::Application) { | 4683 | if (record_type == FileSys::ContentRecordType::Program) { |
| 4680 | list.push_back(QStringLiteral("Application [%1]").arg(hex_title_id)); | 4684 | list.push_back(QStringLiteral("Program [%1]").arg(hex_title_id)); |
| 4685 | } else if (record_type == FileSys::ContentRecordType::HtmlDocument) { | ||
| 4686 | list.push_back(QStringLiteral("HTML document [%1]").arg(hex_title_id)); | ||
| 4687 | } else if (record_type == FileSys::ContentRecordType::LegalInformation) { | ||
| 4688 | list.push_back(QStringLiteral("Legal information [%1]").arg(hex_title_id)); | ||
| 4681 | } else { | 4689 | } else { |
| 4682 | list.push_back( | 4690 | list.push_back( |
| 4683 | QStringLiteral("DLC %1 [%2]").arg(title_id & 0x7FF).arg(hex_title_id)); | 4691 | QStringLiteral("DLC %1 [%2]").arg(title_id & 0x7FF).arg(hex_title_id)); |
| @@ -4695,9 +4703,9 @@ bool GMainWindow::SelectRomFSDumpTarget(const FileSys::ContentProvider& installe | |||
| 4695 | title_index = list.indexOf(res); | 4703 | title_index = list.indexOf(res); |
| 4696 | } | 4704 | } |
| 4697 | 4705 | ||
| 4698 | const auto selected_info = available_title_ids.nth(title_index); | 4706 | const auto& [title_id, title_type, record_type] = *available_title_ids.nth(title_index); |
| 4699 | *selected_title_id = selected_info->first; | 4707 | *selected_title_id = title_id; |
| 4700 | *selected_content_record_type = static_cast<u8>(selected_info->second.second); | 4708 | *selected_content_record_type = static_cast<u8>(record_type); |
| 4701 | return true; | 4709 | return true; |
| 4702 | } | 4710 | } |
| 4703 | 4711 | ||