add patch downloader

This commit is contained in:
Martin Michelsen
2025-10-12 13:59:52 -07:00
parent 09962696b7
commit d9d33c2d65
8 changed files with 424 additions and 54 deletions
+2 -2
View File
@@ -109,8 +109,8 @@ PatchFileIndex::PatchFileIndex(const string& root_dir)
if (!compute_crc32s_message.empty()) {
auto data = f->load_data(); // Sets f->size
f->crc32 = phosg::crc32(data->data(), f->size);
for (size_t x = 0; x < data->size(); x += 0x4000) {
size_t chunk_bytes = min<size_t>(f->size - x, 0x4000);
for (size_t x = 0; x < data->size(); x += this->CHUNK_SIZE) {
size_t chunk_bytes = min<size_t>(f->size - x, this->CHUNK_SIZE);
f->chunk_crcs.emplace_back(phosg::crc32(data->data() + x, chunk_bytes));
}