PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
Archive.hpp
1#pragma once
2
3#include <cstdint>
4#include <cstdio>
5#include <string>
6#include <unordered_map>
7#include <vector>
8
9namespace PixelBullet
10{
11 class VirtualPath;
12
13 struct FileEntry
14 {
15 uint64_t Offset;
16 uint64_t CompressedSize;
17 uint64_t UncompressedSize;
18 };
19
20 class Archive
21 {
22 public:
23 Archive();
24 ~Archive();
25
27 bool Open(const VirtualPath& archivePath);
28
31 std::vector<uint8_t> GetAsset(const std::string& assetName);
32
33 private:
35 bool ReadIndex();
36
37 private:
38 FILE* m_File;
39 std::unordered_map<std::string, FileEntry> m_Index;
40 };
41} // namespace PixelBullet
Definition Archive.hpp:21
std::vector< uint8_t > GetAsset(const std::string &assetName)
Definition Archive.cpp:84
bool Open(const VirtualPath &archivePath)
Opens the archive at the given path and reads the index.
Definition Archive.cpp:24
Definition VirtualPath.hpp:11
Definition Archive.hpp:14