mirror of
https://github.com/Dark98/threeSD.git
synced 2026-07-02 16:49:04 +00:00
Separate NandSavegame/Extdata
Pending further UI changes
This commit is contained in:
+42
-42
@@ -131,17 +131,13 @@ bool SDMCImporter::ImportContentImpl(const ContentSpecifier& specifier,
|
||||
case ContentType::DLC:
|
||||
return ImportTitle(specifier, callback);
|
||||
case ContentType::Savegame:
|
||||
if ((specifier.id >> 32) == 0) {
|
||||
return ImportNandSavegame(specifier.id, callback);
|
||||
} else {
|
||||
return ImportSavegame(specifier.id, callback);
|
||||
}
|
||||
return ImportSavegame(specifier.id, callback);
|
||||
case ContentType::NandSavegame:
|
||||
return ImportNandSavegame(specifier.id, callback);
|
||||
case ContentType::Extdata:
|
||||
if ((specifier.id >> 32) == 0) {
|
||||
return ImportExtdata(specifier.id, callback);
|
||||
} else {
|
||||
return ImportNandExtdata(specifier.id, callback);
|
||||
}
|
||||
return ImportExtdata(specifier.id, callback);
|
||||
case ContentType::NandExtdata:
|
||||
return ImportNandExtdata(specifier.id, callback);
|
||||
case ContentType::Sysdata:
|
||||
return ImportSysdata(specifier.id, callback);
|
||||
case ContentType::SystemTitle:
|
||||
@@ -947,20 +943,20 @@ void SDMCImporter::ListNandSavegame(std::vector<ContentSpecifier>& out) const {
|
||||
const auto citra_path =
|
||||
fmt::format("{}data/00000000000000000000000000000000/sysdata/{}/00000000",
|
||||
FileUtil::GetUserPath(FileUtil::UserPath::NANDDir), virtual_name);
|
||||
out.push_back(
|
||||
{ContentType::Savegame, id, FileUtil::Exists(citra_path), FileUtil::GetSize(path)});
|
||||
out.push_back({ContentType::NandSavegame, id, FileUtil::Exists(citra_path),
|
||||
FileUtil::GetSize(path)});
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
void SDMCImporter::ListExtdata(std::vector<ContentSpecifier>& out) const {
|
||||
const auto ProcessDirectory = [&out](u64 id_high, const std::string& path,
|
||||
const auto ProcessDirectory = [&out](u64 id_high, ContentType type, const std::string& path,
|
||||
const std::string& citra_path_template) {
|
||||
FileUtil::ForeachDirectoryEntry(
|
||||
nullptr, path,
|
||||
[&out, id_high, citra_path_template](u64* /*num_entries_out*/,
|
||||
const std::string& directory,
|
||||
const std::string& virtual_name) {
|
||||
[&out, id_high, type, citra_path_template](u64* /*num_entries_out*/,
|
||||
const std::string& directory,
|
||||
const std::string& virtual_name) {
|
||||
if (!FileUtil::IsDirectory(directory + virtual_name + "/")) {
|
||||
return true;
|
||||
}
|
||||
@@ -971,18 +967,18 @@ void SDMCImporter::ListExtdata(std::vector<ContentSpecifier>& out) const {
|
||||
|
||||
const u64 id = std::stoull(virtual_name, nullptr, 16);
|
||||
const auto citra_path = fmt::format(citra_path_template, virtual_name);
|
||||
out.push_back({ContentType::Extdata, (id_high << 32) | id,
|
||||
FileUtil::Exists(citra_path),
|
||||
out.push_back({type, (id_high << 32) | id, FileUtil::Exists(citra_path),
|
||||
FileUtil::GetDirectoryTreeSize(directory + virtual_name + "/")});
|
||||
return true;
|
||||
});
|
||||
};
|
||||
ProcessDirectory(0, fmt::format("{}extdata/00000000/", config.sdmc_path),
|
||||
ProcessDirectory(0, ContentType::Extdata, fmt::format("{}extdata/00000000/", config.sdmc_path),
|
||||
FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir) +
|
||||
"Nintendo "
|
||||
"3DS/00000000000000000000000000000000/00000000000000000000000000000000/"
|
||||
"extdata/00000000/{}");
|
||||
ProcessDirectory(0x00048000, fmt::format("{}extdata/00048000/", config.nand_data_path),
|
||||
ProcessDirectory(0x00048000, ContentType::NandExtdata,
|
||||
fmt::format("{}extdata/00048000/", config.nand_data_path),
|
||||
FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) +
|
||||
"data/00000000000000000000000000000000/extdata/00048000/{}");
|
||||
}
|
||||
@@ -1048,8 +1044,12 @@ void SDMCImporter::DeleteContent(const ContentSpecifier& specifier) const {
|
||||
return DeleteTitle(specifier.id);
|
||||
case ContentType::Savegame:
|
||||
return DeleteSavegame(specifier.id);
|
||||
case ContentType::NandSavegame:
|
||||
return DeleteNandSavegame(specifier.id);
|
||||
case ContentType::Extdata:
|
||||
return DeleteExtdata(specifier.id);
|
||||
case ContentType::NandExtdata:
|
||||
return DeleteNandExtdata(specifier.id);
|
||||
case ContentType::Sysdata:
|
||||
return DeleteSysdata(specifier.id);
|
||||
case ContentType::SystemTitle:
|
||||
@@ -1075,31 +1075,31 @@ void SDMCImporter::DeleteNandTitle(u64 id) const {
|
||||
}
|
||||
|
||||
void SDMCImporter::DeleteSavegame(u64 id) const {
|
||||
if ((id >> 32) == 0) { // NAND
|
||||
FileUtil::DeleteDirRecursively(
|
||||
fmt::format("{}data/00000000000000000000000000000000/sysdata/{:08x}/",
|
||||
FileUtil::GetUserPath(FileUtil::UserPath::NANDDir), (id & 0xFFFFFFFF)));
|
||||
} else { // SDMC
|
||||
FileUtil::DeleteDirRecursively(fmt::format(
|
||||
"{}Nintendo "
|
||||
"3DS/00000000000000000000000000000000/00000000000000000000000000000000/title/{:08x}/"
|
||||
"{:08x}/data/",
|
||||
FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir), (id >> 32), (id & 0xFFFFFFFF)));
|
||||
}
|
||||
FileUtil::DeleteDirRecursively(fmt::format(
|
||||
"{}Nintendo "
|
||||
"3DS/00000000000000000000000000000000/00000000000000000000000000000000/title/{:08x}/"
|
||||
"{:08x}/data/",
|
||||
FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir), (id >> 32), (id & 0xFFFFFFFF)));
|
||||
}
|
||||
|
||||
void SDMCImporter::DeleteNandSavegame(u64 id) const {
|
||||
FileUtil::DeleteDirRecursively(
|
||||
fmt::format("{}data/00000000000000000000000000000000/sysdata/{:08x}/",
|
||||
FileUtil::GetUserPath(FileUtil::UserPath::NANDDir), (id & 0xFFFFFFFF)));
|
||||
}
|
||||
|
||||
void SDMCImporter::DeleteExtdata(u64 id) const {
|
||||
if ((id >> 32) == 0) { // SDMC
|
||||
FileUtil::DeleteDirRecursively(fmt::format(
|
||||
"{}Nintendo "
|
||||
"3DS/00000000000000000000000000000000/00000000000000000000000000000000/extdata/{:08x}/"
|
||||
"{:08x}/",
|
||||
FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir), (id >> 32), (id & 0xFFFFFFFF)));
|
||||
} else { // NAND
|
||||
FileUtil::DeleteDirRecursively(fmt::format(
|
||||
"{}data/00000000000000000000000000000000/extdata/{:08x}/{:08x}/",
|
||||
FileUtil::GetUserPath(FileUtil::UserPath::NANDDir), (id >> 32), (id & 0xFFFFFFFF)));
|
||||
}
|
||||
FileUtil::DeleteDirRecursively(fmt::format(
|
||||
"{}Nintendo "
|
||||
"3DS/00000000000000000000000000000000/00000000000000000000000000000000/extdata/{:08x}/"
|
||||
"{:08x}/",
|
||||
FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir), (id >> 32), (id & 0xFFFFFFFF)));
|
||||
}
|
||||
|
||||
void SDMCImporter::DeleteNandExtdata(u64 id) const {
|
||||
FileUtil::DeleteDirRecursively(fmt::format(
|
||||
"{}data/00000000000000000000000000000000/extdata/{:08x}/{:08x}/",
|
||||
FileUtil::GetUserPath(FileUtil::UserPath::NANDDir), (id >> 32), (id & 0xFFFFFFFF)));
|
||||
}
|
||||
|
||||
void SDMCImporter::DeleteSysdata(u64 id) const {
|
||||
|
||||
@@ -30,7 +30,9 @@ enum class ContentType {
|
||||
Update,
|
||||
DLC,
|
||||
Savegame,
|
||||
NandSavegame,
|
||||
Extdata,
|
||||
NandExtdata,
|
||||
Sysdata,
|
||||
SystemTitle,
|
||||
SystemApplet, // This should belong to System Title, but they cause problems so a new category.
|
||||
@@ -209,7 +211,9 @@ private:
|
||||
void DeleteTitle(u64 id) const;
|
||||
void DeleteNandTitle(u64 id) const;
|
||||
void DeleteSavegame(u64 id) const;
|
||||
void DeleteNandSavegame(u64 id) const;
|
||||
void DeleteExtdata(u64 id) const;
|
||||
void DeleteNandExtdata(u64 id) const;
|
||||
void DeleteSysdata(u64 id) const;
|
||||
|
||||
bool is_good{};
|
||||
|
||||
@@ -29,13 +29,15 @@
|
||||
|
||||
// content type, singular name, plural name, icon name
|
||||
// clang-format off
|
||||
static constexpr std::array<std::tuple<Core::ContentType, const char*, const char*, const char*>, 8>
|
||||
static constexpr std::array<std::tuple<Core::ContentType, const char*, const char*, const char*>, 10>
|
||||
ContentTypeMap{{
|
||||
{Core::ContentType::Application, QT_TR_NOOP("Application"), QT_TR_NOOP("Applications"), "app"},
|
||||
{Core::ContentType::Update, QT_TR_NOOP("Update"), QT_TR_NOOP("Updates"), "update"},
|
||||
{Core::ContentType::DLC, QT_TR_NOOP("DLC"), QT_TR_NOOP("DLCs"), "dlc"},
|
||||
{Core::ContentType::Savegame, QT_TR_NOOP("Save Data"), QT_TR_NOOP("Save Data"), "save_data"},
|
||||
{Core::ContentType::NandSavegame, QT_TR_NOOP("System Save Data"), QT_TR_NOOP("System Save Data"), "save_data"},
|
||||
{Core::ContentType::Extdata, QT_TR_NOOP("Extra Data"), QT_TR_NOOP("Extra Data"), "save_data"},
|
||||
{Core::ContentType::NandExtdata, QT_TR_NOOP("System Extra Data"), QT_TR_NOOP("System Extra Data"), "save_data"},
|
||||
{Core::ContentType::Sysdata, QT_TR_NOOP("System Data"), QT_TR_NOOP("System Data"), "system_data"},
|
||||
{Core::ContentType::SystemTitle, QT_TR_NOOP("System Title"), QT_TR_NOOP("System Titles"), "hos"},
|
||||
{Core::ContentType::SystemApplet, QT_TR_NOOP("System Applet"), QT_TR_NOOP("System Applets"), "hos"},
|
||||
@@ -212,7 +214,9 @@ void ImportDialog::InsertTopLevelItem(QString text, QPixmap icon, u64 total_size
|
||||
}
|
||||
|
||||
// Content types that themselves form a 'Title' like entity.
|
||||
constexpr std::array<Core::ContentType, 3> SpecialContentTypeList{{
|
||||
constexpr std::array<Core::ContentType, 5> SpecialContentTypeList{{
|
||||
Core::ContentType::NandSavegame,
|
||||
Core::ContentType::NandExtdata,
|
||||
Core::ContentType::Sysdata,
|
||||
Core::ContentType::SystemTitle,
|
||||
Core::ContentType::SystemApplet,
|
||||
|
||||
Reference in New Issue
Block a user