lightningbolt/lib/bolt/Reader.hpp

42 lines
780 B
C++

#pragma once
#include <base/ErrorOr.hpp>
#include <bolt/Errors.hpp>
#include <functional>
namespace lightningbolt {
struct BoltReader {
enum class Game {
LooseBolt, ///< Use this for games with no bolt entry
SimpsonsSkateboarding,
NamcoMuseumGCN
};
// Guess the game the user wants to extract
static Game GuessGame(const fs::path& path);
struct File {
std::string_view filename;
u16 index;
u16 gid;
bool compressed;
u8* uncompressedData { nullptr };
usize uncompressedSize;
};
BoltReader(Game game = Game::SimpsonsSkateboarding);
~BoltReader();
ErrorOr<void> OpenBolt(const fs::path& path);
void ForEachFile(std::function<bool(File&)> f);
private:
struct Impl;
Unique<Impl> impl;
};
} // namespace lightningbolt