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