mirror of
https://github.com/Dark98/threeSD.git
synced 2026-07-06 08:39:06 +00:00
Added some features to SeedDB
This commit is contained in:
@@ -45,7 +45,7 @@ bool SeedDB::AddFromFile(const std::string& path) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SeedDB::Save(const std::string& path) {
|
bool SeedDB::Save(const std::string& path) const {
|
||||||
if (!FileUtil::CreateFullPath(path)) {
|
if (!FileUtil::CreateFullPath(path)) {
|
||||||
LOG_ERROR(Service_FS, "Failed to create seed database");
|
LOG_ERROR(Service_FS, "Failed to create seed database");
|
||||||
return false;
|
return false;
|
||||||
@@ -81,4 +81,8 @@ bool SeedDB::Save(const std::string& path) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::size_t SeedDB::GetSize() const {
|
||||||
|
return sizeof(u32) + SEEDDB_PADDING_BYTES + seeds.size() * SEEDDB_ENTRY_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|||||||
@@ -12,12 +12,14 @@ namespace Core {
|
|||||||
|
|
||||||
constexpr std::size_t SEEDDB_PADDING_BYTES{12};
|
constexpr std::size_t SEEDDB_PADDING_BYTES{12};
|
||||||
constexpr std::size_t SEEDDB_ENTRY_PADDING_BYTES{8};
|
constexpr std::size_t SEEDDB_ENTRY_PADDING_BYTES{8};
|
||||||
|
constexpr std::size_t SEEDDB_ENTRY_SIZE{32};
|
||||||
|
|
||||||
using Seed = std::array<u8, 16>;
|
using Seed = std::array<u8, 16>;
|
||||||
class SeedDB {
|
class SeedDB {
|
||||||
public:
|
public:
|
||||||
bool AddFromFile(const std::string& path);
|
bool AddFromFile(const std::string& path);
|
||||||
bool Save(const std::string& path);
|
bool Save(const std::string& path) const;
|
||||||
|
std::size_t GetSize() const;
|
||||||
|
|
||||||
std::unordered_map<u64, Seed> seeds;
|
std::unordered_map<u64, Seed> seeds;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user