20 if (!std::filesystem::exists(path)) {
25 auto* ol =
new OL{path};
26 auto packFile = std::unique_ptr<PackFile>(ol);
28 FileStream reader{ol->fullFilePath};
36 if (
auto version = reader.read<
float>(); version < 0.05 || version > 0.15) {
41 auto entryOffset = reader.read<uint32_t>();
42 auto entryCount = reader.read<uint32_t>();
44 reader.read(ol->notes);
46 reader.seek_in(entryOffset);
47 for (uint32_t i = 0; i < entryCount; i++) {
50 entry.
offset = reader.read<uint32_t>();
51 entry.
length = reader.read<uint32_t>();
53 const auto baseEntryPath = ol->cleanEntryPath(reader.read_string(31));
54 auto entryPath = baseEntryPath;
56 auto notes = reader.read_string(501);
58 std::string extension;
59 auto type = reader.read<OLEntryType>();
61 case OLEntryType::RMF:
64 case OLEntryType::MAP:
68 entryPath += extension;
71 for (
int j = 1; ol->entries.count(entryPath) > 0; j++) {
72 entryPath = baseEntryPath;
75 .append(std::to_string(j))
81 entry.
extraData = {
reinterpret_cast<const std::byte*
>(
notes.data()),
reinterpret_cast<const std::byte*
>(
notes.data() +
notes.size())};
84 ol->entries.emplace(entryPath, entry);
87 callback(entryPath, entry);
This class represents the metadata that a file has inside a PackFile.
uint64_t offset
Offset, format-specific meaning - 0 if unused, or if the offset genuinely is 0.
uint64_t length
Length in bytes (in formats with compression, this is the uncompressed length)
std::vector< std::byte > extraData
Format-specific (PCK: MD5 hash, VPK: Preloaded data)