21 if (!std::filesystem::exists(path)) {
26 auto* ol =
new OL{path};
27 auto packFile = std::unique_ptr<PackFile>(ol);
29 FileStream reader{ol->fullFilePath};
37 if (
auto version = reader.read<
float>(); version < 0.05 || version > 0.15) {
42 auto entryOffset = reader.read<uint32_t>();
43 auto entryCount = reader.read<uint32_t>();
45 reader.read(ol->notes);
47 reader.seek_in(entryOffset);
48 for (uint32_t i = 0; i < entryCount; i++) {
51 entry.
offset = reader.read<uint32_t>();
52 entry.
length = reader.read<uint32_t>();
54 const auto baseEntryPath = ol->cleanEntryPath(reader.read_string(31));
55 auto entryPath = baseEntryPath;
57 auto notes = reader.read_string(501);
59 std::string extension;
60 auto type = reader.read<OLEntryType>();
62 case OLEntryType::RMF:
65 case OLEntryType::MAP:
69 entryPath += extension;
72 for (
int j = 1; ol->entries.count(entryPath) > 0; j++) {
73 entryPath = baseEntryPath + std::format(
" ({}){}", j, extension);
77 entry.
extraData = {
reinterpret_cast<const std::byte*
>(
notes.data()),
reinterpret_cast<const std::byte*
>(
notes.data() +
notes.size())};
80 ol->entries.emplace(entryPath, entry);
83 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).