mirror of
https://github.com/Dark98/threeSD.git
synced 2026-07-03 00:38:58 +00:00
Code cleanup
Replacing macros with lambdas
This commit is contained in:
+14
-13
@@ -495,16 +495,19 @@ void SDMCImporter::ListSystemArchive(std::vector<ContentSpecifier>& out) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SDMCImporter::ListSysdata(std::vector<ContentSpecifier>& out) const {
|
void SDMCImporter::ListSysdata(std::vector<ContentSpecifier>& out) const {
|
||||||
#define CHECK_CONTENT(id, var_path, citra_path, display_name) \
|
const auto CheckContent = [&out](u64 id, const std::string& var_path,
|
||||||
if (!var_path.empty()) { \
|
const std::string& citra_path,
|
||||||
out.push_back({ContentType::Sysdata, id, FileUtil::Exists(citra_path), \
|
const std::string& display_name) {
|
||||||
FileUtil::GetSize(var_path), display_name}); \
|
if (!var_path.empty()) {
|
||||||
}
|
out.push_back({ContentType::Sysdata, id, FileUtil::Exists(citra_path),
|
||||||
|
FileUtil::GetSize(var_path), display_name});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
{
|
{
|
||||||
const auto sysdata_path = FileUtil::GetUserPath(FileUtil::UserPath::SysDataDir);
|
const auto sysdata_path = FileUtil::GetUserPath(FileUtil::UserPath::SysDataDir);
|
||||||
CHECK_CONTENT(0, config.bootrom_path, sysdata_path + BOOTROM9, BOOTROM9);
|
CheckContent(0, config.bootrom_path, sysdata_path + BOOTROM9, BOOTROM9);
|
||||||
CHECK_CONTENT(3, config.secret_sector_path, sysdata_path + SECRET_SECTOR, SECRET_SECTOR);
|
CheckContent(3, config.secret_sector_path, sysdata_path + SECRET_SECTOR, SECRET_SECTOR);
|
||||||
if (!config.bootrom_path.empty()) {
|
if (!config.bootrom_path.empty()) {
|
||||||
// Check in case there was an older version
|
// Check in case there was an older version
|
||||||
const bool exists = FileUtil::Exists(sysdata_path + AES_KEYS) &&
|
const bool exists = FileUtil::Exists(sysdata_path + AES_KEYS) &&
|
||||||
@@ -513,14 +516,12 @@ void SDMCImporter::ListSysdata(std::vector<ContentSpecifier>& out) const {
|
|||||||
// but it's maximum_size so probably okay
|
// but it's maximum_size so probably okay
|
||||||
out.push_back({ContentType::Sysdata, 4, exists, 47 * 3, AES_KEYS});
|
out.push_back({ContentType::Sysdata, 4, exists, 47 * 3, AES_KEYS});
|
||||||
}
|
}
|
||||||
CHECK_CONTENT(5, config.config_savegame_path,
|
CheckContent(5, config.config_savegame_path,
|
||||||
fmt::format("{}data/00000000000000000000000000000000/sysdata/00010017/",
|
fmt::format("{}data/00000000000000000000000000000000/sysdata/00010017/",
|
||||||
FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)),
|
FileUtil::GetUserPath(FileUtil::UserPath::NANDDir)),
|
||||||
"Config savegame");
|
"Config savegame");
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef CHECK_CONTENT
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (config.safe_mode_firm_path.empty()) {
|
if (config.safe_mode_firm_path.empty()) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user