sys: Remove patched bytes when their value is the same as the original

This commit is contained in:
WerWolv 2022-01-30 11:58:32 +01:00
parent 66a13266e6
commit 4bc074fa84
1 changed files with 10 additions and 2 deletions

View File

@ -154,8 +154,16 @@ namespace hex::prv {
if (createUndo)
createUndoPoint();
for (u64 i = 0; i < size; i++)
getPatches()[offset + i] = reinterpret_cast<const u8 *>(buffer)[i];
for (u64 i = 0; i < size; i++) {
u8 patch = reinterpret_cast<const u8 *>(buffer)[i];
u8 originalValue = 0x00;
this->readRaw(offset + i, &originalValue, sizeof(u8));
if (patch == originalValue)
getPatches().erase(offset + i);
else
getPatches()[offset + i] = patch;
}
}
void Provider::createUndoPoint() {