mirror of
https://github.com/Dark98/threeSD.git
synced 2026-07-03 00:38:58 +00:00
Add support for system titles
This commit is contained in:
@@ -35,7 +35,7 @@ QString ReadableByteSize(qulonglong size) {
|
||||
}
|
||||
|
||||
// content type, name, icon name
|
||||
static constexpr std::array<std::tuple<Core::ContentType, const char*, const char*>, 7>
|
||||
static constexpr std::array<std::tuple<Core::ContentType, const char*, const char*>, 8>
|
||||
ContentTypeMap{{
|
||||
{Core::ContentType::Application, QT_TR_NOOP("Application"), "app"},
|
||||
{Core::ContentType::Update, QT_TR_NOOP("Update"), "update"},
|
||||
@@ -44,6 +44,7 @@ static constexpr std::array<std::tuple<Core::ContentType, const char*, const cha
|
||||
{Core::ContentType::Extdata, QT_TR_NOOP("Extra Data"), "save_data"},
|
||||
{Core::ContentType::SystemArchive, QT_TR_NOOP("System Archive"), "system_archive"},
|
||||
{Core::ContentType::Sysdata, QT_TR_NOOP("System Data"), "system_data"},
|
||||
{Core::ContentType::SystemTitle, QT_TR_NOOP("System Title"), "system_archive"},
|
||||
}};
|
||||
|
||||
static const std::unordered_map<Core::EncryptionType, const char*> EncryptionTypeMap{{
|
||||
@@ -206,7 +207,7 @@ void ImportDialog::InsertSecondLevelItem(std::size_t row, const Core::ContentSpe
|
||||
name = QStringLiteral("%1 (%2)")
|
||||
.arg(GetContentName(content))
|
||||
.arg(GetContentTypeName(content.type));
|
||||
} else if (row <= 2) {
|
||||
} else if (row <= 3) {
|
||||
name = GetContentName(content);
|
||||
} else {
|
||||
name = GetContentTypeName(content.type);
|
||||
@@ -225,7 +226,8 @@ void ImportDialog::InsertSecondLevelItem(std::size_t row, const Core::ContentSpe
|
||||
}
|
||||
|
||||
if (content.type != Core::ContentType::Application &&
|
||||
content.type != Core::ContentType::Update && content.type != Core::ContentType::DLC) {
|
||||
content.type != Core::ContentType::Update && content.type != Core::ContentType::DLC &&
|
||||
content.type != Core::ContentType::SystemTitle) {
|
||||
|
||||
// Do not display encryption in this case
|
||||
encryption.clear();
|
||||
@@ -237,11 +239,15 @@ void ImportDialog::InsertSecondLevelItem(std::size_t row, const Core::ContentSpe
|
||||
|
||||
QPixmap icon;
|
||||
if (replace_icon.isNull()) {
|
||||
// When not in title view, only System Data and System Archive groups use category icons.
|
||||
const bool use_category_icon = content.type == Core::ContentType::Sysdata ||
|
||||
content.type == Core::ContentType::SystemArchive;
|
||||
icon = use_title_view ? GetContentTypeIcon(content.type)
|
||||
: GetContentIcon(content, use_category_icon);
|
||||
// Exclude system titles, they are a single group but have own icons.
|
||||
if (use_title_view && content.type != Core::ContentType::SystemTitle) {
|
||||
icon = GetContentTypeIcon(content.type);
|
||||
} else {
|
||||
// When not in title view, System Data and System Archive groups use category icons.
|
||||
const bool use_category_icon = content.type == Core::ContentType::Sysdata ||
|
||||
content.type == Core::ContentType::SystemArchive;
|
||||
icon = GetContentIcon(content, use_category_icon);
|
||||
}
|
||||
} else {
|
||||
icon = replace_icon;
|
||||
}
|
||||
@@ -258,13 +264,14 @@ void ImportDialog::InsertSecondLevelItem(std::size_t row, const Core::ContentSpe
|
||||
} else {
|
||||
if (!warning_shown && !exists &&
|
||||
(type == Core::ContentType::SystemArchive ||
|
||||
type == Core::ContentType::Sysdata)) {
|
||||
type == Core::ContentType::Sysdata ||
|
||||
type == Core::ContentType::SystemTitle)) {
|
||||
|
||||
QMessageBox::warning(
|
||||
this, tr("Warning"),
|
||||
tr("System Archive and System Data are important files that may "
|
||||
"be necessary for your imported games to run.\nIt is highly "
|
||||
"recommended to import these contents if they do not exist yet."));
|
||||
tr("You are de-selecting important files that may be necessary for "
|
||||
"your imported games to run.\nIt is highly recommended to import "
|
||||
"these contents if they do not exist yet."));
|
||||
warning_shown = true;
|
||||
}
|
||||
total_size -= size;
|
||||
@@ -302,10 +309,12 @@ void ImportDialog::RepopulateContent() {
|
||||
title_name_map.insert_or_assign(0, tr("Ungrouped"));
|
||||
title_name_map.insert_or_assign(1, tr("System Archive"));
|
||||
title_name_map.insert_or_assign(2, tr("System Data"));
|
||||
title_name_map.insert_or_assign(3, tr("System Title"));
|
||||
|
||||
title_icon_map.insert_or_assign(0, QIcon::fromTheme(QStringLiteral("unknown")).pixmap(24));
|
||||
title_icon_map.insert_or_assign(1, GetContentTypeIcon(Core::ContentType::SystemArchive));
|
||||
title_icon_map.insert_or_assign(2, GetContentTypeIcon(Core::ContentType::Sysdata));
|
||||
title_icon_map.insert_or_assign(3, GetContentTypeIcon(Core::ContentType::SystemTitle));
|
||||
|
||||
std::unordered_map<u64, u64> title_row_map;
|
||||
for (const auto& [id, name] : title_name_map) {
|
||||
@@ -342,6 +351,10 @@ void ImportDialog::RepopulateContent() {
|
||||
row = title_row_map.at(2); // System data
|
||||
break;
|
||||
}
|
||||
case Core::ContentType::SystemTitle: {
|
||||
row = title_row_map.at(3); // System title
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
InsertSecondLevelItem(row, content, i);
|
||||
|
||||
Reference in New Issue
Block a user