diff --git a/src/core/db/seed_db.cpp b/src/core/db/seed_db.cpp index 3991314..61e484f 100644 --- a/src/core/db/seed_db.cpp +++ b/src/core/db/seed_db.cpp @@ -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 diff --git a/src/core/db/seed_db.h b/src/core/db/seed_db.h index c694eb2..d411cb0 100644 --- a/src/core/db/seed_db.h +++ b/src/core/db/seed_db.h @@ -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; 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 seeds; };