impr: Allow non-continuous provider values to be saved
This commit is contained in:
parent
4ee53701e6
commit
5442c32a3f
@ -41,14 +41,22 @@ namespace hex::prv {
|
||||
|
||||
if (file.isValid()) {
|
||||
std::vector<u8> buffer(std::min<size_t>(0xFF'FFFF, this->getActualSize()), 0x00);
|
||||
size_t bufferSize = buffer.size();
|
||||
size_t bufferSize = 0;
|
||||
|
||||
for (u64 offset = 0; offset < this->getActualSize(); offset += bufferSize) {
|
||||
if (bufferSize > this->getActualSize() - offset)
|
||||
bufferSize = this->getActualSize() - offset;
|
||||
bufferSize = buffer.size();
|
||||
|
||||
auto [region, valid] = this->getRegionValidity(offset + this->getBaseAddress());
|
||||
if (!valid)
|
||||
offset = region.getEndAddress() + 1;
|
||||
|
||||
auto [newRegion, newValid] = this->getRegionValidity(offset + this->getBaseAddress());
|
||||
bufferSize = std::min(bufferSize, (newRegion.getEndAddress() - offset) + 1);
|
||||
bufferSize = std::min(bufferSize, this->getActualSize() - offset);
|
||||
|
||||
this->read(offset + this->getBaseAddress(), buffer.data(), bufferSize, true);
|
||||
file.write(buffer.data(), bufferSize);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user