mirror of
https://github.com/Dark98/threeSD.git
synced 2026-07-03 08:39:04 +00:00
core, frontend: Group contents by title / game instead of category
I may look to introduce a option to select in the future
This commit is contained in:
@@ -214,7 +214,7 @@ std::vector<ContentSpecifier> SDMCImporter::ListContent() const {
|
||||
// Regex for half Title IDs
|
||||
static const std::regex title_regex{"[0-9a-f]{8}"};
|
||||
|
||||
std::string SDMCImporter::LoadTitleName(const std::string& path) const {
|
||||
std::pair<std::string, u64> SDMCImporter::LoadTitleData(const std::string& path) const {
|
||||
// Remove trailing '/'
|
||||
const auto sdmc_path = config.sdmc_path.substr(0, config.sdmc_path.size() - 1);
|
||||
|
||||
@@ -271,7 +271,11 @@ std::string SDMCImporter::LoadTitleName(const std::string& path) const {
|
||||
|
||||
SMDH smdh;
|
||||
std::memcpy(&smdh, smdh_buffer.data(), smdh_buffer.size());
|
||||
return Common::UTF16BufferToUTF8(smdh.GetShortTitle(SMDH::TitleLanguage::English));
|
||||
|
||||
u64 extdata_id{};
|
||||
ncch.ReadExtdataId(extdata_id);
|
||||
return {Common::UTF16BufferToUTF8(smdh.GetShortTitle(SMDH::TitleLanguage::English)),
|
||||
extdata_id};
|
||||
}
|
||||
|
||||
void SDMCImporter::ListTitle(std::vector<ContentSpecifier>& out) const {
|
||||
@@ -299,10 +303,11 @@ 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] = LoadTitleData(content_path);
|
||||
out.push_back(
|
||||
{type, id, FileUtil::Exists(citra_path + "content/"),
|
||||
FileUtil::GetDirectoryTreeSize(directory + virtual_name + "/content/"),
|
||||
LoadTitleName(content_path)});
|
||||
name, extdata_id});
|
||||
}
|
||||
|
||||
if (type != ContentType::Application) {
|
||||
|
||||
+3
-2
@@ -35,6 +35,7 @@ struct ContentSpecifier {
|
||||
bool already_exists; ///< Tells whether a file already exists in target path.
|
||||
u64 maximum_size; ///< The maximum size of the content. May be slightly bigger than real size.
|
||||
std::string name; ///< Optional. The content's preferred display name.
|
||||
u64 extdata_id; ///< Extdata ID for Applications.
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -119,11 +120,11 @@ private:
|
||||
void DeleteSysdata(u64 id) const;
|
||||
|
||||
/**
|
||||
* Loads the English short title name of a title.
|
||||
* Loads the English short title name and extdata id of a title.
|
||||
* @param path Path of the 'content' folder relative to the SDMC root folder.
|
||||
* Required to end with '/'.
|
||||
*/
|
||||
std::string LoadTitleName(const std::string& path) const;
|
||||
std::pair<std::string, u64> LoadTitleData(const std::string& path) const;
|
||||
|
||||
bool is_good{};
|
||||
Config config;
|
||||
|
||||
Reference in New Issue
Block a user