fix: Multiple file provider resize issues
This commit is contained in:
parent
6d19b33e32
commit
de76c37ffb
@ -62,6 +62,11 @@ namespace hex::prv {
|
||||
file.writeBuffer(buffer.data(), bufferSize);
|
||||
}
|
||||
|
||||
for (auto &[patchAddress, patch] : getPatches()) {
|
||||
file.seek(patchAddress - this->getBaseAddress());
|
||||
file.writeBuffer(&patch, 1);
|
||||
}
|
||||
|
||||
EventManager::post<EventProviderSaved>(this);
|
||||
}
|
||||
}
|
||||
@ -130,13 +135,13 @@ namespace hex::prv {
|
||||
}
|
||||
|
||||
void Provider::applyPatches() {
|
||||
if (!this->isWritable())
|
||||
return;
|
||||
|
||||
for (auto &[patchAddress, patch] : getPatches()) {
|
||||
this->writeRaw(patchAddress - this->getBaseAddress(), &patch, 1);
|
||||
}
|
||||
|
||||
if (!this->isWritable())
|
||||
return;
|
||||
|
||||
this->markDirty();
|
||||
|
||||
this->m_patches.emplace_back();
|
||||
|
@ -116,7 +116,6 @@ namespace hex::plugin::builtin {
|
||||
|
||||
void FileProvider::remove(u64 offset, size_t size) {
|
||||
auto oldSize = this->getActualSize();
|
||||
this->resize(oldSize + size);
|
||||
|
||||
std::vector<u8> buffer(0x1000);
|
||||
|
||||
@ -230,7 +229,7 @@ namespace hex::plugin::builtin {
|
||||
}
|
||||
|
||||
void FileProvider::close() {
|
||||
|
||||
this->m_file.unmap();
|
||||
}
|
||||
|
||||
void FileProvider::loadSettings(const nlohmann::json &settings) {
|
||||
|
Loading…
Reference in New Issue
Block a user