Display title icon; display title icon and names for save/extdata in group mode

This commit is contained in:
zhupengfei
2020-01-17 12:10:44 +08:00
parent 0708744a17
commit 94b9ec028b
4 changed files with 62 additions and 22 deletions
+4 -4
View File
@@ -296,7 +296,7 @@ std::vector<ContentSpecifier> SDMCImporter::ListContent() const {
// Regex for half Title IDs
static const std::regex title_regex{"[0-9a-f]{8}"};
std::tuple<std::string, u64, EncryptionType, bool> SDMCImporter::LoadTitleData(
std::tuple<std::string, u64, EncryptionType, bool, std::vector<u16>> SDMCImporter::LoadTitleData(
const std::string& path) const {
// Remove trailing '/'
const auto sdmc_path = config.sdmc_path.substr(0, config.sdmc_path.size() - 1);
@@ -364,7 +364,7 @@ std::tuple<std::string, u64, EncryptionType, bool> SDMCImporter::LoadTitleData(
bool seed_crypto{};
ncch.ReadSeedCrypto(seed_crypto);
return {Common::UTF16BufferToUTF8(smdh.GetShortTitle(SMDH::TitleLanguage::English)), extdata_id,
encryption, seed_crypto};
encryption, seed_crypto, smdh.GetIcon(false)};
}
void SDMCImporter::ListTitle(std::vector<ContentSpecifier>& out) const {
@@ -392,12 +392,12 @@ void SDMCImporter::ListTitle(std::vector<ContentSpecifier>& out) const {
if (FileUtil::Exists(directory + virtual_name + "/content/")) {
const auto content_path =
fmt::format("/title/{:08x}/{}/content/", high_id, virtual_name);
const auto& [name, extdata_id, encryption, seed_crypto] =
const auto& [name, extdata_id, encryption, seed_crypto, icon] =
LoadTitleData(content_path);
out.push_back(
{type, id, FileUtil::Exists(citra_path + "content/"),
FileUtil::GetDirectoryTreeSize(directory + virtual_name + "/content/"),
name, extdata_id, encryption, seed_crypto});
name, extdata_id, encryption, seed_crypto, icon});
}
if (type != ContentType::Application) {
+4 -3
View File
@@ -51,6 +51,7 @@ struct ContentSpecifier {
u64 extdata_id; ///< Extdata ID for Applications.
EncryptionType encryption = EncryptionType::None; ///< Only for NCCHs. Encryption scheme.
bool seed_crypto = false; ///< Only for NCCHs. Whether seed crypto is used.
std::vector<u16> icon; ///< Optional. The content's icon.
};
/**
@@ -140,12 +141,12 @@ private:
void DeleteSysdata(u64 id) const;
/**
* Loads the English short title name, extdata id and encryption of a title.
* Loads the English short title name, extdata id, encryption and icon of a title.
* @param path Path of the 'content' folder relative to the SDMC root folder.
* Required to end with '/'.
* @return {name, extdata_id, encryption, seed_crypto}
* @return {name, extdata_id, encryption, seed_crypto, icon}
*/
std::tuple<std::string, u64, EncryptionType, bool> LoadTitleData(const std::string& path) const;
std::tuple<std::string, u64, EncryptionType, bool, std::vector<u16>> LoadTitleData(const std::string& path) const;
bool is_good{};
Config config;