fix: Some shortcuts triggering twice

This commit is contained in:
WerWolv
2023-04-12 19:50:03 +02:00
parent 803b99f2a9
commit cf72b5ec5c
5 changed files with 6 additions and 119 deletions

View File

@@ -39,12 +39,10 @@ namespace hex::plugin::builtin {
void FileProvider::read(u64 offset, void *buffer, size_t size, bool overlays) {
this->readRaw(offset - this->getBaseAddress(), buffer, size);
if (overlays) {
if (auto &patches = this->getPatches(); !patches.empty()) {
for (const auto&[patchOffset, patchData] : patches) {
if (patchOffset >= offset && patchOffset <= (offset + size))
reinterpret_cast<u8 *>(buffer)[patchOffset] = patchData;
}
if (overlays) [[likely]] {
for (const auto&[patchOffset, patchData] : getPatches()) {
if (patchOffset >= offset && patchOffset <= (offset + size))
reinterpret_cast<u8 *>(buffer)[patchOffset - offset] = patchData;
}
this->applyOverlays(offset, buffer, size);