Files
threeSD/src/core/db/seed_db.h
T
Pengfei d4e1404788 Fixes to CIA building
1. Optimizes ticket finding
2. Fixes progress reporting overshoot
3. Use u64 for size in general
4. Various other fixes and cleanups
2021-08-06 00:55:35 +08:00

69 lines
1.2 KiB
C++

// Copyright 2018 Citra Emulator Project / 2020 Pengfei Zhu
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
// Modified from Citra's implementation to allow multiple instances
#pragma once
#include <array>
#include <optional>
#include <vector>
#include "common/common_types.h"
#include "common/swap.h"
namespace Core {
constexpr std::size_t SEEDDB_PADDING_BYTES{12};
struct Seed {
using Data = std::array<u8, 16>;
u64_le title_id;
Data data;
std::array<u8, 8> reserved;
};
class SeedDB {
public:
bool Load(const std::string& path);
bool Save(const std::string& path);
void Add(const Seed& seed);
std::size_t Size() const;
std::optional<Seed::Data> Get(u64 title_id) const;
void Clear() {
seeds.clear();
}
auto begin() {
return seeds.begin();
}
auto begin() const {
return seeds.begin();
}
auto end() {
return seeds.end();
}
auto end() const {
return seeds.end();
}
private:
std::vector<Seed> seeds;
};
namespace Seeds {
void Load(const std::string& path);
void Clear();
std::optional<Seed::Data> GetSeed(u64 title_id);
} // namespace Seeds
} // namespace Core