Added some features to SeedDB

This commit is contained in:
Pengfei
2021-08-30 20:12:46 +08:00
parent d90c858715
commit d280dfcffe
2 changed files with 8 additions and 2 deletions
+5 -1
View File
@@ -45,7 +45,7 @@ bool SeedDB::AddFromFile(const std::string& path) {
return true;
}
bool SeedDB::Save(const std::string& path) {
bool SeedDB::Save(const std::string& path) const {
if (!FileUtil::CreateFullPath(path)) {
LOG_ERROR(Service_FS, "Failed to create seed database");
return false;
@@ -81,4 +81,8 @@ bool SeedDB::Save(const std::string& path) {
return true;
}
std::size_t SeedDB::GetSize() const {
return sizeof(u32) + SEEDDB_PADDING_BYTES + seeds.size() * SEEDDB_ENTRY_SIZE;
}
} // namespace Core
+3 -1
View File
@@ -12,12 +12,14 @@ namespace Core {
constexpr std::size_t SEEDDB_PADDING_BYTES{12};
constexpr std::size_t SEEDDB_ENTRY_PADDING_BYTES{8};
constexpr std::size_t SEEDDB_ENTRY_SIZE{32};
using Seed = std::array<u8, 16>;
class SeedDB {
public:
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;
};