Skip to content
This repository has been archived by the owner on Aug 15, 2022. It is now read-only.

Commit

Permalink
Fix reading entries inside core files
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadelessFox committed Sep 15, 2020
1 parent cd65812 commit dc05e63
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/decima/core_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,18 @@ void Decima::CoreFile::parse(ArchiveArray& archive_array) {
unpack();
entries.clear();

// TODO: This is shitty API I wrote, please replace this
ash::buffer buffer(storage.data(), storage.size());

for (std::size_t offset = 0; offset < buffer.size();) {
while (buffer.size() > 0) {
const auto entry_header = Decima::CoreEntry::peek_header(buffer);
const auto entry_offset = buffer.data() - storage.data();

entries.push_back([&] {
auto handler = get_handler(entry_header.file_type);
handler->parse(archive_array, buffer, this);
handler->offset = offset;

handler->offset = entry_offset;
return handler;
}());

offset += entry_header.file_size + sizeof(Decima::GUID);
}
}

0 comments on commit dc05e63

Please sign in to comment.