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:
|
case ContentType::DLC:
|
||||||
return ImportTitle(specifier, callback);
|
return ImportTitle(specifier, callback);
|
||||||
case ContentType::Savegame:
|
case ContentType::Savegame:
|
||||||
if ((specifier.id >> 32) == 0) {
|
return ImportSavegame(specifier.id, callback);
|
||||||
return ImportNandSavegame(specifier.id, callback);
|
case ContentType::NandSavegame:
|
||||||
} else {
|
return ImportNandSavegame(specifier.id, callback);
|
||||||
return ImportSavegame(specifier.id, callback);
|
|
||||||
}
|
|
||||||
case ContentType::Extdata:
|
case ContentType::Extdata:
|
||||||
if ((specifier.id >> 32) == 0) {
|
return ImportExtdata(specifier.id, callback);
|
||||||
return ImportExtdata(specifier.id, callback);
|
case ContentType::NandExtdata:
|
||||||
} else {
|
return ImportNandExtdata(specifier.id, callback);
|
||||||
return ImportNandExtdata(specifier.id, callback);
|
|
||||||
}
|
|
||||||
case ContentType::Sysdata:
|
case ContentType::Sysdata:
|
||||||
return ImportSysdata(specifier.id, callback);
|
return ImportSysdata(specifier.id, callback);
|
||||||
case ContentType::SystemTitle:
|
case ContentType::SystemTitle:
|
||||||
@@ -947,20 +943,20 @@ void SDMCImporter::ListNandSavegame(std::vector<ContentSpecifier>& out) const {
|
|||||||
const auto citra_path =
|
const auto citra_path =
|
||||||
fmt::format("{}data/00000000000000000000000000000000/sysdata/{}/00000000",
|
fmt::format("{}data/00000000000000000000000000000000/sysdata/{}/00000000",
|
||||||
FileUtil::GetUserPath(FileUtil::UserPath::NANDDir), virtual_name);
|
FileUtil::GetUserPath(FileUtil::UserPath::NANDDir), virtual_name);
|
||||||
out.push_back(
|
out.push_back({ContentType::NandSavegame, id, FileUtil::Exists(citra_path),
|
||||||
{ContentType::Savegame, id, FileUtil::Exists(citra_path), FileUtil::GetSize(path)});
|
FileUtil::GetSize(path)});
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDMCImporter::ListExtdata(std::vector<ContentSpecifier>& out) const {
|
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) {
|
const std::string& citra_path_template) {
|
||||||
FileUtil::ForeachDirectoryEntry(
|
FileUtil::ForeachDirectoryEntry(
|
||||||
nullptr, path,
|
nullptr, path,
|
||||||
[&out, id_high, citra_path_template](u64* /*num_entries_out*/,
|
[&out, id_high, type, citra_path_template](u64* /*num_entries_out*/,
|
||||||
const std::string& directory,
|
const std::string& directory,
|
||||||
const std::string& virtual_name) {
|
const std::string& virtual_name) {
|
||||||
if (!FileUtil::IsDirectory(directory + virtual_name + "/")) {
|
if (!FileUtil::IsDirectory(directory + virtual_name + "/")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -971,18 +967,18 @@ void SDMCImporter::ListExtdata(std::vector<ContentSpecifier>& out) const {
|
|||||||
|
|
||||||
const u64 id = std::stoull(virtual_name, nullptr, 16);
|
const u64 id = std::stoull(virtual_name, nullptr, 16);
|
||||||
const auto citra_path = fmt::format(citra_path_template, virtual_name);
|
const auto citra_path = fmt::format(citra_path_template, virtual_name);
|
||||||
out.push_back({ContentType::Extdata, (id_high << 32) | id,
|
out.push_back({type, (id_high << 32) | id, FileUtil::Exists(citra_path),
|
||||||
FileUtil::Exists(citra_path),
|
|
||||||
FileUtil::GetDirectoryTreeSize(directory + virtual_name + "/")});
|
FileUtil::GetDirectoryTreeSize(directory + virtual_name + "/")});
|
||||||
return true;
|
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) +
|
FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir) +
|
||||||
"Nintendo "
|
"Nintendo "
|
||||||
"3DS/00000000000000000000000000000000/00000000000000000000000000000000/"
|
"3DS/00000000000000000000000000000000/00000000000000000000000000000000/"
|
||||||
"extdata/00000000/{}");
|
"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) +
|
FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) +
|
||||||
"data/00000000000000000000000000000000/extdata/00048000/{}");
|
"data/00000000000000000000000000000000/extdata/00048000/{}");
|
||||||
}
|
}
|
||||||
@@ -1048,8 +1044,12 @@ void SDMCImporter::DeleteContent(const ContentSpecifier& specifier) const {
|
|||||||
return DeleteTitle(specifier.id);
|
return DeleteTitle(specifier.id);
|
||||||
case ContentType::Savegame:
|
case ContentType::Savegame:
|
||||||
return DeleteSavegame(specifier.id);
|
return DeleteSavegame(specifier.id);
|
||||||
|
case ContentType::NandSavegame:
|
||||||
|
return DeleteNandSavegame(specifier.id);
|
||||||
case ContentType::Extdata:
|
case ContentType::Extdata:
|
||||||
return DeleteExtdata(specifier.id);
|
return DeleteExtdata(specifier.id);
|
||||||
|
case ContentType::NandExtdata:
|
||||||
|
return DeleteNandExtdata(specifier.id);
|
||||||
case ContentType::Sysdata:
|
case ContentType::Sysdata:
|
||||||
return DeleteSysdata(specifier.id);
|
return DeleteSysdata(specifier.id);
|
||||||
case ContentType::SystemTitle:
|
case ContentType::SystemTitle:
|
||||||
@@ -1075,31 +1075,31 @@ void SDMCImporter::DeleteNandTitle(u64 id) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SDMCImporter::DeleteSavegame(u64 id) const {
|
void SDMCImporter::DeleteSavegame(u64 id) const {
|
||||||
if ((id >> 32) == 0) { // NAND
|
FileUtil::DeleteDirRecursively(fmt::format(
|
||||||
FileUtil::DeleteDirRecursively(
|
"{}Nintendo "
|
||||||
fmt::format("{}data/00000000000000000000000000000000/sysdata/{:08x}/",
|
"3DS/00000000000000000000000000000000/00000000000000000000000000000000/title/{:08x}/"
|
||||||
FileUtil::GetUserPath(FileUtil::UserPath::NANDDir), (id & 0xFFFFFFFF)));
|
"{:08x}/data/",
|
||||||
} else { // SDMC
|
FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir), (id >> 32), (id & 0xFFFFFFFF)));
|
||||||
FileUtil::DeleteDirRecursively(fmt::format(
|
}
|
||||||
"{}Nintendo "
|
|
||||||
"3DS/00000000000000000000000000000000/00000000000000000000000000000000/title/{:08x}/"
|
void SDMCImporter::DeleteNandSavegame(u64 id) const {
|
||||||
"{:08x}/data/",
|
FileUtil::DeleteDirRecursively(
|
||||||
FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir), (id >> 32), (id & 0xFFFFFFFF)));
|
fmt::format("{}data/00000000000000000000000000000000/sysdata/{:08x}/",
|
||||||
}
|
FileUtil::GetUserPath(FileUtil::UserPath::NANDDir), (id & 0xFFFFFFFF)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDMCImporter::DeleteExtdata(u64 id) const {
|
void SDMCImporter::DeleteExtdata(u64 id) const {
|
||||||
if ((id >> 32) == 0) { // SDMC
|
FileUtil::DeleteDirRecursively(fmt::format(
|
||||||
FileUtil::DeleteDirRecursively(fmt::format(
|
"{}Nintendo "
|
||||||
"{}Nintendo "
|
"3DS/00000000000000000000000000000000/00000000000000000000000000000000/extdata/{:08x}/"
|
||||||
"3DS/00000000000000000000000000000000/00000000000000000000000000000000/extdata/{:08x}/"
|
"{:08x}/",
|
||||||
"{:08x}/",
|
FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir), (id >> 32), (id & 0xFFFFFFFF)));
|
||||||
FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir), (id >> 32), (id & 0xFFFFFFFF)));
|
}
|
||||||
} else { // NAND
|
|
||||||
FileUtil::DeleteDirRecursively(fmt::format(
|
void SDMCImporter::DeleteNandExtdata(u64 id) const {
|
||||||
"{}data/00000000000000000000000000000000/extdata/{:08x}/{:08x}/",
|
FileUtil::DeleteDirRecursively(fmt::format(
|
||||||
FileUtil::GetUserPath(FileUtil::UserPath::NANDDir), (id >> 32), (id & 0xFFFFFFFF)));
|
"{}data/00000000000000000000000000000000/extdata/{:08x}/{:08x}/",
|
||||||
}
|
FileUtil::GetUserPath(FileUtil::UserPath::NANDDir), (id >> 32), (id & 0xFFFFFFFF)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDMCImporter::DeleteSysdata(u64 id) const {
|
void SDMCImporter::DeleteSysdata(u64 id) const {
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ enum class ContentType {
|
|||||||
Update,
|
Update,
|
||||||
DLC,
|
DLC,
|
||||||
Savegame,
|
Savegame,
|
||||||
|
NandSavegame,
|
||||||
Extdata,
|
Extdata,
|
||||||
|
NandExtdata,
|
||||||
Sysdata,
|
Sysdata,
|
||||||
SystemTitle,
|
SystemTitle,
|
||||||
SystemApplet, // This should belong to System Title, but they cause problems so a new category.
|
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 DeleteTitle(u64 id) const;
|
||||||
void DeleteNandTitle(u64 id) const;
|
void DeleteNandTitle(u64 id) const;
|
||||||
void DeleteSavegame(u64 id) const;
|
void DeleteSavegame(u64 id) const;
|
||||||
|
void DeleteNandSavegame(u64 id) const;
|
||||||
void DeleteExtdata(u64 id) const;
|
void DeleteExtdata(u64 id) const;
|
||||||
|
void DeleteNandExtdata(u64 id) const;
|
||||||
void DeleteSysdata(u64 id) const;
|
void DeleteSysdata(u64 id) const;
|
||||||
|
|
||||||
bool is_good{};
|
bool is_good{};
|
||||||
|
|||||||
@@ -29,13 +29,15 @@
|
|||||||
|
|
||||||
// content type, singular name, plural name, icon name
|
// content type, singular name, plural name, icon name
|
||||||
// clang-format off
|
// 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{{
|
ContentTypeMap{{
|
||||||
{Core::ContentType::Application, QT_TR_NOOP("Application"), QT_TR_NOOP("Applications"), "app"},
|
{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::Update, QT_TR_NOOP("Update"), QT_TR_NOOP("Updates"), "update"},
|
||||||
{Core::ContentType::DLC, QT_TR_NOOP("DLC"), QT_TR_NOOP("DLCs"), "dlc"},
|
{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::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::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::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::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"},
|
{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.
|
// 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::Sysdata,
|
||||||
Core::ContentType::SystemTitle,
|
Core::ContentType::SystemTitle,
|
||||||
Core::ContentType::SystemApplet,
|
Core::ContentType::SystemApplet,
|
||||||
|
|||||||
Reference in New Issue
Block a user